From 91018f43dda2756322ba964af0bcadda7830312f Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 26 Mar 2024 21:42:43 -0400 Subject: [PATCH] [AutoRelease] t2-iotfirmwaredefense-2024-03-07-08506(can only be merged by SDK owner) (#34683) * code and test * Update CHANGELOG.md --------- Co-authored-by: azure-sdk Co-authored-by: Yuchao Yan --- .../CHANGELOG.md | 46 + .../azure-mgmt-iotfirmwaredefense/README.md | 7 +- .../azure-mgmt-iotfirmwaredefense/_meta.json | 10 +- .../mgmt/iotfirmwaredefense/_configuration.py | 8 +- .../_io_tfirmware_defense_mgmt_client.py | 64 +- .../mgmt/iotfirmwaredefense/_serialization.py | 26 +- .../azure/mgmt/iotfirmwaredefense/_vendor.py | 14 - .../azure/mgmt/iotfirmwaredefense/_version.py | 2 +- .../iotfirmwaredefense/aio/_configuration.py | 8 +- .../aio/_io_tfirmware_defense_mgmt_client.py | 65 +- .../aio/operations/__init__.py | 22 +- .../_binary_hardening_operations.py | 150 + .../_crypto_certificates_operations.py | 150 + .../aio/operations/_crypto_keys_operations.py | 149 + .../aio/operations/_cves_operations.py | 149 + .../aio/operations/_firmware_operations.py | 1803 ------------ .../aio/operations/_firmwares_operations.py | 733 +++++ .../operations/_password_hashes_operations.py | 150 + .../operations/_sbom_components_operations.py | 150 + .../aio/operations/_summaries_operations.py | 229 ++ .../aio/operations/_workspaces_operations.py | 26 +- .../iotfirmwaredefense/models/__init__.py | 100 +- ..._io_tfirmware_defense_mgmt_client_enums.py | 84 +- .../iotfirmwaredefense/models/_models_py3.py | 1556 ++++++---- .../iotfirmwaredefense/operations/__init__.py | 22 +- .../_binary_hardening_operations.py | 189 ++ .../_crypto_certificates_operations.py | 189 ++ .../operations/_crypto_keys_operations.py | 187 ++ .../operations/_cves_operations.py | 187 ++ .../operations/_firmware_operations.py | 2502 ----------------- .../operations/_firmwares_operations.py | 982 +++++++ .../operations/_operations.py | 2 +- .../operations/_password_hashes_operations.py | 189 ++ .../operations/_sbom_components_operations.py | 189 ++ .../operations/_summaries_operations.py | 308 ++ .../operations/_workspaces_operations.py | 70 +- ...ening_list_by_firmware_maximum_set_gen.py} | 10 +- ...ening_list_by_firmware_minimum_set_gen.py} | 10 +- ...icates_list_by_firmware_maximum_set_gen.py | 43 + ...icates_list_by_firmware_minimum_set_gen.py | 43 + ...o_keys_list_by_firmware_maximum_set_gen.py | 43 + ...o_keys_list_by_firmware_minimum_set_gen.py | 43 + .../cves_list_by_firmware_maximum_set_gen.py | 43 + .../cves_list_by_firmware_minimum_set_gen.py | 43 + ...inary_hardening_details_minimum_set_gen.py | 42 - ...inary_hardening_summary_minimum_set_gen.py | 42 - ...erate_component_details_maximum_set_gen.py | 42 - ...erate_component_details_minimum_set_gen.py | 42 - ...pto_certificate_summary_minimum_set_gen.py | 42 - ...rate_crypto_key_summary_minimum_set_gen.py | 42 - ...re_generate_cve_summary_maximum_set_gen.py | 42 - ...re_generate_cve_summary_minimum_set_gen.py | 42 - ...e_generate_download_url_maximum_set_gen.py | 42 - ...e_generate_download_url_minimum_set_gen.py | 42 - ...filesystem_download_url_maximum_set_gen.py | 42 - ...filesystem_download_url_minimum_set_gen.py | 42 - ...e_binary_hardening_list_maximum_set_gen.py | 43 - ...e_binary_hardening_list_minimum_set_gen.py | 43 - ...generate_component_list_maximum_set_gen.py | 43 - ...generate_component_list_minimum_set_gen.py | 43 - ...crypto_certificate_list_minimum_set_gen.py | 43 - ...enerate_crypto_key_list_minimum_set_gen.py | 43 - ..._list_generate_cve_list_maximum_set_gen.py | 43 - ..._list_generate_cve_list_minimum_set_gen.py | 43 - ...rate_password_hash_list_maximum_set_gen.py | 43 - ...rate_password_hash_list_minimum_set_gen.py | 43 - ...py => firmwares_create_maximum_set_gen.py} | 6 +- ...py => firmwares_delete_maximum_set_gen.py} | 6 +- ...py => firmwares_delete_minimum_set_gen.py} | 6 +- ..._generate_download_url_maximum_set_gen.py} | 6 +- ..._generate_download_url_minimum_set_gen.py} | 6 +- ...ilesystem_download_url_maximum_set_gen.py} | 6 +- ...ilesystem_download_url_minimum_set_gen.py} | 6 +- ...en.py => firmwares_get_maximum_set_gen.py} | 6 +- ...en.py => firmwares_get_minimum_set_gen.py} | 6 +- ...ares_list_by_workspace_maximum_set_gen.py} | 6 +- ...ares_list_by_workspace_minimum_set_gen.py} | 6 +- ...py => firmwares_update_maximum_set_gen.py} | 6 +- .../operations_list_maximum_set_gen.py | 2 +- .../operations_list_minimum_set_gen.py | 2 +- ...hashes_list_by_firmware_maximum_set_gen.py | 43 + ...hashes_list_by_firmware_minimum_set_gen.py | 43 + ...onents_list_by_firmware_maximum_set_gen.py | 43 + ...onents_list_by_firmware_minimum_set_gen.py | 43 + ...en.py => summaries_get_maximum_set_gen.py} | 11 +- ...en.py => summaries_get_minimum_set_gen.py} | 11 +- ...maries_list_by_firmware_maximum_set_gen.py | 43 + ...maries_list_by_firmware_minimum_set_gen.py | 43 + .../workspaces_create_maximum_set_gen.py | 2 +- .../workspaces_create_minimum_set_gen.py | 2 +- .../workspaces_delete_maximum_set_gen.py | 2 +- .../workspaces_delete_minimum_set_gen.py | 2 +- ...ces_generate_upload_url_maximum_set_gen.py | 2 +- .../workspaces_get_maximum_set_gen.py | 2 +- .../workspaces_get_minimum_set_gen.py | 2 +- ..._list_by_resource_group_maximum_set_gen.py | 2 +- ..._list_by_resource_group_minimum_set_gen.py | 2 +- ...es_list_by_subscription_maximum_set_gen.py | 2 +- ...es_list_by_subscription_minimum_set_gen.py | 2 +- .../workspaces_update_maximum_set_gen.py | 2 +- .../sdk_packaging.toml | 2 +- .../azure-mgmt-iotfirmwaredefense/setup.py | 7 +- 102 files changed, 6163 insertions(+), 6155 deletions(-) create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_binary_hardening_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_crypto_certificates_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_crypto_keys_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_cves_operations.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_firmware_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_firmwares_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_password_hashes_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_sbom_components_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_summaries_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_binary_hardening_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_crypto_certificates_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_crypto_keys_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_cves_operations.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_firmware_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_firmwares_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_password_hashes_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_sbom_components_operations.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_summaries_operations.py rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_list_generate_crypto_key_list_maximum_set_gen.py => binary_hardening_list_by_firmware_maximum_set_gen.py} (79%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_list_generate_crypto_certificate_list_maximum_set_gen.py => binary_hardening_list_by_firmware_minimum_set_gen.py} (78%) create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_certificates_list_by_firmware_maximum_set_gen.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_certificates_list_by_firmware_minimum_set_gen.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_keys_list_by_firmware_maximum_set_gen.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_keys_list_by_firmware_minimum_set_gen.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/cves_list_by_firmware_maximum_set_gen.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/cves_list_by_firmware_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_details_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_summary_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_component_details_maximum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_component_details_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_certificate_summary_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_key_summary_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_cve_summary_maximum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_cve_summary_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_download_url_maximum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_download_url_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_filesystem_download_url_maximum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_filesystem_download_url_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_binary_hardening_list_maximum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_binary_hardening_list_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_component_list_maximum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_component_list_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_certificate_list_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_key_list_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_cve_list_maximum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_cve_list_minimum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_password_hash_list_maximum_set_gen.py delete mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_password_hash_list_minimum_set_gen.py rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_update_maximum_set_gen.py => firmwares_create_maximum_set_gen.py} (91%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_delete_minimum_set_gen.py => firmwares_delete_maximum_set_gen.py} (89%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_delete_maximum_set_gen.py => firmwares_delete_minimum_set_gen.py} (89%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_generate_summary_maximum_set_gen.py => firmwares_generate_download_url_maximum_set_gen.py} (87%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_generate_summary_minimum_set_gen.py => firmwares_generate_download_url_minimum_set_gen.py} (87%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_generate_binary_hardening_summary_maximum_set_gen.py => firmwares_generate_filesystem_download_url_maximum_set_gen.py} (85%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_generate_binary_hardening_details_maximum_set_gen.py => firmwares_generate_filesystem_download_url_minimum_set_gen.py} (85%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_get_maximum_set_gen.py => firmwares_get_maximum_set_gen.py} (89%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_get_minimum_set_gen.py => firmwares_get_minimum_set_gen.py} (89%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_list_by_workspace_maximum_set_gen.py => firmwares_list_by_workspace_maximum_set_gen.py} (87%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_list_by_workspace_minimum_set_gen.py => firmwares_list_by_workspace_minimum_set_gen.py} (87%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_create_maximum_set_gen.py => firmwares_update_maximum_set_gen.py} (91%) create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/password_hashes_list_by_firmware_maximum_set_gen.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/password_hashes_list_by_firmware_minimum_set_gen.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/sbom_components_list_by_firmware_maximum_set_gen.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/sbom_components_list_by_firmware_minimum_set_gen.py rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_generate_crypto_key_summary_maximum_set_gen.py => summaries_get_maximum_set_gen.py} (79%) rename sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/{firmware_generate_crypto_certificate_summary_maximum_set_gen.py => summaries_get_minimum_set_gen.py} (78%) create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_list_by_firmware_maximum_set_gen.py create mode 100644 sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_list_by_firmware_minimum_set_gen.py diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/CHANGELOG.md b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/CHANGELOG.md index 7e52457d5313..85d17a82ecab 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/CHANGELOG.md +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/CHANGELOG.md @@ -1,5 +1,51 @@ # Release History +## 1.0.0 (2024-03-27) + +### Features Added + + - Added operation group BinaryHardeningOperations + - Added operation group CryptoCertificatesOperations + - Added operation group CryptoKeysOperations + - Added operation group CvesOperations + - Added operation group FirmwaresOperations + - Added operation group PasswordHashesOperations + - Added operation group SbomComponentsOperations + - Added operation group SummariesOperations + - Model Firmware has a new parameter properties + - Model FirmwareUpdateDefinition has a new parameter properties + - Model Workspace has a new parameter properties + - Model WorkspaceUpdateDefinition has a new parameter properties + +### Breaking Changes + + - Model CveSummary has a new required parameter summary_type + - Model CveSummary no longer has parameter undefined + - Model Firmware no longer has parameter description + - Model Firmware no longer has parameter file_name + - Model Firmware no longer has parameter file_size + - Model Firmware no longer has parameter model + - Model Firmware no longer has parameter provisioning_state + - Model Firmware no longer has parameter status + - Model Firmware no longer has parameter status_messages + - Model Firmware no longer has parameter vendor + - Model Firmware no longer has parameter version + - Model FirmwareSummary has a new required parameter summary_type + - Model FirmwareUpdateDefinition no longer has parameter description + - Model FirmwareUpdateDefinition no longer has parameter file_name + - Model FirmwareUpdateDefinition no longer has parameter file_size + - Model FirmwareUpdateDefinition no longer has parameter model + - Model FirmwareUpdateDefinition no longer has parameter provisioning_state + - Model FirmwareUpdateDefinition no longer has parameter status + - Model FirmwareUpdateDefinition no longer has parameter status_messages + - Model FirmwareUpdateDefinition no longer has parameter vendor + - Model FirmwareUpdateDefinition no longer has parameter version + - Model PairedKey no longer has parameter additional_properties + - Model UrlToken no longer has parameter upload_url + - Model Workspace no longer has parameter provisioning_state + - Model WorkspaceUpdateDefinition no longer has parameter provisioning_state + - Removed operation group FirmwareOperations + ## 1.0.0b1 (2023-07-24) * Initial Release diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/README.md b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/README.md index 847dacf04e6b..e9cad170607e 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/README.md +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Iotfirmwaredefense Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-iotfirmwaredefense%2FREADME.png) diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/_meta.json b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/_meta.json index c48fe2b5c53d..fe258baa92a6 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/_meta.json +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/_meta.json @@ -1,11 +1,11 @@ { - "commit": "d03c1964cb76ffd6884d10a1871bbe779a2f68ef", + "commit": "90fc96af52257944371b95428245bce0f218c7f5", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.6.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/fist/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/fist/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/fist/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_configuration.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_configuration.py index 8d453c272b9c..dc051e306afd 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_configuration.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_configuration.py @@ -27,16 +27,16 @@ class IoTFirmwareDefenseMgmtClientConfiguration(Configuration): # pylint: disab :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-02-08-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-10". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IoTFirmwareDefenseMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-02-08-preview") + api_version: str = kwargs.pop("api_version", "2024-01-10") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_io_tfirmware_defense_mgmt_client.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_io_tfirmware_defense_mgmt_client.py index 6f68a7e99c78..2118d3c24740 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_io_tfirmware_defense_mgmt_client.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_io_tfirmware_defense_mgmt_client.py @@ -15,31 +15,56 @@ from . import models as _models from ._configuration import IoTFirmwareDefenseMgmtClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import FirmwareOperations, Operations, WorkspacesOperations +from .operations import ( + BinaryHardeningOperations, + CryptoCertificatesOperations, + CryptoKeysOperations, + CvesOperations, + FirmwaresOperations, + Operations, + PasswordHashesOperations, + SbomComponentsOperations, + SummariesOperations, + WorkspacesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class IoTFirmwareDefenseMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The definitions and parameters in this swagger specification will be used to manage the IoT - Firmware Defense resources. - - :ivar firmware: FirmwareOperations operations - :vartype firmware: azure.mgmt.iotfirmwaredefense.operations.FirmwareOperations - :ivar workspaces: WorkspacesOperations operations - :vartype workspaces: azure.mgmt.iotfirmwaredefense.operations.WorkspacesOperations +class IoTFirmwareDefenseMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Firmware & IoT Security REST API. + + :ivar binary_hardening: BinaryHardeningOperations operations + :vartype binary_hardening: azure.mgmt.iotfirmwaredefense.operations.BinaryHardeningOperations + :ivar crypto_certificates: CryptoCertificatesOperations operations + :vartype crypto_certificates: + azure.mgmt.iotfirmwaredefense.operations.CryptoCertificatesOperations + :ivar crypto_keys: CryptoKeysOperations operations + :vartype crypto_keys: azure.mgmt.iotfirmwaredefense.operations.CryptoKeysOperations + :ivar cves: CvesOperations operations + :vartype cves: azure.mgmt.iotfirmwaredefense.operations.CvesOperations + :ivar firmwares: FirmwaresOperations operations + :vartype firmwares: azure.mgmt.iotfirmwaredefense.operations.FirmwaresOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.iotfirmwaredefense.operations.Operations + :ivar password_hashes: PasswordHashesOperations operations + :vartype password_hashes: azure.mgmt.iotfirmwaredefense.operations.PasswordHashesOperations + :ivar sbom_components: SbomComponentsOperations operations + :vartype sbom_components: azure.mgmt.iotfirmwaredefense.operations.SbomComponentsOperations + :ivar summaries: SummariesOperations operations + :vartype summaries: azure.mgmt.iotfirmwaredefense.operations.SummariesOperations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.iotfirmwaredefense.operations.WorkspacesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-02-08-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-10". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -59,9 +84,20 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.firmware = FirmwareOperations(self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.binary_hardening = BinaryHardeningOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.crypto_certificates = CryptoCertificatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.crypto_keys = CryptoKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.cves = CvesOperations(self._client, self._config, self._serialize, self._deserialize) + self.firmwares = FirmwaresOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.password_hashes = PasswordHashesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sbom_components = SbomComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.summaries = SummariesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_serialization.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_serialization.py index 842ae727fbbc..4bae2292227b 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_serialization.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_serialization.py @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_vendor.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_vendor.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_version.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_version.py index e5754a47ce68..c47f66669f1b 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_version.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0" diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/_configuration.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/_configuration.py index aea1a1d9a35e..16df92ca1642 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/_configuration.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/_configuration.py @@ -27,16 +27,16 @@ class IoTFirmwareDefenseMgmtClientConfiguration(Configuration): # pylint: disab :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-02-08-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-10". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(IoTFirmwareDefenseMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-02-08-preview") + api_version: str = kwargs.pop("api_version", "2024-01-10") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/_io_tfirmware_defense_mgmt_client.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/_io_tfirmware_defense_mgmt_client.py index 3a7c10d1d168..37b880ba02f2 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/_io_tfirmware_defense_mgmt_client.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/_io_tfirmware_defense_mgmt_client.py @@ -15,31 +15,57 @@ from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import IoTFirmwareDefenseMgmtClientConfiguration -from .operations import FirmwareOperations, Operations, WorkspacesOperations +from .operations import ( + BinaryHardeningOperations, + CryptoCertificatesOperations, + CryptoKeysOperations, + CvesOperations, + FirmwaresOperations, + Operations, + PasswordHashesOperations, + SbomComponentsOperations, + SummariesOperations, + WorkspacesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class IoTFirmwareDefenseMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The definitions and parameters in this swagger specification will be used to manage the IoT - Firmware Defense resources. - - :ivar firmware: FirmwareOperations operations - :vartype firmware: azure.mgmt.iotfirmwaredefense.aio.operations.FirmwareOperations - :ivar workspaces: WorkspacesOperations operations - :vartype workspaces: azure.mgmt.iotfirmwaredefense.aio.operations.WorkspacesOperations +class IoTFirmwareDefenseMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """Firmware & IoT Security REST API. + + :ivar binary_hardening: BinaryHardeningOperations operations + :vartype binary_hardening: + azure.mgmt.iotfirmwaredefense.aio.operations.BinaryHardeningOperations + :ivar crypto_certificates: CryptoCertificatesOperations operations + :vartype crypto_certificates: + azure.mgmt.iotfirmwaredefense.aio.operations.CryptoCertificatesOperations + :ivar crypto_keys: CryptoKeysOperations operations + :vartype crypto_keys: azure.mgmt.iotfirmwaredefense.aio.operations.CryptoKeysOperations + :ivar cves: CvesOperations operations + :vartype cves: azure.mgmt.iotfirmwaredefense.aio.operations.CvesOperations + :ivar firmwares: FirmwaresOperations operations + :vartype firmwares: azure.mgmt.iotfirmwaredefense.aio.operations.FirmwaresOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.iotfirmwaredefense.aio.operations.Operations + :ivar password_hashes: PasswordHashesOperations operations + :vartype password_hashes: azure.mgmt.iotfirmwaredefense.aio.operations.PasswordHashesOperations + :ivar sbom_components: SbomComponentsOperations operations + :vartype sbom_components: azure.mgmt.iotfirmwaredefense.aio.operations.SbomComponentsOperations + :ivar summaries: SummariesOperations operations + :vartype summaries: azure.mgmt.iotfirmwaredefense.aio.operations.SummariesOperations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.iotfirmwaredefense.aio.operations.WorkspacesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-02-08-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-10". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -59,9 +85,20 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.firmware = FirmwareOperations(self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.binary_hardening = BinaryHardeningOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.crypto_certificates = CryptoCertificatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.crypto_keys = CryptoKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.cves = CvesOperations(self._client, self._config, self._serialize, self._deserialize) + self.firmwares = FirmwaresOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.password_hashes = PasswordHashesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sbom_components = SbomComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.summaries = SummariesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/__init__.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/__init__.py index eb7a48a55a81..7d414eee1f60 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/__init__.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/__init__.py @@ -6,18 +6,32 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._firmware_operations import FirmwareOperations -from ._workspaces_operations import WorkspacesOperations +from ._binary_hardening_operations import BinaryHardeningOperations +from ._crypto_certificates_operations import CryptoCertificatesOperations +from ._crypto_keys_operations import CryptoKeysOperations +from ._cves_operations import CvesOperations +from ._firmwares_operations import FirmwaresOperations from ._operations import Operations +from ._password_hashes_operations import PasswordHashesOperations +from ._sbom_components_operations import SbomComponentsOperations +from ._summaries_operations import SummariesOperations +from ._workspaces_operations import WorkspacesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "FirmwareOperations", - "WorkspacesOperations", + "BinaryHardeningOperations", + "CryptoCertificatesOperations", + "CryptoKeysOperations", + "CvesOperations", + "FirmwaresOperations", "Operations", + "PasswordHashesOperations", + "SbomComponentsOperations", + "SummariesOperations", + "WorkspacesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_binary_hardening_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_binary_hardening_operations.py new file mode 100644 index 000000000000..410c3d499017 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_binary_hardening_operations.py @@ -0,0 +1,150 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._binary_hardening_operations import build_list_by_firmware_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BinaryHardeningOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.aio.IoTFirmwareDefenseMgmtClient`'s + :attr:`binary_hardening` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> AsyncIterable["_models.BinaryHardeningResource"]: + """Lists binary hardening analysis results of a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BinaryHardeningResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.BinaryHardeningResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BinaryHardeningListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BinaryHardeningListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/binaryHardeningResults" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_crypto_certificates_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_crypto_certificates_operations.py new file mode 100644 index 000000000000..bf152776828f --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_crypto_certificates_operations.py @@ -0,0 +1,150 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._crypto_certificates_operations import build_list_by_firmware_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CryptoCertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.aio.IoTFirmwareDefenseMgmtClient`'s + :attr:`crypto_certificates` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> AsyncIterable["_models.CryptoCertificateResource"]: + """Lists cryptographic certificate analysis results found in a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CryptoCertificateResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.CryptoCertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CryptoCertificateListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CryptoCertificateListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/cryptoCertificates" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_crypto_keys_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_crypto_keys_operations.py new file mode 100644 index 000000000000..789b7e03947e --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_crypto_keys_operations.py @@ -0,0 +1,149 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._crypto_keys_operations import build_list_by_firmware_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CryptoKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.aio.IoTFirmwareDefenseMgmtClient`'s + :attr:`crypto_keys` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> AsyncIterable["_models.CryptoKeyResource"]: + """Lists cryptographic key analysis results found in a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CryptoKeyResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.CryptoKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CryptoKeyListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CryptoKeyListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/cryptoKeys" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_cves_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_cves_operations.py new file mode 100644 index 000000000000..c06cd9155de5 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_cves_operations.py @@ -0,0 +1,149 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._cves_operations import build_list_by_firmware_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CvesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.aio.IoTFirmwareDefenseMgmtClient`'s + :attr:`cves` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> AsyncIterable["_models.CveResource"]: + """Lists CVE analysis results of a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CveResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.CveResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CveListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CveListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/cves" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_firmware_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_firmware_operations.py deleted file mode 100644 index f537f578155c..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_firmware_operations.py +++ /dev/null @@ -1,1803 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._firmware_operations import ( - build_create_request, - build_delete_request, - build_generate_binary_hardening_details_request, - build_generate_binary_hardening_summary_request, - build_generate_component_details_request, - build_generate_crypto_certificate_summary_request, - build_generate_crypto_key_summary_request, - build_generate_cve_summary_request, - build_generate_download_url_request, - build_generate_filesystem_download_url_request, - build_generate_summary_request, - build_get_request, - build_list_by_workspace_request, - build_list_generate_binary_hardening_list_request, - build_list_generate_component_list_request, - build_list_generate_crypto_certificate_list_request, - build_list_generate_crypto_key_list_request, - build_list_generate_cve_list_request, - build_list_generate_password_hash_list_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FirmwareOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.iotfirmwaredefense.aio.IoTFirmwareDefenseMgmtClient`'s - :attr:`firmware` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_workspace( - self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Firmware"]: - """Lists all of firmwares inside a workspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Firmware or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.Firmware] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FirmwareList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_workspace_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FirmwareList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares" - } - - @overload - async def create( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: _models.Firmware, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Firmware: - """The operation to create a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Required. - :type firmware: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Firmware: - """The operation to create a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Required. - :type firmware: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: Union[_models.Firmware, IO], - **kwargs: Any - ) -> _models.Firmware: - """The operation to create a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Is either a Firmware type or - a IO type. Required. - :type firmware: ~azure.mgmt.iotfirmwaredefense.models.Firmware or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(firmware, (IOBase, bytes)): - _content = firmware - else: - _json = self._serialize.body(firmware, "Firmware") - - request = build_create_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Firmware", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Firmware", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" - } - - @overload - async def update( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: _models.FirmwareUpdateDefinition, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Firmware: - """The operation to update firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Required. - :type firmware: ~azure.mgmt.iotfirmwaredefense.models.FirmwareUpdateDefinition - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Firmware: - """The operation to update firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Required. - :type firmware: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: Union[_models.FirmwareUpdateDefinition, IO], - **kwargs: Any - ) -> _models.Firmware: - """The operation to update firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Is either a - FirmwareUpdateDefinition type or a IO type. Required. - :type firmware: ~azure.mgmt.iotfirmwaredefense.models.FirmwareUpdateDefinition or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(firmware, (IOBase, bytes)): - _content = firmware - else: - _json = self._serialize.body(firmware, "FirmwareUpdateDefinition") - - request = build_update_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Firmware", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Firmware", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> None: - """The operation to delete a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.Firmware: - """Get firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Firmware", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" - } - - @distributed_trace_async - async def generate_download_url( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.UrlToken: - """The operation to a url for file download. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UrlToken or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.UrlToken - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.UrlToken] = kwargs.pop("cls", None) - - request = build_generate_download_url_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_download_url.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UrlToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_download_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateDownloadUrl" - } - - @distributed_trace_async - async def generate_filesystem_download_url( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.UrlToken: - """The operation to a url for tar file download. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UrlToken or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.UrlToken - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.UrlToken] = kwargs.pop("cls", None) - - request = build_generate_filesystem_download_url_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_filesystem_download_url.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UrlToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_filesystem_download_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateFilesystemDownloadUrl" - } - - @distributed_trace_async - async def generate_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.FirmwareSummary: - """The operation to get a scan summary. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirmwareSummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.FirmwareSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FirmwareSummary] = kwargs.pop("cls", None) - - request = build_generate_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FirmwareSummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateSummary" - } - - @distributed_trace - def list_generate_component_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> AsyncIterable["_models.Component"]: - """The operation to list all components result for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Component or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.Component] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_component_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_component_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ComponentList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_generate_component_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateComponentList" - } - - @distributed_trace_async - async def generate_component_details( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.Component: - """The operation to get component details for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Component or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Component - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Component] = kwargs.pop("cls", None) - - request = build_generate_component_details_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_component_details.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Component", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_component_details.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateComponentDetails" - } - - @distributed_trace - def list_generate_binary_hardening_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> AsyncIterable["_models.BinaryHardening"]: - """The operation to list all binary hardening result for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BinaryHardening or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.BinaryHardening] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BinaryHardeningList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_binary_hardening_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_binary_hardening_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BinaryHardeningList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_generate_binary_hardening_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateBinaryHardeningList" - } - - @distributed_trace_async - async def generate_binary_hardening_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.BinaryHardeningSummary: - """The operation to list the binary hardening summary percentages for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BinaryHardeningSummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.BinaryHardeningSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BinaryHardeningSummary] = kwargs.pop("cls", None) - - request = build_generate_binary_hardening_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_binary_hardening_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BinaryHardeningSummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_binary_hardening_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateBinaryHardeningSummary" - } - - @distributed_trace_async - async def generate_binary_hardening_details( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.BinaryHardening: - """The operation to get binary hardening details for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BinaryHardening or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.BinaryHardening - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BinaryHardening] = kwargs.pop("cls", None) - - request = build_generate_binary_hardening_details_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_binary_hardening_details.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BinaryHardening", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_binary_hardening_details.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateBinaryHardeningDetails" - } - - @distributed_trace - def list_generate_password_hash_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> AsyncIterable["_models.PasswordHash"]: - """The operation to list all password hashes for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PasswordHash or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.PasswordHash] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PasswordHashList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_password_hash_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_password_hash_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PasswordHashList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_generate_password_hash_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generatePasswordHashList" - } - - @distributed_trace - def list_generate_cve_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> AsyncIterable["_models.Cve"]: - """The operation to list all cve results for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Cve or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.Cve] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CveList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_cve_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_cve_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CveList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_generate_cve_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCveList" - } - - @distributed_trace_async - async def generate_cve_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.CveSummary: - """The operation to provide a high level summary of the CVEs reported for the firmware image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CveSummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.CveSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CveSummary] = kwargs.pop("cls", None) - - request = build_generate_cve_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_cve_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CveSummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_cve_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCveSummary" - } - - @distributed_trace_async - async def generate_crypto_certificate_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.CryptoCertificateSummary: - """The operation to provide a high level summary of the discovered cryptographic certificates - reported for the firmware image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CryptoCertificateSummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.CryptoCertificateSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CryptoCertificateSummary] = kwargs.pop("cls", None) - - request = build_generate_crypto_certificate_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_crypto_certificate_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CryptoCertificateSummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_crypto_certificate_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoCertificateSummary" - } - - @distributed_trace_async - async def generate_crypto_key_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.CryptoKeySummary: - """The operation to provide a high level summary of the discovered cryptographic keys reported for - the firmware image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CryptoKeySummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.CryptoKeySummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CryptoKeySummary] = kwargs.pop("cls", None) - - request = build_generate_crypto_key_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_crypto_key_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CryptoKeySummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_crypto_key_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoKeySummary" - } - - @distributed_trace - def list_generate_crypto_certificate_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> AsyncIterable["_models.CryptoCertificate"]: - """The operation to list all crypto certificates for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CryptoCertificate or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.CryptoCertificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CryptoCertificateList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_crypto_certificate_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_crypto_certificate_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CryptoCertificateList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_generate_crypto_certificate_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoCertificateList" - } - - @distributed_trace - def list_generate_crypto_key_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> AsyncIterable["_models.CryptoKey"]: - """The operation to list all crypto keys for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CryptoKey or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.CryptoKey] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CryptoKeyList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_crypto_key_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_crypto_key_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CryptoKeyList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_generate_crypto_key_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoKeyList" - } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_firmwares_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_firmwares_operations.py new file mode 100644 index 000000000000..2268579c012b --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_firmwares_operations.py @@ -0,0 +1,733 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._firmwares_operations import ( + build_create_request, + build_delete_request, + build_generate_download_url_request, + build_generate_filesystem_download_url_request, + build_get_request, + build_list_by_workspace_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FirmwaresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.aio.IoTFirmwareDefenseMgmtClient`'s + :attr:`firmwares` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_workspace( + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Firmware"]: + """Lists all of firmwares inside a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Firmware or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.Firmware] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FirmwareList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_workspace.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FirmwareList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_workspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares" + } + + @overload + async def create( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: _models.Firmware, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Firmware: + """The operation to create a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Required. + :type firmware: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Firmware: + """The operation to create a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Required. + :type firmware: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: Union[_models.Firmware, IO], + **kwargs: Any + ) -> _models.Firmware: + """The operation to create a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Is either a Firmware type or + a IO type. Required. + :type firmware: ~azure.mgmt.iotfirmwaredefense.models.Firmware or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(firmware, (IOBase, bytes)): + _content = firmware + else: + _json = self._serialize.body(firmware, "Firmware") + + request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Firmware", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Firmware", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" + } + + @overload + async def update( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: _models.FirmwareUpdateDefinition, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Firmware: + """The operation to update firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Required. + :type firmware: ~azure.mgmt.iotfirmwaredefense.models.FirmwareUpdateDefinition + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Firmware: + """The operation to update firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Required. + :type firmware: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: Union[_models.FirmwareUpdateDefinition, IO], + **kwargs: Any + ) -> _models.Firmware: + """The operation to update firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Is either a + FirmwareUpdateDefinition type or a IO type. Required. + :type firmware: ~azure.mgmt.iotfirmwaredefense.models.FirmwareUpdateDefinition or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(firmware, (IOBase, bytes)): + _content = firmware + else: + _json = self._serialize.body(firmware, "FirmwareUpdateDefinition") + + request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Firmware", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> None: + """The operation to delete a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> _models.Firmware: + """Get firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Firmware", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" + } + + @distributed_trace_async + async def generate_download_url( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> _models.UrlToken: + """The operation to a url for file download. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UrlToken or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.UrlToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UrlToken] = kwargs.pop("cls", None) + + request = build_generate_download_url_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.generate_download_url.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UrlToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateDownloadUrl" + } + + @distributed_trace_async + async def generate_filesystem_download_url( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> _models.UrlToken: + """The operation to a url for tar file download. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UrlToken or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.UrlToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UrlToken] = kwargs.pop("cls", None) + + request = build_generate_filesystem_download_url_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.generate_filesystem_download_url.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UrlToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_filesystem_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateFilesystemDownloadUrl" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_password_hashes_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_password_hashes_operations.py new file mode 100644 index 000000000000..6eb49b9df03f --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_password_hashes_operations.py @@ -0,0 +1,150 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._password_hashes_operations import build_list_by_firmware_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PasswordHashesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.aio.IoTFirmwareDefenseMgmtClient`'s + :attr:`password_hashes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> AsyncIterable["_models.PasswordHashResource"]: + """Lists password hash analysis results of a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PasswordHashResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.PasswordHashResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PasswordHashListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PasswordHashListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/passwordHashes" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_sbom_components_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_sbom_components_operations.py new file mode 100644 index 000000000000..afc16670e5a7 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_sbom_components_operations.py @@ -0,0 +1,150 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sbom_components_operations import build_list_by_firmware_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SbomComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.aio.IoTFirmwareDefenseMgmtClient`'s + :attr:`sbom_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> AsyncIterable["_models.SbomComponentResource"]: + """Lists SBOM analysis results of a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SbomComponentResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.SbomComponentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SbomComponentListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SbomComponentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/sbomComponents" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_summaries_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_summaries_operations.py new file mode 100644 index 000000000000..e2bde2b1ecd5 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_summaries_operations.py @@ -0,0 +1,229 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._summaries_operations import build_get_request, build_list_by_firmware_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SummariesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.aio.IoTFirmwareDefenseMgmtClient`'s + :attr:`summaries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> AsyncIterable["_models.SummaryResource"]: + """Lists analysis result summary names of a firmware. To fetch the full summary data, get that + summary by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SummaryResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iotfirmwaredefense.models.SummaryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SummaryListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SummaryListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/summaries" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + summary_name: Union[str, _models.SummaryName], + **kwargs: Any + ) -> _models.SummaryResource: + """Get an analysis result summary of a firmware by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param summary_name: The Firmware analysis summary name describing the type of summary. Known + values are: "Firmware", "CVE", "BinaryHardening", "CryptoCertificate", and "CryptoKey". + Required. + :type summary_name: str or ~azure.mgmt.iotfirmwaredefense.models.SummaryName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SummaryResource or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.SummaryResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SummaryResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + summary_name=summary_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SummaryResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/summaries/{summaryName}" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_workspaces_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_workspaces_operations.py index 541aad36a453..445a09f9afb8 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_workspaces_operations.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/aio/operations/_workspaces_operations.py @@ -504,21 +504,17 @@ async def update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Workspace", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}" @@ -586,7 +582,7 @@ async def delete( # pylint: disable=inconsistent-return-statements } @distributed_trace_async - async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> Optional[_models.Workspace]: + async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: """Get firmware analysis workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -595,8 +591,8 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any :param workspace_name: The name of the firmware analysis workspace. Required. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Workspace or None or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Workspace or None + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -611,7 +607,7 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.Workspace]] = kwargs.pop("cls", None) + cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -632,14 +628,12 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any response = pipeline_response.http_response - if response.status_code not in [200, 304]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/__init__.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/__init__.py index 7c31bbdd1412..59a7505ef965 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/__init__.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/__init__.py @@ -6,28 +6,32 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import BinaryHardening -from ._models_py3 import BinaryHardeningList -from ._models_py3 import BinaryHardeningSummary -from ._models_py3 import Component -from ._models_py3 import ComponentList +from ._models_py3 import BinaryHardeningFeatures +from ._models_py3 import BinaryHardeningListResult +from ._models_py3 import BinaryHardeningResource +from ._models_py3 import BinaryHardeningResult +from ._models_py3 import BinaryHardeningSummaryResource from ._models_py3 import CryptoCertificate from ._models_py3 import CryptoCertificateEntity -from ._models_py3 import CryptoCertificateList -from ._models_py3 import CryptoCertificateSummary +from ._models_py3 import CryptoCertificateListResult +from ._models_py3 import CryptoCertificateResource +from ._models_py3 import CryptoCertificateSummaryResource from ._models_py3 import CryptoKey -from ._models_py3 import CryptoKeyList -from ._models_py3 import CryptoKeySummary -from ._models_py3 import Cve +from ._models_py3 import CryptoKeyListResult +from ._models_py3 import CryptoKeyResource +from ._models_py3 import CryptoKeySummaryResource from ._models_py3 import CveComponent from ._models_py3 import CveLink -from ._models_py3 import CveList +from ._models_py3 import CveListResult +from ._models_py3 import CveResource +from ._models_py3 import CveResult from ._models_py3 import CveSummary from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import Firmware from ._models_py3 import FirmwareList +from ._models_py3 import FirmwareProperties from ._models_py3 import FirmwareSummary from ._models_py3 import FirmwareUpdateDefinition from ._models_py3 import GenerateUploadUrlRequest @@ -36,58 +40,62 @@ from ._models_py3 import OperationListResult from ._models_py3 import PairedKey from ._models_py3 import PasswordHash -from ._models_py3 import PasswordHashList -from ._models_py3 import ProxyResource +from ._models_py3 import PasswordHashListResult +from ._models_py3 import PasswordHashResource from ._models_py3 import Resource +from ._models_py3 import SbomComponent +from ._models_py3 import SbomComponentListResult +from ._models_py3 import SbomComponentResource +from ._models_py3 import StatusMessage +from ._models_py3 import SummaryListResult +from ._models_py3 import SummaryResource +from ._models_py3 import SummaryResourceProperties from ._models_py3 import SystemData from ._models_py3 import TrackedResource from ._models_py3 import UrlToken from ._models_py3 import Workspace from ._models_py3 import WorkspaceList +from ._models_py3 import WorkspaceProperties from ._models_py3 import WorkspaceUpdateDefinition from ._io_tfirmware_defense_mgmt_client_enums import ActionType -from ._io_tfirmware_defense_mgmt_client_enums import CanaryFlag from ._io_tfirmware_defense_mgmt_client_enums import CreatedByType -from ._io_tfirmware_defense_mgmt_client_enums import IsExpired -from ._io_tfirmware_defense_mgmt_client_enums import IsSelfSigned -from ._io_tfirmware_defense_mgmt_client_enums import IsShortKeySize -from ._io_tfirmware_defense_mgmt_client_enums import IsUpdateAvailable -from ._io_tfirmware_defense_mgmt_client_enums import IsWeakSignature -from ._io_tfirmware_defense_mgmt_client_enums import NxFlag from ._io_tfirmware_defense_mgmt_client_enums import Origin -from ._io_tfirmware_defense_mgmt_client_enums import PieFlag from ._io_tfirmware_defense_mgmt_client_enums import ProvisioningState -from ._io_tfirmware_defense_mgmt_client_enums import RelroFlag from ._io_tfirmware_defense_mgmt_client_enums import Status -from ._io_tfirmware_defense_mgmt_client_enums import StrippedFlag +from ._io_tfirmware_defense_mgmt_client_enums import SummaryName +from ._io_tfirmware_defense_mgmt_client_enums import SummaryType from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "BinaryHardening", - "BinaryHardeningList", - "BinaryHardeningSummary", - "Component", - "ComponentList", + "BinaryHardeningFeatures", + "BinaryHardeningListResult", + "BinaryHardeningResource", + "BinaryHardeningResult", + "BinaryHardeningSummaryResource", "CryptoCertificate", "CryptoCertificateEntity", - "CryptoCertificateList", - "CryptoCertificateSummary", + "CryptoCertificateListResult", + "CryptoCertificateResource", + "CryptoCertificateSummaryResource", "CryptoKey", - "CryptoKeyList", - "CryptoKeySummary", - "Cve", + "CryptoKeyListResult", + "CryptoKeyResource", + "CryptoKeySummaryResource", "CveComponent", "CveLink", - "CveList", + "CveListResult", + "CveResource", + "CveResult", "CveSummary", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", "Firmware", "FirmwareList", + "FirmwareProperties", "FirmwareSummary", "FirmwareUpdateDefinition", "GenerateUploadUrlRequest", @@ -96,30 +104,30 @@ "OperationListResult", "PairedKey", "PasswordHash", - "PasswordHashList", - "ProxyResource", + "PasswordHashListResult", + "PasswordHashResource", "Resource", + "SbomComponent", + "SbomComponentListResult", + "SbomComponentResource", + "StatusMessage", + "SummaryListResult", + "SummaryResource", + "SummaryResourceProperties", "SystemData", "TrackedResource", "UrlToken", "Workspace", "WorkspaceList", + "WorkspaceProperties", "WorkspaceUpdateDefinition", "ActionType", - "CanaryFlag", "CreatedByType", - "IsExpired", - "IsSelfSigned", - "IsShortKeySize", - "IsUpdateAvailable", - "IsWeakSignature", - "NxFlag", "Origin", - "PieFlag", "ProvisioningState", - "RelroFlag", "Status", - "StrippedFlag", + "SummaryName", + "SummaryType", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/_io_tfirmware_defense_mgmt_client_enums.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/_io_tfirmware_defense_mgmt_client_enums.py index 25931ec82195..5f44569d8333 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/_io_tfirmware_defense_mgmt_client_enums.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/_io_tfirmware_defense_mgmt_client_enums.py @@ -16,13 +16,6 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" -class CanaryFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Canary flag.""" - - TRUE = "True" - FALSE = "False" - - class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -32,48 +25,6 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" -class IsExpired(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates if the certificate is expired.""" - - TRUE = "True" - FALSE = "False" - - -class IsSelfSigned(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates if the certificate was self-signed.""" - - TRUE = "True" - FALSE = "False" - - -class IsShortKeySize(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates the key size is considered too small to be secure for the algorithm.""" - - TRUE = "True" - FALSE = "False" - - -class IsUpdateAvailable(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Flag if new update is available for the component.""" - - TRUE = "True" - FALSE = "False" - - -class IsWeakSignature(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates the signature algorithm used is insecure.""" - - TRUE = "True" - FALSE = "False" - - -class NxFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """NX flag.""" - - TRUE = "True" - FALSE = "False" - - class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". @@ -84,13 +35,6 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" -class PieFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """PIE flag.""" - - TRUE = "True" - FALSE = "False" - - class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the resource.""" @@ -100,13 +44,6 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" -class RelroFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RELRO flag.""" - - TRUE = "True" - FALSE = "False" - - class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of firmware scan.""" @@ -117,8 +54,21 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): ERROR = "Error" -class StrippedFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Stripped flag.""" +class SummaryName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SummaryName.""" + + FIRMWARE = "Firmware" + CVE = "CVE" + BINARY_HARDENING = "BinaryHardening" + CRYPTO_CERTIFICATE = "CryptoCertificate" + CRYPTO_KEY = "CryptoKey" + + +class SummaryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes the type of summary.""" - TRUE = "True" - FALSE = "False" + FIRMWARE = "Firmware" + CVE = "CVE" + BINARY_HARDENING = "BinaryHardening" + CRYPTO_CERTIFICATE = "CryptoCertificate" + CRYPTO_KEY = "CryptoKey" diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/_models_py3.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/_models_py3.py index f56ca70313bf..a6e8ed6b3eb7 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/_models_py3.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/models/_models_py3.py @@ -8,150 +8,296 @@ # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -class BinaryHardening(_serialization.Model): # pylint: disable=too-many-instance-attributes +class BinaryHardeningFeatures(_serialization.Model): + """Binary hardening features. + + :ivar nx: NX (no-execute) flag. + :vartype nx: bool + :ivar pie: PIE (position independent executable) flag. + :vartype pie: bool + :ivar relro: RELRO (relocation read-only) flag. + :vartype relro: bool + :ivar canary: Canary (stack canaries) flag. + :vartype canary: bool + :ivar stripped: Stripped flag. + :vartype stripped: bool + """ + + _attribute_map = { + "nx": {"key": "nx", "type": "bool"}, + "pie": {"key": "pie", "type": "bool"}, + "relro": {"key": "relro", "type": "bool"}, + "canary": {"key": "canary", "type": "bool"}, + "stripped": {"key": "stripped", "type": "bool"}, + } + + def __init__( + self, + *, + nx: Optional[bool] = None, + pie: Optional[bool] = None, + relro: Optional[bool] = None, + canary: Optional[bool] = None, + stripped: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword nx: NX (no-execute) flag. + :paramtype nx: bool + :keyword pie: PIE (position independent executable) flag. + :paramtype pie: bool + :keyword relro: RELRO (relocation read-only) flag. + :paramtype relro: bool + :keyword canary: Canary (stack canaries) flag. + :paramtype canary: bool + :keyword stripped: Stripped flag. + :paramtype stripped: bool + """ + super().__init__(**kwargs) + self.nx = nx + self.pie = pie + self.relro = relro + self.canary = canary + self.stripped = stripped + + +class BinaryHardeningListResult(_serialization.Model): + """List of binary hardening results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of binary hardening results. + :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.BinaryHardeningResource] + :ivar next_link: The uri to fetch the next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[BinaryHardeningResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The uri to fetch the next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class BinaryHardeningResource(Resource): + """binary hardening analysis result resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + :ivar properties: The properties of a binary hardening result found within a firmware image. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.BinaryHardeningResult + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "BinaryHardeningResult"}, + } + + def __init__(self, *, properties: Optional["_models.BinaryHardeningResult"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The properties of a binary hardening result found within a firmware image. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.BinaryHardeningResult + """ + super().__init__(**kwargs) + self.properties = properties + + +class BinaryHardeningResult(_serialization.Model): """Binary hardening of a firmware. :ivar binary_hardening_id: ID for the binary hardening result. :vartype binary_hardening_id: str + :ivar features: Binary hardening features. + :vartype features: ~azure.mgmt.iotfirmwaredefense.models.BinaryHardeningFeatures :ivar architecture: The architecture of the uploaded firmware. :vartype architecture: str - :ivar path: path for binary hardening. - :vartype path: str - :ivar class_property: class for binary hardening. + :ivar file_path: The executable path. + :vartype file_path: str + :ivar class_property: The executable class to indicate 32 or 64 bit. :vartype class_property: str :ivar runpath: The runpath of the uploaded firmware. :vartype runpath: str :ivar rpath: The rpath of the uploaded firmware. :vartype rpath: str - :ivar nx: NX flag. Known values are: "True" and "False". - :vartype nx: str or ~azure.mgmt.iotfirmwaredefense.models.NxFlag - :ivar pie: PIE flag. Known values are: "True" and "False". - :vartype pie: str or ~azure.mgmt.iotfirmwaredefense.models.PieFlag - :ivar relro: RELRO flag. Known values are: "True" and "False". - :vartype relro: str or ~azure.mgmt.iotfirmwaredefense.models.RelroFlag - :ivar canary: Canary flag. Known values are: "True" and "False". - :vartype canary: str or ~azure.mgmt.iotfirmwaredefense.models.CanaryFlag - :ivar stripped: Stripped flag. Known values are: "True" and "False". - :vartype stripped: str or ~azure.mgmt.iotfirmwaredefense.models.StrippedFlag """ _attribute_map = { "binary_hardening_id": {"key": "binaryHardeningId", "type": "str"}, + "features": {"key": "features", "type": "BinaryHardeningFeatures"}, "architecture": {"key": "architecture", "type": "str"}, - "path": {"key": "path", "type": "str"}, + "file_path": {"key": "filePath", "type": "str"}, "class_property": {"key": "class", "type": "str"}, "runpath": {"key": "runpath", "type": "str"}, "rpath": {"key": "rpath", "type": "str"}, - "nx": {"key": "features.nx", "type": "str"}, - "pie": {"key": "features.pie", "type": "str"}, - "relro": {"key": "features.relro", "type": "str"}, - "canary": {"key": "features.canary", "type": "str"}, - "stripped": {"key": "features.stripped", "type": "str"}, } def __init__( self, *, binary_hardening_id: Optional[str] = None, + features: Optional["_models.BinaryHardeningFeatures"] = None, architecture: Optional[str] = None, - path: Optional[str] = None, + file_path: Optional[str] = None, class_property: Optional[str] = None, runpath: Optional[str] = None, rpath: Optional[str] = None, - nx: Optional[Union[str, "_models.NxFlag"]] = None, - pie: Optional[Union[str, "_models.PieFlag"]] = None, - relro: Optional[Union[str, "_models.RelroFlag"]] = None, - canary: Optional[Union[str, "_models.CanaryFlag"]] = None, - stripped: Optional[Union[str, "_models.StrippedFlag"]] = None, **kwargs: Any ) -> None: """ :keyword binary_hardening_id: ID for the binary hardening result. :paramtype binary_hardening_id: str + :keyword features: Binary hardening features. + :paramtype features: ~azure.mgmt.iotfirmwaredefense.models.BinaryHardeningFeatures :keyword architecture: The architecture of the uploaded firmware. :paramtype architecture: str - :keyword path: path for binary hardening. - :paramtype path: str - :keyword class_property: class for binary hardening. + :keyword file_path: The executable path. + :paramtype file_path: str + :keyword class_property: The executable class to indicate 32 or 64 bit. :paramtype class_property: str :keyword runpath: The runpath of the uploaded firmware. :paramtype runpath: str :keyword rpath: The rpath of the uploaded firmware. :paramtype rpath: str - :keyword nx: NX flag. Known values are: "True" and "False". - :paramtype nx: str or ~azure.mgmt.iotfirmwaredefense.models.NxFlag - :keyword pie: PIE flag. Known values are: "True" and "False". - :paramtype pie: str or ~azure.mgmt.iotfirmwaredefense.models.PieFlag - :keyword relro: RELRO flag. Known values are: "True" and "False". - :paramtype relro: str or ~azure.mgmt.iotfirmwaredefense.models.RelroFlag - :keyword canary: Canary flag. Known values are: "True" and "False". - :paramtype canary: str or ~azure.mgmt.iotfirmwaredefense.models.CanaryFlag - :keyword stripped: Stripped flag. Known values are: "True" and "False". - :paramtype stripped: str or ~azure.mgmt.iotfirmwaredefense.models.StrippedFlag """ super().__init__(**kwargs) self.binary_hardening_id = binary_hardening_id + self.features = features self.architecture = architecture - self.path = path + self.file_path = file_path self.class_property = class_property self.runpath = runpath self.rpath = rpath - self.nx = nx - self.pie = pie - self.relro = relro - self.canary = canary - self.stripped = stripped -class BinaryHardeningList(_serialization.Model): - """List result for binary hardening. +class SummaryResourceProperties(_serialization.Model): + """Properties of an analysis summary. - Variables are only populated by the server, and will be ignored when sending a request. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + BinaryHardeningSummaryResource, CveSummary, CryptoCertificateSummaryResource, + CryptoKeySummaryResource, FirmwareSummary - :ivar value: The list of binary hardening results. - :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.BinaryHardening] - :ivar next_link: The uri to fetch the next page of asset. - :vartype next_link: str + All required parameters must be populated in order to send to Azure. + + :ivar summary_type: Describes the type of summary. Required. Known values are: "Firmware", + "CVE", "BinaryHardening", "CryptoCertificate", and "CryptoKey". + :vartype summary_type: str or ~azure.mgmt.iotfirmwaredefense.models.SummaryType """ _validation = { - "value": {"readonly": True}, + "summary_type": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[BinaryHardening]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "summary_type": {"key": "summaryType", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The uri to fetch the next page of asset. - :paramtype next_link: str - """ + _subtype_map = { + "summary_type": { + "BinaryHardening": "BinaryHardeningSummaryResource", + "CVE": "CveSummary", + "CryptoCertificate": "CryptoCertificateSummaryResource", + "CryptoKey": "CryptoKeySummaryResource", + "Firmware": "FirmwareSummary", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = None - self.next_link = next_link + self.summary_type: Optional[str] = None -class BinaryHardeningSummary(_serialization.Model): - """Binary hardening summary percentages. +class BinaryHardeningSummaryResource(SummaryResourceProperties): + """Properties for a binary hardening analysis summary. + All required parameters must be populated in order to send to Azure. + + :ivar summary_type: Describes the type of summary. Required. Known values are: "Firmware", + "CVE", "BinaryHardening", "CryptoCertificate", and "CryptoKey". + :vartype summary_type: str or ~azure.mgmt.iotfirmwaredefense.models.SummaryType :ivar total_files: Total number of binaries that were analyzed. :vartype total_files: int :ivar nx: NX summary percentage. @@ -166,7 +312,12 @@ class BinaryHardeningSummary(_serialization.Model): :vartype stripped: int """ + _validation = { + "summary_type": {"required": True}, + } + _attribute_map = { + "summary_type": {"key": "summaryType", "type": "str"}, "total_files": {"key": "totalFiles", "type": "int"}, "nx": {"key": "nx", "type": "int"}, "pie": {"key": "pie", "type": "int"}, @@ -201,6 +352,7 @@ def __init__( :paramtype stripped: int """ super().__init__(**kwargs) + self.summary_type: str = "BinaryHardening" self.total_files = total_files self.nx = nx self.pie = pie @@ -209,111 +361,12 @@ def __init__( self.stripped = stripped -class Component(_serialization.Model): - """Component of a firmware. - - :ivar component_id: ID for the component. - :vartype component_id: str - :ivar component_name: Name for the component. - :vartype component_name: str - :ivar version: Version for the component. - :vartype version: str - :ivar license: License for the component. - :vartype license: str - :ivar release_date: Release date for the component. - :vartype release_date: ~datetime.datetime - :ivar paths: Paths of the component. - :vartype paths: list[str] - :ivar is_update_available: Flag if new update is available for the component. Known values are: - "True" and "False". - :vartype is_update_available: str or ~azure.mgmt.iotfirmwaredefense.models.IsUpdateAvailable - """ - - _attribute_map = { - "component_id": {"key": "componentId", "type": "str"}, - "component_name": {"key": "componentName", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "license": {"key": "license", "type": "str"}, - "release_date": {"key": "releaseDate", "type": "iso-8601"}, - "paths": {"key": "paths", "type": "[str]"}, - "is_update_available": {"key": "isUpdateAvailable", "type": "str"}, - } - - def __init__( - self, - *, - component_id: Optional[str] = None, - component_name: Optional[str] = None, - version: Optional[str] = None, - license: Optional[str] = None, - release_date: Optional[datetime.datetime] = None, - paths: Optional[List[str]] = None, - is_update_available: Optional[Union[str, "_models.IsUpdateAvailable"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword component_id: ID for the component. - :paramtype component_id: str - :keyword component_name: Name for the component. - :paramtype component_name: str - :keyword version: Version for the component. - :paramtype version: str - :keyword license: License for the component. - :paramtype license: str - :keyword release_date: Release date for the component. - :paramtype release_date: ~datetime.datetime - :keyword paths: Paths of the component. - :paramtype paths: list[str] - :keyword is_update_available: Flag if new update is available for the component. Known values - are: "True" and "False". - :paramtype is_update_available: str or ~azure.mgmt.iotfirmwaredefense.models.IsUpdateAvailable - """ - super().__init__(**kwargs) - self.component_id = component_id - self.component_name = component_name - self.version = version - self.license = license - self.release_date = release_date - self.paths = paths - self.is_update_available = is_update_available - - -class ComponentList(_serialization.Model): - """List result for components. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of components. - :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.Component] - :ivar next_link: The uri to fetch the next page of asset. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Component]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The uri to fetch the next page of asset. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - - class CryptoCertificate(_serialization.Model): # pylint: disable=too-many-instance-attributes """Crypto certificate properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar crypto_cert_id: ID for the certificate. + :ivar crypto_cert_id: ID for the certificate result. :vartype crypto_cert_id: str :ivar name: Name of the certificate. :vartype name: str @@ -341,22 +394,19 @@ class CryptoCertificate(_serialization.Model): # pylint: disable=too-many-insta :vartype fingerprint: str :ivar usage: List of functions the certificate can fulfill. :vartype usage: list[str] - :ivar file_paths: List of files paths for this certificate. + :ivar file_paths: List of files where this certificate was found. :vartype file_paths: list[str] :ivar paired_key: A matching paired private key. :vartype paired_key: ~azure.mgmt.iotfirmwaredefense.models.PairedKey - :ivar is_expired: Indicates if the certificate is expired. Known values are: "True" and - "False". - :vartype is_expired: str or ~azure.mgmt.iotfirmwaredefense.models.IsExpired - :ivar is_self_signed: Indicates if the certificate was self-signed. Known values are: "True" - and "False". - :vartype is_self_signed: str or ~azure.mgmt.iotfirmwaredefense.models.IsSelfSigned - :ivar is_weak_signature: Indicates the signature algorithm used is insecure. Known values are: - "True" and "False". - :vartype is_weak_signature: str or ~azure.mgmt.iotfirmwaredefense.models.IsWeakSignature + :ivar is_expired: Indicates if the certificate is expired. + :vartype is_expired: bool + :ivar is_self_signed: Indicates if the certificate is self-signed. + :vartype is_self_signed: bool + :ivar is_weak_signature: Indicates the signature algorithm used is insecure. + :vartype is_weak_signature: bool :ivar is_short_key_size: Indicates the certificate's key size is considered too small to be - secure for the key algorithm. Known values are: "True" and "False". - :vartype is_short_key_size: str or ~azure.mgmt.iotfirmwaredefense.models.IsShortKeySize + secure for the key algorithm. + :vartype is_short_key_size: bool """ _validation = { @@ -380,10 +430,10 @@ class CryptoCertificate(_serialization.Model): # pylint: disable=too-many-insta "usage": {"key": "usage", "type": "[str]"}, "file_paths": {"key": "filePaths", "type": "[str]"}, "paired_key": {"key": "pairedKey", "type": "PairedKey"}, - "is_expired": {"key": "isExpired", "type": "str"}, - "is_self_signed": {"key": "isSelfSigned", "type": "str"}, - "is_weak_signature": {"key": "isWeakSignature", "type": "str"}, - "is_short_key_size": {"key": "isShortKeySize", "type": "str"}, + "is_expired": {"key": "isExpired", "type": "bool"}, + "is_self_signed": {"key": "isSelfSigned", "type": "bool"}, + "is_weak_signature": {"key": "isWeakSignature", "type": "bool"}, + "is_short_key_size": {"key": "isShortKeySize", "type": "bool"}, } def __init__( @@ -404,14 +454,14 @@ def __init__( fingerprint: Optional[str] = None, usage: Optional[List[str]] = None, paired_key: Optional["_models.PairedKey"] = None, - is_expired: Optional[Union[str, "_models.IsExpired"]] = None, - is_self_signed: Optional[Union[str, "_models.IsSelfSigned"]] = None, - is_weak_signature: Optional[Union[str, "_models.IsWeakSignature"]] = None, - is_short_key_size: Optional[Union[str, "_models.IsShortKeySize"]] = None, + is_expired: Optional[bool] = None, + is_self_signed: Optional[bool] = None, + is_weak_signature: Optional[bool] = None, + is_short_key_size: Optional[bool] = None, **kwargs: Any ) -> None: """ - :keyword crypto_cert_id: ID for the certificate. + :keyword crypto_cert_id: ID for the certificate result. :paramtype crypto_cert_id: str :keyword name: Name of the certificate. :paramtype name: str @@ -441,18 +491,15 @@ def __init__( :paramtype usage: list[str] :keyword paired_key: A matching paired private key. :paramtype paired_key: ~azure.mgmt.iotfirmwaredefense.models.PairedKey - :keyword is_expired: Indicates if the certificate is expired. Known values are: "True" and - "False". - :paramtype is_expired: str or ~azure.mgmt.iotfirmwaredefense.models.IsExpired - :keyword is_self_signed: Indicates if the certificate was self-signed. Known values are: "True" - and "False". - :paramtype is_self_signed: str or ~azure.mgmt.iotfirmwaredefense.models.IsSelfSigned - :keyword is_weak_signature: Indicates the signature algorithm used is insecure. Known values - are: "True" and "False". - :paramtype is_weak_signature: str or ~azure.mgmt.iotfirmwaredefense.models.IsWeakSignature + :keyword is_expired: Indicates if the certificate is expired. + :paramtype is_expired: bool + :keyword is_self_signed: Indicates if the certificate is self-signed. + :paramtype is_self_signed: bool + :keyword is_weak_signature: Indicates the signature algorithm used is insecure. + :paramtype is_weak_signature: bool :keyword is_short_key_size: Indicates the certificate's key size is considered too small to be - secure for the key algorithm. Known values are: "True" and "False". - :paramtype is_short_key_size: str or ~azure.mgmt.iotfirmwaredefense.models.IsShortKeySize + secure for the key algorithm. + :paramtype is_short_key_size: bool """ super().__init__(**kwargs) self.crypto_cert_id = crypto_cert_id @@ -530,14 +577,14 @@ def __init__( self.country = country -class CryptoCertificateList(_serialization.Model): - """Crypto certificates list. +class CryptoCertificateListResult(_serialization.Model): + """List of crypto certificates. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Crypto certificates list. - :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.CryptoCertificate] - :ivar next_link: The uri to fetch the next page of asset. + :ivar value: The list of crypto certificate results. + :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.CryptoCertificateResource] + :ivar next_link: The uri to fetch the next page of resources. :vartype next_link: str """ @@ -546,13 +593,13 @@ class CryptoCertificateList(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[CryptoCertificate]"}, + "value": {"key": "value", "type": "[CryptoCertificateResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword next_link: The uri to fetch the next page of asset. + :keyword next_link: The uri to fetch the next page of resources. :paramtype next_link: str """ super().__init__(**kwargs) @@ -560,9 +607,58 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: self.next_link = next_link -class CryptoCertificateSummary(_serialization.Model): - """Cryptographic certificate summary values. +class CryptoCertificateResource(Resource): + """Crypto certificate resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + :ivar properties: The properties of a crypto certificate found within a firmware image. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.CryptoCertificate + """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "CryptoCertificate"}, + } + + def __init__(self, *, properties: Optional["_models.CryptoCertificate"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The properties of a crypto certificate found within a firmware image. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.CryptoCertificate + """ + super().__init__(**kwargs) + self.properties = properties + + +class CryptoCertificateSummaryResource(SummaryResourceProperties): + """Properties for cryptographic certificate summary. + + All required parameters must be populated in order to send to Azure. + + :ivar summary_type: Describes the type of summary. Required. Known values are: "Firmware", + "CVE", "BinaryHardening", "CryptoCertificate", and "CryptoKey". + :vartype summary_type: str or ~azure.mgmt.iotfirmwaredefense.models.SummaryType :ivar total_certificates: Total number of certificates found. :vartype total_certificates: int :ivar paired_keys: Total number of paired private keys found for the certificates. @@ -580,7 +676,12 @@ class CryptoCertificateSummary(_serialization.Model): :vartype short_key_size: int """ + _validation = { + "summary_type": {"required": True}, + } + _attribute_map = { + "summary_type": {"key": "summaryType", "type": "str"}, "total_certificates": {"key": "totalCertificates", "type": "int"}, "paired_keys": {"key": "pairedKeys", "type": "int"}, "expired": {"key": "expired", "type": "int"}, @@ -620,6 +721,7 @@ def __init__( :paramtype short_key_size: int """ super().__init__(**kwargs) + self.summary_type: str = "CryptoCertificate" self.total_certificates = total_certificates self.paired_keys = paired_keys self.expired = expired @@ -634,7 +736,7 @@ class CryptoKey(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar crypto_key_id: ID for the key. + :ivar crypto_key_id: ID for the key result. :vartype crypto_key_id: str :ivar key_type: Type of the key (public or private). :vartype key_type: str @@ -644,13 +746,13 @@ class CryptoKey(_serialization.Model): :vartype key_algorithm: str :ivar usage: Functions the key can fulfill. :vartype usage: list[str] - :ivar file_paths: List of files paths for this key. + :ivar file_paths: List of files where this key was found. :vartype file_paths: list[str] :ivar paired_key: A matching paired key or certificate. :vartype paired_key: ~azure.mgmt.iotfirmwaredefense.models.PairedKey :ivar is_short_key_size: Indicates the key size is considered too small to be secure for the - algorithm. Known values are: "True" and "False". - :vartype is_short_key_size: str or ~azure.mgmt.iotfirmwaredefense.models.IsShortKeySize + algorithm. + :vartype is_short_key_size: bool """ _validation = { @@ -665,7 +767,7 @@ class CryptoKey(_serialization.Model): "usage": {"key": "usage", "type": "[str]"}, "file_paths": {"key": "filePaths", "type": "[str]"}, "paired_key": {"key": "pairedKey", "type": "PairedKey"}, - "is_short_key_size": {"key": "isShortKeySize", "type": "str"}, + "is_short_key_size": {"key": "isShortKeySize", "type": "bool"}, } def __init__( @@ -677,11 +779,11 @@ def __init__( key_algorithm: Optional[str] = None, usage: Optional[List[str]] = None, paired_key: Optional["_models.PairedKey"] = None, - is_short_key_size: Optional[Union[str, "_models.IsShortKeySize"]] = None, + is_short_key_size: Optional[bool] = None, **kwargs: Any ) -> None: """ - :keyword crypto_key_id: ID for the key. + :keyword crypto_key_id: ID for the key result. :paramtype crypto_key_id: str :keyword key_type: Type of the key (public or private). :paramtype key_type: str @@ -694,8 +796,8 @@ def __init__( :keyword paired_key: A matching paired key or certificate. :paramtype paired_key: ~azure.mgmt.iotfirmwaredefense.models.PairedKey :keyword is_short_key_size: Indicates the key size is considered too small to be secure for the - algorithm. Known values are: "True" and "False". - :paramtype is_short_key_size: str or ~azure.mgmt.iotfirmwaredefense.models.IsShortKeySize + algorithm. + :paramtype is_short_key_size: bool """ super().__init__(**kwargs) self.crypto_key_id = crypto_key_id @@ -708,14 +810,14 @@ def __init__( self.is_short_key_size = is_short_key_size -class CryptoKeyList(_serialization.Model): - """Crypto keys list. +class CryptoKeyListResult(_serialization.Model): + """List of crypto keys. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Crypto keys list. - :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.CryptoKey] - :ivar next_link: The uri to fetch the next page of asset. + :ivar value: The list of crypto key results. + :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.CryptoKeyResource] + :ivar next_link: The uri to fetch the next page of resources. :vartype next_link: str """ @@ -724,13 +826,13 @@ class CryptoKeyList(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[CryptoKey]"}, + "value": {"key": "value", "type": "[CryptoKeyResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword next_link: The uri to fetch the next page of asset. + :keyword next_link: The uri to fetch the next page of resources. :paramtype next_link: str """ super().__init__(**kwargs) @@ -738,9 +840,58 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: self.next_link = next_link -class CryptoKeySummary(_serialization.Model): - """Cryptographic key summary values. +class CryptoKeyResource(Resource): + """Crypto key resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + :ivar properties: The properties of a crypto key found within a firmware image. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.CryptoKey + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "CryptoKey"}, + } + + def __init__(self, *, properties: Optional["_models.CryptoKey"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The properties of a crypto key found within a firmware image. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.CryptoKey + """ + super().__init__(**kwargs) + self.properties = properties + + +class CryptoKeySummaryResource(SummaryResourceProperties): + """Properties for cryptographic key summary. + All required parameters must be populated in order to send to Azure. + + :ivar summary_type: Describes the type of summary. Required. Known values are: "Firmware", + "CVE", "BinaryHardening", "CryptoCertificate", and "CryptoKey". + :vartype summary_type: str or ~azure.mgmt.iotfirmwaredefense.models.SummaryType :ivar total_keys: Total number of cryptographic keys found. :vartype total_keys: int :ivar public_keys: Total number of (non-certificate) public keys found. @@ -754,7 +905,12 @@ class CryptoKeySummary(_serialization.Model): :vartype short_key_size: int """ + _validation = { + "summary_type": {"required": True}, + } + _attribute_map = { + "summary_type": {"key": "summaryType", "type": "str"}, "total_keys": {"key": "totalKeys", "type": "int"}, "public_keys": {"key": "publicKeys", "type": "int"}, "private_keys": {"key": "privateKeys", "type": "int"}, @@ -787,42 +943,178 @@ def __init__( :paramtype short_key_size: int """ super().__init__(**kwargs) - self.total_keys = total_keys - self.public_keys = public_keys - self.private_keys = private_keys - self.paired_keys = paired_keys - self.short_key_size = short_key_size + self.summary_type: str = "CryptoKey" + self.total_keys = total_keys + self.public_keys = public_keys + self.private_keys = private_keys + self.paired_keys = paired_keys + self.short_key_size = short_key_size + + +class CveComponent(_serialization.Model): + """Properties of the SBOM component for a CVE. + + :ivar component_id: ID of the SBOM component. + :vartype component_id: str + :ivar name: Name of the SBOM component. + :vartype name: str + :ivar version: Version of the SBOM component. + :vartype version: str + """ + + _attribute_map = { + "component_id": {"key": "componentId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + component_id: Optional[str] = None, + name: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword component_id: ID of the SBOM component. + :paramtype component_id: str + :keyword name: Name of the SBOM component. + :paramtype name: str + :keyword version: Version of the SBOM component. + :paramtype version: str + """ + super().__init__(**kwargs) + self.component_id = component_id + self.name = name + self.version = version + + +class CveLink(_serialization.Model): + """Properties of a reference link for a CVE. + + :ivar href: The destination of the reference link. + :vartype href: str + :ivar label: The label of the reference link. + :vartype label: str + """ + + _attribute_map = { + "href": {"key": "href", "type": "str"}, + "label": {"key": "label", "type": "str"}, + } + + def __init__(self, *, href: Optional[str] = None, label: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword href: The destination of the reference link. + :paramtype href: str + :keyword label: The label of the reference link. + :paramtype label: str + """ + super().__init__(**kwargs) + self.href = href + self.label = label + + +class CveListResult(_serialization.Model): + """List of CVE results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of CVE results. + :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.CveResource] + :ivar next_link: The uri to fetch the next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[CveResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The uri to fetch the next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class CveResource(Resource): + """CVE analysis result resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + :ivar properties: The properties of a CVE result found within a firmware image. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.CveResult + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "CveResult"}, + } + + def __init__(self, *, properties: Optional["_models.CveResult"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The properties of a CVE result found within a firmware image. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.CveResult + """ + super().__init__(**kwargs) + self.properties = properties -class Cve(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Known CVEs of a firmware. +class CveResult(_serialization.Model): + """Details of a CVE detected in firmware. Variables are only populated by the server, and will be ignored when sending a request. - :ivar cve_id: ID of CVE. + :ivar cve_id: ID of the CVE result. :vartype cve_id: str - :ivar component: Component of CVE. - :vartype component: JSON - :ivar severity: Severity of CVE. + :ivar component: The SBOM component for the CVE. + :vartype component: ~azure.mgmt.iotfirmwaredefense.models.CveComponent + :ivar severity: Severity of the CVE. :vartype severity: str - :ivar name: Name of CVE. + :ivar name: Name of the CVE. :vartype name: str :ivar cvss_score: A single CVSS score to represent the CVE. If a V3 score is specified, then it will use the V3 score. Otherwise if the V2 score is specified it will be the V2 score. :vartype cvss_score: str - :ivar cvss_version: Cvss version of CVE. + :ivar cvss_version: CVSS version of the CVE. :vartype cvss_version: str - :ivar cvss_v2_score: Cvss V2 score of CVE. + :ivar cvss_v2_score: CVSS V2 score of the CVE. :vartype cvss_v2_score: str - :ivar cvss_v3_score: Cvss V3 score of CVE. + :ivar cvss_v3_score: CVSS V3 score of the CVE. :vartype cvss_v3_score: str - :ivar publish_date: Publish date of CVE. - :vartype publish_date: ~datetime.datetime - :ivar updated_date: Updated date of CVE. - :vartype updated_date: ~datetime.datetime - :ivar links: The list of CVE links. + :ivar links: The list of reference links for the CVE. :vartype links: list[~azure.mgmt.iotfirmwaredefense.models.CveLink] - :ivar description: Description of CVE. + :ivar description: The CVE description. :vartype description: str """ @@ -832,15 +1124,13 @@ class Cve(_serialization.Model): # pylint: disable=too-many-instance-attributes _attribute_map = { "cve_id": {"key": "cveId", "type": "str"}, - "component": {"key": "component", "type": "object"}, + "component": {"key": "component", "type": "CveComponent"}, "severity": {"key": "severity", "type": "str"}, "name": {"key": "name", "type": "str"}, "cvss_score": {"key": "cvssScore", "type": "str"}, "cvss_version": {"key": "cvssVersion", "type": "str"}, "cvss_v2_score": {"key": "cvssV2Score", "type": "str"}, "cvss_v3_score": {"key": "cvssV3Score", "type": "str"}, - "publish_date": {"key": "publishDate", "type": "iso-8601"}, - "updated_date": {"key": "updatedDate", "type": "iso-8601"}, "links": {"key": "links", "type": "[CveLink]"}, "description": {"key": "description", "type": "str"}, } @@ -849,41 +1139,35 @@ def __init__( self, *, cve_id: Optional[str] = None, - component: Optional[JSON] = None, + component: Optional["_models.CveComponent"] = None, severity: Optional[str] = None, name: Optional[str] = None, cvss_score: Optional[str] = None, cvss_version: Optional[str] = None, cvss_v2_score: Optional[str] = None, cvss_v3_score: Optional[str] = None, - publish_date: Optional[datetime.datetime] = None, - updated_date: Optional[datetime.datetime] = None, description: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword cve_id: ID of CVE. + :keyword cve_id: ID of the CVE result. :paramtype cve_id: str - :keyword component: Component of CVE. - :paramtype component: JSON - :keyword severity: Severity of CVE. + :keyword component: The SBOM component for the CVE. + :paramtype component: ~azure.mgmt.iotfirmwaredefense.models.CveComponent + :keyword severity: Severity of the CVE. :paramtype severity: str - :keyword name: Name of CVE. + :keyword name: Name of the CVE. :paramtype name: str :keyword cvss_score: A single CVSS score to represent the CVE. If a V3 score is specified, then it will use the V3 score. Otherwise if the V2 score is specified it will be the V2 score. :paramtype cvss_score: str - :keyword cvss_version: Cvss version of CVE. + :keyword cvss_version: CVSS version of the CVE. :paramtype cvss_version: str - :keyword cvss_v2_score: Cvss V2 score of CVE. + :keyword cvss_v2_score: CVSS V2 score of the CVE. :paramtype cvss_v2_score: str - :keyword cvss_v3_score: Cvss V3 score of CVE. + :keyword cvss_v3_score: CVSS V3 score of the CVE. :paramtype cvss_v3_score: str - :keyword publish_date: Publish date of CVE. - :paramtype publish_date: ~datetime.datetime - :keyword updated_date: Updated date of CVE. - :paramtype updated_date: ~datetime.datetime - :keyword description: Description of CVE. + :keyword description: The CVE description. :paramtype description: str """ super().__init__(**kwargs) @@ -895,110 +1179,18 @@ def __init__( self.cvss_version = cvss_version self.cvss_v2_score = cvss_v2_score self.cvss_v3_score = cvss_v3_score - self.publish_date = publish_date - self.updated_date = updated_date self.links = None self.description = description -class CveComponent(_serialization.Model): - """Component for CVE. - - :ivar component_id: ID of CVE component. - :vartype component_id: str - :ivar name: Name of CVE component. - :vartype name: str - :ivar version: Version of CVE component. - :vartype version: str - """ - - _attribute_map = { - "component_id": {"key": "componentId", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, - *, - component_id: Optional[str] = None, - name: Optional[str] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword component_id: ID of CVE component. - :paramtype component_id: str - :keyword name: Name of CVE component. - :paramtype name: str - :keyword version: Version of CVE component. - :paramtype version: str - """ - super().__init__(**kwargs) - self.component_id = component_id - self.name = name - self.version = version - - -class CveLink(_serialization.Model): - """Link for CVE. - - :ivar href: Href of CVE link. - :vartype href: str - :ivar label: Label of CVE link. - :vartype label: str - """ - - _attribute_map = { - "href": {"key": "href", "type": "str"}, - "label": {"key": "label", "type": "str"}, - } - - def __init__(self, *, href: Optional[str] = None, label: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword href: Href of CVE link. - :paramtype href: str - :keyword label: Label of CVE link. - :paramtype label: str - """ - super().__init__(**kwargs) - self.href = href - self.label = label - - -class CveList(_serialization.Model): - """List result for CVE. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of CVE results. - :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.Cve] - :ivar next_link: The uri to fetch the next page of asset. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Cve]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The uri to fetch the next page of asset. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - +class CveSummary(SummaryResourceProperties): + """Properties for a CVE analysis summary. -class CveSummary(_serialization.Model): - """CVE summary values. + All required parameters must be populated in order to send to Azure. + :ivar summary_type: Describes the type of summary. Required. Known values are: "Firmware", + "CVE", "BinaryHardening", "CryptoCertificate", and "CryptoKey". + :vartype summary_type: str or ~azure.mgmt.iotfirmwaredefense.models.SummaryType :ivar critical: The total number of critical severity CVEs detected. :vartype critical: int :ivar high: The total number of high severity CVEs detected. @@ -1009,17 +1201,19 @@ class CveSummary(_serialization.Model): :vartype low: int :ivar unknown: The total number of unknown severity CVEs detected. :vartype unknown: int - :ivar undefined: The total number of undefined severity CVEs detected. - :vartype undefined: int """ + _validation = { + "summary_type": {"required": True}, + } + _attribute_map = { + "summary_type": {"key": "summaryType", "type": "str"}, "critical": {"key": "critical", "type": "int"}, "high": {"key": "high", "type": "int"}, "medium": {"key": "medium", "type": "int"}, "low": {"key": "low", "type": "int"}, "unknown": {"key": "unknown", "type": "int"}, - "undefined": {"key": "undefined", "type": "int"}, } def __init__( @@ -1030,7 +1224,6 @@ def __init__( medium: Optional[int] = None, low: Optional[int] = None, unknown: Optional[int] = None, - undefined: Optional[int] = None, **kwargs: Any ) -> None: """ @@ -1044,16 +1237,14 @@ def __init__( :paramtype low: int :keyword unknown: The total number of unknown severity CVEs detected. :paramtype unknown: int - :keyword undefined: The total number of undefined severity CVEs detected. - :paramtype undefined: int """ super().__init__(**kwargs) + self.summary_type: str = "CVE" self.critical = critical self.high = high self.medium = medium self.low = low self.unknown = unknown - self.undefined = undefined class ErrorAdditionalInfo(_serialization.Model): @@ -1148,13 +1339,13 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class Firmware(Resource): + """Firmware definition. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1164,6 +1355,8 @@ class Resource(_serialization.Model): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + :ivar properties: The properties of a firmware. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.FirmwareProperties """ _validation = { @@ -1178,71 +1371,53 @@ class Resource(_serialization.Model): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "FirmwareProperties"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, properties: Optional["_models.FirmwareProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The properties of a firmware. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.FirmwareProperties + """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.properties = properties -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. +class FirmwareList(_serialization.Model): + """List of firmwares. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + :ivar value: The list of firmwares. + :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.Firmware] + :ivar next_link: The uri to fetch the next page of asset. + :vartype next_link: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "value": {"key": "value", "type": "[Firmware]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The uri to fetch the next page of asset. + :paramtype next_link: str + """ super().__init__(**kwargs) + self.value = None + self.next_link = next_link -class Firmware(ProxyResource): # pylint: disable=too-many-instance-attributes - """Firmware definition. +class FirmwareProperties(_serialization.Model): + """Firmware properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData :ivar file_name: File name for a firmware that user uploaded. :vartype file_name: str :ivar vendor: Firmware vendor. @@ -1259,34 +1434,26 @@ class Firmware(ProxyResource): # pylint: disable=too-many-instance-attributes "Analyzing", "Ready", and "Error". :vartype status: str or ~azure.mgmt.iotfirmwaredefense.models.Status :ivar status_messages: A list of errors or other messages generated during firmware analysis. - :vartype status_messages: list[JSON] + :vartype status_messages: list[~azure.mgmt.iotfirmwaredefense.models.StatusMessage] :ivar provisioning_state: Provisioning state of the resource. Known values are: "Accepted", "Succeeded", "Canceled", and "Failed". :vartype provisioning_state: str or ~azure.mgmt.iotfirmwaredefense.models.ProvisioningState """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "file_name": {"key": "properties.fileName", "type": "str"}, - "vendor": {"key": "properties.vendor", "type": "str"}, - "model": {"key": "properties.model", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "file_size": {"key": "properties.fileSize", "type": "int"}, - "status": {"key": "properties.status", "type": "str"}, - "status_messages": {"key": "properties.statusMessages", "type": "[object]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "file_name": {"key": "fileName", "type": "str"}, + "vendor": {"key": "vendor", "type": "str"}, + "model": {"key": "model", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "file_size": {"key": "fileSize", "type": "int"}, + "status": {"key": "status", "type": "str"}, + "status_messages": {"key": "statusMessages", "type": "[StatusMessage]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -1299,7 +1466,7 @@ def __init__( description: Optional[str] = None, file_size: Optional[int] = None, status: Union[str, "_models.Status"] = "Pending", - status_messages: Optional[List[JSON]] = None, + status_messages: Optional[List["_models.StatusMessage"]] = None, **kwargs: Any ) -> None: """ @@ -1320,7 +1487,7 @@ def __init__( :paramtype status: str or ~azure.mgmt.iotfirmwaredefense.models.Status :keyword status_messages: A list of errors or other messages generated during firmware analysis. - :paramtype status_messages: list[JSON] + :paramtype status_messages: list[~azure.mgmt.iotfirmwaredefense.models.StatusMessage] """ super().__init__(**kwargs) self.file_name = file_name @@ -1334,39 +1501,14 @@ def __init__( self.provisioning_state = None -class FirmwareList(_serialization.Model): - """List of firmwares. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of firmwares. - :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.Firmware] - :ivar next_link: The uri to fetch the next page of asset. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Firmware]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The uri to fetch the next page of asset. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - +class FirmwareSummary(SummaryResourceProperties): + """Properties for high level summary of firmware analysis results. -class FirmwareSummary(_serialization.Model): - """Summary result after scanning the firmware. + All required parameters must be populated in order to send to Azure. + :ivar summary_type: Describes the type of summary. Required. Known values are: "Firmware", + "CVE", "BinaryHardening", "CryptoCertificate", and "CryptoKey". + :vartype summary_type: str or ~azure.mgmt.iotfirmwaredefense.models.SummaryType :ivar extracted_size: Total extracted size of the firmware in bytes. :vartype extracted_size: int :ivar file_size: Firmware file size in bytes. @@ -1383,7 +1525,12 @@ class FirmwareSummary(_serialization.Model): :vartype root_file_systems: int """ + _validation = { + "summary_type": {"required": True}, + } + _attribute_map = { + "summary_type": {"key": "summaryType", "type": "str"}, "extracted_size": {"key": "extractedSize", "type": "int"}, "file_size": {"key": "fileSize", "type": "int"}, "extracted_file_count": {"key": "extractedFileCount", "type": "int"}, @@ -1422,101 +1569,34 @@ def __init__( :paramtype root_file_systems: int """ super().__init__(**kwargs) + self.summary_type: str = "Firmware" self.extracted_size = extracted_size self.file_size = file_size self.extracted_file_count = extracted_file_count - self.component_count = component_count - self.binary_count = binary_count - self.analysis_time_seconds = analysis_time_seconds - self.root_file_systems = root_file_systems - - -class FirmwareUpdateDefinition(_serialization.Model): - """Firmware definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar file_name: File name for a firmware that user uploaded. - :vartype file_name: str - :ivar vendor: Firmware vendor. - :vartype vendor: str - :ivar model: Firmware model. - :vartype model: str - :ivar version: Firmware version. - :vartype version: str - :ivar description: User-specified description of the firmware. - :vartype description: str - :ivar file_size: File size of the uploaded firmware image. - :vartype file_size: int - :ivar status: The status of firmware scan. Known values are: "Pending", "Extracting", - "Analyzing", "Ready", and "Error". - :vartype status: str or ~azure.mgmt.iotfirmwaredefense.models.Status - :ivar status_messages: A list of errors or other messages generated during firmware analysis. - :vartype status_messages: list[JSON] - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Accepted", - "Succeeded", "Canceled", and "Failed". - :vartype provisioning_state: str or ~azure.mgmt.iotfirmwaredefense.models.ProvisioningState - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "file_name": {"key": "properties.fileName", "type": "str"}, - "vendor": {"key": "properties.vendor", "type": "str"}, - "model": {"key": "properties.model", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "file_size": {"key": "properties.fileSize", "type": "int"}, - "status": {"key": "properties.status", "type": "str"}, - "status_messages": {"key": "properties.statusMessages", "type": "[object]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - file_name: Optional[str] = None, - vendor: Optional[str] = None, - model: Optional[str] = None, - version: Optional[str] = None, - description: Optional[str] = None, - file_size: Optional[int] = None, - status: Union[str, "_models.Status"] = "Pending", - status_messages: Optional[List[JSON]] = None, - **kwargs: Any - ) -> None: - """ - :keyword file_name: File name for a firmware that user uploaded. - :paramtype file_name: str - :keyword vendor: Firmware vendor. - :paramtype vendor: str - :keyword model: Firmware model. - :paramtype model: str - :keyword version: Firmware version. - :paramtype version: str - :keyword description: User-specified description of the firmware. - :paramtype description: str - :keyword file_size: File size of the uploaded firmware image. - :paramtype file_size: int - :keyword status: The status of firmware scan. Known values are: "Pending", "Extracting", - "Analyzing", "Ready", and "Error". - :paramtype status: str or ~azure.mgmt.iotfirmwaredefense.models.Status - :keyword status_messages: A list of errors or other messages generated during firmware - analysis. - :paramtype status_messages: list[JSON] + self.component_count = component_count + self.binary_count = binary_count + self.analysis_time_seconds = analysis_time_seconds + self.root_file_systems = root_file_systems + + +class FirmwareUpdateDefinition(_serialization.Model): + """Firmware definition. + + :ivar properties: The editable properties of a firmware. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.FirmwareProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "FirmwareProperties"}, + } + + def __init__(self, *, properties: Optional["_models.FirmwareProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The editable properties of a firmware. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.FirmwareProperties """ super().__init__(**kwargs) - self.file_name = file_name - self.vendor = vendor - self.model = model - self.version = version - self.description = description - self.file_size = file_size - self.status = status - self.status_messages = status_messages - self.provisioning_state = None + self.properties = properties class GenerateUploadUrlRequest(_serialization.Model): @@ -1667,14 +1747,11 @@ class PairedKey(_serialization.Model): :vartype id: str :ivar type: The type indicating whether the paired object is a key or certificate. :vartype type: str - :ivar additional_properties: Additional paired key properties. - :vartype additional_properties: JSON """ _attribute_map = { "id": {"key": "id", "type": "str"}, "type": {"key": "type", "type": "str"}, - "additional_properties": {"key": "additionalProperties", "type": "object"}, } def __init__( @@ -1682,7 +1759,6 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin type: Optional[str] = None, - additional_properties: Optional[JSON] = None, **kwargs: Any ) -> None: """ @@ -1690,13 +1766,10 @@ def __init__( :paramtype id: str :keyword type: The type indicating whether the paired object is a key or certificate. :paramtype type: str - :keyword additional_properties: Additional paired key properties. - :paramtype additional_properties: JSON """ super().__init__(**kwargs) self.id = id self.type = type - self.additional_properties = additional_properties class PasswordHash(_serialization.Model): @@ -1766,14 +1839,14 @@ def __init__( self.algorithm = algorithm -class PasswordHashList(_serialization.Model): - """Password hashes list. +class PasswordHashListResult(_serialization.Model): + """List of password hash results. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Password hashes list. - :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.PasswordHash] - :ivar next_link: The uri to fetch the next page of asset. + :ivar value: The list of password hash results. + :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.PasswordHashResource] + :ivar next_link: The uri to fetch the next page of resources. :vartype next_link: str """ @@ -1782,13 +1855,140 @@ class PasswordHashList(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[PasswordHash]"}, + "value": {"key": "value", "type": "[PasswordHashResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword next_link: The uri to fetch the next page of asset. + :keyword next_link: The uri to fetch the next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class PasswordHashResource(Resource): + """Password hash resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + :ivar properties: The properties of a password hash found within a firmware image. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.PasswordHash + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "PasswordHash"}, + } + + def __init__(self, *, properties: Optional["_models.PasswordHash"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The properties of a password hash found within a firmware image. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.PasswordHash + """ + super().__init__(**kwargs) + self.properties = properties + + +class SbomComponent(_serialization.Model): + """SBOM component of a firmware. + + :ivar component_id: ID for the component. + :vartype component_id: str + :ivar component_name: Name for the component. + :vartype component_name: str + :ivar version: Version for the component. + :vartype version: str + :ivar license: License for the component. + :vartype license: str + :ivar file_paths: File paths related to the component. + :vartype file_paths: list[str] + """ + + _attribute_map = { + "component_id": {"key": "componentId", "type": "str"}, + "component_name": {"key": "componentName", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "license": {"key": "license", "type": "str"}, + "file_paths": {"key": "filePaths", "type": "[str]"}, + } + + def __init__( + self, + *, + component_id: Optional[str] = None, + component_name: Optional[str] = None, + version: Optional[str] = None, + license: Optional[str] = None, + file_paths: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword component_id: ID for the component. + :paramtype component_id: str + :keyword component_name: Name for the component. + :paramtype component_name: str + :keyword version: Version for the component. + :paramtype version: str + :keyword license: License for the component. + :paramtype license: str + :keyword file_paths: File paths related to the component. + :paramtype file_paths: list[str] + """ + super().__init__(**kwargs) + self.component_id = component_id + self.component_name = component_name + self.version = version + self.license = license + self.file_paths = file_paths + + +class SbomComponentListResult(_serialization.Model): + """List of SBOM results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of SBOM components. + :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.SbomComponentResource] + :ivar next_link: The uri to fetch the next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SbomComponentResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The uri to fetch the next page of resources. :paramtype next_link: str """ super().__init__(**kwargs) @@ -1796,6 +1996,148 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: self.next_link = next_link +class SbomComponentResource(Resource): + """SBOM analysis result resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + :ivar properties: The properties of an SBOM component found within a firmware image. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.SbomComponent + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "SbomComponent"}, + } + + def __init__(self, *, properties: Optional["_models.SbomComponent"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The properties of an SBOM component found within a firmware image. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.SbomComponent + """ + super().__init__(**kwargs) + self.properties = properties + + +class StatusMessage(_serialization.Model): + """Error and status message. + + :ivar error_code: The error code. + :vartype error_code: int + :ivar message: The error or status message. + :vartype message: str + """ + + _attribute_map = { + "error_code": {"key": "errorCode", "type": "int"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, error_code: Optional[int] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword error_code: The error code. + :paramtype error_code: int + :keyword message: The error or status message. + :paramtype message: str + """ + super().__init__(**kwargs) + self.error_code = error_code + self.message = message + + +class SummaryListResult(_serialization.Model): + """List of analysis summaries. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of summaries. + :vartype value: list[~azure.mgmt.iotfirmwaredefense.models.SummaryResource] + :ivar next_link: The uri to fetch the next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SummaryResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The uri to fetch the next page of resources. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class SummaryResource(Resource): + """The object representing a firmware analysis summary resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.iotfirmwaredefense.models.SystemData + :ivar properties: Properties of an analysis summary. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.SummaryResourceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "SummaryResourceProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.properties = None + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -1868,8 +2210,8 @@ class TrackedResource(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1921,25 +2263,20 @@ class UrlToken(_serialization.Model): :ivar url: SAS URL for creating or accessing a blob file. :vartype url: str - :ivar upload_url: SAS URL for file uploading. Kept for backwards compatibility. - :vartype upload_url: str """ _validation = { "url": {"readonly": True}, - "upload_url": {"readonly": True}, } _attribute_map = { "url": {"key": "url", "type": "str"}, - "upload_url": {"key": "uploadUrl", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.url = None - self.upload_url = None class Workspace(TrackedResource): @@ -1949,8 +2286,8 @@ class Workspace(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1964,9 +2301,8 @@ class Workspace(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Accepted", - "Succeeded", "Canceled", and "Failed". - :vartype provisioning_state: str or ~azure.mgmt.iotfirmwaredefense.models.ProvisioningState + :ivar properties: Workspace properties. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.WorkspaceProperties """ _validation = { @@ -1975,7 +2311,6 @@ class Workspace(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1985,18 +2320,27 @@ class Workspace(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "WorkspaceProperties"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.WorkspaceProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword properties: Workspace properties. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.WorkspaceProperties """ super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = None + self.properties = properties class WorkspaceList(_serialization.Model): @@ -2029,8 +2373,8 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: self.next_link = next_link -class WorkspaceUpdateDefinition(_serialization.Model): - """Firmware analysis workspace. +class WorkspaceProperties(_serialization.Model): + """Workspace properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -2044,10 +2388,30 @@ class WorkspaceUpdateDefinition(_serialization.Model): } _attribute_map = { - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None + + +class WorkspaceUpdateDefinition(_serialization.Model): + """Firmware analysis workspace. + + :ivar properties: The editable workspace properties. + :vartype properties: ~azure.mgmt.iotfirmwaredefense.models.WorkspaceProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "WorkspaceProperties"}, + } + + def __init__(self, *, properties: Optional["_models.WorkspaceProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The editable workspace properties. + :paramtype properties: ~azure.mgmt.iotfirmwaredefense.models.WorkspaceProperties + """ + super().__init__(**kwargs) + self.properties = properties diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/__init__.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/__init__.py index eb7a48a55a81..7d414eee1f60 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/__init__.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/__init__.py @@ -6,18 +6,32 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._firmware_operations import FirmwareOperations -from ._workspaces_operations import WorkspacesOperations +from ._binary_hardening_operations import BinaryHardeningOperations +from ._crypto_certificates_operations import CryptoCertificatesOperations +from ._crypto_keys_operations import CryptoKeysOperations +from ._cves_operations import CvesOperations +from ._firmwares_operations import FirmwaresOperations from ._operations import Operations +from ._password_hashes_operations import PasswordHashesOperations +from ._sbom_components_operations import SbomComponentsOperations +from ._summaries_operations import SummariesOperations +from ._workspaces_operations import WorkspacesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "FirmwareOperations", - "WorkspacesOperations", + "BinaryHardeningOperations", + "CryptoCertificatesOperations", + "CryptoKeysOperations", + "CvesOperations", + "FirmwaresOperations", "Operations", + "PasswordHashesOperations", + "SbomComponentsOperations", + "SummariesOperations", + "WorkspacesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_binary_hardening_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_binary_hardening_operations.py new file mode 100644 index 000000000000..6cffd565db7e --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_binary_hardening_operations.py @@ -0,0 +1,189 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_firmware_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/binaryHardeningResults", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BinaryHardeningOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.IoTFirmwareDefenseMgmtClient`'s + :attr:`binary_hardening` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> Iterable["_models.BinaryHardeningResource"]: + """Lists binary hardening analysis results of a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BinaryHardeningResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.BinaryHardeningResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BinaryHardeningListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BinaryHardeningListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/binaryHardeningResults" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_crypto_certificates_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_crypto_certificates_operations.py new file mode 100644 index 000000000000..c5dbb04a900f --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_crypto_certificates_operations.py @@ -0,0 +1,189 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_firmware_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/cryptoCertificates", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CryptoCertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.IoTFirmwareDefenseMgmtClient`'s + :attr:`crypto_certificates` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> Iterable["_models.CryptoCertificateResource"]: + """Lists cryptographic certificate analysis results found in a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CryptoCertificateResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.CryptoCertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CryptoCertificateListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CryptoCertificateListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/cryptoCertificates" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_crypto_keys_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_crypto_keys_operations.py new file mode 100644 index 000000000000..83c9f301d574 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_crypto_keys_operations.py @@ -0,0 +1,187 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_firmware_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/cryptoKeys", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CryptoKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.IoTFirmwareDefenseMgmtClient`'s + :attr:`crypto_keys` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> Iterable["_models.CryptoKeyResource"]: + """Lists cryptographic key analysis results found in a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CryptoKeyResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.CryptoKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CryptoKeyListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CryptoKeyListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/cryptoKeys" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_cves_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_cves_operations.py new file mode 100644 index 000000000000..76260fbe1fdb --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_cves_operations.py @@ -0,0 +1,187 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_firmware_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/cves", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CvesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.IoTFirmwareDefenseMgmtClient`'s + :attr:`cves` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> Iterable["_models.CveResource"]: + """Lists CVE analysis results of a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CveResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.CveResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CveListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CveListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/cves" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_firmware_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_firmware_operations.py deleted file mode 100644 index 6dadcad4d563..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_firmware_operations.py +++ /dev/null @@ -1,2502 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_workspace_request( - resource_group_name: str, workspace_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_download_url_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateDownloadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_filesystem_download_url_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateFilesystemDownloadUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_summary_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateSummary", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_generate_component_list_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateComponentList", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_component_details_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateComponentDetails", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_generate_binary_hardening_list_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateBinaryHardeningList", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_binary_hardening_summary_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateBinaryHardeningSummary", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_binary_hardening_details_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateBinaryHardeningDetails", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_generate_password_hash_list_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generatePasswordHashList", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_generate_cve_list_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCveList", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_cve_summary_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCveSummary", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_crypto_certificate_summary_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoCertificateSummary", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_crypto_key_summary_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoKeySummary", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_generate_crypto_certificate_list_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoCertificateList", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_generate_crypto_key_list_request( - resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoKeyList", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "workspaceName": _SERIALIZER.url( - "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FirmwareOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.iotfirmwaredefense.IoTFirmwareDefenseMgmtClient`'s - :attr:`firmware` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_workspace( - self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Iterable["_models.Firmware"]: - """Lists all of firmwares inside a workspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Firmware or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.Firmware] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FirmwareList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_workspace_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_workspace.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FirmwareList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_workspace.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares" - } - - @overload - def create( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: _models.Firmware, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Firmware: - """The operation to create a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Required. - :type firmware: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Firmware: - """The operation to create a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Required. - :type firmware: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: Union[_models.Firmware, IO], - **kwargs: Any - ) -> _models.Firmware: - """The operation to create a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Is either a Firmware type or - a IO type. Required. - :type firmware: ~azure.mgmt.iotfirmwaredefense.models.Firmware or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(firmware, (IOBase, bytes)): - _content = firmware - else: - _json = self._serialize.body(firmware, "Firmware") - - request = build_create_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Firmware", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Firmware", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" - } - - @overload - def update( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: _models.FirmwareUpdateDefinition, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Firmware: - """The operation to update firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Required. - :type firmware: ~azure.mgmt.iotfirmwaredefense.models.FirmwareUpdateDefinition - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Firmware: - """The operation to update firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Required. - :type firmware: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - workspace_name: str, - firmware_id: str, - firmware: Union[_models.FirmwareUpdateDefinition, IO], - **kwargs: Any - ) -> _models.Firmware: - """The operation to update firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :param firmware: Details of the firmware being created or updated. Is either a - FirmwareUpdateDefinition type or a IO type. Required. - :type firmware: ~azure.mgmt.iotfirmwaredefense.models.FirmwareUpdateDefinition or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(firmware, (IOBase, bytes)): - _content = firmware - else: - _json = self._serialize.body(firmware, "FirmwareUpdateDefinition") - - request = build_update_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Firmware", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Firmware", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> None: - """The operation to delete a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" - } - - @distributed_trace - def get(self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any) -> _models.Firmware: - """Get firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Firmware or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Firmware", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" - } - - @distributed_trace - def generate_download_url( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.UrlToken: - """The operation to a url for file download. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UrlToken or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.UrlToken - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.UrlToken] = kwargs.pop("cls", None) - - request = build_generate_download_url_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_download_url.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UrlToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_download_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateDownloadUrl" - } - - @distributed_trace - def generate_filesystem_download_url( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.UrlToken: - """The operation to a url for tar file download. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UrlToken or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.UrlToken - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.UrlToken] = kwargs.pop("cls", None) - - request = build_generate_filesystem_download_url_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_filesystem_download_url.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UrlToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_filesystem_download_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateFilesystemDownloadUrl" - } - - @distributed_trace - def generate_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.FirmwareSummary: - """The operation to get a scan summary. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: FirmwareSummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.FirmwareSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FirmwareSummary] = kwargs.pop("cls", None) - - request = build_generate_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FirmwareSummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateSummary" - } - - @distributed_trace - def list_generate_component_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> Iterable["_models.Component"]: - """The operation to list all components result for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Component or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.Component] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_component_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_component_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ComponentList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_generate_component_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateComponentList" - } - - @distributed_trace - def generate_component_details( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.Component: - """The operation to get component details for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Component or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Component - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Component] = kwargs.pop("cls", None) - - request = build_generate_component_details_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_component_details.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Component", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_component_details.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateComponentDetails" - } - - @distributed_trace - def list_generate_binary_hardening_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> Iterable["_models.BinaryHardening"]: - """The operation to list all binary hardening result for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BinaryHardening or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.BinaryHardening] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BinaryHardeningList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_binary_hardening_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_binary_hardening_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BinaryHardeningList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_generate_binary_hardening_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateBinaryHardeningList" - } - - @distributed_trace - def generate_binary_hardening_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.BinaryHardeningSummary: - """The operation to list the binary hardening summary percentages for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BinaryHardeningSummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.BinaryHardeningSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BinaryHardeningSummary] = kwargs.pop("cls", None) - - request = build_generate_binary_hardening_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_binary_hardening_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BinaryHardeningSummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_binary_hardening_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateBinaryHardeningSummary" - } - - @distributed_trace - def generate_binary_hardening_details( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.BinaryHardening: - """The operation to get binary hardening details for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BinaryHardening or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.BinaryHardening - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BinaryHardening] = kwargs.pop("cls", None) - - request = build_generate_binary_hardening_details_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_binary_hardening_details.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BinaryHardening", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_binary_hardening_details.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateBinaryHardeningDetails" - } - - @distributed_trace - def list_generate_password_hash_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> Iterable["_models.PasswordHash"]: - """The operation to list all password hashes for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PasswordHash or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.PasswordHash] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PasswordHashList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_password_hash_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_password_hash_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PasswordHashList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_generate_password_hash_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generatePasswordHashList" - } - - @distributed_trace - def list_generate_cve_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> Iterable["_models.Cve"]: - """The operation to list all cve results for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Cve or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.Cve] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CveList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_cve_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_cve_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CveList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_generate_cve_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCveList" - } - - @distributed_trace - def generate_cve_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.CveSummary: - """The operation to provide a high level summary of the CVEs reported for the firmware image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CveSummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.CveSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CveSummary] = kwargs.pop("cls", None) - - request = build_generate_cve_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_cve_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CveSummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_cve_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCveSummary" - } - - @distributed_trace - def generate_crypto_certificate_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.CryptoCertificateSummary: - """The operation to provide a high level summary of the discovered cryptographic certificates - reported for the firmware image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CryptoCertificateSummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.CryptoCertificateSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CryptoCertificateSummary] = kwargs.pop("cls", None) - - request = build_generate_crypto_certificate_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_crypto_certificate_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CryptoCertificateSummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_crypto_certificate_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoCertificateSummary" - } - - @distributed_trace - def generate_crypto_key_summary( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> _models.CryptoKeySummary: - """The operation to provide a high level summary of the discovered cryptographic keys reported for - the firmware image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CryptoKeySummary or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.CryptoKeySummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CryptoKeySummary] = kwargs.pop("cls", None) - - request = build_generate_crypto_key_summary_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.generate_crypto_key_summary.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CryptoKeySummary", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_crypto_key_summary.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoKeySummary" - } - - @distributed_trace - def list_generate_crypto_certificate_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> Iterable["_models.CryptoCertificate"]: - """The operation to list all crypto certificates for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CryptoCertificate or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.CryptoCertificate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CryptoCertificateList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_crypto_certificate_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_crypto_certificate_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CryptoCertificateList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_generate_crypto_certificate_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoCertificateList" - } - - @distributed_trace - def list_generate_crypto_key_list( - self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any - ) -> Iterable["_models.CryptoKey"]: - """The operation to list all crypto keys for a firmware. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param workspace_name: The name of the firmware analysis workspace. Required. - :type workspace_name: str - :param firmware_id: The id of the firmware. Required. - :type firmware_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CryptoKey or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.CryptoKey] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CryptoKeyList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_generate_crypto_key_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - firmware_id=firmware_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_generate_crypto_key_list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CryptoKeyList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_generate_crypto_key_list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateCryptoKeyList" - } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_firmwares_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_firmwares_operations.py new file mode 100644 index 000000000000..1378b23719d0 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_firmwares_operations.py @@ -0,0 +1,982 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_workspace_request( + resource_group_name: str, workspace_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-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_generate_download_url_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateDownloadUrl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_generate_filesystem_download_url_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateFilesystemDownloadUrl", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class FirmwaresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.IoTFirmwareDefenseMgmtClient`'s + :attr:`firmwares` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_workspace( + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> Iterable["_models.Firmware"]: + """Lists all of firmwares inside a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Firmware or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.Firmware] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FirmwareList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_workspace.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FirmwareList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_workspace.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares" + } + + @overload + def create( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: _models.Firmware, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Firmware: + """The operation to create a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Required. + :type firmware: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Firmware: + """The operation to create a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Required. + :type firmware: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: Union[_models.Firmware, IO], + **kwargs: Any + ) -> _models.Firmware: + """The operation to create a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Is either a Firmware type or + a IO type. Required. + :type firmware: ~azure.mgmt.iotfirmwaredefense.models.Firmware or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(firmware, (IOBase, bytes)): + _content = firmware + else: + _json = self._serialize.body(firmware, "Firmware") + + request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Firmware", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Firmware", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" + } + + @overload + def update( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: _models.FirmwareUpdateDefinition, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Firmware: + """The operation to update firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Required. + :type firmware: ~azure.mgmt.iotfirmwaredefense.models.FirmwareUpdateDefinition + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Firmware: + """The operation to update firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Required. + :type firmware: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + firmware: Union[_models.FirmwareUpdateDefinition, IO], + **kwargs: Any + ) -> _models.Firmware: + """The operation to update firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param firmware: Details of the firmware being created or updated. Is either a + FirmwareUpdateDefinition type or a IO type. Required. + :type firmware: ~azure.mgmt.iotfirmwaredefense.models.FirmwareUpdateDefinition or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(firmware, (IOBase, bytes)): + _content = firmware + else: + _json = self._serialize.body(firmware, "FirmwareUpdateDefinition") + + request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Firmware", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> None: + """The operation to delete a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" + } + + @distributed_trace + def get(self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any) -> _models.Firmware: + """Get firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Firmware or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Firmware + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Firmware] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Firmware", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}" + } + + @distributed_trace + def generate_download_url( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> _models.UrlToken: + """The operation to a url for file download. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UrlToken or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.UrlToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UrlToken] = kwargs.pop("cls", None) + + request = build_generate_download_url_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.generate_download_url.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UrlToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateDownloadUrl" + } + + @distributed_trace + def generate_filesystem_download_url( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> _models.UrlToken: + """The operation to a url for tar file download. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UrlToken or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.UrlToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UrlToken] = kwargs.pop("cls", None) + + request = build_generate_filesystem_download_url_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.generate_filesystem_download_url.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("UrlToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_filesystem_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/generateFilesystemDownloadUrl" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_operations.py index 5dead38ff877..41ecb600e6f6 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_operations.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_operations.py @@ -40,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_password_hashes_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_password_hashes_operations.py new file mode 100644 index 000000000000..681e266f0d84 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_password_hashes_operations.py @@ -0,0 +1,189 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_firmware_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/passwordHashes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class PasswordHashesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.IoTFirmwareDefenseMgmtClient`'s + :attr:`password_hashes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> Iterable["_models.PasswordHashResource"]: + """Lists password hash analysis results of a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PasswordHashResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.PasswordHashResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PasswordHashListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PasswordHashListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/passwordHashes" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_sbom_components_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_sbom_components_operations.py new file mode 100644 index 000000000000..b4033f27eaa3 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_sbom_components_operations.py @@ -0,0 +1,189 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_firmware_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/sbomComponents", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SbomComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.IoTFirmwareDefenseMgmtClient`'s + :attr:`sbom_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> Iterable["_models.SbomComponentResource"]: + """Lists SBOM analysis results of a firmware. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SbomComponentResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.SbomComponentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SbomComponentListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SbomComponentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/sbomComponents" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_summaries_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_summaries_operations.py new file mode 100644 index 000000000000..7d28c82bbcd9 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_summaries_operations.py @@ -0,0 +1,308 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_firmware_request( + resource_group_name: str, workspace_name: str, firmware_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/summaries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + workspace_name: str, + firmware_id: str, + summary_name: Union[str, _models.SummaryName], + 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-01-10")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/summaries/{summaryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "firmwareId": _SERIALIZER.url("firmware_id", firmware_id, "str"), + "summaryName": _SERIALIZER.url("summary_name", summary_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SummariesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.iotfirmwaredefense.IoTFirmwareDefenseMgmtClient`'s + :attr:`summaries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_firmware( + self, resource_group_name: str, workspace_name: str, firmware_id: str, **kwargs: Any + ) -> Iterable["_models.SummaryResource"]: + """Lists analysis result summary names of a firmware. To fetch the full summary data, get that + summary by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SummaryResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iotfirmwaredefense.models.SummaryResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SummaryListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_firmware_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_firmware.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SummaryListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_firmware.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/summaries" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + workspace_name: str, + firmware_id: str, + summary_name: Union[str, _models.SummaryName], + **kwargs: Any + ) -> _models.SummaryResource: + """Get an analysis result summary of a firmware by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the firmware analysis workspace. Required. + :type workspace_name: str + :param firmware_id: The id of the firmware. Required. + :type firmware_id: str + :param summary_name: The Firmware analysis summary name describing the type of summary. Known + values are: "Firmware", "CVE", "BinaryHardening", "CryptoCertificate", and "CryptoKey". + Required. + :type summary_name: str or ~azure.mgmt.iotfirmwaredefense.models.SummaryName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SummaryResource or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.SummaryResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SummaryResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + firmware_id=firmware_id, + summary_name=summary_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SummaryResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareId}/summaries/{summaryName}" + } diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_workspaces_operations.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_workspaces_operations.py index 2c35fd152374..0907da1439ef 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_workspaces_operations.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/azure/mgmt/iotfirmwaredefense/operations/_workspaces_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +41,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,10 +49,10 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.IoTFirmwareDefense/workspaces" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,13 +76,13 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,7 +99,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -109,7 +109,7 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -118,7 +118,7 @@ def build_create_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +137,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +147,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -156,7 +156,7 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +175,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +184,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -193,7 +193,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,7 +210,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -219,7 +219,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -228,7 +228,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,7 +245,7 @@ def build_generate_upload_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-08-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-10")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -255,7 +255,7 @@ def build_generate_upload_url_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/generateUploadUrl", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -264,7 +264,7 @@ def build_generate_upload_url_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -736,21 +736,17 @@ def update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Workspace", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}" @@ -818,7 +814,7 @@ def delete( # pylint: disable=inconsistent-return-statements } @distributed_trace - def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> Optional[_models.Workspace]: + def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: """Get firmware analysis workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -827,8 +823,8 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> O :param workspace_name: The name of the firmware analysis workspace. Required. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Workspace or None or the result of cls(response) - :rtype: ~azure.mgmt.iotfirmwaredefense.models.Workspace or None + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.iotfirmwaredefense.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -843,7 +839,7 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> O _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.Workspace]] = kwargs.pop("cls", None) + cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -864,14 +860,12 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> O response = pipeline_response.http_response - if response.status_code not in [200, 304]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_key_list_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/binary_hardening_list_by_firmware_maximum_set_gen.py similarity index 79% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_key_list_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/binary_hardening_list_by_firmware_maximum_set_gen.py index fb38abc49374..2117c09ad3aa 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_key_list_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/binary_hardening_list_by_firmware_maximum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_list_generate_crypto_key_list_maximum_set_gen.py + python binary_hardening_list_by_firmware_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,18 +26,18 @@ def main(): client = IoTFirmwareDefenseMgmtClient( credential=DefaultAzureCredential(), - subscription_id="C589E84A-5C11-4A25-9CF9-4E9C2F1EBFCA", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.firmware.list_generate_crypto_key_list( + response = client.binary_hardening.list_by_firmware( resource_group_name="FirmwareAnalysisRG", workspace_name="default", - firmware_id="DECAFBAD-0000-0000-0000-BADBADBADBAD", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", ) for item in response: print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateCryptoKeyList_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/BinaryHardening_ListByFirmware_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_certificate_list_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/binary_hardening_list_by_firmware_minimum_set_gen.py similarity index 78% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_certificate_list_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/binary_hardening_list_by_firmware_minimum_set_gen.py index 3bdc5b07e60c..a884bbae3228 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_certificate_list_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/binary_hardening_list_by_firmware_minimum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_list_generate_crypto_certificate_list_maximum_set_gen.py + python binary_hardening_list_by_firmware_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,18 +26,18 @@ def main(): client = IoTFirmwareDefenseMgmtClient( credential=DefaultAzureCredential(), - subscription_id="C589E84A-5C11-4A25-9CF9-4E9C2F1EBFCA", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.firmware.list_generate_crypto_certificate_list( + response = client.binary_hardening.list_by_firmware( resource_group_name="FirmwareAnalysisRG", workspace_name="default", - firmware_id="DECAFBAD-0000-0000-0000-BADBADBADBAD", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", ) for item in response: print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateCryptoCertificateList_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/BinaryHardening_ListByFirmware_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_certificates_list_by_firmware_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_certificates_list_by_firmware_maximum_set_gen.py new file mode 100644 index 000000000000..b6177b866df5 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_certificates_list_by_firmware_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python crypto_certificates_list_by_firmware_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.crypto_certificates.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/CryptoCertificates_ListByFirmware_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_certificates_list_by_firmware_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_certificates_list_by_firmware_minimum_set_gen.py new file mode 100644 index 000000000000..3abec7d42aba --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_certificates_list_by_firmware_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python crypto_certificates_list_by_firmware_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.crypto_certificates.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/CryptoCertificates_ListByFirmware_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_keys_list_by_firmware_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_keys_list_by_firmware_maximum_set_gen.py new file mode 100644 index 000000000000..2f24a170f207 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_keys_list_by_firmware_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python crypto_keys_list_by_firmware_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.crypto_keys.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/CryptoKeys_ListByFirmware_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_keys_list_by_firmware_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_keys_list_by_firmware_minimum_set_gen.py new file mode 100644 index 000000000000..753c4c120666 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/crypto_keys_list_by_firmware_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python crypto_keys_list_by_firmware_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.crypto_keys.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/CryptoKeys_ListByFirmware_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/cves_list_by_firmware_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/cves_list_by_firmware_maximum_set_gen.py new file mode 100644 index 000000000000..77149589a0af --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/cves_list_by_firmware_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python cves_list_by_firmware_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cves.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Cves_ListByFirmware_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/cves_list_by_firmware_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/cves_list_by_firmware_minimum_set_gen.py new file mode 100644 index 000000000000..b4847589fe9c --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/cves_list_by_firmware_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python cves_list_by_firmware_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cves.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Cves_ListByFirmware_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_details_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_details_minimum_set_gen.py deleted file mode 100644 index 55487a7b5411..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_details_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_binary_hardening_details_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_binary_hardening_details( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateBinaryHardeningDetails_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_summary_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_summary_minimum_set_gen.py deleted file mode 100644 index 923947b770ca..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_summary_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_binary_hardening_summary_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_binary_hardening_summary( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateBinaryHardeningSummary_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_component_details_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_component_details_maximum_set_gen.py deleted file mode 100644 index 4f1050c368b4..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_component_details_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_component_details_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_component_details( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateComponentDetails_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_component_details_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_component_details_minimum_set_gen.py deleted file mode 100644 index ef1efdf864c6..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_component_details_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_component_details_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_component_details( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateComponentDetails_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_certificate_summary_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_certificate_summary_minimum_set_gen.py deleted file mode 100644 index 7ff911175be3..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_certificate_summary_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_crypto_certificate_summary_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="C589E84A-5C11-4A25-9CF9-4E9C2F1EBFCA", - ) - - response = client.firmware.generate_crypto_certificate_summary( - resource_group_name="rgworkspaces-firmwares", - workspace_name="j5QE_", - firmware_id="wujtpcgypfpqseyrsebolarkspy", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateCryptoCertificateSummary_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_key_summary_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_key_summary_minimum_set_gen.py deleted file mode 100644 index 933d596a2aca..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_key_summary_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_crypto_key_summary_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="C589E84A-5C11-4A25-9CF9-4E9C2F1EBFCA", - ) - - response = client.firmware.generate_crypto_key_summary( - resource_group_name="rgworkspaces-firmwares", - workspace_name="j5QE_", - firmware_id="wujtpcgypfpqseyrsebolarkspy", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateCryptoKeySummary_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_cve_summary_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_cve_summary_maximum_set_gen.py deleted file mode 100644 index ac73bfbbdc55..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_cve_summary_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_cve_summary_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_cve_summary( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateCveSummary_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_cve_summary_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_cve_summary_minimum_set_gen.py deleted file mode 100644 index 4654fa21c54e..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_cve_summary_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_cve_summary_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_cve_summary( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateCveSummary_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_download_url_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_download_url_maximum_set_gen.py deleted file mode 100644 index 5431a96240da..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_download_url_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_download_url_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_download_url( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateDownloadUrl_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_download_url_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_download_url_minimum_set_gen.py deleted file mode 100644 index e06316658df0..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_download_url_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_download_url_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_download_url( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateDownloadUrl_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_filesystem_download_url_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_filesystem_download_url_maximum_set_gen.py deleted file mode 100644 index f7cd0bd0ee8a..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_filesystem_download_url_maximum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_filesystem_download_url_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_filesystem_download_url( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateFilesystemDownloadUrl_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_filesystem_download_url_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_filesystem_download_url_minimum_set_gen.py deleted file mode 100644 index 7eadc34cf3f9..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_filesystem_download_url_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_generate_filesystem_download_url_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.generate_filesystem_download_url( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - print(response) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateFilesystemDownloadUrl_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_binary_hardening_list_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_binary_hardening_list_maximum_set_gen.py deleted file mode 100644 index 72a8029b2d22..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_binary_hardening_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_binary_hardening_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.list_generate_binary_hardening_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateBinaryHardeningList_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_binary_hardening_list_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_binary_hardening_list_minimum_set_gen.py deleted file mode 100644 index f7f3d2c271b0..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_binary_hardening_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_binary_hardening_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.list_generate_binary_hardening_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateBinaryHardeningList_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_component_list_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_component_list_maximum_set_gen.py deleted file mode 100644 index ee2e9729a1c6..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_component_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_component_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.list_generate_component_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateComponentList_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_component_list_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_component_list_minimum_set_gen.py deleted file mode 100644 index 2039346cd84d..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_component_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_component_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.list_generate_component_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateComponentList_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_certificate_list_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_certificate_list_minimum_set_gen.py deleted file mode 100644 index 05e3fb2685aa..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_certificate_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_crypto_certificate_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="C589E84A-5C11-4A25-9CF9-4E9C2F1EBFCA", - ) - - response = client.firmware.list_generate_crypto_certificate_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="j5QE_", - firmware_id="wujtpcgypfpqseyrsebolarkspy", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateCryptoCertificateList_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_key_list_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_key_list_minimum_set_gen.py deleted file mode 100644 index 4c284824de5e..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_crypto_key_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_crypto_key_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="C589E84A-5C11-4A25-9CF9-4E9C2F1EBFCA", - ) - - response = client.firmware.list_generate_crypto_key_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="j5QE_", - firmware_id="wujtpcgypfpqseyrsebolarkspy", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateCryptoKeyList_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_cve_list_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_cve_list_maximum_set_gen.py deleted file mode 100644 index fc1dd5e400f4..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_cve_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_cve_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.list_generate_cve_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateCveList_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_cve_list_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_cve_list_minimum_set_gen.py deleted file mode 100644 index e473c26a896d..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_cve_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_cve_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.list_generate_cve_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGenerateCveList_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_password_hash_list_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_password_hash_list_maximum_set_gen.py deleted file mode 100644 index 76a5f273c972..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_password_hash_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_password_hash_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.list_generate_password_hash_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGeneratePasswordHashList_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_password_hash_list_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_password_hash_list_minimum_set_gen.py deleted file mode 100644 index d9caed6fdffc..000000000000 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_generate_password_hash_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-iotfirmwaredefense -# USAGE - python firmware_list_generate_password_hash_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = IoTFirmwareDefenseMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", - ) - - response = client.firmware.list_generate_password_hash_list( - resource_group_name="rgworkspaces-firmwares", - workspace_name="A7", - firmware_id="umrkdttp", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListGeneratePasswordHashList_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_update_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_create_maximum_set_gen.py similarity index 91% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_update_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_create_maximum_set_gen.py index 085af3079b27..d094cfa83780 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_update_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_create_maximum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_update_maximum_set_gen.py + python firmwares_create_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.update( + response = client.firmwares.create( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_Create_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_delete_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_delete_maximum_set_gen.py similarity index 89% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_delete_minimum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_delete_maximum_set_gen.py index 17ecdb8bce80..ab89e6c335bf 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_delete_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_delete_maximum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_delete_minimum_set_gen.py + python firmwares_delete_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,13 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - client.firmware.delete( + client.firmwares.delete( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", ) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_delete_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_delete_minimum_set_gen.py similarity index 89% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_delete_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_delete_minimum_set_gen.py index 37ea49f0f5f9..509f0628fbfe 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_delete_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_delete_minimum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_delete_maximum_set_gen.py + python firmwares_delete_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,13 +29,13 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - client.firmware.delete( + client.firmwares.delete( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", ) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_summary_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_download_url_maximum_set_gen.py similarity index 87% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_summary_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_download_url_maximum_set_gen.py index 98b5d0d866a9..5ce73cb9057f 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_summary_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_download_url_maximum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_generate_summary_maximum_set_gen.py + python firmwares_generate_download_url_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.generate_summary( + response = client.firmwares.generate_download_url( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateSummary_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_GenerateDownloadUrl_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_summary_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_download_url_minimum_set_gen.py similarity index 87% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_summary_minimum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_download_url_minimum_set_gen.py index fd95f995b7ca..7adf972d7eac 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_summary_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_download_url_minimum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_generate_summary_minimum_set_gen.py + python firmwares_generate_download_url_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.generate_summary( + response = client.firmwares.generate_download_url( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateSummary_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_GenerateDownloadUrl_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_summary_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_filesystem_download_url_maximum_set_gen.py similarity index 85% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_summary_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_filesystem_download_url_maximum_set_gen.py index 8047774d9ea4..45c5c11e595f 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_summary_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_filesystem_download_url_maximum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_generate_binary_hardening_summary_maximum_set_gen.py + python firmwares_generate_filesystem_download_url_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.generate_binary_hardening_summary( + response = client.firmwares.generate_filesystem_download_url( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateBinaryHardeningSummary_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_GenerateFilesystemDownloadUrl_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_details_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_filesystem_download_url_minimum_set_gen.py similarity index 85% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_details_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_filesystem_download_url_minimum_set_gen.py index 65d664bb8b56..bd9bf8ac3849 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_binary_hardening_details_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_generate_filesystem_download_url_minimum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_generate_binary_hardening_details_maximum_set_gen.py + python firmwares_generate_filesystem_download_url_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.generate_binary_hardening_details( + response = client.firmwares.generate_filesystem_download_url( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateBinaryHardeningDetails_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_GenerateFilesystemDownloadUrl_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_get_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_get_maximum_set_gen.py similarity index 89% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_get_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_get_maximum_set_gen.py index a83858cf61d8..813c97b8b969 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_get_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_get_maximum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_get_maximum_set_gen.py + python firmwares_get_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.get( + response = client.firmwares.get( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_get_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_get_minimum_set_gen.py similarity index 89% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_get_minimum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_get_minimum_set_gen.py index aa7c7295e11e..2db99361502c 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_get_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_get_minimum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_get_minimum_set_gen.py + python firmwares_get_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.get( + response = client.firmwares.get( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_by_workspace_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_list_by_workspace_maximum_set_gen.py similarity index 87% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_by_workspace_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_list_by_workspace_maximum_set_gen.py index fe59be4d9182..b3e2ee6370a7 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_by_workspace_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_list_by_workspace_maximum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_list_by_workspace_maximum_set_gen.py + python firmwares_list_by_workspace_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.list_by_workspace( + response = client.firmwares.list_by_workspace( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListByWorkspace_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_ListByWorkspace_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_by_workspace_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_list_by_workspace_minimum_set_gen.py similarity index 87% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_by_workspace_minimum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_list_by_workspace_minimum_set_gen.py index bbb8274606c2..d2471c3cee41 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_list_by_workspace_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_list_by_workspace_minimum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_list_by_workspace_minimum_set_gen.py + python firmwares_list_by_workspace_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.list_by_workspace( + response = client.firmwares.list_by_workspace( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_ListByWorkspace_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_ListByWorkspace_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_create_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_update_maximum_set_gen.py similarity index 91% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_create_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_update_maximum_set_gen.py index 8c0aa58f4ab3..a2c2464681c1 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_create_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmwares_update_maximum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_create_maximum_set_gen.py + python firmwares_update_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,7 +29,7 @@ def main(): subscription_id="685C0C6F-9867-4B1C-A534-AA3A05B54BCE", ) - response = client.firmware.create( + response = client.firmwares.update( resource_group_name="rgworkspaces-firmwares", workspace_name="A7", firmware_id="umrkdttp", @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_Create_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Firmwares_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/operations_list_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/operations_list_maximum_set_gen.py index 8c2454d67049..cdc4e90f7931 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/operations_list_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/operations_list_maximum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Operations_List_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Operations_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/operations_list_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/operations_list_minimum_set_gen.py index b968e220c29e..01fd1d4fb5d2 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/operations_list_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/operations_list_minimum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Operations_List_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Operations_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/password_hashes_list_by_firmware_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/password_hashes_list_by_firmware_maximum_set_gen.py new file mode 100644 index 000000000000..d9f0cf17c395 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/password_hashes_list_by_firmware_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python password_hashes_list_by_firmware_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.password_hashes.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/PasswordHashes_ListByFirmware_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/password_hashes_list_by_firmware_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/password_hashes_list_by_firmware_minimum_set_gen.py new file mode 100644 index 000000000000..3f3960e10974 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/password_hashes_list_by_firmware_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python password_hashes_list_by_firmware_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.password_hashes.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/PasswordHashes_ListByFirmware_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/sbom_components_list_by_firmware_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/sbom_components_list_by_firmware_maximum_set_gen.py new file mode 100644 index 000000000000..bc8e14f0d0b5 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/sbom_components_list_by_firmware_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python sbom_components_list_by_firmware_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.sbom_components.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/SbomComponents_ListByFirmware_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/sbom_components_list_by_firmware_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/sbom_components_list_by_firmware_minimum_set_gen.py new file mode 100644 index 000000000000..c981f58b56c6 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/sbom_components_list_by_firmware_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python sbom_components_list_by_firmware_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.sbom_components.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/SbomComponents_ListByFirmware_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_key_summary_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_get_maximum_set_gen.py similarity index 79% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_key_summary_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_get_maximum_set_gen.py index 3208b369c61d..30427962f5ed 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_key_summary_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_get_maximum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_generate_crypto_key_summary_maximum_set_gen.py + python summaries_get_maximum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,18 @@ def main(): client = IoTFirmwareDefenseMgmtClient( credential=DefaultAzureCredential(), - subscription_id="C589E84A-5C11-4A25-9CF9-4E9C2F1EBFCA", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.firmware.generate_crypto_key_summary( + response = client.summaries.get( resource_group_name="FirmwareAnalysisRG", workspace_name="default", - firmware_id="DECAFBAD-0000-0000-0000-BADBADBADBAD", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + summary_name="Firmware", ) print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateCryptoKeySummary_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Summaries_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_certificate_summary_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_get_minimum_set_gen.py similarity index 78% rename from sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_certificate_summary_maximum_set_gen.py rename to sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_get_minimum_set_gen.py index 8332957ec8b6..b5783041dd35 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/firmware_generate_crypto_certificate_summary_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_get_minimum_set_gen.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-iotfirmwaredefense # USAGE - python firmware_generate_crypto_certificate_summary_maximum_set_gen.py + python summaries_get_minimum_set_gen.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,18 @@ def main(): client = IoTFirmwareDefenseMgmtClient( credential=DefaultAzureCredential(), - subscription_id="C589E84A-5C11-4A25-9CF9-4E9C2F1EBFCA", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.firmware.generate_crypto_certificate_summary( + response = client.summaries.get( resource_group_name="FirmwareAnalysisRG", workspace_name="default", - firmware_id="DECAFBAD-0000-0000-0000-BADBADBADBAD", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + summary_name="Firmware", ) print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Firmware_GenerateCryptoCertificateSummary_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Summaries_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_list_by_firmware_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_list_by_firmware_maximum_set_gen.py new file mode 100644 index 000000000000..17c4191667da --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_list_by_firmware_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python summaries_list_by_firmware_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.summaries.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Summaries_ListByFirmware_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_list_by_firmware_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_list_by_firmware_minimum_set_gen.py new file mode 100644 index 000000000000..e32d89ea722a --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/summaries_list_by_firmware_minimum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.iotfirmwaredefense import IoTFirmwareDefenseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-iotfirmwaredefense +# USAGE + python summaries_list_by_firmware_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = IoTFirmwareDefenseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.summaries.list_by_firmware( + resource_group_name="FirmwareAnalysisRG", + workspace_name="default", + firmware_id="109a9886-50bf-85a8-9d75-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Summaries_ListByFirmware_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_create_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_create_maximum_set_gen.py index a9bfd3b04228..edcb8f9ba0b9 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_create_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_create_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_Create_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_Create_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_create_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_create_minimum_set_gen.py index 6ac865f30dd0..dd76b5d47126 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_create_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_create_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_Create_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_Create_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_delete_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_delete_maximum_set_gen.py index 892fca994ded..fcb99d6ff8f6 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_delete_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_delete_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_delete_minimum_set_gen.py index c7682b400499..b5536001eca1 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_delete_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_generate_upload_url_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_generate_upload_url_maximum_set_gen.py index 5278cb9b1f7f..53b3df3ddb85 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_generate_upload_url_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_generate_upload_url_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_GenerateUploadUrl_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_GenerateUploadUrl_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_get_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_get_maximum_set_gen.py index a102146c4635..7f0724a9d990 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_get_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_get_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_get_minimum_set_gen.py index afe110df5de7..ab3a669cbc2c 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_get_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_resource_group_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_resource_group_maximum_set_gen.py index 41d016acb7c1..963407cf9c73 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_resource_group_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_resource_group_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_resource_group_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_resource_group_minimum_set_gen.py index ebbfcfb4ae9d..528969bab668 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_resource_group_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_resource_group_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_subscription_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_subscription_maximum_set_gen.py index 88bbdd9aa581..eb0a6d605f10 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_subscription_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_subscription_maximum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_subscription_minimum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_subscription_minimum_set_gen.py index 84fb996e28df..6cd6aea96606 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_subscription_minimum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_list_by_subscription_minimum_set_gen.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_update_maximum_set_gen.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_update_maximum_set_gen.py index 6e0893a8e0e3..a7ac0342d755 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_update_maximum_set_gen.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/generated_samples/workspaces_update_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/preview/2023-02-08-preview/examples/Workspaces_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/examples/Workspaces_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/sdk_packaging.toml b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/sdk_packaging.toml index c1daf43c801e..b2ad930f15a5 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/sdk_packaging.toml +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-iotfirmwaredefense" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Iotfirmwaredefense Management" package_doc_id = "" -is_stable = false +is_stable = true is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/setup.py b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/setup.py index 0e563cb97a8a..c4d3b2eed9f1 100644 --- a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/setup.py +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/setup.py @@ -49,15 +49,15 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -77,7 +77,6 @@ "isodate<1.0.0,>=0.6.1", "azure-common~=1.1", "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", ], - python_requires=">=3.7", + python_requires=">=3.8", )