Skip to content

Commit

Permalink
[AutoRelease] t2-iotfirmwaredefense-2024-03-07-08506(can only be merg…
Browse files Browse the repository at this point in the history
…ed by SDK owner) (#34683)

* code and test

* Update CHANGELOG.md

---------

Co-authored-by: azure-sdk <PythonSdkPipelines>
Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
  • Loading branch information
azure-sdk and msyyc authored Mar 27, 2024
1 parent 28a603a commit 91018f4
Show file tree
Hide file tree
Showing 102 changed files with 6,163 additions and 6,155 deletions.
46 changes: 46 additions & 0 deletions sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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_
Expand All @@ -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
Expand Down Expand Up @@ -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)
10 changes: 5 additions & 5 deletions sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/_meta.json
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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):
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
Loading

0 comments on commit 91018f4

Please sign in to comment.