From 224cb8efedcc51b06bc06dfd1a2bc7fabe3fc115 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 9 May 2024 16:54:31 -0400 Subject: [PATCH 1/6] udgrade to 0.42.1 of tcgc --- .../spheredpg/aio/operations/_operations.py | 10 +-- .../mgmt/spheredpg/operations/_operations.py | 74 +++++++++++-------- .../srv/driven2/_operations/_operations.py | 9 --- .../driven2/aio/_operations/_operations.py | 9 --- .../added/aio/operations/_operations.py | 12 +-- .../added/operations/_operations.py | 12 +-- .../srv/driven2/_operations/_operations.py | 9 --- .../driven2/aio/_operations/_operations.py | 9 --- .../added/aio/operations/_operations.py | 12 +-- .../added/operations/_operations.py | 12 +-- pnpm-lock.yaml | 28 +++---- 11 files changed, 76 insertions(+), 120 deletions(-) diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py index f16d2281802..8fcd871d34d 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py @@ -379,8 +379,8 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, + content_type=content_type, content=_content, headers=_headers, params=_params, @@ -1091,8 +1091,8 @@ async def update( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, + content_type=content_type, content=_content, headers=_headers, params=_params, @@ -2642,11 +2642,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, + api_version=self._config.api_version, filter=filter, top=top, skip=skip, maxpagesize=maxpagesize, - api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -2730,8 +2730,8 @@ async def _create_or_update_initial( catalog_name=catalog_name, image_name=image_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, + content_type=content_type, content=_content, headers=_headers, params=_params, @@ -5240,11 +5240,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, + api_version=self._config.api_version, filter=filter, top=top, skip=skip, maxpagesize=maxpagesize, - api_version=self._config.api_version, headers=_headers, params=_params, ) diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py index ce04e7f28c3..7760da64b5d 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py @@ -45,11 +45,10 @@ _SERIALIZER.client_side_validation = False -def build_operations_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(*, api_version: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,12 +64,11 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: def build_catalogs_get_request( - resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,13 +91,12 @@ def build_catalogs_get_request( def build_catalogs_create_or_update_request( - resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,13 +121,12 @@ def build_catalogs_create_or_update_request( def build_catalogs_update_request( - resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,12 +151,11 @@ def build_catalogs_update_request( def build_catalogs_delete_request( - resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,12 +178,11 @@ def build_catalogs_delete_request( def build_catalogs_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, subscription_id: str, *, api_version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,12 +204,11 @@ def build_catalogs_list_by_resource_group_request( # pylint: disable=name-too-l def build_catalogs_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any + subscription_id: str, *, api_version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -443,12 +436,17 @@ def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long def build_images_get_request( - resource_group_name: str, catalog_name: str, image_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + catalog_name: str, + image_name: str, + subscription_id: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -476,6 +474,7 @@ def build_images_list_by_catalog_request( catalog_name: str, subscription_id: str, *, + api_version: str, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, @@ -485,7 +484,6 @@ def build_images_list_by_catalog_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -516,13 +514,18 @@ def build_images_list_by_catalog_request( def build_images_create_or_update_request( - resource_group_name: str, catalog_name: str, image_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + catalog_name: str, + image_name: str, + subscription_id: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -548,12 +551,17 @@ def build_images_create_or_update_request( def build_images_delete_request( - resource_group_name: str, catalog_name: str, image_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + catalog_name: str, + image_name: str, + subscription_id: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -842,12 +850,17 @@ def build_device_groups_claim_devices_request( # pylint: disable=name-too-long def build_certificates_get_request( - resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + catalog_name: str, + serial_number: str, + subscription_id: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -875,6 +888,7 @@ def build_certificates_list_by_catalog_request( # pylint: disable=name-too-long catalog_name: str, subscription_id: str, *, + api_version: str, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, @@ -884,7 +898,6 @@ def build_certificates_list_by_catalog_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1367,12 +1380,11 @@ def build_devices_generate_capability_image_request( # pylint: disable=name-too def build_products_list_by_catalog_request( - resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1865,8 +1877,8 @@ def _create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, + content_type=content_type, content=_content, headers=_headers, params=_params, @@ -2577,8 +2589,8 @@ def update( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, + content_type=content_type, content=_content, headers=_headers, params=_params, @@ -4126,11 +4138,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, + api_version=self._config.api_version, filter=filter, top=top, skip=skip, maxpagesize=maxpagesize, - api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -4214,8 +4226,8 @@ def _create_or_update_initial( catalog_name=catalog_name, image_name=image_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, + content_type=content_type, content=_content, headers=_headers, params=_params, @@ -6724,11 +6736,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, + api_version=self._config.api_version, filter=filter, top=top, skip=skip, maxpagesize=maxpagesize, - api_version=self._config.api_version, headers=_headers, params=_params, ) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py index 354843865d9..3f0da9f52f7 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py @@ -152,9 +152,6 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bool: """Test that grew up from accepting no parameters to an optional input parameter. @@ -209,9 +206,6 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo return 200 <= response.status_code <= 299 @distributed_trace - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) # pylint: disable=inconsistent-return-statements def from_one_required( # pylint: disable=inconsistent-return-statements self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: @@ -271,9 +265,6 @@ def from_one_required( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) # pylint: disable=inconsistent-return-statements def from_one_optional( # pylint: disable=inconsistent-return-statements self, *, parameter: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py index 8e676ee7014..fb236f85f0c 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py @@ -96,9 +96,6 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bool: """Test that grew up from accepting no parameters to an optional input parameter. @@ -153,9 +150,6 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) return 200 <= response.status_code <= 299 @distributed_trace_async - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) # pylint: disable=inconsistent-return-statements async def from_one_required( # pylint: disable=inconsistent-return-statements self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: @@ -215,9 +209,6 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) # pylint: disable=inconsistent-return-statements async def from_one_optional( # pylint: disable=inconsistent-return-statements self, *, parameter: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: diff --git a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py index 22dccae3bcd..b6b9cd2e43f 100644 --- a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py @@ -62,8 +62,7 @@ def __init__(self, *args, **kwargs) -> None: @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) async def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -99,8 +98,7 @@ async def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) async def v2_in_interface( self, body: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -129,8 +127,7 @@ async def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) async def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -159,8 +156,7 @@ async def v2_in_interface( @distributed_trace_async @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) async def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. diff --git a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py index e53f0ea7bec..b5a4b8e55ce 100644 --- a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py @@ -113,8 +113,7 @@ def __init__(self, *args, **kwargs): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -150,8 +149,7 @@ def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -178,8 +176,7 @@ def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -208,8 +205,7 @@ def v2_in_interface( @distributed_trace @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py index 1f01e20d2e9..d6952b81caf 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py @@ -149,9 +149,6 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) # type: ignore - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bool: """Test that grew up from accepting no parameters to an optional input parameter. @@ -205,9 +202,6 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) # pylint: disable=inconsistent-return-statements def from_one_required( # pylint: disable=inconsistent-return-statements self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: @@ -266,9 +260,6 @@ def from_one_required( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) # pylint: disable=inconsistent-return-statements def from_one_optional( # pylint: disable=inconsistent-return-statements self, *, parameter: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py index a4b7cb8f4e4..f9537e017e7 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py @@ -93,9 +93,6 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) # type: ignore - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bool: """Test that grew up from accepting no parameters to an optional input parameter. @@ -149,9 +146,6 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) # pylint: disable=inconsistent-return-statements async def from_one_required( # pylint: disable=inconsistent-return-statements self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: @@ -210,9 +204,6 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - @api_version_validation( - params_added_on={"v2": ["new_parameter"]}, - ) # pylint: disable=inconsistent-return-statements async def from_one_optional( # pylint: disable=inconsistent-return-statements self, *, parameter: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: diff --git a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py index 5156d246645..2856262af13 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py @@ -61,8 +61,7 @@ def __init__(self, *args, **kwargs) -> None: @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) async def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -98,8 +97,7 @@ async def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) async def v2_in_interface( self, body: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -128,8 +126,7 @@ async def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) async def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -157,8 +154,7 @@ async def v2_in_interface( """ @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) async def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. diff --git a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py index 69aca7e20ff..4e70b2db4dc 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py @@ -112,8 +112,7 @@ def __init__(self, *args, **kwargs): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -149,8 +148,7 @@ def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -177,8 +175,7 @@ def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -206,8 +203,7 @@ def v2_in_interface( """ @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v1": ["endpoint", "version", "accept"]}, ) def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index adcf9442380..6ae8f054334 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,16 +75,16 @@ importers: version: 0.33.2(@azure-tools/cadl-ranch-expect@0.13.3)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@azure-tools/typespec-autorest': specifier: ~0.41.0 - version: 0.41.0(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.8)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + version: 0.41.1(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.9)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@azure-tools/typespec-azure-core': specifier: ~0.41.0 version: 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) '@azure-tools/typespec-azure-resource-manager': specifier: ~0.41.0 - version: 0.41.0(@azure-tools/typespec-autorest@0.41.0)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + version: 0.41.0(@azure-tools/typespec-autorest@0.41.1)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@azure-tools/typespec-client-generator-core': specifier: ~0.41.8 - version: 0.41.8(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + version: 0.41.9(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@types/js-yaml': specifier: ~4.0.5 version: 4.0.5 @@ -270,12 +270,12 @@ packages: - supports-color dev: true - /@azure-tools/typespec-autorest@0.41.0(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.8)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-yMbzIXKO7jH2+w69nhrQoq6tsvEls1rP62bBduFNY8wGsYNirTnbyRoRmP42gG2cGoa9uXcol9fCprarKysXCw==} + /@azure-tools/typespec-autorest@0.41.1(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.9)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): + resolution: {integrity: sha512-m2Rq8aFMvICfkG/+B1kGSDepCUDHhiQ93y1/IcE+XU1+IU2iuNoSgUd0lHgksP5Aqnvs3Wm9JDmA9nMNjOM1Ww==} engines: {node: '>=18.0.0'} peerDependencies: '@azure-tools/typespec-azure-core': ~0.41.0 - '@azure-tools/typespec-client-generator-core': ~0.41.0 + '@azure-tools/typespec-client-generator-core': ~0.41.1 '@typespec/compiler': ~0.55.0 '@typespec/http': ~0.55.0 '@typespec/openapi': ~0.55.0 @@ -283,7 +283,7 @@ packages: '@typespec/versioning': ~0.55.0 dependencies: '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) - '@azure-tools/typespec-client-generator-core': 0.41.8(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + '@azure-tools/typespec-client-generator-core': 0.41.9(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@typespec/compiler': 0.55.0 '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) @@ -304,7 +304,7 @@ packages: '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) dev: true - /@azure-tools/typespec-azure-resource-manager@0.41.0(@azure-tools/typespec-autorest@0.41.0)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): + /@azure-tools/typespec-azure-resource-manager@0.41.0(@azure-tools/typespec-autorest@0.41.1)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): resolution: {integrity: sha512-KPeQQle+hd508bkRjWHDsUXhoLjXVJg0DQyPM9wIxf+3cE0yH0aUxWPU6aj+aTio84226ExO2Qh8IadqgoQ5qg==} engines: {node: '>=18.0.0'} peerDependencies: @@ -316,7 +316,7 @@ packages: '@typespec/rest': ~0.55.0 '@typespec/versioning': ~0.55.0 dependencies: - '@azure-tools/typespec-autorest': 0.41.0(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.8)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + '@azure-tools/typespec-autorest': 0.41.1(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.9)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) '@typespec/compiler': 0.55.0 '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) @@ -325,8 +325,8 @@ packages: '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) dev: true - /@azure-tools/typespec-client-generator-core@0.41.8(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-d72LPwkEio/swqyAAgcuOaw+K4ghSbZcRjpjsvddxHWHh25ZukjD2hU/BfCtidnKptgKjs79fV++w2MYE6sTyw==} + /@azure-tools/typespec-client-generator-core@0.41.9(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): + resolution: {integrity: sha512-OKtt0p/MwDZ4lJwN4Wz2u28vLF65iQTpbikJ2iH954K11p8bo4R2LNGI7FMoE3FQKnpVqd8CwZRejG4KZX/yvg==} engines: {node: '>=18.0.0'} peerDependencies: '@azure-tools/typespec-azure-core': ~0.41.0 @@ -1610,7 +1610,7 @@ packages: dependencies: '@babel/code-frame': 7.24.2 ajv: 8.12.0 - change-case: 5.4.3 + change-case: 5.4.4 globby: 14.0.1 mustache: 4.2.0 picocolors: 1.0.0 @@ -2180,12 +2180,8 @@ packages: supports-color: 7.2.0 dev: true - /change-case@5.4.3: - resolution: {integrity: sha512-4cdyvorTy/lViZlVzw2O8/hHCLUuHqp4KpSSP3DlauhFCf3LdnfF+p5s0EAhjKsU7bqrMzu7iQArYfoPiHO2nw==} - /change-case@5.4.4: resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==} - dev: true /chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} From ea2e690dadb81ea0004e68b86bec93bb94702145 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 9 May 2024 16:55:04 -0400 Subject: [PATCH 2/6] add changeset --- .chronus/changes/update_tcgc-2024-4-9-16-55-0.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/update_tcgc-2024-4-9-16-55-0.md diff --git a/.chronus/changes/update_tcgc-2024-4-9-16-55-0.md b/.chronus/changes/update_tcgc-2024-4-9-16-55-0.md new file mode 100644 index 00000000000..e5154935779 --- /dev/null +++ b/.chronus/changes/update_tcgc-2024-4-9-16-55-0.md @@ -0,0 +1,7 @@ +--- +changeKind: dependencies +packages: + - "@azure-tools/typespec-python" +--- + +bump tcgc to 0.42.1 \ No newline at end of file From e3b53dd62dff7df79adbfef1ea0bc7627d239f2a Mon Sep 17 00:00:00 2001 From: tadelesh Date: Fri, 10 May 2024 13:38:27 +0800 Subject: [PATCH 3/6] updated with latest dev version and regen --- packages/typespec-python/package.json | 46 +- packages/typespec-python/src/utils.ts | 5 +- .../union/apiview_mapping_python.json | 7 - .../core/usage/apiview_mapping_python.json | 10 - .../core/basic/apiview_mapping_python.json | 23 - .../lro/standard/apiview_mapping_python.json | 10 - .../core/scalar/apiview_mapping_python.json | 11 - .../core/traits/apiview_mapping_python.json | 11 - .../apiview_mapping_python.json | 93 +- .../azure/mgmt/spheredpg/_client.py | 24 +- .../azure/mgmt/spheredpg/_configuration.py | 7 +- .../azure/mgmt/spheredpg/aio/_client.py | 24 +- .../mgmt/spheredpg/aio/_configuration.py | 7 +- .../mgmt/spheredpg/aio/operations/__init__.py | 10 +- .../spheredpg/aio/operations/_operations.py | 10242 ++++++++------- .../spheredpg/apiview_mapping_python.json | 111 - .../azure/mgmt/spheredpg/models/__init__.py | 24 +- .../azure/mgmt/spheredpg/models/_enums.py | 6 +- .../azure/mgmt/spheredpg/models/_models.py | 174 +- .../mgmt/spheredpg/operations/__init__.py | 10 +- .../mgmt/spheredpg/operations/_operations.py | 10818 ++++++++-------- .../lro/rpc/apiview_mapping_python.json | 12 - .../service/apiview_mapping_python.json | 13 - .../multiclient/apiview_mapping_python.json | 12 - .../encode/bytes/apiview_mapping_python.json | 31 - .../pageable/_operations/_operations.py | 4 + .../payload/pageable/_validation.py | 50 + .../pageable/aio/_operations/_operations.py | 4 + .../pageable/apiview_mapping_python.json | 7 - .../srv/driven2/_operations/_operations.py | 9 + .../driven2/aio/_operations/_operations.py | 9 + .../versioned/apiview_mapping_python.json | 8 - .../specialwords/apiview_mapping_python.json | 140 - .../enum/fixed/apiview_mapping_python.json | 9 - .../apiview_mapping_python.json | 19 - .../apiview_mapping_python.json | 50 - .../valuetypes/apiview_mapping_python.json | 96 - .../added/aio/operations/_operations.py | 36 +- .../added/operations/_operations.py | 36 +- .../specification/mgmt/sphere/catalog.tsp | 249 +- .../specification/mgmt/sphere/certificate.tsp | 147 +- .../specification/mgmt/sphere/common.tsp | 169 - .../specification/mgmt/sphere/deployment.tsp | 90 +- .../specification/mgmt/sphere/device.tsp | 175 +- .../specification/mgmt/sphere/deviceGroup.tsp | 181 +- .../azure/specification/mgmt/sphere/image.tsp | 161 +- .../azure/specification/mgmt/sphere/main.tsp | 41 +- .../specification/mgmt/sphere/models.tsp | 865 ++ .../specification/mgmt/sphere/product.tsp | 106 +- .../specification/mgmt/sphere/tspconfig.yaml | 10 +- .../pageable/_operations/_operations.py | 4 + .../payload/pageable/_validation.py | 50 + .../pageable/aio/_operations/_operations.py | 4 + .../srv/driven2/_operations/_operations.py | 9 + .../driven2/aio/_operations/_operations.py | 9 + .../added/aio/operations/_operations.py | 36 +- .../added/operations/_operations.py | 36 +- pnpm-lock.yaml | 899 +- 58 files changed, 13038 insertions(+), 12421 deletions(-) delete mode 100644 packages/typespec-python/test/azure/generated/authentication-union/authentication/union/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/apiview_mapping_python.json create mode 100644 packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_validation.py delete mode 100644 packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/special-words/specialwords/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/specification/mgmt/sphere/common.tsp create mode 100644 packages/typespec-python/test/azure/specification/mgmt/sphere/models.tsp create mode 100644 packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_validation.py diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index 3b4f428eab3..2b9b2664979 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -42,15 +42,15 @@ "get-autorest-python-path.cjs" ], "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.41.0 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.41.0 <1.0.0", - "@azure-tools/typespec-autorest": ">=0.41.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.41.8 <1.0.0", - "@typespec/compiler": ">=0.55.0 <1.0.0", - "@typespec/http": ">=0.55.0 <1.0.0", - "@typespec/rest": ">=0.55.0 <1.0.0", - "@typespec/versioning": ">=0.55.0 <1.0.0", - "@typespec/openapi": ">=0.55.0 <1.0.0" + "@azure-tools/typespec-azure-core": ">=0.43.0-dev.1 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.43.0-dev.2 <1.0.0", + "@azure-tools/typespec-autorest": ">=0.42.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.42.1 <1.0.0", + "@typespec/compiler": ">=0.57.0-dev.4 <1.0.0", + "@typespec/http": ">=0.57.0-dev.2 <1.0.0", + "@typespec/rest": ">=0.56.0 <1.0.0", + "@typespec/versioning": ">=0.56.0 <1.0.0", + "@typespec/openapi": ">=0.56.0 <1.0.0" }, "dependenciesMeta": { "@azure-tools/typespec-client-generator-core": { @@ -60,28 +60,28 @@ "dependencies": { "@autorest/python": "workspace:^", "js-yaml": "~4.1.0", - "@typespec/openapi3": "~0.55.0" + "@typespec/openapi3": "~0.56.0" }, "devDependencies": { - "@azure-tools/typespec-azure-resource-manager": "~0.41.0", - "@azure-tools/typespec-autorest": "~0.41.0", - "@azure-tools/cadl-ranch-expect": "~0.13.3", - "@azure-tools/cadl-ranch-specs": "~0.33.2", + "@azure-tools/typespec-azure-resource-manager": "~0.43.0-dev.2", + "@azure-tools/typespec-autorest": "~0.42.0", + "@azure-tools/cadl-ranch-expect": "~0.13.4", + "@azure-tools/cadl-ranch-specs": "~0.33.4", "@types/js-yaml": "~4.0.5", "@types/mocha": "~10.0.1", "@types/node": "^18.16.3", - "@typespec/eslint-config-typespec": "~0.55.0", - "@typespec/openapi": "~0.55.0", + "@typespec/eslint-plugin": "~0.56.0", + "@typespec/openapi": "~0.56.0", "c8": "~7.13.0", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "mocha": "~10.2.0", "rimraf": "~5.0.0", "typescript": "~5.1.3", - "@azure-tools/typespec-azure-core": "~0.41.0", - "@azure-tools/typespec-client-generator-core": "~0.41.8", - "@typespec/compiler": "~0.55.0", - "@typespec/http": "~0.55.0", - "@typespec/rest": "~0.55.0", - "@typespec/versioning": "~0.55.0" + "@azure-tools/typespec-azure-core": "~0.43.0-dev.1", + "@azure-tools/typespec-client-generator-core": "~0.42.1", + "@typespec/compiler": "~0.57.0-dev.4", + "@typespec/http": "~0.57.0-dev.2", + "@typespec/rest": "~0.56.0", + "@typespec/versioning": "~0.56.0" } } diff --git a/packages/typespec-python/src/utils.ts b/packages/typespec-python/src/utils.ts index ccb9aa31070..8ab19e90750 100644 --- a/packages/typespec-python/src/utils.ts +++ b/packages/typespec-python/src/utils.ts @@ -77,8 +77,9 @@ export function getAddedOn( context: PythonSdkContext, type: SdkModelPropertyType | SdkMethod, ): string | undefined { - // We only want added on if it's not the same as the client's added on - if (type.apiVersions[0] === context.experimental_sdkPackage.clients[0].apiVersions[0]) return undefined; + // since we do not support multi-service for now, we can just check the root client's api version + // if type is added in the first version of the client, we do not need to add the versioning info + if (type.apiVersions[0] === context.experimental_sdkPackage.clients.find(c => c.initialization.access === "public")?.apiVersions[0]) return undefined; return type.apiVersions[0]; } diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/apiview_mapping_python.json deleted file mode 100644 index b351c64f20d..00000000000 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/apiview_mapping_python.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "CrossLanguagePackageId": "Authentication.Union", - "CrossLanguageDefinitionId": { - "authentication.union.UnionClient.valid_key": "validKey", - "authentication.union.UnionClient.valid_token": "validToken" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/apiview_mapping_python.json deleted file mode 100644 index 3b314fe39e6..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/apiview_mapping_python.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.ClientGenerator.Core.Usage", - "CrossLanguageDefinitionId": { - "specs.azure.clientgenerator.core.usage.models.InputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.InputModel", - "specs.azure.clientgenerator.core.usage.models.OrphanModel": "_Specs_.Azure.ClientGenerator.Core.Usage.OrphanModel", - "specs.azure.clientgenerator.core.usage.models.OutputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.OutputModel", - "specs.azure.clientgenerator.core.usage.UsageClient.model_in_operation.input_to_input_output": "inputToInputOutput", - "specs.azure.clientgenerator.core.usage.UsageClient.model_in_operation.output_to_input_output": "outputToInputOutput" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/apiview_mapping_python.json deleted file mode 100644 index 243ce130cf5..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/apiview_mapping_python.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Basic", - "CrossLanguageDefinitionId": { - "specs.azure.core.basic.models.FirstItem": "_Specs_.Azure.Core.Basic.FirstItem", - "specs.azure.core.basic.models.ListItemInputBody": "_Specs_.Azure.Core.Basic.ListItemInputBody", - "specs.azure.core.basic.models.SecondItem": "_Specs_.Azure.Core.Basic.SecondItem", - "specs.azure.core.basic.models.User": "_Specs_.Azure.Core.Basic.User", - "specs.azure.core.basic.models.UserListResults": "_Specs_.Azure.Core.Basic.CustomPageModel", - "specs.azure.core.basic.models.UserOrder": "_Specs_.Azure.Core.Basic.UserOrder", - "specs.azure.core.basic.models.ListItemInputExtensibleEnum": "_Specs_.Azure.Core.Basic.ListItemInputExtensibleEnum", - "specs.azure.core.basic.BasicClient.two_models_as_page_item.list_first_item": "listFirstItem", - "specs.azure.core.basic.BasicClient.two_models_as_page_item.list_second_item": "listSecondItem", - "specs.azure.core.basic.BasicClient.create_or_update": "createOrUpdate", - "specs.azure.core.basic.BasicClient.create_or_replace": "createOrReplace", - "specs.azure.core.basic.BasicClient.get": "get", - "specs.azure.core.basic.BasicClient.list": "list", - "specs.azure.core.basic.BasicClient.list_with_page": "listWithPage", - "specs.azure.core.basic.BasicClient.list_with_parameters": "listWithParameters", - "specs.azure.core.basic.BasicClient.list_with_custom_page_model": "listWithCustomPageModel", - "specs.azure.core.basic.BasicClient.delete": "delete", - "specs.azure.core.basic.BasicClient.export": "export" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/apiview_mapping_python.json deleted file mode 100644 index d4c18a09651..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/apiview_mapping_python.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Lro.Standard", - "CrossLanguageDefinitionId": { - "specs.azure.core.lro.standard.models.ExportedUser": "_Specs_.Azure.Core.Lro.Standard.ExportedUser", - "specs.azure.core.lro.standard.models.User": "_Specs_.Azure.Core.Lro.Standard.User", - "specs.azure.core.lro.standard.StandardClient.begin_create_or_replace": "createOrReplace", - "specs.azure.core.lro.standard.StandardClient.begin_delete": "delete", - "specs.azure.core.lro.standard.StandardClient.begin_export": "export" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/apiview_mapping_python.json deleted file mode 100644 index 460480959e7..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/apiview_mapping_python.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Scalar", - "CrossLanguageDefinitionId": { - "specs.azure.core.scalar.models.AzureLocationModel": "_Specs_.Azure.Core.Scalar.AzureLocationModel", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.get": "get", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.put": "put", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.post": "post", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.header": "header", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.query": "query" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/apiview_mapping_python.json deleted file mode 100644 index 7035a181b8d..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/apiview_mapping_python.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Traits", - "CrossLanguageDefinitionId": { - "specs.azure.core.traits.models.User": "_Specs_.Azure.Core.Traits.User", - "specs.azure.core.traits.models.UserActionParam": "_Specs_.Azure.Core.Traits.UserActionParam", - "specs.azure.core.traits.models.UserActionResponse": "_Specs_.Azure.Core.Traits.UserActionResponse", - "specs.azure.core.traits.models.RepeatabilityResult": "Azure.Core.RepeatabilityResult", - "specs.azure.core.traits.TraitsClient.smoke_test": "smokeTest", - "specs.azure.core.traits.TraitsClient.repeatable_action": "repeatableAction" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/apiview_mapping_python.json index 9b0f1a46276..ad276dc8108 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/apiview_mapping_python.json +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/apiview_mapping_python.json @@ -1,22 +1,21 @@ { "CrossLanguagePackageId": "Microsoft.AzureSphere", "CrossLanguageDefinitionId": { - "azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState": "Azure.ResourceManager.ArmOperationStatus", - "azure.mgmt.spheredpg.models.ArmResourceBase": "Azure.ResourceManager.Foundations.ArmResourceBase", - "azure.mgmt.spheredpg.models.ArmResource": "Azure.ResourceManager.Foundations.ArmResource", - "azure.mgmt.spheredpg.models.TrackedResourceBase": "Azure.ResourceManager.Foundations.TrackedResourceBase", + "azure.mgmt.spheredpg.models.ArmOperationStatus": "Azure.ResourceManager.ArmOperationStatus", + "azure.mgmt.spheredpg.models.Resource": "Azure.ResourceManager.Foundations.Resource", + "azure.mgmt.spheredpg.models.TrackedResource": "Azure.ResourceManager.Foundations.TrackedResource", "azure.mgmt.spheredpg.models.Catalog": "Microsoft.AzureSphere.Catalog", "azure.mgmt.spheredpg.models.CatalogListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.CatalogProperties": "Microsoft.AzureSphere.CatalogProperties", - "azure.mgmt.spheredpg.models.CatalogUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.ProxyResourceBase": "Azure.ResourceManager.Foundations.ProxyResourceBase", + "azure.mgmt.spheredpg.models.CatalogUpdate": "Microsoft.AzureSphere.CatalogUpdate", + "azure.mgmt.spheredpg.models.ProxyResource": "Azure.ResourceManager.Foundations.ProxyResource", "azure.mgmt.spheredpg.models.Certificate": "Microsoft.AzureSphere.Certificate", "azure.mgmt.spheredpg.models.CertificateChainResponse": "Microsoft.AzureSphere.CertificateChainResponse", "azure.mgmt.spheredpg.models.CertificateListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.CertificateProperties": "Microsoft.AzureSphere.CertificateProperties", "azure.mgmt.spheredpg.models.ClaimDevicesRequest": "Microsoft.AzureSphere.ClaimDevicesRequest", "azure.mgmt.spheredpg.models.CountElementsResponse": "Microsoft.AzureSphere.CountElementsResponse", - "azure.mgmt.spheredpg.models.CountDeviceResponse": "Microsoft.AzureSphere.CountDeviceResponse", + "azure.mgmt.spheredpg.models.CountDevicesResponse": "Microsoft.AzureSphere.CountDevicesResponse", "azure.mgmt.spheredpg.models.Deployment": "Microsoft.AzureSphere.Deployment", "azure.mgmt.spheredpg.models.DeploymentListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.DeploymentProperties": "Microsoft.AzureSphere.DeploymentProperties", @@ -24,13 +23,13 @@ "azure.mgmt.spheredpg.models.DeviceGroup": "Microsoft.AzureSphere.DeviceGroup", "azure.mgmt.spheredpg.models.DeviceGroupListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.DeviceGroupProperties": "Microsoft.AzureSphere.DeviceGroupProperties", - "azure.mgmt.spheredpg.models.DeviceGroupUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.DeviceGroupUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.spheredpg.models.DeviceGroupUpdate": "Microsoft.AzureSphere.DeviceGroupUpdate", + "azure.mgmt.spheredpg.models.DeviceGroupUpdateProperties": "Microsoft.AzureSphere.DeviceGroupUpdateProperties", "azure.mgmt.spheredpg.models.DeviceInsight": "Microsoft.AzureSphere.DeviceInsight", "azure.mgmt.spheredpg.models.DeviceListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.DeviceProperties": "Microsoft.AzureSphere.DeviceProperties", - "azure.mgmt.spheredpg.models.DeviceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.DeviceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.spheredpg.models.DeviceUpdate": "Microsoft.AzureSphere.DeviceUpdate", + "azure.mgmt.spheredpg.models.DeviceUpdateProperties": "Microsoft.AzureSphere.DeviceUpdateProperties", "azure.mgmt.spheredpg.models.ErrorAdditionalInfo": "Azure.ResourceManager.Foundations.ErrorAdditionalInfo", "azure.mgmt.spheredpg.models.ErrorDetail": "Azure.ResourceManager.Foundations.ErrorDetail", "azure.mgmt.spheredpg.models.ErrorResponse": "Azure.ResourceManager.ErrorResponse", @@ -41,12 +40,13 @@ "azure.mgmt.spheredpg.models.ListDeviceGroupsRequest": "Microsoft.AzureSphere.ListDeviceGroupsRequest", "azure.mgmt.spheredpg.models.Operation": "Azure.ResourceManager.Foundations.Operation", "azure.mgmt.spheredpg.models.OperationDisplay": "Azure.ResourceManager.Foundations.OperationDisplay", + "azure.mgmt.spheredpg.models.PagedDeviceInsight": "Microsoft.AzureSphere.PagedDeviceInsight", "azure.mgmt.spheredpg.models.PagedOperation": "Azure.ResourceManager.Foundations.OperationListResult", "azure.mgmt.spheredpg.models.Product": "Microsoft.AzureSphere.Product", "azure.mgmt.spheredpg.models.ProductListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.ProductProperties": "Microsoft.AzureSphere.ProductProperties", - "azure.mgmt.spheredpg.models.ProductUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.ProductUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.spheredpg.models.ProductUpdate": "Microsoft.AzureSphere.ProductUpdate", + "azure.mgmt.spheredpg.models.ProductUpdateProperties": "Microsoft.AzureSphere.ProductUpdateProperties", "azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest": "Microsoft.AzureSphere.ProofOfPossessionNonceRequest", "azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse": "Microsoft.AzureSphere.ProofOfPossessionNonceResponse", "azure.mgmt.spheredpg.models.SignedCapabilityImageResponse": "Microsoft.AzureSphere.SignedCapabilityImageResponse", @@ -54,58 +54,59 @@ "azure.mgmt.spheredpg.models.CreatedByType": "Azure.ResourceManager.Foundations.createdByType", "azure.mgmt.spheredpg.models.ProvisioningState": "Microsoft.AzureSphere.ProvisioningState", "azure.mgmt.spheredpg.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", + "azure.mgmt.spheredpg.models.CapabilityType": "Microsoft.AzureSphere.CapabilityType", + "azure.mgmt.spheredpg.models.RegionalDataBoundary": "Microsoft.AzureSphere.RegionalDataBoundary", + "azure.mgmt.spheredpg.models.ImageType": "Microsoft.AzureSphere.ImageType", "azure.mgmt.spheredpg.models.OSFeedType": "Microsoft.AzureSphere.OSFeedType", "azure.mgmt.spheredpg.models.UpdatePolicy": "Microsoft.AzureSphere.UpdatePolicy", "azure.mgmt.spheredpg.models.AllowCrashDumpCollection": "Microsoft.AzureSphere.AllowCrashDumpCollection", - "azure.mgmt.spheredpg.models.RegionalDataBoundary": "Microsoft.AzureSphere.RegionalDataBoundary", - "azure.mgmt.spheredpg.models.CapabilityType": "Microsoft.AzureSphere.CapabilityType", - "azure.mgmt.spheredpg.models.ImageType": "Microsoft.AzureSphere.ImageType", "azure.mgmt.spheredpg.models.CertificateStatus": "Microsoft.AzureSphere.CertificateStatus", "azure.mgmt.spheredpg.models.Origin": "Azure.ResourceManager.Foundations.Origin", "azure.mgmt.spheredpg.models.ActionType": "Azure.ResourceManager.Foundations.ActionType", "azure.mgmt.spheredpg.AzureSphereClient.operations.list": "Azure.ResourceManager.Operations.list", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.get": "Azure.ResourceManager.Catalogs.get", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_create_or_update": "Azure.ResourceManager.Catalogs.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.update": "Azure.ResourceManager.Catalogs.update", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_delete": "Azure.ResourceManager.Catalogs.delete", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_resource_group": "Azure.ResourceManager.Catalogs.listByResourceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_subscription": "Azure.ResourceManager.Catalogs.listBySubscription", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.get": "Microsoft.AzureSphere.Catalogs.get", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_create_or_update": "Microsoft.AzureSphere.Catalogs.createOrUpdate", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.update": "Microsoft.AzureSphere.Catalogs.update", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_delete": "Microsoft.AzureSphere.Catalogs.delete", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_resource_group": "Microsoft.AzureSphere.Catalogs.listByResourceGroup", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_subscription": "Microsoft.AzureSphere.Catalogs.listBySubscription", "azure.mgmt.spheredpg.AzureSphereClient.catalogs.count_devices": "Microsoft.AzureSphere.Catalogs.countDevices", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_insights": "Microsoft.AzureSphere.Catalogs.listDeviceInsights", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_devices": "Microsoft.AzureSphere.Catalogs.listDevices", "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_deployments": "Microsoft.AzureSphere.Catalogs.listDeployments", "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_groups": "Microsoft.AzureSphere.Catalogs.listDeviceGroups", - "azure.mgmt.spheredpg.AzureSphereClient.images.get": "Azure.ResourceManager.Images.get", - "azure.mgmt.spheredpg.AzureSphereClient.images.list_by_catalog": "Azure.ResourceManager.Images.listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.images.begin_create_or_update": "Azure.ResourceManager.Images.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.images.begin_delete": "Azure.ResourceManager.Images.delete", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.list_by_product": "Microsoft.AzureSphere.DeviceGroups.listByProduct", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_insights": "Microsoft.AzureSphere.Catalogs.listDeviceInsights", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_devices": "Microsoft.AzureSphere.Catalogs.listDevices", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_upload_image": "Microsoft.AzureSphere.Catalogs.uploadImage", + "azure.mgmt.spheredpg.AzureSphereClient.certificates.get": "Microsoft.AzureSphere.Certificates.get", + "azure.mgmt.spheredpg.AzureSphereClient.certificates.list_by_catalog": "Microsoft.AzureSphere.Certificates.listByCatalog", + "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_cert_chain": "Microsoft.AzureSphere.Certificates.retrieveCertChain", + "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_proof_of_possession_nonce": "Microsoft.AzureSphere.Certificates.retrieveProofOfPossessionNonce", + "azure.mgmt.spheredpg.AzureSphereClient.images.get": "Microsoft.AzureSphere.Images.get", + "azure.mgmt.spheredpg.AzureSphereClient.images.begin_create_or_update": "Microsoft.AzureSphere.Images.createOrUpdate", + "azure.mgmt.spheredpg.AzureSphereClient.images.begin_delete": "Microsoft.AzureSphere.Images.delete", + "azure.mgmt.spheredpg.AzureSphereClient.images.list_by_catalog": "Microsoft.AzureSphere.Images.listByCatalog", + "azure.mgmt.spheredpg.AzureSphereClient.products.get": "Microsoft.AzureSphere.Products.get", + "azure.mgmt.spheredpg.AzureSphereClient.products.begin_create_or_update": "Microsoft.AzureSphere.Products.createOrUpdate", + "azure.mgmt.spheredpg.AzureSphereClient.products.begin_update": "Microsoft.AzureSphere.Products.update", + "azure.mgmt.spheredpg.AzureSphereClient.products.begin_delete": "Microsoft.AzureSphere.Products.delete", + "azure.mgmt.spheredpg.AzureSphereClient.products.list_by_catalog": "Microsoft.AzureSphere.Products.listByCatalog", + "azure.mgmt.spheredpg.AzureSphereClient.products.count_devices": "Microsoft.AzureSphere.Products.countDevices", + "azure.mgmt.spheredpg.AzureSphereClient.products.generate_default_device_groups": "Microsoft.AzureSphere.Products.generateDefaultDeviceGroups", "azure.mgmt.spheredpg.AzureSphereClient.device_groups.get": "Microsoft.AzureSphere.DeviceGroups.get", "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_create_or_update": "Microsoft.AzureSphere.DeviceGroups.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_delete": "Microsoft.AzureSphere.DeviceGroups.delete", "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_update": "Microsoft.AzureSphere.DeviceGroups.update", + "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_delete": "Microsoft.AzureSphere.DeviceGroups.delete", + "azure.mgmt.spheredpg.AzureSphereClient.device_groups.list_by_product": "Microsoft.AzureSphere.DeviceGroups.listByProduct", + "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_claim_devices": "Microsoft.AzureSphere.DeviceGroups.claimDevices", "azure.mgmt.spheredpg.AzureSphereClient.device_groups.count_devices": "Microsoft.AzureSphere.DeviceGroups.countDevices", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.claim_devices": "Microsoft.AzureSphere.DeviceGroups.claimDevices", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.get": "Azure.ResourceManager.Certificates.get", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.list_by_catalog": "Azure.ResourceManager.Certificates.listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_cert_chain": "Microsoft.AzureSphere.Certificates.retrieveCertChain", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_proof_of_possession_nonce": "Microsoft.AzureSphere.Certificates.retrieveProofOfPossessionNonce", "azure.mgmt.spheredpg.AzureSphereClient.deployments.get": "Microsoft.AzureSphere.Deployments.get", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.list_by_device_group": "Microsoft.AzureSphere.Deployments.listByDeviceGroup", "azure.mgmt.spheredpg.AzureSphereClient.deployments.begin_create_or_update": "Microsoft.AzureSphere.Deployments.createOrUpdate", "azure.mgmt.spheredpg.AzureSphereClient.deployments.begin_delete": "Microsoft.AzureSphere.Deployments.delete", + "azure.mgmt.spheredpg.AzureSphereClient.deployments.list_by_device_group": "Microsoft.AzureSphere.Deployments.listByDeviceGroup", "azure.mgmt.spheredpg.AzureSphereClient.devices.get": "Microsoft.AzureSphere.Devices.get", "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_create_or_update": "Microsoft.AzureSphere.Devices.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.devices.list_by_device_group": "Microsoft.AzureSphere.Devices.listByDeviceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_delete": "Microsoft.AzureSphere.Devices.delete", "azure.mgmt.spheredpg.AzureSphereClient.devices.update": "Microsoft.AzureSphere.Devices.update", - "azure.mgmt.spheredpg.AzureSphereClient.devices.generate_capability_image": "Microsoft.AzureSphere.Devices.generateCapabilityImage", - "azure.mgmt.spheredpg.AzureSphereClient.products.list_by_catalog": "Azure.ResourceManager.Products.listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.products.get": "Microsoft.AzureSphere.Products.get", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_create_or_update": "Microsoft.AzureSphere.Products.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_delete": "Microsoft.AzureSphere.Products.delete", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_update": "Microsoft.AzureSphere.Products.update", - "azure.mgmt.spheredpg.AzureSphereClient.products.generate_default_device_groups": "Microsoft.AzureSphere.Products.generateDefaultDeviceGroups", - "azure.mgmt.spheredpg.AzureSphereClient.products.count_devices": "Microsoft.AzureSphere.Products.countDevices" + "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_delete": "Microsoft.AzureSphere.Devices.delete", + "azure.mgmt.spheredpg.AzureSphereClient.devices.list_by_device_group": "Microsoft.AzureSphere.Devices.listByDeviceGroup", + "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_generate_capability_image": "Microsoft.AzureSphere.Devices.generateCapabilityImage" } } \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py index c832ff8c050..c9dca361e7a 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py @@ -19,7 +19,6 @@ from .operations import ( CatalogsOperations, CertificatesOperations, - CustomUpdateOperationsOperations, DeploymentsOperations, DeviceGroupsOperations, DevicesOperations, @@ -38,32 +37,28 @@ class AzureSphereClient: # pylint: disable=client-accepts-api-version-keyword,t :ivar operations: Operations operations :vartype operations: azure.mgmt.spheredpg.operations.Operations - :ivar custom_update_operations: CustomUpdateOperationsOperations operations - :vartype custom_update_operations: - azure.mgmt.spheredpg.operations.CustomUpdateOperationsOperations :ivar catalogs: CatalogsOperations operations :vartype catalogs: azure.mgmt.spheredpg.operations.CatalogsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.spheredpg.operations.CertificatesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.spheredpg.operations.ImagesOperations + :ivar products: ProductsOperations operations + :vartype products: azure.mgmt.spheredpg.operations.ProductsOperations :ivar device_groups: DeviceGroupsOperations operations :vartype device_groups: azure.mgmt.spheredpg.operations.DeviceGroupsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.spheredpg.operations.CertificatesOperations :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.spheredpg.operations.DeploymentsOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.spheredpg.operations.DevicesOperations - :ivar products: ProductsOperations operations - :vartype products: azure.mgmt.spheredpg.operations.ProductsOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2022-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -101,16 +96,13 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.custom_update_operations = CustomUpdateOperationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.catalogs = CatalogsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize) self.device_groups = DeviceGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py index eeabd380351..d7f93c9e28f 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py @@ -28,14 +28,13 @@ class AzureSphereClientConfiguration: # pylint: disable=too-many-instance-attri :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: The API version to use for this operation. Default value is - "2022-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py index 420fc219a4a..676ea35869a 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py @@ -19,7 +19,6 @@ from .operations import ( CatalogsOperations, CertificatesOperations, - CustomUpdateOperationsOperations, DeploymentsOperations, DeviceGroupsOperations, DevicesOperations, @@ -38,32 +37,28 @@ class AzureSphereClient: # pylint: disable=client-accepts-api-version-keyword,t :ivar operations: Operations operations :vartype operations: azure.mgmt.spheredpg.aio.operations.Operations - :ivar custom_update_operations: CustomUpdateOperationsOperations operations - :vartype custom_update_operations: - azure.mgmt.spheredpg.aio.operations.CustomUpdateOperationsOperations :ivar catalogs: CatalogsOperations operations :vartype catalogs: azure.mgmt.spheredpg.aio.operations.CatalogsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.spheredpg.aio.operations.CertificatesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.spheredpg.aio.operations.ImagesOperations + :ivar products: ProductsOperations operations + :vartype products: azure.mgmt.spheredpg.aio.operations.ProductsOperations :ivar device_groups: DeviceGroupsOperations operations :vartype device_groups: azure.mgmt.spheredpg.aio.operations.DeviceGroupsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.spheredpg.aio.operations.CertificatesOperations :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.spheredpg.aio.operations.DeploymentsOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.spheredpg.aio.operations.DevicesOperations - :ivar products: ProductsOperations operations - :vartype products: azure.mgmt.spheredpg.aio.operations.ProductsOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2022-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -101,16 +96,13 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.custom_update_operations = CustomUpdateOperationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.catalogs = CatalogsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize) self.device_groups = DeviceGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py index dc70360cd62..08d89f19252 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py @@ -28,14 +28,13 @@ class AzureSphereClientConfiguration: # pylint: disable=too-many-instance-attri :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: The API version to use for this operation. Default value is - "2022-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/__init__.py index 868f22c85ea..c05eeb4ce12 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/__init__.py @@ -7,14 +7,13 @@ # -------------------------------------------------------------------------- from ._operations import Operations -from ._operations import CustomUpdateOperationsOperations from ._operations import CatalogsOperations +from ._operations import CertificatesOperations from ._operations import ImagesOperations +from ._operations import ProductsOperations from ._operations import DeviceGroupsOperations -from ._operations import CertificatesOperations from ._operations import DeploymentsOperations from ._operations import DevicesOperations -from ._operations import ProductsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -22,14 +21,13 @@ __all__ = [ "Operations", - "CustomUpdateOperationsOperations", "CatalogsOperations", + "CertificatesOperations", "ImagesOperations", + "ProductsOperations", "DeviceGroupsOperations", - "CertificatesOperations", "DeploymentsOperations", "DevicesOperations", - "ProductsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py index 8fcd871d34d..7b86f22f589 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py @@ -44,6 +44,7 @@ build_catalogs_list_device_insights_request, build_catalogs_list_devices_request, build_catalogs_update_request, + build_catalogs_upload_image_request, build_certificates_get_request, build_certificates_list_by_catalog_request, build_certificates_retrieve_cert_chain_request, @@ -119,8 +120,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: # response body for status code(s): 200 response == { - "actionType": "str", # Optional. Enum. Indicates the action type. "Internal" - refers to actions that are for internal only APIs. "Internal" + "actionType": "str", # Optional. Extensible enum. Indicates the action type. + "Internal" refers to actions that are for internal only APIs. "Internal" "display": { "description": "str", # Optional. The short, localized friendly description of the operation; suitable for tool tips and detailed views. @@ -213,24 +214,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class CustomUpdateOperationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`custom_update_operations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - class CatalogsOperations: """ .. warning:: @@ -267,17 +250,16 @@ async def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -297,7 +279,9 @@ async def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -379,8 +363,8 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - api_version=self._config.api_version, content_type=content_type, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, @@ -448,17 +432,16 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -478,22 +461,23 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -513,7 +497,9 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -550,17 +536,16 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -580,7 +565,9 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -617,17 +604,16 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -647,7 +633,9 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -680,17 +668,16 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -710,22 +697,23 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -745,7 +733,9 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -832,17 +822,16 @@ async def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -862,7 +851,9 @@ async def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -898,17 +889,16 @@ async def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -928,7 +918,9 @@ async def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -964,17 +956,16 @@ async def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -994,7 +985,9 @@ async def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -1033,17 +1026,16 @@ async def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1063,7 +1055,9 @@ async def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -1091,8 +1085,8 @@ async def update( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - api_version=self._config.api_version, content_type=content_type, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, @@ -1238,17 +1232,16 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1268,7 +1261,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -1354,17 +1349,16 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Catalog" # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1384,7 +1378,9 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Catalog" }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -1458,7 +1454,7 @@ async def get_next(next_link=None): @distributed_trace_async async def count_devices( self, resource_group_name: str, catalog_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: + ) -> _models.CountDevicesResponse: """Counts devices in catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1466,8 +1462,8 @@ async def count_devices( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -1489,7 +1485,7 @@ async def count_devices( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) _request = build_catalogs_count_devices_request( resource_group_name=resource_group_name, @@ -1518,7 +1514,7 @@ async def count_devices( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1526,7 +1522,7 @@ async def count_devices( return deserialized # type: ignore @distributed_trace - def list_device_insights( + def list_deployments( self, resource_group_name: str, catalog_name: str, @@ -1535,8 +1531,9 @@ def list_device_insights( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeviceInsight"]: - """Lists device insights for catalog. + ) -> AsyncIterable["_models.Deployment"]: + # pylint: disable=line-too-long + """Lists deployments for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1549,8 +1546,8 @@ def list_device_insights( :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of DeviceInsight - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceInsight] + :return: An iterator like instance of Deployment + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -1558,22 +1555,97 @@ def list_device_insights( # response body for status code(s): 200 response == { - "description": "str", # Event description. Required. - "deviceId": "str", # Device ID. Required. - "endTimestampUtc": "2020-02-20 00:00:00", # Event end timestamp. Required. - "eventCategory": "str", # Event category. Required. - "eventClass": "str", # Event class. Required. - "eventCount": 0, # Event count. Required. - "eventType": "str", # Event type. Required. - "startTimestampUtc": "2020-02-20 00:00:00" # Event start timestamp. - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -1586,7 +1658,7 @@ def list_device_insights( def prepare_request(next_link=None): if not next_link: - _request = build_catalogs_list_device_insights_request( + _request = build_catalogs_list_deployments_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1619,7 +1691,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceInsight], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Deployment], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1644,60 +1716,71 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list_devices( + @overload + def list_device_groups( self, resource_group_name: str, catalog_name: str, + body: _models.ListDeviceGroupsRequest, *, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.Device"]: + ) -> AsyncIterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Lists devices for catalog. + """List the device groups for the catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str + :param body: List device groups for catalog. Required. + :type body: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of Device - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Device] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "deviceGroupName": "str" # Optional. Device Group name. + } + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1714,111 +1797,46 @@ def list_devices( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_catalogs_list_devices_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list_deployments( + @overload + def list_device_groups( self, resource_group_name: str, catalog_name: str, + body: JSON, *, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.Deployment"]: + ) -> AsyncIterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Lists deployments for catalog. + """List the device groups for the catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str + :param body: List device groups for catalog. Required. + :type body: JSON :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of Deployment - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Deployment] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -1826,74 +1844,25 @@ def list_deployments( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1910,136 +1879,56 @@ def list_deployments( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + @overload + def list_device_groups( + self, + resource_group_name: str, + catalog_name: str, + body: IO[bytes], + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.DeviceGroup"]: + # pylint: disable=line-too-long + """List the device groups for the catalog. - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param body: List device groups for catalog. Required. + :type body: IO[bytes] + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: - def prepare_request(next_link=None): - if not next_link: - - _request = build_catalogs_list_deployments_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Deployment], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - def list_device_groups( - self, - resource_group_name: str, - catalog_name: str, - parameters: _models.ListDeviceGroupsRequest, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: - # pylint: disable=line-too-long - """List the device groups for the catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - parameters = { - "deviceGroupName": "str" # Optional. Device Group name. - } + Example: + .. code-block:: python # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -2072,21 +1961,22 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @overload + @distributed_trace def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: JSON, + body: Union[_models.ListDeviceGroupsRequest, JSON, IO[bytes]], *, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, - content_type: str = "application/json", **kwargs: Any ) -> AsyncIterable["_models.DeviceGroup"]: # pylint: disable=line-too-long @@ -2097,17 +1987,15 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: JSON + :param body: List device groups for catalog. Is one of the following types: + ListDeviceGroupsRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest or JSON or IO[bytes] :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str :return: An iterator like instance of DeviceGroup :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -2115,14 +2003,16 @@ def list_device_groups( Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "deviceGroupName": "str" # Optional. Device Group name. + } + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -2155,44 +2045,121 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - @overload - def list_device_groups( + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + def prepare_request(next_link=None): + if not next_link: + + _request = build_catalogs_list_device_groups_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_device_insights( self, resource_group_name: str, catalog_name: str, - parameters: IO[bytes], *, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, - content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: - # pylint: disable=line-too-long - """List the device groups for the catalog. + ) -> AsyncIterable["_models.DeviceInsight"]: + """Lists device insights for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: IO[bytes] :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An iterator like instance of DeviceInsight + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceInsight] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -2200,113 +2167,143 @@ def list_device_groups( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + "description": "str", # Event description. Required. + "deviceId": "str", # Device ID. Required. + "endTimestampUtc": "2020-02-20 00:00:00", # Event end timestamp. Required. + "eventCategory": "str", # Event category. Required. + "eventClass": "str", # Event class. Required. + "eventCount": 0, # Event count. Required. + "eventType": "str", # Event type. Required. + "startTimestampUtc": "2020-02-20 00:00:00" # Event start timestamp. Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_catalogs_list_device_insights_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceInsight], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_device_groups( + def list_devices( self, resource_group_name: str, catalog_name: str, - parameters: Union[_models.ListDeviceGroupsRequest, JSON, IO[bytes]], *, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: + ) -> AsyncIterable["_models.Device"]: # pylint: disable=line-too-long - """List the device groups for the catalog. + """Lists devices for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Is one of the following types: - ListDeviceGroupsRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest or JSON or IO[bytes] :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An iterator like instance of Device + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - parameters = { - "deviceGroupName": "str" # Optional. Device Group name. - } - # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2323,15 +2320,16 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -2340,17 +2338,11 @@ def list_device_groups( 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore def prepare_request(next_link=None): if not next_link: - _request = build_catalogs_list_device_groups_request( + _request = build_catalogs_list_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -2358,9 +2350,7 @@ def prepare_request(next_link=None): top=top, skip=skip, maxpagesize=maxpagesize, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -2385,7 +2375,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2410,51 +2400,98 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + async def _upload_image_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, body: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) -class ImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`images` attribute. - """ + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - 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") + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - @distributed_trace_async - async def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: + _request = build_catalogs_upload_image_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @overload + async def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + body: _models.Image, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: # pylint: disable=line-too-long - """Get a Image. + """Creates an image. Use this action when the image ID is unknown. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :return: Image. The Image is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Image + :param body: Image upload request body. Required. + :type body: ~azure.mgmt.spheredpg.models.Image + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + body = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. "description": "str", # Optional. The image description. @@ -2491,26 +2528,271 @@ async def get(self, resource_group_name: str, catalog_name: str, image_name: str "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + @overload + async def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. - cls: ClsType[_models.Image] = kwargs.pop("cls", None) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param body: Image upload request body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ - _request = build_images_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, + @overload + async def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param body: Image upload request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_upload_image( + self, resource_group_name: str, catalog_name: str, body: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + # pylint: disable=line-too-long + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param body: Image upload request body. Is one of the following types: Image, JSON, IO[bytes] + Required. + :type body: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._upload_image_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s + :attr:`certificates` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any + ) -> _models.Certificate: + # pylint: disable=line-too-long + """Get a Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "certificate": "str", # Optional. The certificate as a UTF-8 encoded + base 64 string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate + expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate + not before date. + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values + are: "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + + _request = build_certificates_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + serial_number=serial_number, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -2535,7 +2817,7 @@ async def get(self, resource_group_name: str, catalog_name: str, image_name: str if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Image, response.json()) + deserialized = _deserialize(_models.Certificate, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2552,9 +2834,9 @@ def list_by_catalog( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.Image"]: + ) -> AsyncIterable["_models.Certificate"]: # pylint: disable=line-too-long - """List Image resources by Catalog. + """List Certificate resources by Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2567,8 +2849,8 @@ def list_by_catalog( :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of Image - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Image] + :return: An iterator like instance of Certificate + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -2576,32 +2858,23 @@ def list_by_catalog( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "certificate": "str", # Optional. The certificate as a UTF-8 encoded + base 64 string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate + expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate + not before date. "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. + "status": "str", # Optional. The certificate status. Known values + are: "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2618,14 +2891,16 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -2638,15 +2913,15 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - _request = build_images_list_by_catalog_request( + _request = build_certificates_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - api_version=self._config.api_version, filter=filter, top=top, skip=skip, maxpagesize=maxpagesize, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -2671,7 +2946,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Image], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Certificate], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2696,14 +2971,33 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - image_name: str, - resource: Union[_models.Image, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: + @distributed_trace_async + async def retrieve_cert_chain( + self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any + ) -> _models.CertificateChainResponse: + """Retrieves cert chain. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :return: CertificateChainResponse. The CertificateChainResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CertificateChainResponse + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "certificateChain": "str" # Optional. The certificate chain. + } + """ error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2712,391 +3006,359 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) - _request = build_images_create_or_update_request( + _request = build_certificates_retrieve_cert_chain_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - image_name=image_name, + serial_number=serial_number, subscription_id=self._config.subscription_id, api_version=self._config.api_version, - content_type=content_type, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CertificateChainResponse, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - async def begin_create_or_update( + async def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: _models.Image, + serial_number: str, + body: _models.ProofOfPossessionNonceRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Create a Image. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Image + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + body = { + "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. } - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ @overload - async def begin_create_or_update( + async def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: JSON, + serial_number: str, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Create a Image. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ @overload - async def begin_create_or_update( + async def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: IO[bytes], + serial_number: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Create a Image. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ @distributed_trace_async - async def begin_create_or_update( + async def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: Union[_models.Image, JSON, IO[bytes]], + serial_number: str, + body: Union[_models.ProofOfPossessionNonceRequest, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Create a Image. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Is one of the following types: Image, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Is one of the following types: + ProofOfPossessionNonceRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest or JSON or IO[bytes] + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + body = { + "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. + } + + # response body for status code(s): 200 + response == { + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProofOfPossessionNonceResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificates_retrieve_proof_of_possession_nonce_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + serial_number=serial_number, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProofOfPossessionNonceResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s + :attr:`images` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: + # pylint: disable=line-too-long + """Get a Image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :return: Image. The Image is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Image + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. "description": "str", # Optional. The image description. @@ -3133,105 +3395,67 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Image] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Image, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + _request = build_images_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Image].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Image]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> None: + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Image, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + image_name: str, + resource: Union[_models.Image, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3240,17 +3464,27 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_images_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_images_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, image_name=image_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -3263,7 +3497,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 201]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -3271,146 +3505,78 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) -class DeviceGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + deserialized = _deserialize(JSON, response.json()) - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`device_groups` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - 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") + return deserialized # type: ignore - @distributed_trace - def list_by_product( + @overload + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, + image_name: str, + resource: _models.Image, *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: + ) -> AsyncLROPoller[_models.Image]: # pylint: disable=line-too-long - """List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values - and cannot be used for product name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Image + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3427,133 +3593,117 @@ def list_by_product( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_device_groups_list_by_product_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - return AsyncItemPaged(get_next, extract_data) + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ - @distributed_trace_async - async def get( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.DeviceGroup: + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + image_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Image]: # pylint: disable=line-too-long - """Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.DeviceGroup + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3570,163 +3720,118 @@ async def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + image_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Image]: + # pylint: disable=line-too-long + """Create a Image. - cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: - _request = build_device_groups_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DeviceGroup, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - resource: Union[_models.DeviceGroup, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_device_groups_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + Example: + .. code-block:: python - return deserialized # type: ignore + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ - @overload + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - resource: _models.DeviceGroup, - *, - content_type: str = "application/json", + image_name: str, + resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Image]: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Is one of the following types: Image, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -3734,28 +3839,29 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3772,33 +3878,36 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3815,72 +3924,218 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Image, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Image].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_images_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Image. - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: - # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. - :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_catalog( + self, + resource_group_name: str, + catalog_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Image"]: + # pylint: disable=line-too-long + """List Image resources by Catalog. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Image + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3897,105 +4152,111 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: - # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_images_list_by_catalog_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } - } - """ + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Image], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ProductsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s + :attr:`products` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - resource: Union[_models.DeviceGroup, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + async def get( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> _models.Product: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4004,86 +4265,23 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Is one of the following types: DeviceGroup, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: Product. The Product is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Product :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4100,77 +4298,28 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DeviceGroup, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[_models.Product] = kwargs.pop("cls", None) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DeviceGroup]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_device_groups_delete_request( + _request = build_products_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -4178,96 +4327,38 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ) _request.url = self._client.format_url(_request.url) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Product, response.json()) if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return deserialized # type: ignore - async def _update_initial( + async def _create_or_update_initial( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + resource: Union[_models.Product, JSON, IO[bytes]], **kwargs: Any - ) -> Optional[JSON]: + ) -> JSON: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4280,20 +4371,19 @@ async def _update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_device_groups_update_request( + _request = build_products_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -4310,42 +4400,41 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} if response.status_code == 200: deserialized = _deserialize(JSON, response.json()) - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = _deserialize(JSON, response.json()) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - properties: _models.DeviceGroupUpdate, + resource: _models.Product, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Product]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4354,61 +4443,60 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Product :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - } + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4425,25 +4513,26 @@ async def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - properties: JSON, + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Product]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4452,45 +4541,29 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON + :param resource: Resource create parameters. Required. + :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4507,25 +4580,26 @@ async def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - properties: IO[bytes], + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Product]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4534,45 +4608,29 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4589,23 +4647,24 @@ async def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @distributed_trace_async - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + resource: Union[_models.Product, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Product]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4614,59 +4673,58 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DeviceGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :param resource: Resource create parameters. Is one of the following types: Product, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Product or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - } + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4683,24 +4741,25 @@ async def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.Product] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, - properties=properties, + resource=resource, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -4711,7 +4770,7 @@ async def begin_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.DeviceGroup, response.json()) + deserialized = _deserialize(_models.Product, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4723,44 +4782,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( + return AsyncLROPoller[_models.Product].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.DeviceGroup]( + return AsyncLROPoller[_models.Product]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def count_devices( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: - """Counts devices in device group. '.default' and '.unassigned' are system defined values and - cannot be used for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "value": 0 # Number of children resources in parent resource. Required. - } - """ + async def _update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Optional[JSON]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4769,61 +4808,74 @@ async def count_devices( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) - _request = build_device_groups_count_devices_request( + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_products_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def claim_devices( # pylint: disable=inconsistent-return-statements + async def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: _models.ClaimDevicesRequest, + properties: _models.ProductUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4832,42 +4884,72 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - claim_devices_request = { - "deviceIdentifiers": [ - "str" # Device identifiers of the devices to be claimed. Required. - ] + properties = { + "properties": { + "description": "str" # Optional. Description of the product. + } + } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def claim_devices( # pylint: disable=inconsistent-return-statements + async def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: JSON, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4876,32 +4958,65 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: JSON + :param properties: The resource properties to be updated. Required. + :type properties: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } """ @overload - async def claim_devices( # pylint: disable=inconsistent-return-statements + async def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: IO[bytes], + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4910,30 +5025,63 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: IO[bytes] + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } """ @distributed_trace_async - async def claim_devices( # pylint: disable=inconsistent-return-statements + async def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], + properties: Union[_models.ProductUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4942,26 +5090,104 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Is one of the following types: - ClaimDevicesRequest, JSON, IO[bytes] Required. - :type claim_devices_request: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest or JSON or - IO[bytes] - :return: None - :rtype: None + :param properties: The resource properties to be updated. Is one of the following types: + ProductUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - claim_devices_request = { - "deviceIdentifiers": [ - "str" # Device identifiers of the devices to be claimed. Required. - ] + properties = { + "properties": { + "description": "str" # Optional. Description of the product. + } + } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Product] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Product, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Product].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Product]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4970,28 +5196,17 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(claim_devices_request, (IOBase, bytes)): - _content = claim_devices_request - else: - _content = json.dumps(claim_devices_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_device_groups_claim_devices_request( + _request = build_products_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -5004,7 +5219,7 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -5012,167 +5227,83 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`certificates` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( - self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any - ) -> _models.Certificate: - # pylint: disable=line-too-long - """Get a Certificate. + async def begin_delete( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name'. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :return: Certificate. The Certificate is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Certificate + :param product_name: Name of product. Required. + :type product_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded - base 64 string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate - expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate - not before date. - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values - are: "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - - _request = build_certificates_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - serial_number=serial_number, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - if _stream: - deserialized = response.iter_bytes() + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: - deserialized = _deserialize(_models.Certificate, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_catalog( - self, - resource_group_name: str, - catalog_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.Certificate"]: + self, resource_group_name: str, catalog_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Product"]: # pylint: disable=line-too-long - """List Certificate resources by Catalog. + """List Product resources by Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Certificate - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Certificate] + :return: An iterator like instance of Product + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5180,26 +5311,14 @@ def list_by_catalog( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded - base 64 string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate - expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate - not before date. - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values - are: "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5216,14 +5335,15 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -5236,15 +5356,11 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - _request = build_certificates_list_by_catalog_request( + _request = build_products_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, headers=_headers, params=_params, ) @@ -5269,7 +5385,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Certificate], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Product], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -5295,22 +5411,21 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def retrieve_cert_chain( - self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any - ) -> _models.CertificateChainResponse: - """Retrieves cert chain. + async def count_devices( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> _models.CountDevicesResponse: + """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be + used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :return: CertificateChainResponse. The CertificateChainResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CertificateChainResponse + :param product_name: Name of product. Required. + :type product_name: str + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5318,7 +5433,7 @@ async def retrieve_cert_chain( # response body for status code(s): 200 response == { - "certificateChain": "str" # Optional. The certificate chain. + "value": 0 # Number of children resources in parent resource. Required. } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -5332,12 +5447,12 @@ async def retrieve_cert_chain( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) - _request = build_certificates_retrieve_cert_chain_request( + _request = build_products_count_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - serial_number=serial_number, + product_name=product_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5362,227 +5477,82 @@ async def retrieve_cert_chain( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CertificateChainResponse, response.json()) + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: _models.ProofOfPossessionNonceRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + @distributed_trace + def generate_default_device_groups( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Generates default device groups for the product. '.default' and '.unassigned' are system + defined values and cannot be used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :param product_name: Name of product. Required. + :type product_name: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - parameters = { - "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. - } - # response body for status code(s): 200 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - } - """ - - @overload - async def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: - # pylint: disable=line-too-long - """Gets the proof of possession nonce. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - } - """ - - @overload - async def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: - # pylint: disable=line-too-long - """Gets the proof of possession nonce. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @distributed_trace_async - async def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: Union[_models.ProofOfPossessionNonceRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: - # pylint: disable=line-too-long - """Gets the proof of possession nonce. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Is one of the following types: - ProofOfPossessionNonceRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest or JSON or - IO[bytes] - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - parameters = { - "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. - } + cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - # response body for status code(s): 200 - response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - } - """ error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5591,65 +5561,73 @@ async def retrieve_proof_of_possession_nonce( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProofOfPossessionNonceResponse] = kwargs.pop("cls", None) + _request = build_products_generate_default_device_groups_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - _request = build_certificates_retrieve_proof_of_possession_nonce_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - serial_number=serial_number, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + return _request - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProofOfPossessionNonceResponse, response.json()) + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) -class DeploymentsOperations: +class DeviceGroupsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`deployments` attribute. + :attr:`device_groups` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -5661,17 +5639,11 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - deployment_name: str, - **kwargs: Any - ) -> _models.Deployment: + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> _models.DeviceGroup: # pylint: disable=line-too-long - """Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - product or device group name. + """Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5682,11 +5654,8 @@ async def get( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Deployment + :return: DeviceGroup. The DeviceGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.DeviceGroup :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5694,74 +5663,25 @@ async def get( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5778,7 +5698,9 @@ async def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -5792,14 +5714,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) - _request = build_deployments_get_request( + _request = build_device_groups_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5824,29 +5745,100 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Deployment, response.json()) + deserialized = _deserialize(_models.DeviceGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_device_group( + async def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: Union[_models.DeviceGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_device_groups_create_or_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(JSON, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, + resource: _models.DeviceGroup, *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.Deployment"]: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined - values and cannot be used for product or device group name. + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5857,89 +5849,82 @@ def list_by_device_group( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Deployment - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Deployment] + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5956,159 +5941,11 @@ def list_by_device_group( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_deployments_list_by_device_group_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Deployment], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - deployment_name: str, - resource: Union[_models.Deployment, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_deployments_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore @overload async def begin_create_or_update( @@ -6117,14 +5954,13 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, - resource: _models.Deployment, + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Deployment]: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6136,92 +5972,40 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Deployment + :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6238,96 +6022,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -6338,14 +6035,13 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, - resource: JSON, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Deployment]: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6357,17 +6053,14 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -6375,74 +6068,25 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6459,25 +6103,24 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @overload + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", + resource: Union[_models.DeviceGroup, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Deployment]: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6489,92 +6132,457 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + :param resource: Resource create parameters. Is one of the following types: DeviceGroup, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeviceGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Optional[JSON]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_device_groups_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: _models.DeviceGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + } + } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6591,24 +6599,275 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param properties: The resource properties to be updated. Is one of the following types: + DeviceGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". } } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeviceGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_device_groups_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_create_or_update( + async def begin_delete( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_product( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - deployment_name: str, - resource: Union[_models.Deployment, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.Deployment]: + ) -> AsyncIterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values + and cannot be used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6617,181 +6876,40 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Is one of the following types: Deployment, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Deployment or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6808,64 +6926,94 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - deployment_name=deployment_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Deployment, response.json()) + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_device_groups_list_by_product_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Deployment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[_models.Deployment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response - async def _delete_initial( # pylint: disable=inconsistent-return-statements + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _claim_devices_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + body: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -6876,19 +7024,28 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_deployments_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_device_groups_claim_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6901,7 +7058,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -6909,25 +7066,136 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore + @overload + async def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: _models.ClaimDevicesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "deviceIdentifiers": [ + "str" # Device identifiers of the devices to be claimed. Required. + ] + } + """ + + @overload + async def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete( + async def begin_claim_devices( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + body: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6938,27 +7206,39 @@ async def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str + :param body: Bulk claim devices request body. Is one of the following types: + ClaimDevicesRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "deviceIdentifiers": [ + "str" # Device identifiers of the devices to be claimed. Required. + ] + } """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._claim_devices_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, + body=body, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -6985,15 +7265,92 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace_async + async def count_devices( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> _models.CountDevicesResponse: + """Counts devices in device group. '.default' and '.unassigned' are system defined values and + cannot be used for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "value": 0 # Number of children resources in parent resource. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) + + _request = build_device_groups_count_devices_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore -class DevicesOperations: + +class DeploymentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`devices` attribute. + :attr:`deployments` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -7010,12 +7367,12 @@ async def get( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any - ) -> _models.Device: + ) -> _models.Deployment: # pylint: disable=line-too-long - """Get a Device. Use '.unassigned' or '.default' for the device group and product names when a - device does not belong to a device group and product. + """Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7026,10 +7383,11 @@ async def get( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7037,23 +7395,68 @@ async def get( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7073,7 +7476,9 @@ async def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -7087,14 +7492,14 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - _request = build_devices_get_request( + _request = build_deployments_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7119,7 +7524,7 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(_models.Deployment, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7132,8 +7537,8 @@ async def _create_or_update_initial( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: Union[_models.Device, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any ) -> JSON: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -7157,12 +7562,12 @@ async def _create_or_update_initial( else: _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_devices_create_or_update_request( + _request = build_deployments_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -7207,15 +7612,15 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: _models.Device, + deployment_name: str, + resource: _models.Deployment, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: + ) -> AsyncLROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7226,16 +7631,17 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Device + :type resource: ~azure.mgmt.spheredpg.models.Deployment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] + :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7243,23 +7649,68 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7279,28 +7730,75 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7320,7 +7818,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -7331,15 +7831,15 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: + ) -> AsyncLROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7350,16 +7850,17 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :param resource: Resource create parameters. Required. :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] + :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7367,23 +7868,68 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7403,7 +7949,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -7414,15 +7962,15 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: + ) -> AsyncLROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7433,16 +7981,17 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :param resource: Resource create parameters. Required. :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] + :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7450,23 +7999,68 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7486,7 +8080,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -7497,13 +8093,13 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: Union[_models.Device, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: + ) -> AsyncLROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7514,14 +8110,15 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param resource: Resource create parameters. Is one of the following types: Device, JSON, + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str + :param resource: Resource create parameters. Is one of the following types: Deployment, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Device or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] + :type resource: ~azure.mgmt.spheredpg.models.Deployment or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7529,23 +8126,68 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7565,28 +8207,75 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7606,14 +8295,16 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -7623,176 +8314,39 @@ async def begin_create_or_update( catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Device, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Device].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Device]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_device_group( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Device"]: - # pylint: disable=line-too-long - """List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values - and cannot be used for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: An iterator like instance of Device - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Device] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_devices_list_by_device_group_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deployment_name=deployment_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Deployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Deployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Deployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -7800,7 +8354,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -7816,12 +8370,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_devices_delete_request( + _request = build_deployments_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7858,10 +8412,11 @@ async def begin_delete( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a Device. + """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7872,239 +8427,69 @@ async def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - device_name=device_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - device_name: str, - properties: _models.DeviceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Device: - # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "deviceGroupId": "str" # Optional. Device group id. - } - } - - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - - @overload - async def update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - device_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Device: - # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def update( + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + deployment_name=deployment_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_device_group( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - properties: IO[bytes], *, - content_type: str = "application/json", + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> _models.Device: + ) -> AsyncIterable["_models.Deployment"]: # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. + """List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined + values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8115,39 +8500,83 @@ async def update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Deployment + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8167,24 +8596,119 @@ async def update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_by_device_group_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Deployment], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DevicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s + :attr:`devices` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def update( + async def get( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.Device: # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. + """Get a Device. Use '.unassigned' or '.default' for the device group and product names when a + device does not belong to a device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8197,31 +8721,18 @@ async def update( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DeviceUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] :return: Device. The Device is compatible with MutableMapping :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "deviceGroupId": "str" # Optional. Device group id. - } - } + .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "chipSku": "str", # Optional. SKU of the chip. "deviceId": "str", # Optional. Device ID. @@ -8252,7 +8763,9 @@ async def update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -8263,20 +8776,80 @@ async def update( } error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + + _request = build_devices_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + resource: Union[_models.Device, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_devices_update_request( + _request = build_devices_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -8291,14 +8864,14 @@ async def update( ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -8307,18 +8880,12 @@ async def update( response_headers = {} if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(JSON, response.json()) - if response.status_code == 202: + if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(JSON, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8326,21 +8893,21 @@ async def update( return deserialized # type: ignore @overload - async def generate_capability_image( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: _models.GenerateCapabilityImageRequest, + resource: _models.Device, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> AsyncLROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8353,49 +8920,116 @@ async def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Device :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "capabilities": [ - "str" # List of capabilities to create. Required. - ] + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def generate_capability_image( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: JSON, + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> AsyncLROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8408,42 +9042,76 @@ async def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: JSON + :param resource: Resource create parameters. Required. + :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def generate_capability_image( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: IO[bytes], + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> AsyncLROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8456,40 +9124,74 @@ async def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: IO[bytes] + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @distributed_trace_async - async def generate_capability_image( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], + resource: Union[_models.Device, JSON, IO[bytes]], **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> AsyncLROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8502,148 +9204,73 @@ async def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Is one of the following types: - GenerateCapabilityImageRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or - IO[bytes] - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :param resource: Resource create parameters. Is one of the following types: Device, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Device or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "capabilities": [ - "str" # List of capabilities to create. Required. - ] - } - - # response body for status code(s): 200, 202 - response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SignedCapabilityImageResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_devices_generate_capability_image_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - device_name=device_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) - - if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - -class ProductsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`products` attribute. - """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_catalog( - self, resource_group_name: str, catalog_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Product"]: - # pylint: disable=line-too-long - """List Product resources by Catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :return: An iterator like instance of Product - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8663,86 +9290,75 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_products_list_by_catalog_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Product], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Device, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Device].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Device]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace_async - async def get( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> _models.Product: + @overload + async def update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + properties: _models.DeviceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Device: # pylint: disable=line-too-long - """Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8751,23 +9367,45 @@ async def get( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :return: Product. The Product is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Product + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "deviceGroupId": "str" # Optional. Device group id. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8787,141 +9425,28 @@ async def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Product] = kwargs.pop("cls", None) - - _request = build_products_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Product, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - resource: Union[_models.Product, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_products_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore @overload - async def begin_create_or_update( + async def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: _models.Product, + device_group_name: str, + device_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8930,61 +9455,38 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Product + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :paramtype content_type: str + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9004,24 +9506,28 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def begin_create_or_update( + async def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: JSON, + device_group_name: str, + device_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9030,29 +9536,38 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9072,24 +9587,26 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @overload - async def begin_create_or_update( + @distributed_trace_async + async def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", + device_group_name: str, + device_name: str, + properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9098,29 +9615,43 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Is one of the following types: + DeviceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "deviceGroupId": "str" # Optional. Device group id. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9140,22 +9671,149 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_devices_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_devices_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_create_or_update( + async def begin_delete( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: Union[_models.Product, JSON, IO[bytes]], + device_group_name: str, + device_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[None]: + """Delete a Device. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9164,96 +9822,28 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Is one of the following types: Product, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Product or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Product] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - resource=resource, - content_type=content_type, + device_group_name=device_group_name, + device_name=device_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -9261,12 +9851,9 @@ async def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Product, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -9275,19 +9862,83 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Product].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Product]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_device_group( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Device"]: + # pylint: disable=line-too-long + """List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values + and cannot be used for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: An iterator like instance of Device + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Device] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9296,106 +9947,73 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_products_delete_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + def prepare_request(next_link=None): + if not next_link: - if response.status_code not in [200, 202, 204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _request = build_devices_list_by_device_group_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return _request - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name'. + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + async def get_next(next_link=None): + _request = prepare_request(next_link) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return pipeline_response - async def _update_initial( + return AsyncItemPaged(get_next, extract_data) + + async def _generate_capability_image_initial( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + device_group_name: str, + device_name: str, + body: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -9414,15 +10032,17 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_products_update_request( + _request = build_devices_generate_capability_image_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -9461,19 +10081,21 @@ async def _update_initial( return deserialized # type: ignore @overload - async def begin_update( + async def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: _models.ProductUpdate, + device_group_name: str, + device_name: str, + body: _models.GenerateCapabilityImageRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9482,73 +10104,54 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of AsyncLROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "description": "str" # Optional. Description of the product. - } + body = { + "capabilities": [ + "str" # List of capabilities to create. Required. + ] } - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @overload - async def begin_update( + async def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: JSON, + device_group_name: str, + device_name: str, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9557,66 +10160,47 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of AsyncLROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @overload - async def begin_update( + async def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: IO[bytes], + device_group_name: str, + device_name: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9625,64 +10209,45 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of AsyncLROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @distributed_trace_async - async def begin_update( + async def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + device_group_name: str, + device_name: str, + body: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9691,70 +10256,51 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Is one of the following types: - ProductUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Is one of the following types: + GenerateCapabilityImageRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "description": "str" # Optional. Description of the product. - } + body = { + "capabilities": [ + "str" # List of capabilities to create. Required. + ] } - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Product] = kwargs.pop("cls", None) + cls: ClsType[_models.SignedCapabilityImageResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._generate_capability_image_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - properties=properties, + device_group_name=device_group_name, + device_name=device_name, + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -9764,10 +10310,14 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} response = pipeline_response.http_response - deserialized = _deserialize(_models.Product, response.json()) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -9777,222 +10327,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Product].from_continuation_token( + return AsyncLROPoller[_models.SignedCapabilityImageResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Product]( + return AsyncLROPoller[_models.SignedCapabilityImageResponse]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - @distributed_trace - def generate_default_device_groups( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: - # pylint: disable=line-too-long - """Generates default device groups for the product. '.default' and '.unassigned' are system - defined values and cannot be used for product name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_products_generate_default_device_groups_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def count_devices( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: - """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be - used for product name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "value": 0 # Number of children resources in parent resource. Required. - } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) - - _request = build_products_count_devices_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/apiview_mapping_python.json deleted file mode 100644 index c98ca40672b..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/apiview_mapping_python.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "CrossLanguagePackageId": "Microsoft.AzureSphere", - "CrossLanguageDefinitionId": { - "azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState": "Azure.ResourceManager.ArmOperationStatus", - "azure.mgmt.spheredpg.models.ArmResourceBase": "Azure.ResourceManager.Foundations.ArmResourceBase", - "azure.mgmt.spheredpg.models.ArmResource": "Azure.ResourceManager.Foundations.ArmResource", - "azure.mgmt.spheredpg.models.TrackedResourceBase": "Azure.ResourceManager.Foundations.TrackedResourceBase", - "azure.mgmt.spheredpg.models.Catalog": "Microsoft.AzureSphere.Catalog", - "azure.mgmt.spheredpg.models.CatalogListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.CatalogProperties": "Microsoft.AzureSphere.CatalogProperties", - "azure.mgmt.spheredpg.models.CatalogUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.ProxyResourceBase": "Azure.ResourceManager.Foundations.ProxyResourceBase", - "azure.mgmt.spheredpg.models.Certificate": "Microsoft.AzureSphere.Certificate", - "azure.mgmt.spheredpg.models.CertificateChainResponse": "Microsoft.AzureSphere.CertificateChainResponse", - "azure.mgmt.spheredpg.models.CertificateListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.CertificateProperties": "Microsoft.AzureSphere.CertificateProperties", - "azure.mgmt.spheredpg.models.ClaimDevicesRequest": "Microsoft.AzureSphere.ClaimDevicesRequest", - "azure.mgmt.spheredpg.models.CountElementsResponse": "Microsoft.AzureSphere.CountElementsResponse", - "azure.mgmt.spheredpg.models.CountDeviceResponse": "Microsoft.AzureSphere.CountDeviceResponse", - "azure.mgmt.spheredpg.models.Deployment": "Microsoft.AzureSphere.Deployment", - "azure.mgmt.spheredpg.models.DeploymentListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.DeploymentProperties": "Microsoft.AzureSphere.DeploymentProperties", - "azure.mgmt.spheredpg.models.Device": "Microsoft.AzureSphere.Device", - "azure.mgmt.spheredpg.models.DeviceGroup": "Microsoft.AzureSphere.DeviceGroup", - "azure.mgmt.spheredpg.models.DeviceGroupListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.DeviceGroupProperties": "Microsoft.AzureSphere.DeviceGroupProperties", - "azure.mgmt.spheredpg.models.DeviceGroupUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.DeviceGroupUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "azure.mgmt.spheredpg.models.DeviceInsight": "Microsoft.AzureSphere.DeviceInsight", - "azure.mgmt.spheredpg.models.DeviceListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.DeviceProperties": "Microsoft.AzureSphere.DeviceProperties", - "azure.mgmt.spheredpg.models.DeviceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.DeviceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "azure.mgmt.spheredpg.models.ErrorAdditionalInfo": "Azure.ResourceManager.Foundations.ErrorAdditionalInfo", - "azure.mgmt.spheredpg.models.ErrorDetail": "Azure.ResourceManager.Foundations.ErrorDetail", - "azure.mgmt.spheredpg.models.ErrorResponse": "Azure.ResourceManager.ErrorResponse", - "azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest": "Microsoft.AzureSphere.GenerateCapabilityImageRequest", - "azure.mgmt.spheredpg.models.Image": "Microsoft.AzureSphere.Image", - "azure.mgmt.spheredpg.models.ImageListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.ImageProperties": "Microsoft.AzureSphere.ImageProperties", - "azure.mgmt.spheredpg.models.ListDeviceGroupsRequest": "Microsoft.AzureSphere.ListDeviceGroupsRequest", - "azure.mgmt.spheredpg.models.Operation": "Azure.ResourceManager.Foundations.Operation", - "azure.mgmt.spheredpg.models.OperationDisplay": "Azure.ResourceManager.Foundations.OperationDisplay", - "azure.mgmt.spheredpg.models.PagedOperation": "Azure.ResourceManager.Foundations.OperationListResult", - "azure.mgmt.spheredpg.models.Product": "Microsoft.AzureSphere.Product", - "azure.mgmt.spheredpg.models.ProductListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.ProductProperties": "Microsoft.AzureSphere.ProductProperties", - "azure.mgmt.spheredpg.models.ProductUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.ProductUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest": "Microsoft.AzureSphere.ProofOfPossessionNonceRequest", - "azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse": "Microsoft.AzureSphere.ProofOfPossessionNonceResponse", - "azure.mgmt.spheredpg.models.SignedCapabilityImageResponse": "Microsoft.AzureSphere.SignedCapabilityImageResponse", - "azure.mgmt.spheredpg.models.SystemData": "Azure.ResourceManager.Foundations.SystemData", - "azure.mgmt.spheredpg.models.CreatedByType": "Azure.ResourceManager.Foundations.createdByType", - "azure.mgmt.spheredpg.models.ProvisioningState": "Microsoft.AzureSphere.ProvisioningState", - "azure.mgmt.spheredpg.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", - "azure.mgmt.spheredpg.models.OSFeedType": "Microsoft.AzureSphere.OSFeedType", - "azure.mgmt.spheredpg.models.UpdatePolicy": "Microsoft.AzureSphere.UpdatePolicy", - "azure.mgmt.spheredpg.models.AllowCrashDumpCollection": "Microsoft.AzureSphere.AllowCrashDumpCollection", - "azure.mgmt.spheredpg.models.RegionalDataBoundary": "Microsoft.AzureSphere.RegionalDataBoundary", - "azure.mgmt.spheredpg.models.CapabilityType": "Microsoft.AzureSphere.CapabilityType", - "azure.mgmt.spheredpg.models.ImageType": "Microsoft.AzureSphere.ImageType", - "azure.mgmt.spheredpg.models.CertificateStatus": "Microsoft.AzureSphere.CertificateStatus", - "azure.mgmt.spheredpg.models.Origin": "Azure.ResourceManager.Foundations.Origin", - "azure.mgmt.spheredpg.models.ActionType": "Azure.ResourceManager.Foundations.ActionType", - "azure.mgmt.spheredpg.AzureSphereClient.operations.list": "list", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.update": "update", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_resource_group": "listByResourceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_subscription": "listBySubscription", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.count_devices": "countDevices", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_insights": "listDeviceInsights", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_devices": "listDevices", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_deployments": "listDeployments", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_groups": "listDeviceGroups", - "azure.mgmt.spheredpg.AzureSphereClient.images.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.images.list_by_catalog": "listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.images.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.images.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.list_by_product": "listByProduct", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_update": "update", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.count_devices": "countDevices", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.claim_devices": "claimDevices", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.list_by_catalog": "listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_cert_chain": "retrieveCertChain", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_proof_of_possession_nonce": "retrieveProofOfPossessionNonce", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.list_by_device_group": "listByDeviceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.devices.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.devices.list_by_device_group": "listByDeviceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.devices.update": "update", - "azure.mgmt.spheredpg.AzureSphereClient.devices.generate_capability_image": "generateCapabilityImage", - "azure.mgmt.spheredpg.AzureSphereClient.products.list_by_catalog": "listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.products.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_update": "update", - "azure.mgmt.spheredpg.AzureSphereClient.products.generate_default_device_groups": "generateDefaultDeviceGroups", - "azure.mgmt.spheredpg.AzureSphereClient.products.count_devices": "countDevices" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py index 73e830ed238..35a4fb93890 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py @@ -6,9 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models import ArmOperationStatusResourceProvisioningState -from ._models import ArmResource -from ._models import ArmResourceBase +from ._models import ArmOperationStatus from ._models import Catalog from ._models import CatalogListResult from ._models import CatalogProperties @@ -18,7 +16,7 @@ from ._models import CertificateListResult from ._models import CertificateProperties from ._models import ClaimDevicesRequest -from ._models import CountDeviceResponse +from ._models import CountDevicesResponse from ._models import CountElementsResponse from ._models import Deployment from ._models import DeploymentListResult @@ -44,6 +42,7 @@ from ._models import ListDeviceGroupsRequest from ._models import Operation from ._models import OperationDisplay +from ._models import PagedDeviceInsight from ._models import PagedOperation from ._models import Product from ._models import ProductListResult @@ -52,10 +51,11 @@ from ._models import ProductUpdateProperties from ._models import ProofOfPossessionNonceRequest from ._models import ProofOfPossessionNonceResponse -from ._models import ProxyResourceBase +from ._models import ProxyResource +from ._models import Resource from ._models import SignedCapabilityImageResponse from ._models import SystemData -from ._models import TrackedResourceBase +from ._models import TrackedResource from ._enums import ActionType from ._enums import AllowCrashDumpCollection @@ -74,9 +74,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ArmOperationStatusResourceProvisioningState", - "ArmResource", - "ArmResourceBase", + "ArmOperationStatus", "Catalog", "CatalogListResult", "CatalogProperties", @@ -86,7 +84,7 @@ "CertificateListResult", "CertificateProperties", "ClaimDevicesRequest", - "CountDeviceResponse", + "CountDevicesResponse", "CountElementsResponse", "Deployment", "DeploymentListResult", @@ -112,6 +110,7 @@ "ListDeviceGroupsRequest", "Operation", "OperationDisplay", + "PagedDeviceInsight", "PagedOperation", "Product", "ProductListResult", @@ -120,10 +119,11 @@ "ProductUpdateProperties", "ProofOfPossessionNonceRequest", "ProofOfPossessionNonceResponse", - "ProxyResourceBase", + "ProxyResource", + "Resource", "SignedCapabilityImageResponse", "SystemData", - "TrackedResourceBase", + "TrackedResource", "ActionType", "AllowCrashDumpCollection", "CapabilityType", diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_enums.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_enums.py index df8347d69c3..3964d580f2a 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_enums.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_enums.py @@ -11,7 +11,9 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ INTERNAL = "Internal" """Actions are for internal-only APIs.""" @@ -137,7 +139,7 @@ class OSFeedType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the resource.""" + """Provisioning state of resource.""" SUCCEEDED = "Succeeded" """Resource has been created.""" diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py index be6ced9f961..92ef644147d 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py @@ -18,7 +18,7 @@ from .. import models as _models -class ArmOperationStatusResourceProvisioningState(_model_base.Model): # pylint: disable=name-too-long +class ArmOperationStatus(_model_base.Model): """Standard Azure Resource Manager operation status response. Readonly variables are only populated by the server, and will be ignored when sending a request. @@ -71,42 +71,39 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class ArmResourceBase(_model_base.Model): - """Base class used for type definitions.""" - - -class ArmResource(ArmResourceBase): +class Resource(_model_base.Model): """Common properties for all Azure Resource Manager resources. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.spheredpg.models.SystemData """ - id: str = rest_field(visibility=["read"]) + id: Optional[str] = rest_field(visibility=["read"]) """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required.""" - type: str = rest_field(visibility=["read"]) + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or - \"Microsoft.Storage/storageAccounts\". Required.""" + \"Microsoft.Storage/storageAccounts\".""" system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" -class TrackedResourceBase(ArmResource): - """The resource model definition for an Azure Resource Manager tracked top level resource. +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Readonly variables are only populated by the server, and will be ignored when sending a request. @@ -114,10 +111,11 @@ class TrackedResourceBase(ArmResource): :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -152,7 +150,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Catalog(TrackedResourceBase): +class Catalog(TrackedResource): """An Azure Sphere catalog. Readonly variables are only populated by the server, and will be ignored when sending a request. @@ -161,10 +159,11 @@ class Catalog(TrackedResourceBase): :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -240,11 +239,15 @@ class CatalogProperties(_model_base.Model): Readonly variables are only populated by the server, and will be ignored when sending a request. + :ivar tenant_id: The Azure Sphere tenant ID associated with the catalog. + :vartype tenant_id: str :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". :vartype provisioning_state: str or ~azure.mgmt.spheredpg.models.ProvisioningState """ + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The Azure Sphere tenant ID associated with the catalog.""" provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] ) @@ -280,19 +283,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class ProxyResourceBase(ArmResource): +class ProxyResource(Resource): """The base proxy resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -300,19 +302,18 @@ class ProxyResourceBase(ArmResource): """ -class Certificate(ProxyResourceBase): +class Certificate(ProxyResource): """An certificate resource belonging to a catalog resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -493,7 +494,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class CountDeviceResponse(CountElementsResponse): +class CountDevicesResponse(CountElementsResponse): """Response to the action call for count devices in a catalog. All required parameters must be populated in order to send to server. @@ -520,19 +521,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Deployment(ProxyResourceBase): +class Deployment(ProxyResource): """An deployment resource belonging to a device group resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -646,19 +646,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Device(ProxyResourceBase): +class Device(ProxyResource): """An device resource belonging to a device group resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -688,19 +687,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class DeviceGroup(ProxyResourceBase): +class DeviceGroup(ProxyResource): """An device group resource belonging to a product resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -842,11 +840,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DeviceGroupUpdate(_model_base.Model): """The type used for update operations of the DeviceGroup. - :ivar properties: + :ivar properties: The updatable properties of the DeviceGroup. :vartype properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdateProperties """ properties: Optional["_models.DeviceGroupUpdateProperties"] = rest_field() + """The updatable properties of the DeviceGroup.""" @overload def __init__( @@ -1091,11 +1090,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DeviceUpdate(_model_base.Model): """The type used for update operations of the Device. - :ivar properties: + :ivar properties: The updatable properties of the Device. :vartype properties: ~azure.mgmt.spheredpg.models.DeviceUpdateProperties """ properties: Optional["_models.DeviceUpdateProperties"] = rest_field() + """The updatable properties of the Device.""" @overload def __init__( @@ -1250,19 +1250,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Image(ProxyResourceBase): +class Image(ProxyResource): """An image resource belonging to a catalog resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -1455,8 +1454,8 @@ class Operation(_model_base.Model): (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", and "user,system". :vartype origin: str or ~azure.mgmt.spheredpg.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" :vartype action_type: str or ~azure.mgmt.spheredpg.models.ActionType """ @@ -1474,8 +1473,8 @@ class Operation(_model_base.Model): logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and \"user,system\".""" action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType") - """Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only - APIs. \"Internal\"""" + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" @overload def __init__( @@ -1547,6 +1546,41 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class PagedDeviceInsight(_model_base.Model): + """Paged collection of DeviceInsight items. + + All required parameters must be populated in order to send to server. + + :ivar value: The DeviceInsight items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.DeviceInsight] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.DeviceInsight"] = rest_field() + """The DeviceInsight items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.DeviceInsight"], + next_link: Optional[str] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class PagedOperation(_model_base.Model): """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. @@ -1583,19 +1617,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Product(ProxyResourceBase): +class Product(ProxyResource): """An product resource belonging to a catalog resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :vartype id: str + :ivar name: The name of the resource. + :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -1665,17 +1698,15 @@ class ProductProperties(_model_base.Model): Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar description: Description of the product. Required. + :ivar description: Description of the product. :vartype description: str :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". :vartype provisioning_state: str or ~azure.mgmt.spheredpg.models.ProvisioningState """ - description: str = rest_field() - """Description of the product. Required.""" + description: Optional[str] = rest_field() + """Description of the product.""" provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] ) @@ -1686,7 +1717,7 @@ class ProductProperties(_model_base.Model): def __init__( self, *, - description: str, + description: Optional[str] = None, ): ... @overload @@ -1703,11 +1734,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class ProductUpdate(_model_base.Model): """The type used for update operations of the Product. - :ivar properties: + :ivar properties: The updatable properties of the Product. :vartype properties: ~azure.mgmt.spheredpg.models.ProductUpdateProperties """ properties: Optional["_models.ProductUpdateProperties"] = rest_field() + """The updatable properties of the Product.""" @overload def __init__( diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/__init__.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/__init__.py index 868f22c85ea..c05eeb4ce12 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/__init__.py @@ -7,14 +7,13 @@ # -------------------------------------------------------------------------- from ._operations import Operations -from ._operations import CustomUpdateOperationsOperations from ._operations import CatalogsOperations +from ._operations import CertificatesOperations from ._operations import ImagesOperations +from ._operations import ProductsOperations from ._operations import DeviceGroupsOperations -from ._operations import CertificatesOperations from ._operations import DeploymentsOperations from ._operations import DevicesOperations -from ._operations import ProductsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -22,14 +21,13 @@ __all__ = [ "Operations", - "CustomUpdateOperationsOperations", "CatalogsOperations", + "CertificatesOperations", "ImagesOperations", + "ProductsOperations", "DeviceGroupsOperations", - "CertificatesOperations", "DeploymentsOperations", "DevicesOperations", - "ProductsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py index 7760da64b5d..dab1eb134cf 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py @@ -45,10 +45,11 @@ _SERIALIZER.client_side_validation = False -def build_operations_list_request(*, api_version: str, **kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,11 +65,12 @@ def build_operations_list_request(*, api_version: str, **kwargs: Any) -> HttpReq def build_catalogs_get_request( - resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any + resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,12 +93,13 @@ def build_catalogs_get_request( def build_catalogs_create_or_update_request( - resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any + resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,12 +124,13 @@ def build_catalogs_create_or_update_request( def build_catalogs_update_request( - resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any + resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,11 +155,12 @@ def build_catalogs_update_request( def build_catalogs_delete_request( - resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any + resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,11 +183,12 @@ def build_catalogs_delete_request( def build_catalogs_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, *, api_version: str, **kwargs: Any + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,11 +210,12 @@ def build_catalogs_list_by_resource_group_request( # pylint: disable=name-too-l def build_catalogs_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, *, api_version: str, **kwargs: Any + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +241,7 @@ def build_catalogs_count_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -256,7 +263,7 @@ def build_catalogs_count_devices_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_catalogs_list_device_insights_request( # pylint: disable=name-too-long +def build_catalogs_list_deployments_request( resource_group_name: str, catalog_name: str, subscription_id: str, @@ -270,11 +277,11 @@ def build_catalogs_list_device_insights_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -300,7 +307,7 @@ def build_catalogs_list_device_insights_request( # pylint: disable=name-too-lon return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_catalogs_list_devices_request( +def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, subscription_id: str, @@ -314,11 +321,12 @@ def build_catalogs_list_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -339,12 +347,14 @@ def build_catalogs_list_devices_request( _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_catalogs_list_deployments_request( +def build_catalogs_list_device_insights_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, subscription_id: str, @@ -358,11 +368,11 @@ def build_catalogs_list_deployments_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -388,7 +398,7 @@ def build_catalogs_list_deployments_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long +def build_catalogs_list_devices_request( resource_group_name: str, catalog_name: str, subscription_id: str, @@ -402,12 +412,11 @@ def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -428,34 +437,27 @@ def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_get_request( - resource_group_name: str, - catalog_name: str, - image_name: str, - subscription_id: str, - *, - api_version: str, - **kwargs: Any +def build_catalogs_upload_image_request( + resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/uploadImage" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -464,47 +466,34 @@ def build_images_get_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_list_by_catalog_request( - resource_group_name: str, - catalog_name: str, - subscription_id: str, - *, - api_version: str, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - maxpagesize: Optional[int] = None, - **kwargs: Any +def build_certificates_get_request( + resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), + "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "int") - if maxpagesize is not None: - _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -513,64 +502,66 @@ def build_images_list_by_catalog_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_create_or_update_request( +def build_certificates_list_by_catalog_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, - image_name: str, subscription_id: str, *, - api_version: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + maxpagesize: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if maxpagesize is not None: + _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_delete_request( - resource_group_name: str, - catalog_name: str, - image_name: str, - subscription_id: str, - *, - api_version: str, - **kwargs: Any +def build_certificates_retrieve_cert_chain_request( # pylint: disable=name-too-long + resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), + "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -581,77 +572,57 @@ def build_images_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_list_by_product_request( # pylint: disable=name-too-long - resource_group_name: str, - catalog_name: str, - product_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - maxpagesize: Optional[int] = None, - **kwargs: Any +def build_certificates_retrieve_proof_of_possession_nonce_request( # pylint: disable=name-too-long + resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "productName": _SERIALIZER.url("product_name", product_name, "str"), + "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "int") - if maxpagesize is not None: - _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_get_request( - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_images_get_request( + resource_group_name: str, catalog_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -665,29 +636,23 @@ def build_device_groups_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_images_create_or_update_request( + resource_group_name: str, catalog_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -703,28 +668,22 @@ def build_device_groups_create_or_update_request( # pylint: disable=name-too-lo return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_delete_request( - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_images_delete_request( + resource_group_name: str, catalog_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -738,66 +697,66 @@ def build_device_groups_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_update_request( +def build_images_list_by_catalog_request( resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + maxpagesize: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if maxpagesize is not None: + _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_count_devices_request( # pylint: disable=name-too-long - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_products_get_request( + resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -808,32 +767,26 @@ def build_device_groups_count_devices_request( # pylint: disable=name-too-long # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_claim_devices_request( # pylint: disable=name-too-long - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_products_create_or_update_request( + resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -846,30 +799,26 @@ def build_device_groups_claim_devices_request( # pylint: disable=name-too-long _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_certificates_get_request( - resource_group_name: str, - catalog_name: str, - serial_number: str, - subscription_id: str, - *, - api_version: str, - **kwargs: Any +def build_products_update_request( + resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), + "productName": _SERIALIZER.url("product_name", product_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -878,30 +827,53 @@ def build_certificates_get_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_certificates_list_by_catalog_request( # pylint: disable=name-too-long - resource_group_name: str, - catalog_name: str, - subscription_id: str, - *, - api_version: str, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - maxpagesize: Optional[int] = None, - **kwargs: Any +def build_products_delete_request( + resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), + "productName": _SERIALIZER.url("product_name", product_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_products_list_by_catalog_request( + resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -911,14 +883,6 @@ def build_certificates_list_by_catalog_request( # pylint: disable=name-too-long _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "int") - if maxpagesize is not None: - _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -927,22 +891,22 @@ def build_certificates_list_by_catalog_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_certificates_retrieve_cert_chain_request( # pylint: disable=name-too-long - resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any +def build_products_count_devices_request( + resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), + "productName": _SERIALIZER.url("product_name", product_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -956,23 +920,22 @@ def build_certificates_retrieve_cert_chain_request( # pylint: disable=name-too- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_certificates_retrieve_proof_of_possession_nonce_request( # pylint: disable=name-too-long - resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any +def build_products_generate_default_device_groups_request( # pylint: disable=name-too-long + resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), + "productName": _SERIALIZER.url("product_name", product_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -981,37 +944,33 @@ def build_certificates_retrieve_proof_of_possession_nonce_request( # pylint: di _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_get_request( +def build_device_groups_get_request( resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1025,27 +984,23 @@ def build_deployments_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_list_by_device_group_request( # pylint: disable=name-too-long +def build_device_groups_create_or_update_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, subscription_id: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - maxpagesize: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1057,28 +1012,21 @@ def build_deployments_list_by_device_group_request( # pylint: disable=name-too- _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "int") - if maxpagesize is not None: - _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_create_or_update_request( # pylint: disable=name-too-long +def build_device_groups_update_request( resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -1086,18 +1034,17 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1110,33 +1057,31 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_delete_request( +def build_device_groups_delete_request( resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1150,36 +1095,45 @@ def build_deployments_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_get_request( +def build_device_groups_list_by_product_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - device_name: str, subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + maxpagesize: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if maxpagesize is not None: + _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1187,12 +1141,11 @@ def build_devices_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_create_or_update_request( +def build_device_groups_claim_devices_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -1200,18 +1153,17 @@ def build_devices_create_or_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1224,10 +1176,10 @@ def build_devices_create_or_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_list_by_device_group_request( # pylint: disable=name-too-long +def build_device_groups_count_devices_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, @@ -1238,11 +1190,11 @@ def build_devices_list_by_device_group_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1259,33 +1211,33 @@ def build_devices_list_by_device_group_request( # pylint: disable=name-too-long # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_delete_request( +def build_deployments_get_request( resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1296,15 +1248,15 @@ def build_devices_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_update_request( +def build_deployments_create_or_update_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -1312,18 +1264,18 @@ def build_devices_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1336,34 +1288,33 @@ def build_devices_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_generate_capability_image_request( # pylint: disable=name-too-long +def build_deployments_delete_request( resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1372,33 +1323,52 @@ def build_devices_generate_capability_image_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_list_by_catalog_request( - resource_group_name: str, catalog_name: str, subscription_id: str, *, api_version: str, **kwargs: Any +def build_deployments_list_by_device_group_request( # pylint: disable=name-too-long + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + maxpagesize: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), + "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if maxpagesize is not None: + _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1406,22 +1376,30 @@ def build_products_list_by_catalog_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_get_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any +def build_devices_get_request( + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1435,23 +1413,31 @@ def build_products_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_create_or_update_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any +def build_devices_create_or_update_request( + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1467,22 +1453,31 @@ def build_products_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_delete_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any +def build_devices_update_request( + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1491,28 +1486,37 @@ def build_products_delete_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_update_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any +def build_devices_delete_request( + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1521,29 +1525,33 @@ def build_products_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_generate_default_device_groups_request( # pylint: disable=name-too-long - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_devices_list_by_device_group_request( # pylint: disable=name-too-long + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1554,25 +1562,34 @@ def build_products_generate_default_device_groups_request( # pylint: disable=na # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_count_devices_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any +def build_devices_generate_capability_image_request( # pylint: disable=name-too-long + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1581,6 +1598,8 @@ def build_products_count_devices_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -1617,8 +1636,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: # response body for status code(s): 200 response == { - "actionType": "str", # Optional. Enum. Indicates the action type. "Internal" - refers to actions that are for internal only APIs. "Internal" + "actionType": "str", # Optional. Extensible enum. Indicates the action type. + "Internal" refers to actions that are for internal only APIs. "Internal" "display": { "description": "str", # Optional. The short, localized friendly description of the operation; suitable for tool tips and detailed views. @@ -1711,24 +1730,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class CustomUpdateOperationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`custom_update_operations` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - class CatalogsOperations: """ .. warning:: @@ -1765,17 +1766,16 @@ def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _mo # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1795,7 +1795,9 @@ def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _mo }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -1877,8 +1879,8 @@ def _create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - api_version=self._config.api_version, content_type=content_type, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, @@ -1946,17 +1948,16 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1976,22 +1977,23 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2011,7 +2013,9 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2048,17 +2052,16 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2078,7 +2081,9 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2115,17 +2120,16 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2145,7 +2149,9 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2178,17 +2184,16 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2208,22 +2213,23 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2243,7 +2249,9 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2330,17 +2338,16 @@ def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2360,7 +2367,9 @@ def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2396,17 +2405,16 @@ def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2426,7 +2434,9 @@ def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2462,17 +2472,16 @@ def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2492,7 +2501,9 @@ def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2531,17 +2542,16 @@ def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2561,7 +2571,9 @@ def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -2589,8 +2601,8 @@ def update( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - api_version=self._config.api_version, content_type=content_type, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, @@ -2736,17 +2748,16 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2766,7 +2777,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -2852,17 +2865,16 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Catalog"]: # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2882,7 +2894,9 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Catalog"]: }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -2954,7 +2968,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _models.CountDeviceResponse: + def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _models.CountDevicesResponse: """Counts devices in catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2962,8 +2976,8 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -2985,7 +2999,7 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) _request = build_catalogs_count_devices_request( resource_group_name=resource_group_name, @@ -3014,7 +3028,7 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3022,7 +3036,7 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A return deserialized # type: ignore @distributed_trace - def list_device_insights( + def list_deployments( self, resource_group_name: str, catalog_name: str, @@ -3031,8 +3045,9 @@ def list_device_insights( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.DeviceInsight"]: - """Lists device insights for catalog. + ) -> Iterable["_models.Deployment"]: + # pylint: disable=line-too-long + """Lists deployments for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3045,8 +3060,8 @@ def list_device_insights( :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of DeviceInsight - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceInsight] + :return: An iterator like instance of Deployment + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -3054,290 +3069,16 @@ def list_device_insights( # response body for status code(s): 200 response == { - "description": "str", # Event description. Required. - "deviceId": "str", # Device ID. Required. - "endTimestampUtc": "2020-02-20 00:00:00", # Event end timestamp. Required. - "eventCategory": "str", # Event category. Required. - "eventClass": "str", # Event class. Required. - "eventCount": 0, # Event count. Required. - "eventType": "str", # Event type. Required. - "startTimestampUtc": "2020-02-20 00:00:00" # Event start timestamp. - Required. - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_catalogs_list_device_insights_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceInsight], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_devices( - self, - resource_group_name: str, - catalog_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.Device"]: - # pylint: disable=line-too-long - """Lists devices for catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Device - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Device] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_catalogs_list_devices_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_deployments( - self, - resource_group_name: str, - catalog_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.Deployment"]: - # pylint: disable=line-too-long - """Lists deployments for catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Deployment - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Deployment] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "deployedImages": [ { - "id": "str", # Fully qualified resource ID for the - resource. Ex - + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. @@ -3381,7 +3122,10 @@ def list_deployments( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". } ], "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment @@ -3406,7 +3150,9 @@ def list_deployments( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -3489,7 +3235,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: _models.ListDeviceGroupsRequest, + body: _models.ListDeviceGroupsRequest, *, filter: Optional[str] = None, top: Optional[int] = None, @@ -3505,8 +3251,8 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest + :param body: List device groups for catalog. Required. + :type body: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. @@ -3524,18 +3270,15 @@ def list_device_groups( .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { + body = { "deviceGroupName": "str" # Optional. Device Group name. } # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -3568,7 +3311,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -3577,7 +3322,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: JSON, + body: JSON, *, filter: Optional[str] = None, top: Optional[int] = None, @@ -3593,8 +3338,8 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: JSON + :param body: List device groups for catalog. Required. + :type body: JSON :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. @@ -3613,12 +3358,9 @@ def list_device_groups( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -3651,7 +3393,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -3660,7 +3404,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: IO[bytes], + body: IO[bytes], *, filter: Optional[str] = None, top: Optional[int] = None, @@ -3676,8 +3420,8 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: IO[bytes] + :param body: List device groups for catalog. Required. + :type body: IO[bytes] :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. @@ -3696,12 +3440,9 @@ def list_device_groups( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -3734,7 +3475,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -3743,7 +3486,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: Union[_models.ListDeviceGroupsRequest, JSON, IO[bytes]], + body: Union[_models.ListDeviceGroupsRequest, JSON, IO[bytes]], *, filter: Optional[str] = None, top: Optional[int] = None, @@ -3758,9 +3501,9 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Is one of the following types: + :param body: List device groups for catalog. Is one of the following types: ListDeviceGroupsRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest or JSON or IO[bytes] + :type body: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest or JSON or IO[bytes] :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. @@ -3775,18 +3518,15 @@ def list_device_groups( .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { + body = { "deviceGroupName": "str" # Optional. Device Group name. } # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -3819,7 +3559,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3838,10 +3580,10 @@ def list_device_groups( error_map.update(kwargs.pop("error_map", {}) or {}) content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore def prepare_request(next_link=None): if not next_link: @@ -3906,38 +3648,32 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class ImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`images` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: - # pylint: disable=line-too-long - """Get a Image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + def list_device_insights( + self, + resource_group_name: str, + catalog_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeviceInsight"]: + """Lists device insights for catalog. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :return: Image. The Image is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Image + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of DeviceInsight + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceInsight] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -3945,51 +3681,23 @@ def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kw # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + "description": "str", # Event description. Required. + "deviceId": "str", # Device ID. Required. + "endTimestampUtc": "2020-02-20 00:00:00", # Event end timestamp. Required. + "eventCategory": "str", # Event category. Required. + "eventClass": "str", # Event class. Required. + "eventCount": 0, # Event count. Required. + "eventType": "str", # Event type. Required. + "startTimestampUtc": "2020-02-20 00:00:00" # Event start timestamp. Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3998,48 +3706,69 @@ def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kw } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.Image] = kwargs.pop("cls", None) + _request = build_catalogs_list_device_insights_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_images_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceInsight], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Image, response.json()) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_catalog( + def list_devices( self, resource_group_name: str, catalog_name: str, @@ -4048,9 +3777,9 @@ def list_by_catalog( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.Image"]: + ) -> Iterable["_models.Device"]: # pylint: disable=line-too-long - """List Image resources by Catalog. + """Lists devices for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4063,8 +3792,8 @@ def list_by_catalog( :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of Image - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Image] + :return: An iterator like instance of Device + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -4072,32 +3801,23 @@ def list_by_catalog( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4114,14 +3834,16 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -4134,15 +3856,15 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - _request = build_images_list_by_catalog_request( + _request = build_catalogs_list_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - api_version=self._config.api_version, filter=filter, top=top, skip=skip, maxpagesize=maxpagesize, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -4167,7 +3889,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Image], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -4192,14 +3914,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - image_name: str, - resource: Union[_models.Image, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: + def _upload_image_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, body: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4212,22 +3929,21 @@ def _create_or_update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_images_create_or_update_request( + _request = build_catalogs_upload_image_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - image_name=image_name, subscription_id=self._config.subscription_id, - api_version=self._config.api_version, content_type=content_type, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, @@ -4241,7 +3957,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [202]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -4249,61 +3965,47 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, response_headers) # type: ignore @overload - def begin_create_or_update( + def begin_upload_image( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: _models.Image, + body: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Image]: + ) -> LROPoller[None]: # pylint: disable=line-too-long - """Create a Image. + """Creates an image. Use this action when the image ID is unknown. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Image + :param body: Image upload request body. Required. + :type body: ~azure.mgmt.spheredpg.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + body = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. "description": "str", # Optional. The image description. @@ -4340,259 +4042,93 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def begin_create_or_update( + def begin_upload_image( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: JSON, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Image]: - # pylint: disable=line-too-long - """Create a Image. + ) -> LROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON + :param body: Image upload request body. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } """ @overload - def begin_create_or_update( + def begin_upload_image( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: IO[bytes], + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Image]: - # pylint: disable=line-too-long - """Create a Image. + ) -> LROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] + :param body: Image upload request body. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } """ @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - catalog_name: str, - image_name: str, - resource: Union[_models.Image, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Image]: + def begin_upload_image( + self, resource_group_name: str, catalog_name: str, body: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: # pylint: disable=line-too-long - """Create a Image. + """Creates an image. Use this action when the image ID is unknown. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Is one of the following types: Image, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] - :return: An instance of LROPoller that returns Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] + :param body: Image upload request body. Is one of the following types: Image, JSON, IO[bytes] + Required. + :type body: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + body = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. "description": "str", # Optional. The image description. @@ -4629,70 +4165,24 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._upload_image_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, - image_name=image_name, - resource=resource, + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -4701,12 +4191,9 @@ def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Image, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -4715,19 +4202,94 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Image].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Image]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> None: + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`certificates` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any + ) -> _models.Certificate: + # pylint: disable=line-too-long + """Get a Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Certificate + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "certificate": "str", # Optional. The certificate as a UTF-8 encoded + base 64 string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate + expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate + not before date. + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values + are: "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4739,12 +4301,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - _request = build_images_delete_request( + _request = build_certificates_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - image_name=image_name, + serial_number=serial_number, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -4752,132 +4314,57 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ) _request.url = self._client.format_url(_request.url) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Image. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - -class DeviceGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + deserialized = _deserialize(_models.Certificate, response.json()) - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`device_groups` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - 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") + return deserialized # type: ignore @distributed_trace - def list_by_product( + def list_by_catalog( self, resource_group_name: str, catalog_name: str, - product_name: str, *, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.DeviceGroup"]: + ) -> Iterable["_models.Certificate"]: # pylint: disable=line-too-long - """List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values - and cannot be used for product name. + """List Certificate resources by Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An iterator like instance of Certificate + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -4885,28 +4372,23 @@ def list_by_product( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "certificate": "str", # Optional. The certificate as a UTF-8 encoded + base 64 string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate + expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate + not before date. "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + "status": "str", # Optional. The certificate status. Known values + are: "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4923,14 +4405,16 @@ def list_by_product( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -4943,10 +4427,9 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - _request = build_device_groups_list_by_product_request( + _request = build_certificates_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, subscription_id=self._config.subscription_id, filter=filter, top=top, @@ -4977,7 +4460,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Certificate], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -5003,24 +4486,22 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.DeviceGroup: - # pylint: disable=line-too-long - """Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + def retrieve_cert_chain( + self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any + ) -> _models.CertificateChainResponse: + """Retrieves cert chain. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.DeviceGroup + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :return: CertificateChainResponse. The CertificateChainResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CertificateChainResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5028,45 +4509,7 @@ def get( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificateChain": "str" # Optional. The certificate chain. } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -5080,13 +4523,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) - _request = build_device_groups_get_request( + _request = build_certificates_retrieve_cert_chain_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + serial_number=serial_number, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5111,659 +4553,423 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DeviceGroup, response.json()) + deserialized = _deserialize(_models.CertificateChainResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - resource: Union[_models.DeviceGroup, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_device_groups_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - @overload - def begin_create_or_update( + def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - resource: _models.DeviceGroup, + serial_number: str, + body: _models.ProofOfPossessionNonceRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + body = { + "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. } - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ @overload - def begin_create_or_update( + def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - resource: JSON, + serial_number: str, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ @overload - def begin_create_or_update( + def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - resource: IO[bytes], + serial_number: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ @distributed_trace - def begin_create_or_update( + def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - resource: Union[_models.DeviceGroup, JSON, IO[bytes]], + serial_number: str, + body: Union[_models.ProofOfPossessionNonceRequest, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Is one of the following types: DeviceGroup, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup or JSON or IO[bytes] - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Is one of the following types: + ProofOfPossessionNonceRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest or JSON or IO[bytes] + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + body = { + "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. } - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DeviceGroup, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[_models.ProofOfPossessionNonceResponse] = kwargs.pop("cls", None) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body else: - polling_method = polling - if cont_token: - return LROPoller[_models.DeviceGroup].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DeviceGroup]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_device_groups_delete_request( + _request = build_certificates_retrieve_proof_of_possession_nonce_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + serial_number=serial_number, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ProofOfPossessionNonceResponse, response.json()) if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`images` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def begin_delete( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: + # pylint: disable=line-too-long + """Get a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :return: Image. The Image is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Image :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _request = build_images_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = _deserialize(_models.Image, response.json()) - def _update_initial( + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + image_name: str, + resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any - ) -> Optional[JSON]: + ) -> JSON: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5776,20 +4982,19 @@ def _update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_device_groups_update_request( + _request = build_images_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + image_name=image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -5806,105 +5011,132 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} if response.status_code == 200: deserialized = _deserialize(JSON, response.json()) - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = _deserialize(JSON, response.json()) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - properties: _models.DeviceGroupUpdate, + image_name: str, + resource: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Image]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + :return: An instance of LROPoller that returns Image. The Image is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - } + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5921,72 +5153,71 @@ def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - properties: JSON, + image_name: str, + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Image]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + :return: An instance of LROPoller that returns Image. The Image is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6003,72 +5234,71 @@ def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - properties: IO[bytes], + image_name: str, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Image]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + :return: An instance of LROPoller that returns Image. The Image is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6085,84 +5315,113 @@ def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @distributed_trace - def begin_update( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + image_name: str, + resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Image]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DeviceGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Is one of the following types: Image, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] + :return: An instance of LROPoller that returns Image. The Image is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - } + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6179,24 +5438,25 @@ def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - properties=properties, + image_name=image_name, + resource=resource, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -6207,7 +5467,7 @@ def begin_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.DeviceGroup, response.json()) + deserialized = _deserialize(_models.Image, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6219,44 +5479,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.DeviceGroup].from_continuation_token( + return LROPoller[_models.Image].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.DeviceGroup]( + return LROPoller[_models.Image]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def count_devices( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: - """Counts devices in device group. '.default' and '.unassigned' are system defined values and - cannot be used for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "value": 0 # Number of children resources in parent resource. Required. - } - """ + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any + ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6268,13 +5503,12 @@ def count_devices( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_device_groups_count_devices_request( + _request = build_images_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + image_name=image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6282,182 +5516,167 @@ def count_devices( ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202, 204]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, response_headers) # type: ignore - @overload - def claim_devices( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - claim_devices_request: _models.ClaimDevicesRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + @distributed_trace + def begin_delete( + self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Example: - .. code-block:: python + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - # JSON input template you can fill out and use as your body input. - claim_devices_request = { - "deviceIdentifiers": [ - "str" # Device identifiers of the devices to be claimed. Required. - ] - } - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @overload - def claim_devices( # pylint: disable=inconsistent-return-statements + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_catalog( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - claim_devices_request: JSON, *, - content_type: str = "application/json", + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> Iterable["_models.Image"]: + # pylint: disable=line-too-long + """List Image resources by Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def claim_devices( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - claim_devices_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def claim_devices( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - claim_devices_request: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Is one of the following types: - ClaimDevicesRequest, JSON, IO[bytes] Required. - :type claim_devices_request: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest or JSON or - IO[bytes] - :return: None - :rtype: None + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Image + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - claim_devices_request = { - "deviceIdentifiers": [ - "str" # Device identifiers of the devices to be claimed. Required. - ] + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6466,62 +5685,76 @@ def claim_devices( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + _request = build_images_list_by_catalog_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - content_type = content_type or "application/json" - _content = None - if isinstance(claim_devices_request, (IOBase, bytes)): - _content = claim_devices_request - else: - _content = json.dumps(claim_devices_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - _request = build_device_groups_claim_devices_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + return _request - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Image], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [202]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - response_headers = {} - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) -class CertificatesOperations: +class ProductsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`certificates` attribute. + :attr:`products` attribute. """ def __init__(self, *args, **kwargs): @@ -6532,22 +5765,20 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any - ) -> _models.Certificate: + def get(self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any) -> _models.Product: # pylint: disable=line-too-long - """Get a Certificate. + """Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :return: Certificate. The Certificate is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Certificate + :param product_name: Name of product. Required. + :type product_name: str + :return: Product. The Product is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Product :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -6555,26 +5786,14 @@ def get( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded - base 64 string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate - expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate - not before date. - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values - are: "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6591,7 +5810,9 @@ def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -6605,12 +5826,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + cls: ClsType[_models.Product] = kwargs.pop("cls", None) - _request = build_certificates_get_request( + _request = build_products_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - serial_number=serial_number, + product_name=product_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6635,475 +5856,487 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Certificate, response.json()) + deserialized = _deserialize(_models.Product, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_catalog( + def _create_or_update_initial( self, resource_group_name: str, catalog_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, + product_name: str, + resource: Union[_models.Product, JSON, IO[bytes]], **kwargs: Any - ) -> Iterable["_models.Certificate"]: - # pylint: disable=line-too-long - """List Certificate resources by Catalog. + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Certificate - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Certificate] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded - base 64 string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate - expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate - not before date. - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values - are: "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_certificates_list_by_catalog_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Certificate], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def retrieve_cert_chain( - self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any - ) -> _models.CertificateChainResponse: - """Retrieves cert chain. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :return: CertificateChainResponse. The CertificateChainResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CertificateChainResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "certificateChain": "str" # Optional. The certificate chain. - } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) - cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_certificates_retrieve_cert_chain_request( + _request = build_products_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - serial_number=serial_number, + product_name=product_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CertificateChainResponse, response.json()) + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(JSON, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def retrieve_proof_of_possession_nonce( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - serial_number: str, - parameters: _models.ProofOfPossessionNonceRequest, + product_name: str, + resource: _models.Product, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest + :param product_name: Name of product. Required. + :type product_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Product :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + :return: An instance of LROPoller that returns Product. The Product is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - } - """ + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ @overload - def retrieve_proof_of_possession_nonce( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - serial_number: str, - parameters: JSON, + product_name: str, + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: JSON + :param product_name: Name of product. Required. + :type product_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + :return: An instance of LROPoller that returns Product. The Product is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def retrieve_proof_of_possession_nonce( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - serial_number: str, - parameters: IO[bytes], + product_name: str, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: IO[bytes] + :param product_name: Name of product. Required. + :type product_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + :return: An instance of LROPoller that returns Product. The Product is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @distributed_trace - def retrieve_proof_of_possession_nonce( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - serial_number: str, - parameters: Union[_models.ProofOfPossessionNonceRequest, JSON, IO[bytes]], + product_name: str, + resource: Union[_models.Product, JSON, IO[bytes]], **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Is one of the following types: - ProofOfPossessionNonceRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest or JSON or - IO[bytes] - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + :param product_name: Name of product. Required. + :type product_name: str + :param resource: Resource create parameters. Is one of the following types: Product, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Product or JSON or IO[bytes] + :return: An instance of LROPoller that returns Product. The Product is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProofOfPossessionNonceResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.Product] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - _request = build_certificates_retrieve_proof_of_possession_nonce_request( + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Product, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Product].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Product]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Optional[JSON]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_products_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - serial_number=serial_number, + product_name=product_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -7113,61 +6346,48 @@ def retrieve_proof_of_possession_nonce( ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProofOfPossessionNonceResponse, response.json()) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`deployments` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( + @overload + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - deployment_name: str, + properties: _models.ProductUpdate, + *, + content_type: str = "application/json", **kwargs: Any - ) -> _models.Deployment: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - product or device group name. + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7176,85 +6396,33 @@ def get( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Deployment + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "description": "str" # Optional. Description of the product. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. + "description": "str", # Optional. Description of the product. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7274,75 +6442,26 @@ def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - - _request = build_deployments_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Deployment, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized # type: ignore - - @distributed_trace - def list_by_device_group( + @overload + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, + properties: JSON, *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> Iterable["_models.Deployment"]: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined - values and cannot be used for product or device group name. + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7351,88 +6470,26 @@ def list_by_device_group( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Deployment - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Deployment] + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. + "description": "str", # Optional. Description of the product. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7452,176 +6509,26 @@ def list_by_device_group( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_deployments_list_by_device_group_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Deployment], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - deployment_name: str, - resource: Union[_models.Deployment, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_deployments_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - deployment_name: str, - resource: _models.Deployment, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Deployment]: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7630,91 +6537,26 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Deployment - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + :return: An instance of LROPoller that returns Product. The Product is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. + "description": "str", # Optional. Description of the product. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7734,115 +6576,24 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @overload - def begin_create_or_update( + @distributed_trace + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - deployment_name: str, - resource: JSON, - *, - content_type: str = "application/json", + properties: Union[_models.ProductUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Deployment]: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7851,91 +6602,31 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + :param properties: The resource properties to be updated. Is one of the following types: + ProductUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns Product. The Product is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "description": "str" # Optional. Description of the product. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. + "description": "str", # Optional. Description of the product. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7955,122 +6646,1548 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - @overload - def begin_create_or_update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - deployment_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Deployment]: - # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Product] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Product, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Product].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Product]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_products_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name'. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_catalog( + self, resource_group_name: str, catalog_name: str, **kwargs: Any + ) -> Iterable["_models.Product"]: + # pylint: disable=line-too-long + """List Product resources by Catalog. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :return: An iterator like instance of Product + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Product] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_products_list_by_catalog_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Product], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def count_devices( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> _models.CountDevicesResponse: + """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be + used for product name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "value": 0 # Number of children resources in parent resource. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) + + _request = build_products_count_devices_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def generate_default_device_groups( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> Iterable["_models.DeviceGroup"]: + # pylint: disable=line-too-long + """Generates default device groups for the product. '.default' and '.unassigned' are system + defined values and cannot be used for product name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_products_generate_default_device_groups_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DeviceGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`device_groups` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> _models.DeviceGroup: + # pylint: disable=line-too-long + """Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: DeviceGroup. The DeviceGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.DeviceGroup + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + + _request = build_device_groups_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeviceGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: Union[_models.DeviceGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_device_groups_create_or_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(JSON, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: _models.DeviceGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: Union[_models.DeviceGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param resource: Resource create parameters. Is one of the following types: DeviceGroup, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup or JSON or IO[bytes] + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeviceGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeviceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Optional[JSON]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_device_groups_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: _models.DeviceGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + } + } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @overload + def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @overload + def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + :param properties: The resource properties to be updated. Is one of the following types: + DeviceGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -8087,24 +8204,182 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeviceGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeviceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_device_groups_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def begin_create_or_update( + def list_by_product( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - deployment_name: str, - resource: Union[_models.Deployment, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> LROPoller[_models.Deployment]: + ) -> Iterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values + and cannot be used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8113,181 +8388,40 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Is one of the following types: Deployment, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Deployment or JSON or IO[bytes] - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -8304,64 +8438,94 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - deployment_name=deployment_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_device_groups_list_by_product_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Deployment, response.json()) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Deployment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[_models.Deployment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response - def _delete_initial( # pylint: disable=inconsistent-return-statements + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _claim_devices_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + body: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -8372,19 +8536,28 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_deployments_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_device_groups_claim_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8397,7 +8570,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -8405,25 +8578,136 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore + @overload + def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: _models.ClaimDevicesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "deviceIdentifiers": [ + "str" # Device identifiers of the devices to be claimed. Required. + ] + } + """ + + @overload + def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete( + def begin_claim_devices( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + body: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: - """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8434,27 +8718,39 @@ def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str + :param body: Bulk claim devices request body. Is one of the following types: + ClaimDevicesRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "deviceIdentifiers": [ + "str" # Device identifiers of the devices to be claimed. Required. + ] + } """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._claim_devices_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, + body=body, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8481,15 +8777,92 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace + def count_devices( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> _models.CountDevicesResponse: + """Counts devices in device group. '.default' and '.unassigned' are system defined values and + cannot be used for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "value": 0 # Number of children resources in parent resource. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) + + _request = build_device_groups_count_devices_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore -class DevicesOperations: + return deserialized # type: ignore + + +class DeploymentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`devices` attribute. + :attr:`deployments` attribute. """ def __init__(self, *args, **kwargs): @@ -8506,12 +8879,12 @@ def get( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any - ) -> _models.Device: + ) -> _models.Deployment: # pylint: disable=line-too-long - """Get a Device. Use '.unassigned' or '.default' for the device group and product names when a - device does not belong to a device group and product. + """Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8522,10 +8895,11 @@ def get( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8533,23 +8907,68 @@ def get( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8569,7 +8988,9 @@ def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -8583,14 +9004,14 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - _request = build_devices_get_request( + _request = build_deployments_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -8615,7 +9036,7 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(_models.Deployment, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8628,8 +9049,8 @@ def _create_or_update_initial( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: Union[_models.Device, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any ) -> JSON: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -8653,12 +9074,12 @@ def _create_or_update_initial( else: _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_devices_create_or_update_request( + _request = build_deployments_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -8703,15 +9124,15 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: _models.Device, + deployment_name: str, + resource: _models.Deployment, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Device]: + ) -> LROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8722,16 +9143,17 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Device + :type resource: ~azure.mgmt.spheredpg.models.Deployment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Device. The Device is compatible with + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8739,23 +9161,68 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8775,28 +9242,75 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8816,7 +9330,9 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -8827,15 +9343,15 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Device]: + ) -> LROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8846,16 +9362,17 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :param resource: Resource create parameters. Required. :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Device. The Device is compatible with + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8863,23 +9380,68 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8899,7 +9461,9 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -8910,15 +9474,15 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Device]: + ) -> LROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8929,16 +9493,17 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :param resource: Resource create parameters. Required. :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Device. The Device is compatible with + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8946,23 +9511,68 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8982,7 +9592,9 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -8993,13 +9605,13 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: Union[_models.Device, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Device]: + ) -> LROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9010,14 +9622,15 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param resource: Resource create parameters. Is one of the following types: Device, JSON, + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str + :param resource: Resource create parameters. Is one of the following types: Deployment, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Device or JSON or IO[bytes] - :return: An instance of LROPoller that returns Device. The Device is compatible with + :type resource: ~azure.mgmt.spheredpg.models.Deployment or JSON or IO[bytes] + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -9025,23 +9638,68 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9061,28 +9719,75 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9102,14 +9807,16 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -9119,176 +9826,39 @@ def begin_create_or_update( catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Device, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Device].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Device]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_device_group( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> Iterable["_models.Device"]: - # pylint: disable=line-too-long - """List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values - and cannot be used for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: An iterator like instance of Device - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Device] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_devices_list_by_device_group_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deployment_name=deployment_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Deployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Deployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Deployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -9296,7 +9866,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -9312,12 +9882,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_devices_delete_request( + _request = build_deployments_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9354,10 +9924,11 @@ def begin_delete( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a Device. + """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9368,239 +9939,69 @@ def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - device_name=device_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - device_name: str, - properties: _models.DeviceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Device: - # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "deviceGroupId": "str" # Optional. Device group id. - } - } - - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - - @overload - def update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - device_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Device: - # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def update( + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + deployment_name=deployment_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_device_group( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - properties: IO[bytes], *, - content_type: str = "application/json", + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> _models.Device: + ) -> Iterable["_models.Deployment"]: # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. + """List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined + values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9611,39 +10012,83 @@ def update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Deployment + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9663,24 +10108,119 @@ def update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_by_device_group_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Deployment], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DevicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`devices` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def update( + def get( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.Device: # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. + """Get a Device. Use '.unassigned' or '.default' for the device group and product names when a + device does not belong to a device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9693,9 +10233,6 @@ def update( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DeviceUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] :return: Device. The Device is compatible with MutableMapping :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: @@ -9703,21 +10240,11 @@ def update( Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "deviceGroupId": "str" # Optional. Device group id. - } - } - - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "chipSku": "str", # Optional. SKU of the chip. "deviceId": "str", # Optional. Device ID. @@ -9748,7 +10275,9 @@ def update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -9759,20 +10288,80 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + + _request = build_devices_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + resource: Union[_models.Device, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_devices_update_request( + _request = build_devices_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -9787,14 +10376,14 @@ def update( ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -9803,18 +10392,12 @@ def update( response_headers = {} if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(JSON, response.json()) - if response.status_code == 202: + if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(JSON, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -9822,21 +10405,21 @@ def update( return deserialized # type: ignore @overload - def generate_capability_image( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: _models.GenerateCapabilityImageRequest, + resource: _models.Device, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> LROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9849,49 +10432,116 @@ def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Device :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of LROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "capabilities": [ - "str" # List of capabilities to create. Required. - ] + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def generate_capability_image( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: JSON, + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> LROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9904,42 +10554,76 @@ def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: JSON + :param resource: Resource create parameters. Required. + :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of LROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def generate_capability_image( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: IO[bytes], + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> LROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9952,40 +10636,74 @@ def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: IO[bytes] + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of LROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @distributed_trace - def generate_capability_image( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], + resource: Union[_models.Device, JSON, IO[bytes]], **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> LROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9998,148 +10716,73 @@ def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Is one of the following types: - GenerateCapabilityImageRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or - IO[bytes] - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :param resource: Resource create parameters. Is one of the following types: Device, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Device or JSON or IO[bytes] + :return: An instance of LROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "capabilities": [ - "str" # List of capabilities to create. Required. - ] - } - - # response body for status code(s): 200, 202 - response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SignedCapabilityImageResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_devices_generate_capability_image_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - device_name=device_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) - - if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - -class ProductsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`products` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_catalog( - self, resource_group_name: str, catalog_name: str, **kwargs: Any - ) -> Iterable["_models.Product"]: - # pylint: disable=line-too-long - """List Product resources by Catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :return: An iterator like instance of Product - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10159,84 +10802,75 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_products_list_by_catalog_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Product], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Device, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Device].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Device]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace - def get(self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any) -> _models.Product: + @overload + def update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + properties: _models.DeviceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Device: # pylint: disable=line-too-long - """Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10245,23 +10879,45 @@ def get(self, resource_group_name: str, catalog_name: str, product_name: str, ** :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :return: Product. The Product is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Product + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "deviceGroupId": "str" # Optional. Device group id. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10281,141 +10937,28 @@ def get(self, resource_group_name: str, catalog_name: str, product_name: str, ** "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Product] = kwargs.pop("cls", None) - - _request = build_products_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Product, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - resource: Union[_models.Product, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_products_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore @overload - def begin_create_or_update( + def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: _models.Product, + device_group_name: str, + device_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10424,61 +10967,38 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Product + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :paramtype content_type: str + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10498,24 +11018,28 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def begin_create_or_update( + def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: JSON, + device_group_name: str, + device_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10524,29 +11048,38 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10566,24 +11099,26 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @overload - def begin_create_or_update( + @distributed_trace + def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", + device_group_name: str, + device_name: str, + properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10592,29 +11127,43 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Is one of the following types: + DeviceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "deviceGroupId": "str" # Optional. Device group id. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10634,22 +11183,149 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_devices_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_devices_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_create_or_update( + def begin_delete( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: Union[_models.Product, JSON, IO[bytes]], + device_group_name: str, + device_name: str, **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[None]: + """Delete a Device. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10658,96 +11334,28 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Is one of the following types: Product, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Product or JSON or IO[bytes] - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Product] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - resource=resource, - content_type=content_type, + device_group_name=device_group_name, + device_name=device_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10755,12 +11363,9 @@ def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Product, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -10769,19 +11374,83 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Product].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Product]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_device_group( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> Iterable["_models.Device"]: + # pylint: disable=line-too-long + """List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values + and cannot be used for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: An iterator like instance of Device + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Device] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10790,106 +11459,73 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_products_delete_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + def prepare_request(next_link=None): + if not next_link: - if response.status_code not in [200, 202, 204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _request = build_devices_list_by_device_group_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return _request - @distributed_trace - def begin_delete( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name'. + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def get_next(next_link=None): + _request = prepare_request(next_link) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return pipeline_response - def _update_initial( + return ItemPaged(get_next, extract_data) + + def _generate_capability_image_initial( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + device_group_name: str, + device_name: str, + body: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -10908,15 +11544,17 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_products_update_request( + _request = build_devices_generate_capability_image_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -10955,19 +11593,21 @@ def _update_initial( return deserialized # type: ignore @overload - def begin_update( + def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: _models.ProductUpdate, + device_group_name: str, + device_name: str, + body: _models.GenerateCapabilityImageRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10976,73 +11616,54 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of LROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "description": "str" # Optional. Description of the product. - } + body = { + "capabilities": [ + "str" # List of capabilities to create. Required. + ] } - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @overload - def begin_update( + def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: JSON, + device_group_name: str, + device_name: str, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11051,66 +11672,47 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of LROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @overload - def begin_update( + def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: IO[bytes], + device_group_name: str, + device_name: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11119,64 +11721,45 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of LROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @distributed_trace - def begin_update( + def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + device_group_name: str, + device_name: str, + body: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11185,70 +11768,51 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Is one of the following types: - ProductUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Is one of the following types: + GenerateCapabilityImageRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "description": "str" # Optional. Description of the product. - } + body = { + "capabilities": [ + "str" # List of capabilities to create. Required. + ] } - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Product] = kwargs.pop("cls", None) + cls: ClsType[_models.SignedCapabilityImageResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._generate_capability_image_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - properties=properties, + device_group_name=device_group_name, + device_name=device_name, + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -11258,10 +11822,14 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} response = pipeline_response.http_response - deserialized = _deserialize(_models.Product, response.json()) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -11271,222 +11839,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Product].from_continuation_token( + return LROPoller[_models.SignedCapabilityImageResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Product]( + return LROPoller[_models.SignedCapabilityImageResponse]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - @distributed_trace - def generate_default_device_groups( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> Iterable["_models.DeviceGroup"]: - # pylint: disable=line-too-long - """Generates default device groups for the product. '.default' and '.unassigned' are system - defined values and cannot be used for product name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_products_generate_default_device_groups_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def count_devices( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: - """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be - used for product name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "value": 0 # Number of children resources in parent resource. Required. - } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) - - _request = build_products_count_devices_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/apiview_mapping_python.json deleted file mode 100644 index 4a6e53675fa..00000000000 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/apiview_mapping_python.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Lro.Rpc", - "CrossLanguageDefinitionId": { - "azurecore.lro.rpc.models.Error": "Azure.Core.Foundations.Error", - "azurecore.lro.rpc.models.GenerationOptions": "_Specs_.Azure.Core.Lro.Rpc.GenerationOptions", - "azurecore.lro.rpc.models.GenerationResponse": "_Specs_.Azure.Core.Lro.Rpc.GenerationResponse", - "azurecore.lro.rpc.models.GenerationResult": "_Specs_.Azure.Core.Lro.Rpc.GenerationResult", - "azurecore.lro.rpc.models.InnerError": "Azure.Core.Foundations.InnerError", - "azurecore.lro.rpc.models.OperationState": "Azure.Core.Foundations.OperationState", - "azurecore.lro.rpc.RpcClient.begin_long_running_rpc": "longRunningRpc" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/apiview_mapping_python.json deleted file mode 100644 index e915b4c3afa..00000000000 --- a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/apiview_mapping_python.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "CrossLanguagePackageId": "Client.Structure.Service", - "CrossLanguageDefinitionId": { - "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType", - "client.structure.service.ServiceClient.qux.eight": "eight", - "client.structure.service.ServiceClient.foo.three": "three", - "client.structure.service.ServiceClient.foo.four": "four", - "client.structure.service.ServiceClient.bar.five": "five", - "client.structure.service.ServiceClient.bar.six": "six", - "client.structure.service.ServiceClient.one": "one", - "client.structure.service.ServiceClient.two": "two" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/apiview_mapping_python.json deleted file mode 100644 index ea78977021b..00000000000 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/apiview_mapping_python.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "Client.Structure.Service", - "CrossLanguageDefinitionId": { - "client.structure.multiclient.models.ClientType": "Client.Structure.Service.ClientType", - "client.structure.multiclient.ClientAClient.renamed_one": "renamedOne", - "client.structure.multiclient.ClientAClient.renamed_three": "renamedThree", - "client.structure.multiclient.ClientAClient.renamed_five": "renamedFive", - "client.structure.multiclient.ClientBClient.renamed_two": "renamedTwo", - "client.structure.multiclient.ClientBClient.renamed_four": "renamedFour", - "client.structure.multiclient.ClientBClient.renamed_six": "renamedSix" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/apiview_mapping_python.json deleted file mode 100644 index 17e44c8793e..00000000000 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/apiview_mapping_python.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "CrossLanguagePackageId": "Encode.Bytes", - "CrossLanguageDefinitionId": { - "encode.bytes.models.Base64BytesProperty": "Encode.Bytes.Base64BytesProperty", - "encode.bytes.models.Base64urlArrayBytesProperty": "Encode.Bytes.Base64urlArrayBytesProperty", - "encode.bytes.models.Base64urlBytesProperty": "Encode.Bytes.Base64urlBytesProperty", - "encode.bytes.models.DefaultBytesProperty": "Encode.Bytes.DefaultBytesProperty", - "encode.bytes.BytesClient.query.default": "default", - "encode.bytes.BytesClient.query.base64": "base64", - "encode.bytes.BytesClient.query.base64url": "base64url", - "encode.bytes.BytesClient.query.base64url_array": "base64urlArray", - "encode.bytes.BytesClient.property.default": "default", - "encode.bytes.BytesClient.property.base64": "base64", - "encode.bytes.BytesClient.property.base64url": "base64url", - "encode.bytes.BytesClient.property.base64url_array": "base64urlArray", - "encode.bytes.BytesClient.header.default": "default", - "encode.bytes.BytesClient.header.base64": "base64", - "encode.bytes.BytesClient.header.base64url": "base64url", - "encode.bytes.BytesClient.header.base64url_array": "base64urlArray", - "encode.bytes.BytesClient.request_body.default": "default", - "encode.bytes.BytesClient.request_body.octet_stream": "octetStream", - "encode.bytes.BytesClient.request_body.custom_content_type": "customContentType", - "encode.bytes.BytesClient.request_body.base64": "base64", - "encode.bytes.BytesClient.request_body.base64url": "base64url", - "encode.bytes.BytesClient.response_body.default": "default", - "encode.bytes.BytesClient.response_body.octet_stream": "octetStream", - "encode.bytes.BytesClient.response_body.custom_content_type": "customContentType", - "encode.bytes.BytesClient.response_body.base64": "base64", - "encode.bytes.BytesClient.response_body.base64url": "base64url" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py index 4adc44ee4c6..e3c26520e02 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py @@ -26,6 +26,7 @@ from .. import models as _models from .._model_base import _deserialize from .._serialization import Serializer +from .._validation import api_version_validation from .._vendor import PageableClientMixinABC if sys.version_info >= (3, 9): @@ -61,6 +62,9 @@ def build_pageable_list_request(*, maxpagesize: Optional[int] = None, **kwargs: class PageableClientOperationsMixin(PageableClientMixinABC): @distributed_trace + @api_version_validation( + params_added_on={"1.0-preview.1": ["maxpagesize"]}, + ) def list(self, **kwargs: Any) -> Iterable["_models.User"]: """List users. diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_validation.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_validation.py new file mode 100644 index 00000000000..752b2822f9d --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_validation.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if method_added_on > client_api_version: + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and api_version > client_api_version + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py index ee55adb3573..f42debf579e 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py @@ -25,6 +25,7 @@ from ... import models as _models from ..._model_base import _deserialize from ..._operations._operations import build_pageable_list_request +from ..._validation import api_version_validation from .._vendor import PageableClientMixinABC if sys.version_info >= (3, 9): @@ -38,6 +39,9 @@ class PageableClientOperationsMixin(PageableClientMixinABC): @distributed_trace + @api_version_validation( + params_added_on={"1.0-preview.1": ["maxpagesize"]}, + ) def list(self, **kwargs: Any) -> AsyncIterable["_models.User"]: """List users. diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/apiview_mapping_python.json deleted file mode 100644 index 723e29dd073..00000000000 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/apiview_mapping_python.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "CrossLanguagePackageId": "Payload.Pageable", - "CrossLanguageDefinitionId": { - "payload.pageable.models.User": "Payload.Pageable.User", - "payload.pageable.PageableClient.list": "list" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py index 3f0da9f52f7..354843865d9 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py @@ -152,6 +152,9 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore @distributed_trace + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bool: """Test that grew up from accepting no parameters to an optional input parameter. @@ -206,6 +209,9 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo return 200 <= response.status_code <= 299 @distributed_trace + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) # pylint: disable=inconsistent-return-statements def from_one_required( # pylint: disable=inconsistent-return-statements self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: @@ -265,6 +271,9 @@ def from_one_required( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) # pylint: disable=inconsistent-return-statements def from_one_optional( # pylint: disable=inconsistent-return-statements self, *, parameter: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py index fb236f85f0c..8e676ee7014 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py @@ -96,6 +96,9 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bool: """Test that grew up from accepting no parameters to an optional input parameter. @@ -150,6 +153,9 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) return 200 <= response.status_code <= 299 @distributed_trace_async + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) # pylint: disable=inconsistent-return-statements async def from_one_required( # pylint: disable=inconsistent-return-statements self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: @@ -209,6 +215,9 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) # pylint: disable=inconsistent-return-statements async def from_one_optional( # pylint: disable=inconsistent-return-statements self, *, parameter: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: diff --git a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/apiview_mapping_python.json deleted file mode 100644 index 8ca87cc12c9..00000000000 --- a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/apiview_mapping_python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "CrossLanguagePackageId": "Server.Versions.Versioned", - "CrossLanguageDefinitionId": { - "server.versions.versioned.VersionedClient.without_api_version": "withoutApiVersion", - "server.versions.versioned.VersionedClient.with_query_api_version": "withQueryApiVersion", - "server.versions.versioned.VersionedClient.with_path_api_version": "withPathApiVersion" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/special-words/specialwords/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/special-words/specialwords/apiview_mapping_python.json deleted file mode 100644 index e669e182f4b..00000000000 --- a/packages/typespec-python/test/azure/generated/special-words/specialwords/apiview_mapping_python.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "CrossLanguagePackageId": "SpecialWords", - "CrossLanguageDefinitionId": { - "specialwords.models.AndModel": "SpecialWords.Models.and", - "specialwords.models.AsModel": "SpecialWords.Models.as", - "specialwords.models.AssertModel": "SpecialWords.Models.assert", - "specialwords.models.AsyncModel": "SpecialWords.Models.async", - "specialwords.models.AwaitModel": "SpecialWords.Models.await", - "specialwords.models.BreakModel": "SpecialWords.Models.break", - "specialwords.models.ClassModel": "SpecialWords.Models.class", - "specialwords.models.Constructor": "SpecialWords.Models.constructor", - "specialwords.models.ContinueModel": "SpecialWords.Models.continue", - "specialwords.models.DefModel": "SpecialWords.Models.def", - "specialwords.models.DelModel": "SpecialWords.Models.del", - "specialwords.models.ElifModel": "SpecialWords.Models.elif", - "specialwords.models.ElseModel": "SpecialWords.Models.else", - "specialwords.models.ExceptModel": "SpecialWords.Models.except", - "specialwords.models.ExecModel": "SpecialWords.Models.exec", - "specialwords.models.FinallyModel": "SpecialWords.Models.finally", - "specialwords.models.ForModel": "SpecialWords.Models.for", - "specialwords.models.FromModel": "SpecialWords.Models.from", - "specialwords.models.GlobalModel": "SpecialWords.Models.global", - "specialwords.models.IfModel": "SpecialWords.Models.if", - "specialwords.models.ImportModel": "SpecialWords.Models.import", - "specialwords.models.InModel": "SpecialWords.Models.in", - "specialwords.models.IsModel": "SpecialWords.Models.is", - "specialwords.models.LambdaModel": "SpecialWords.Models.lambda", - "specialwords.models.NotModel": "SpecialWords.Models.not", - "specialwords.models.OrModel": "SpecialWords.Models.or", - "specialwords.models.PassModel": "SpecialWords.Models.pass", - "specialwords.models.RaiseModel": "SpecialWords.Models.raise", - "specialwords.models.ReturnModel": "SpecialWords.Models.return", - "specialwords.models.SameAsModel": "SpecialWords.ModelProperties.SameAsModel", - "specialwords.models.TryModel": "SpecialWords.Models.try", - "specialwords.models.WhileModel": "SpecialWords.Models.while", - "specialwords.models.WithModel": "SpecialWords.Models.with", - "specialwords.models.YieldModel": "SpecialWords.Models.yield", - "specialwords.SpecialWordsClient.models.with_and": "withAnd", - "specialwords.SpecialWordsClient.models.with_as": "withAs", - "specialwords.SpecialWordsClient.models.with_assert": "withAssert", - "specialwords.SpecialWordsClient.models.with_async": "withAsync", - "specialwords.SpecialWordsClient.models.with_await": "withAwait", - "specialwords.SpecialWordsClient.models.with_break": "withBreak", - "specialwords.SpecialWordsClient.models.with_class": "withClass", - "specialwords.SpecialWordsClient.models.with_constructor": "withConstructor", - "specialwords.SpecialWordsClient.models.with_continue": "withContinue", - "specialwords.SpecialWordsClient.models.with_def": "withDef", - "specialwords.SpecialWordsClient.models.with_del": "withDel", - "specialwords.SpecialWordsClient.models.with_elif": "withElif", - "specialwords.SpecialWordsClient.models.with_else": "withElse", - "specialwords.SpecialWordsClient.models.with_except": "withExcept", - "specialwords.SpecialWordsClient.models.with_exec": "withExec", - "specialwords.SpecialWordsClient.models.with_finally": "withFinally", - "specialwords.SpecialWordsClient.models.with_for": "withFor", - "specialwords.SpecialWordsClient.models.with_from": "withFrom", - "specialwords.SpecialWordsClient.models.with_global": "withGlobal", - "specialwords.SpecialWordsClient.models.with_if": "withIf", - "specialwords.SpecialWordsClient.models.with_import": "withImport", - "specialwords.SpecialWordsClient.models.with_in": "withIn", - "specialwords.SpecialWordsClient.models.with_is": "withIs", - "specialwords.SpecialWordsClient.models.with_lambda": "withLambda", - "specialwords.SpecialWordsClient.models.with_not": "withNot", - "specialwords.SpecialWordsClient.models.with_or": "withOr", - "specialwords.SpecialWordsClient.models.with_pass": "withPass", - "specialwords.SpecialWordsClient.models.with_raise": "withRaise", - "specialwords.SpecialWordsClient.models.with_return": "withReturn", - "specialwords.SpecialWordsClient.models.with_try": "withTry", - "specialwords.SpecialWordsClient.models.with_while": "withWhile", - "specialwords.SpecialWordsClient.models.with_with": "withWith", - "specialwords.SpecialWordsClient.models.with_yield": "withYield", - "specialwords.SpecialWordsClient.model_properties.same_as_model": "sameAsModel", - "specialwords.SpecialWordsClient.operations.and_method": "and", - "specialwords.SpecialWordsClient.operations.as_method": "as", - "specialwords.SpecialWordsClient.operations.assert_method": "assert", - "specialwords.SpecialWordsClient.operations.async_method": "async", - "specialwords.SpecialWordsClient.operations.await_method": "await", - "specialwords.SpecialWordsClient.operations.break_method": "break", - "specialwords.SpecialWordsClient.operations.class_method": "class", - "specialwords.SpecialWordsClient.operations.constructor": "constructor", - "specialwords.SpecialWordsClient.operations.continue_method": "continue", - "specialwords.SpecialWordsClient.operations.def_method": "def", - "specialwords.SpecialWordsClient.operations.del_method": "del", - "specialwords.SpecialWordsClient.operations.elif_method": "elif", - "specialwords.SpecialWordsClient.operations.else_method": "else", - "specialwords.SpecialWordsClient.operations.except_method": "except", - "specialwords.SpecialWordsClient.operations.exec_method": "exec", - "specialwords.SpecialWordsClient.operations.finally_method": "finally", - "specialwords.SpecialWordsClient.operations.for_method": "for", - "specialwords.SpecialWordsClient.operations.from_method": "from", - "specialwords.SpecialWordsClient.operations.global_method": "global", - "specialwords.SpecialWordsClient.operations.if_method": "if", - "specialwords.SpecialWordsClient.operations.import_method": "import", - "specialwords.SpecialWordsClient.operations.in_method": "in", - "specialwords.SpecialWordsClient.operations.is_method": "is", - "specialwords.SpecialWordsClient.operations.lambda_method": "lambda", - "specialwords.SpecialWordsClient.operations.not_method": "not", - "specialwords.SpecialWordsClient.operations.or_method": "or", - "specialwords.SpecialWordsClient.operations.pass_method": "pass", - "specialwords.SpecialWordsClient.operations.raise_method": "raise", - "specialwords.SpecialWordsClient.operations.return_method": "return", - "specialwords.SpecialWordsClient.operations.try_method": "try", - "specialwords.SpecialWordsClient.operations.while_method": "while", - "specialwords.SpecialWordsClient.operations.with_method": "with", - "specialwords.SpecialWordsClient.operations.yield_method": "yield", - "specialwords.SpecialWordsClient.parameters.with_and": "withAnd", - "specialwords.SpecialWordsClient.parameters.with_as": "withAs", - "specialwords.SpecialWordsClient.parameters.with_assert": "withAssert", - "specialwords.SpecialWordsClient.parameters.with_async": "withAsync", - "specialwords.SpecialWordsClient.parameters.with_await": "withAwait", - "specialwords.SpecialWordsClient.parameters.with_break": "withBreak", - "specialwords.SpecialWordsClient.parameters.with_class": "withClass", - "specialwords.SpecialWordsClient.parameters.with_constructor": "withConstructor", - "specialwords.SpecialWordsClient.parameters.with_continue": "withContinue", - "specialwords.SpecialWordsClient.parameters.with_def": "withDef", - "specialwords.SpecialWordsClient.parameters.with_del": "withDel", - "specialwords.SpecialWordsClient.parameters.with_elif": "withElif", - "specialwords.SpecialWordsClient.parameters.with_else": "withElse", - "specialwords.SpecialWordsClient.parameters.with_except": "withExcept", - "specialwords.SpecialWordsClient.parameters.with_exec": "withExec", - "specialwords.SpecialWordsClient.parameters.with_finally": "withFinally", - "specialwords.SpecialWordsClient.parameters.with_for": "withFor", - "specialwords.SpecialWordsClient.parameters.with_from": "withFrom", - "specialwords.SpecialWordsClient.parameters.with_global": "withGlobal", - "specialwords.SpecialWordsClient.parameters.with_if": "withIf", - "specialwords.SpecialWordsClient.parameters.with_import": "withImport", - "specialwords.SpecialWordsClient.parameters.with_in": "withIn", - "specialwords.SpecialWordsClient.parameters.with_is": "withIs", - "specialwords.SpecialWordsClient.parameters.with_lambda": "withLambda", - "specialwords.SpecialWordsClient.parameters.with_not": "withNot", - "specialwords.SpecialWordsClient.parameters.with_or": "withOr", - "specialwords.SpecialWordsClient.parameters.with_pass": "withPass", - "specialwords.SpecialWordsClient.parameters.with_raise": "withRaise", - "specialwords.SpecialWordsClient.parameters.with_return": "withReturn", - "specialwords.SpecialWordsClient.parameters.with_try": "withTry", - "specialwords.SpecialWordsClient.parameters.with_while": "withWhile", - "specialwords.SpecialWordsClient.parameters.with_with": "withWith", - "specialwords.SpecialWordsClient.parameters.with_yield": "withYield", - "specialwords.SpecialWordsClient.parameters.with_cancellation_token": "withCancellationToken" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/apiview_mapping_python.json deleted file mode 100644 index 54eedb38ae7..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/apiview_mapping_python.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Enum.Fixed", - "CrossLanguageDefinitionId": { - "typetest.enum.fixed.models.DaysOfWeekEnum": "Type.Enum.Fixed.DaysOfWeekEnum", - "typetest.enum.fixed.FixedClient.string.get_known_value": "getKnownValue", - "typetest.enum.fixed.FixedClient.string.put_known_value": "putKnownValue", - "typetest.enum.fixed.FixedClient.string.put_unknown_value": "putUnknownValue" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/apiview_mapping_python.json deleted file mode 100644 index 8e1fd91daf2..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/apiview_mapping_python.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Inheritance.EnumDiscriminator", - "CrossLanguageDefinitionId": { - "typetest.model.enumdiscriminator.models.Snake": "Type.Model.Inheritance.EnumDiscriminator.Snake", - "typetest.model.enumdiscriminator.models.Cobra": "Type.Model.Inheritance.EnumDiscriminator.Cobra", - "typetest.model.enumdiscriminator.models.Dog": "Type.Model.Inheritance.EnumDiscriminator.Dog", - "typetest.model.enumdiscriminator.models.Golden": "Type.Model.Inheritance.EnumDiscriminator.Golden", - "typetest.model.enumdiscriminator.models.DogKind": "Type.Model.Inheritance.EnumDiscriminator.DogKind", - "typetest.model.enumdiscriminator.models.SnakeKind": "Type.Model.Inheritance.EnumDiscriminator.SnakeKind", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_extensible_model": "getExtensibleModel", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.put_extensible_model": "putExtensibleModel", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_extensible_model_missing_discriminator": "getExtensibleModelMissingDiscriminator", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_extensible_model_wrong_discriminator": "getExtensibleModelWrongDiscriminator", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_fixed_model": "getFixedModel", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.put_fixed_model": "putFixedModel", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_fixed_model_missing_discriminator": "getFixedModelMissingDiscriminator", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_fixed_model_wrong_discriminator": "getFixedModelWrongDiscriminator" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/apiview_mapping_python.json deleted file mode 100644 index 4b90702a251..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/apiview_mapping_python.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Property.AdditionalProperties", - "CrossLanguageDefinitionId": { - "typetest.property.additionalproperties.models.ExtendsFloatAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsFloatAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsModelAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsModelAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsModelArrayAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsStringAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsStringAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsUnknownAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDerived", - "typetest.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminated", - "typetest.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived", - "typetest.property.additionalproperties.models.IsFloatAdditionalProperties": "Type.Property.AdditionalProperties.IsFloatAdditionalProperties", - "typetest.property.additionalproperties.models.IsModelAdditionalProperties": "Type.Property.AdditionalProperties.IsModelAdditionalProperties", - "typetest.property.additionalproperties.models.IsModelArrayAdditionalProperties": "Type.Property.AdditionalProperties.IsModelArrayAdditionalProperties", - "typetest.property.additionalproperties.models.IsStringAdditionalProperties": "Type.Property.AdditionalProperties.IsStringAdditionalProperties", - "typetest.property.additionalproperties.models.IsUnknownAdditionalProperties": "Type.Property.AdditionalProperties.IsUnknownAdditionalProperties", - "typetest.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDerived", - "typetest.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminated", - "typetest.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminatedDerived": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminatedDerived", - "typetest.property.additionalproperties.models.ModelForRecord": "Type.Property.AdditionalProperties.ModelForRecord", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown_derived.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown_derived.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown_discriminated.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown_discriminated.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown_derived.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown_derived.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown_discriminated.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown_discriminated.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_string.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_string.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_string.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_string.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_float.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_float.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_float.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_float.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_model.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_model.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_model.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_model.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_model_array.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_model_array.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_model_array.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_model_array.put": "put" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/apiview_mapping_python.json deleted file mode 100644 index 9ceea55ea0d..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/apiview_mapping_python.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Property.ValueTypes", - "CrossLanguageDefinitionId": { - "typetest.property.valuetypes.models.BooleanLiteralProperty": "Type.Property.ValueTypes.BooleanLiteralProperty", - "typetest.property.valuetypes.models.BooleanProperty": "Type.Property.ValueTypes.BooleanProperty", - "typetest.property.valuetypes.models.BytesProperty": "Type.Property.ValueTypes.BytesProperty", - "typetest.property.valuetypes.models.CollectionsIntProperty": "Type.Property.ValueTypes.CollectionsIntProperty", - "typetest.property.valuetypes.models.CollectionsModelProperty": "Type.Property.ValueTypes.CollectionsModelProperty", - "typetest.property.valuetypes.models.CollectionsStringProperty": "Type.Property.ValueTypes.CollectionsStringProperty", - "typetest.property.valuetypes.models.DatetimeProperty": "Type.Property.ValueTypes.DatetimeProperty", - "typetest.property.valuetypes.models.Decimal128Property": "Type.Property.ValueTypes.Decimal128Property", - "typetest.property.valuetypes.models.DecimalProperty": "Type.Property.ValueTypes.DecimalProperty", - "typetest.property.valuetypes.models.DictionaryStringProperty": "Type.Property.ValueTypes.DictionaryStringProperty", - "typetest.property.valuetypes.models.DurationProperty": "Type.Property.ValueTypes.DurationProperty", - "typetest.property.valuetypes.models.EnumProperty": "Type.Property.ValueTypes.EnumProperty", - "typetest.property.valuetypes.models.ExtensibleEnumProperty": "Type.Property.ValueTypes.ExtensibleEnumProperty", - "typetest.property.valuetypes.models.FloatLiteralProperty": "Type.Property.ValueTypes.FloatLiteralProperty", - "typetest.property.valuetypes.models.FloatProperty": "Type.Property.ValueTypes.FloatProperty", - "typetest.property.valuetypes.models.InnerModel": "Type.Property.ValueTypes.InnerModel", - "typetest.property.valuetypes.models.IntLiteralProperty": "Type.Property.ValueTypes.IntLiteralProperty", - "typetest.property.valuetypes.models.IntProperty": "Type.Property.ValueTypes.IntProperty", - "typetest.property.valuetypes.models.ModelProperty": "Type.Property.ValueTypes.ModelProperty", - "typetest.property.valuetypes.models.NeverProperty": "Type.Property.ValueTypes.NeverProperty", - "typetest.property.valuetypes.models.StringLiteralProperty": "Type.Property.ValueTypes.StringLiteralProperty", - "typetest.property.valuetypes.models.StringProperty": "Type.Property.ValueTypes.StringProperty", - "typetest.property.valuetypes.models.UnionEnumValueProperty": "Type.Property.ValueTypes.UnionEnumValueProperty", - "typetest.property.valuetypes.models.UnionFloatLiteralProperty": "Type.Property.ValueTypes.UnionFloatLiteralProperty", - "typetest.property.valuetypes.models.UnionIntLiteralProperty": "Type.Property.ValueTypes.UnionIntLiteralProperty", - "typetest.property.valuetypes.models.UnionStringLiteralProperty": "Type.Property.ValueTypes.UnionStringLiteralProperty", - "typetest.property.valuetypes.models.UnknownArrayProperty": "Type.Property.ValueTypes.UnknownArrayProperty", - "typetest.property.valuetypes.models.UnknownDictProperty": "Type.Property.ValueTypes.UnknownDictProperty", - "typetest.property.valuetypes.models.UnknownIntProperty": "Type.Property.ValueTypes.UnknownIntProperty", - "typetest.property.valuetypes.models.UnknownStringProperty": "Type.Property.ValueTypes.UnknownStringProperty", - "typetest.property.valuetypes.models.ExtendedEnum": "Type.Property.ValueTypes.ExtendedEnum", - "typetest.property.valuetypes.models.InnerEnum": "Type.Property.ValueTypes.InnerEnum", - "typetest.property.valuetypes.models.FixedInnerEnum": "Type.Property.ValueTypes.FixedInnerEnum", - "typetest.property.valuetypes.ValueTypesClient.boolean.get": "get", - "typetest.property.valuetypes.ValueTypesClient.boolean.put": "put", - "typetest.property.valuetypes.ValueTypesClient.string.get": "get", - "typetest.property.valuetypes.ValueTypesClient.string.put": "put", - "typetest.property.valuetypes.ValueTypesClient.bytes.get": "get", - "typetest.property.valuetypes.ValueTypesClient.bytes.put": "put", - "typetest.property.valuetypes.ValueTypesClient.int_operations.get": "get", - "typetest.property.valuetypes.ValueTypesClient.int_operations.put": "put", - "typetest.property.valuetypes.ValueTypesClient.float.get": "get", - "typetest.property.valuetypes.ValueTypesClient.float.put": "put", - "typetest.property.valuetypes.ValueTypesClient.decimal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.decimal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.decimal128.get": "get", - "typetest.property.valuetypes.ValueTypesClient.decimal128.put": "put", - "typetest.property.valuetypes.ValueTypesClient.datetime.get": "get", - "typetest.property.valuetypes.ValueTypesClient.datetime.put": "put", - "typetest.property.valuetypes.ValueTypesClient.duration.get": "get", - "typetest.property.valuetypes.ValueTypesClient.duration.put": "put", - "typetest.property.valuetypes.ValueTypesClient.enum.get": "get", - "typetest.property.valuetypes.ValueTypesClient.enum.put": "put", - "typetest.property.valuetypes.ValueTypesClient.extensible_enum.get": "get", - "typetest.property.valuetypes.ValueTypesClient.extensible_enum.put": "put", - "typetest.property.valuetypes.ValueTypesClient.model.get": "get", - "typetest.property.valuetypes.ValueTypesClient.model.put": "put", - "typetest.property.valuetypes.ValueTypesClient.collections_string.get": "get", - "typetest.property.valuetypes.ValueTypesClient.collections_string.put": "put", - "typetest.property.valuetypes.ValueTypesClient.collections_int.get": "get", - "typetest.property.valuetypes.ValueTypesClient.collections_int.put": "put", - "typetest.property.valuetypes.ValueTypesClient.collections_model.get": "get", - "typetest.property.valuetypes.ValueTypesClient.collections_model.put": "put", - "typetest.property.valuetypes.ValueTypesClient.dictionary_string.get": "get", - "typetest.property.valuetypes.ValueTypesClient.dictionary_string.put": "put", - "typetest.property.valuetypes.ValueTypesClient.never.get": "get", - "typetest.property.valuetypes.ValueTypesClient.never.put": "put", - "typetest.property.valuetypes.ValueTypesClient.unknown_string.get": "get", - "typetest.property.valuetypes.ValueTypesClient.unknown_string.put": "put", - "typetest.property.valuetypes.ValueTypesClient.unknown_int.get": "get", - "typetest.property.valuetypes.ValueTypesClient.unknown_int.put": "put", - "typetest.property.valuetypes.ValueTypesClient.unknown_dict.get": "get", - "typetest.property.valuetypes.ValueTypesClient.unknown_dict.put": "put", - "typetest.property.valuetypes.ValueTypesClient.unknown_array.get": "get", - "typetest.property.valuetypes.ValueTypesClient.unknown_array.put": "put", - "typetest.property.valuetypes.ValueTypesClient.string_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.string_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.int_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.int_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.float_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.float_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.boolean_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.boolean_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.union_string_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.union_string_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.union_int_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.union_int_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.union_float_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.union_float_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.union_enum_value.get": "get", - "typetest.property.valuetypes.ValueTypesClient.union_enum_value.put": "put" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py index b6b9cd2e43f..ca097a11089 100644 --- a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py @@ -62,7 +62,8 @@ def __init__(self, *args, **kwargs) -> None: @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -98,7 +99,8 @@ async def v2_in_interface( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -127,7 +129,8 @@ async def v2_in_interface( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -156,7 +159,8 @@ async def v2_in_interface( @distributed_trace_async @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -245,8 +249,7 @@ class AddedClientOperationsMixin(AddedClientMixinABC): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: _models.ModelV1, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -286,8 +289,7 @@ async def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: JSON, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -319,8 +321,7 @@ async def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: IO[bytes], *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -352,8 +353,7 @@ async def v1( @distributed_trace_async @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, **kwargs: Any @@ -446,7 +446,8 @@ async def v1( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -482,7 +483,8 @@ async def v2( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -509,7 +511,8 @@ async def v2(self, body: JSON, *, content_type: str = "application/json", **kwar @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -536,7 +539,8 @@ async def v2(self, body: IO[bytes], *, content_type: str = "application/json", * @distributed_trace_async @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2. diff --git a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py index b5a4b8e55ce..572fa86ef03 100644 --- a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py @@ -113,7 +113,8 @@ def __init__(self, *args, **kwargs): @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -149,7 +150,8 @@ def v2_in_interface( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -176,7 +178,8 @@ def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -205,7 +208,8 @@ def v2_in_interface( @distributed_trace @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -294,8 +298,7 @@ class AddedClientOperationsMixin(AddedClientMixinABC): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: _models.ModelV1, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -335,8 +338,7 @@ def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: JSON, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -368,8 +370,7 @@ def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: IO[bytes], *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -401,8 +402,7 @@ def v1( @distributed_trace @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1(self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, **kwargs: Any) -> _models.ModelV1: """v1. @@ -493,7 +493,8 @@ def v1(self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, * @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -527,7 +528,8 @@ def v2(self, body: _models.ModelV2, *, content_type: str = "application/json", * @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -554,7 +556,8 @@ def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: An @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -581,7 +584,8 @@ def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwarg @distributed_trace @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2. diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp index 6610588b813..28023f7a915 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp @@ -1,121 +1,158 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; -using Azure.ClientGenerator.Core; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -//Catalogs -@doc("An Azure Sphere catalog") -model Catalog is TrackedResource { - @doc("Name of catalog") +/** + * An Azure Sphere catalog + */ +model Catalog is Azure.ResourceManager.TrackedResource { + /** + * Name of catalog + */ @pattern("^[A-Za-z0-9_-]{1,50}$") - @key("catalogName") @path + @key("catalogName") @segment("catalogs") - name: string; -} - -@doc("Catalog properties") -model CatalogProperties { @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} - -@doc("Request of the action to list device groups for a catalog.") -model ListDeviceGroupsRequest { - @doc("Device Group name.") - deviceGroupName?: string; -} -@doc("Device insight report.") -model DeviceInsight { - @doc("Device ID") - deviceId: string; - - @doc("Event description") - description: string; - - @doc("Event start timestamp") - startTimestampUtc: utcDateTime; - - @doc("Event end timestamp") - endTimestampUtc: utcDateTime; - - @doc("Event category") - eventCategory: string; - - @doc("Event class") - eventClass: string; - - @doc("Event type") - eventType: string; - - @doc("Event count") - eventCount: int32; + name: string; } @armResourceOperations -interface Catalogs - extends Azure.ResourceManager.TrackedResourceOperations< - Catalog, - CatalogProperties - > { - @autoRoute - @doc("Counts devices in catalog.") - @armResourceAction(Catalog) - @post - countDevices( - ...ResourceInstanceParameters, - ): ArmResponse | ErrorResponse; - - @autoRoute - @doc("Lists device insights for catalog.") - @armResourceAction(Catalog) - @post - listDeviceInsights( - ...ResourceInstanceParameters, - ...ListQueryParameters, - ): ArmResponse> | ErrorResponse; - - @autoRoute - @doc("Lists devices for catalog.") - @armResourceAction(Catalog) - @post - listDevices( - ...ResourceInstanceParameters, - ...ListQueryParameters, - ): ArmResponse> | ErrorResponse; - - @autoRoute - @doc("Lists deployments for catalog.") - @armResourceAction(Catalog) - @post - listDeployments( - ...ResourceInstanceParameters, - ...ListQueryParameters, - ): ArmResponse> | ErrorResponse; - - @autoRoute - @armResourceAction(Catalog) - @doc("List the device groups for the catalog.") - @post - listDeviceGroups( - ...ResourceInstanceParameters, - ...ListQueryParameters, - - @doc("List device groups for catalog.") - @body - @projectedName("python", "parameters") - listDeviceGroupsRequest: ListDeviceGroupsRequest, - ): ArmResponse> | ErrorResponse; +interface Catalogs { + /** + * Get a Catalog + */ + get is ArmResourceRead; + + /** + * Create a Catalog + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + /** + * Update a Catalog + */ + @parameterVisibility + update is ArmCustomPatchSync; + + /** + * Delete a Catalog + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; + + /** + * List Catalog resources by resource group + */ + listByResourceGroup is ArmResourceListByParent; + + /** + * List Catalog resources by subscription ID + */ + listBySubscription is ArmListBySubscription; + + /** + * Counts devices in catalog. + */ + countDevices is ArmResourceActionSync; + + /** + * Lists deployments for catalog. + */ + listDeployments is ArmResourceActionSync< + Catalog, + void, + ResourceListResult, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * List the device groups for the catalog. + */ + listDeviceGroups is ArmResourceActionSync< + Catalog, + ListDeviceGroupsRequest, + ResourceListResult, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * Lists device insights for catalog. + */ + listDeviceInsights is ArmResourceActionSync< + Catalog, + void, + PagedDeviceInsight, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * Lists devices for catalog. + */ + listDevices is ArmResourceActionSync< + Catalog, + void, + ResourceListResult, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * Creates an image. Use this action when the image ID is unknown. + */ + uploadImage is ArmResourceActionNoResponseContentAsync; } + +@@doc(Catalogs.listDeviceGroups::parameters.body, + "List device groups for catalog." +); +@@encodedName(Catalogs.listDeviceGroups::parameters.body, + "application/json", + "listDeviceGroupsRequest" +); +@@extension(Catalogs.listDeviceGroups::parameters.body, + "x-ms-client-name", + "listDeviceGroupsRequest" +); +@@doc(Catalogs.uploadImage::parameters.body, "Image upload request body."); +@@encodedName(Catalogs.uploadImage::parameters.body, + "application/json", + "uploadImageRequest" +); +@@extension(Catalogs.uploadImage::parameters.body, + "x-ms-client-name", + "uploadImageRequest" +); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp index d1fccb86b43..3f33f1a9376 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp @@ -1,98 +1,81 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./catalog.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; -using Azure.ClientGenerator.Core; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -//Certificates -@doc("An certificate resource belonging to a catalog resource.") +/** + * An certificate resource belonging to a catalog resource. + */ @parentResource(Catalog) -model Certificate is ProxyResource { - @doc("Serial number of the certificate. Use '.default' to get current active certificate.") - @key("serialNumber") +model Certificate is Azure.ResourceManager.ProxyResource { + /** + * Serial number of the certificate. Use '.default' to get current active certificate. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern" "existing api" @path + @key("serialNumber") @segment("certificates") + @visibility("read") name: string; } @armResourceOperations -interface Certificates - extends ProxyResourceOperationsReadList { - @autoRoute - @doc("Retrieves cert chain.") - @armResourceAction(Certificate) - @post - retrieveCertChain( - ...ResourceInstanceParameters, - ): ArmResponse | ErrorResponse; - - @autoRoute - @armResourceAction(Certificate) - @post - @doc("Gets the proof of possession nonce.") - retrieveProofOfPossessionNonce( - ...ResourceInstanceParameters, - - @doc("Proof of possession nonce request body ") - @body - @projectedName("python", "parameters") - proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, - ): ArmResponse | ErrorResponse; -} - -@doc("The properties of certificate") -model CertificateProperties { - @doc("The certificate as a UTF-8 encoded base 64 string.") - @visibility("read") - certificate?: string; - - @visibility("read") - @doc("The certificate status.") - status?: CertificateStatus; - - @visibility("read") - @doc("The certificate subject.") - subject?: string; - - @visibility("read") - @doc("The certificate thumbprint.") - thumbprint?: string; - - @visibility("read") - @doc("The certificate expiry date.") - expiryUtc?: utcDateTime; - - @visibility("read") - @doc("The certificate not before date.") - notBeforeUtc?: utcDateTime; - - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} - -@doc("The certificate chain response.") -model CertificateChainResponse { - @doc("The certificate chain.") - @visibility("read") - certificateChain?: string; -} - -@doc("Request for the proof of possession nonce") -model ProofOfPossessionNonceRequest { - @doc("The proof of possession nonce") - proofOfPossessionNonce: string; +interface Certificates { + /** + * Get a Certificate + */ + get is ArmResourceRead; + + /** + * List Certificate resources by Catalog + */ + listByCatalog is ArmResourceListByParent< + Certificate, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * Retrieves cert chain. + */ + retrieveCertChain is ArmResourceActionSync< + Certificate, + void, + CertificateChainResponse + >; + + /** + * Gets the proof of possession nonce. + */ + retrieveProofOfPossessionNonce is ArmResourceActionSync< + Certificate, + ProofOfPossessionNonceRequest, + ProofOfPossessionNonceResponse + >; } -@doc("Result of the action to generate a proof of possession nonce") -model ProofOfPossessionNonceResponse extends CertificateProperties {} +@@doc(Certificates.retrieveProofOfPossessionNonce::parameters.body, + "Proof of possession nonce request body " +); +@@encodedName(Certificates.retrieveProofOfPossessionNonce::parameters.body, + "application/json", + "proofOfPossessionNonceRequest" +); +@@extension(Certificates.retrieveProofOfPossessionNonce::parameters.body, + "x-ms-client-name", + "proofOfPossessionNonceRequest" +); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/common.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/common.tsp deleted file mode 100644 index 239b23b73fe..00000000000 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/common.tsp +++ /dev/null @@ -1,169 +0,0 @@ -import "@typespec/openapi"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; - -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; -using Azure.ResourceManager; -using OpenAPI; - -namespace Microsoft.AzureSphere; - -interface Operations extends Azure.ResourceManager.Operations {} - -// Common models -/** Provisioning state of the resource. */ -@lroStatus -enum ProvisioningState { - ...ResourceProvisioningState, - /** The resource is being provisioned */ - Provisioning, - /** The resource is being updated */ - Updating, - /** The resource is being deleted */ - Deleting, - /** The resource create request has been accepted */ - Accepted, -} - -@doc("Regional data boundary values.") -enum RegionalDataBoundary { - /** No data boundary */ - None, - /** EU data boundary */ - EU, -} - -@doc("Allow crash dumps values.") -enum AllowCrashDumpCollection { - /** Crash dump collection enabled */ - Enabled, - /** Crash dump collection disabled */ - Disabled, -} - -@doc("Certificate status values.") -enum CertificateStatus { - /** Certificate is active */ - Active, - /** Certificate is inactive */ - Inactive, - /** Certificate has expired */ - Expired, - /** Certificate has been revoked */ - Revoked, -} - -@doc("Provides the custom '$filter' query parameter for list operations") -model CustomFilterQueryParameter { - @query("$filter") - @doc("Filter the result list using the given expression") - filter?: string; -} - -@doc("Provides the custom '$top' query parameter for list operations.") -model CustomTopQueryParameter { - @query("$top") - @doc("The number of result items to return.") - top?: int32; -} - -@doc("Provides the custom '$skip' query parameter for list operations.") -model CustomSkipQueryParameter { - @query("$skip") - @doc("The number of result items to skip.") - skip?: int32; -} - -@doc("Provides the custom '$maxpagesize' query parameter for list operations.") -model CustomMaxPageSizeQueryParameter { - @query("$maxpagesize") - @doc("The maximum number of result items per page.") - maxpagesize?: int32; -} - -// @doc("Provides the most common query parameters for list operations.") -alias StandardListQueryParametersWithCorrectNames = { - ...CustomTopQueryParameter; - ...CustomSkipQueryParameter; - ...CustomMaxPageSizeQueryParameter; -}; - -@doc("Response to the action call for count devices in a catalog.") -model CountDeviceResponse extends CountElementsResponse {} - -@doc("Response of the count for elements.") -model CountElementsResponse { - @doc("Number of children resources in parent resource.") - value: int32; -} - -alias ListQueryParameters = { - ...CustomFilterQueryParameter; - ...StandardListQueryParametersWithCorrectNames; -}; - -// Templates -interface ProxyResourceOperationsReadList< - TResource extends ArmResource, - TListParameters extends {} = {} -> - extends Azure.ResourceManager.ResourceRead, - ResourceListByParent< - TResource, - TListParameters & BaseParameters - > {} - -interface ProxyResourceOperationsReadListCreateDelete< - TResource extends ArmResource, - TListParameters extends {} = {} -> - extends Azure.ResourceManager.ResourceRead, - ResourceListByParent< - TResource, - TListParameters & BaseParameters - >, - ResourceCreate, - Azure.ResourceManager.ResourceDelete {} - -// Custom update operations -@armResourceOperations -interface CustomUpdateOperations { - @autoRoute - @doc("Update a {name}", TResource) - @extension("x-ms-long-running-operation", true) - @extension( - "x-ms-long-running-operation-options", - { - `final-state-via`: "location", - } - ) - @armResourceUpdate(TResource) - @patch - ArmCustomPatchAsyncWithLocation< - TResource extends ArmResource, - TPatchModel extends TagsUpdateModel, - TBaseParameters = BaseParameters - >( - ...ResourceInstanceParameters, - - @doc("The resource properties to be updated.") - @body - properties: TPatchModel, - ): ArmResponse | ArmAcceptedResponse<"Resource update request accepted."> | ErrorResponse; -} - -alias CustomArmResourcePatchAsync< - TResource extends ArmResource, - TProperties extends {}, - TBaseParameters = BaseParameters -> = CustomUpdateOperations.ArmCustomPatchAsyncWithLocation< - TResource, - ResourceUpdateModel, - TBaseParameters ->; diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/deployment.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/deployment.tsp index 72009dc2f07..b45f84e756e 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/deployment.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/deployment.tsp @@ -1,63 +1,63 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./deviceGroup.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -// Deployment -@doc("An deployment resource belonging to a device group resource.") +/** + * An deployment resource belonging to a device group resource. + */ @parentResource(DeviceGroup) -model Deployment is ProxyResource { - @doc("Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group.") - @key("deploymentName") +model Deployment is Azure.ResourceManager.ProxyResource { + /** + * Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern" "existing api" @path + @key("deploymentName") @segment("deployments") + @visibility("read") name: string; } -interface ProxyResourceOperationsDeployments< - TResource extends ArmResource, - TListParameters extends {} = {} -> { - @doc("Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - get is ArmResourceRead; - @doc("List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - list is ArmResourceListByParent< - TResource, - ListQueryParameters & BaseParameters - >; - @doc("Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - createOrUpdate is ArmResourceCreateOrUpdateAsync; - @doc("Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - delete is ArmResourceDeleteAsync; -} - @armResourceOperations -interface Deployments extends ProxyResourceOperationsDeployments {} - -@doc("The properties of deployment") -model DeploymentProperties { - @visibility("create", "read") - @doc("Deployment ID") - deploymentId?: string; +interface Deployments { + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + get is ArmResourceRead; - @doc("Images deployed") - @visibility("create", "read") - deployedImages?: Image[]; + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; - @doc("Deployment date UTC") - @visibility("read") - deploymentDateUtc?: utcDateTime; + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + listByDeviceGroup is ArmResourceListByParent< + Deployment, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; } diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp index a8ed1a1f3e6..beb00e0ae23 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp @@ -1,129 +1,86 @@ -import "@typespec/rest"; -import "@typespec/openapi"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./deviceGroup.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; -using OpenAPI; -using Azure.ClientGenerator.Core; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -// Devices -@doc("An device resource belonging to a device group resource.") +/** + * An device resource belonging to a device group resource. + */ @parentResource(DeviceGroup) -model Device is ProxyResource { - @doc("Device name") +model Device is Azure.ResourceManager.ProxyResource { + /** + * Device name + */ @pattern("^[a-zA-Z0-9-]{128}$") - @key("deviceName") @path + @key("deviceName") @segment("devices") + @visibility("read") name: string; } -interface ProxyResourceOperationsDevice< - TResource extends ArmResource, - TListParameters extends {} = {} -> { - @doc("Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product.") - get is ArmResourceRead; - @doc("Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only.") - createOrUpdate is ArmResourceCreateOrUpdateAsync; - @doc("List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - list is ArmResourceListByParent< - TResource, - TListParameters & BaseParameters - >; - delete is ArmResourceDeleteAsync; - @doc("Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level.") - update is CustomArmResourcePatchAsync; -} - @armResourceOperations -interface Devices extends ProxyResourceOperationsDevice { - @autoRoute - @armResourceAction(Device) - @post - @doc("Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product.") - @extension("x-ms-long-running-operation", true) - @extension( - "x-ms-long-running-operation-options", - { - `final-state-via`: "location", - } - ) - generateCapabilityImage( - ...ResourceInstanceParameters, - - @doc("Generate capability image request body.") - @body - @projectedName("python", "parameters") - generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, - ): ArmResponse | ArmAcceptedResponse | ErrorResponse; -} - -@doc("The properties of device") -model DeviceProperties { - @doc("Device ID") - @visibility("create", "read") - deviceId?: string; - - @doc("SKU of the chip") - @visibility("read") - chipSku?: string; - - @doc("OS version available for installation when update requested") - @visibility("read") - lastAvailableOsVersion?: string; - - @doc("OS version running on device when update requested") - @visibility("read") - lastInstalledOsVersion?: string; - - @doc("Time when update requested and new OS version available") - @visibility("read") - lastOsUpdateUtc?: utcDateTime; - - @doc("Time when update was last requested") - @visibility("read") - lastUpdateRequestUtc?: utcDateTime; - - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} +interface Devices { + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. + */ + get is ArmResourceRead; -// Device models -@doc("Request of the action to create a signed device capability image") -model GenerateCapabilityImageRequest { - @doc("List of capabilities to create") - capabilities: CapabilityType[]; -} + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "Existing API" + @parameterVisibility + update is ArmCustomPatchAsync< + Device, + DeviceUpdate, + LroHeaders = Azure.Core.Foundations.RetryAfterHeader + >; -@doc("Signed device capability image response") -model SignedCapabilityImageResponse { - @doc("The signed device capability image as a UTF-8 encoded base 64 string.") - @visibility("read") - image?: string; -} + /** + * Delete a Device + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; -@doc("Capability image type") -enum CapabilityType { - /** Application development capability */ - ApplicationDevelopment, - /** Field servicing capability */ - FieldServicing, + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + listByDeviceGroup is ArmResourceListByParent; + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. + */ + generateCapabilityImage is ArmResourceActionAsync< + Device, + GenerateCapabilityImageRequest, + SignedCapabilityImageResponse + >; } -@doc("The properties of device patch") -model DevicePatchProperties { - @doc("Device group id") - deviceGroupId: string; -} +@@doc(Devices.generateCapabilityImage::parameters.body, + "Generate capability image request body." +); +@@encodedName(Devices.generateCapabilityImage::parameters.body, + "application/json", + "generateDeviceCapabilityRequest" +); +@@extension(Devices.generateCapabilityImage::parameters.body, + "x-ms-client-name", + "generateDeviceCapabilityRequest" +); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp index acb3c5bbe5e..d050170ec64 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp @@ -1,129 +1,98 @@ -import "@typespec/rest"; -import "@typespec/openapi"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./product.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; -using OpenAPI; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -@doc("An device group resource belonging to a product resource.") +/** + * An device group resource belonging to a product resource. + */ @parentResource(Product) -model DeviceGroup is ProxyResource { - @doc("Name of device group.") +model DeviceGroup is Azure.ResourceManager.ProxyResource { + /** + * Name of device group. + */ @pattern("^[A-Za-z0-9]{1,2}$|^[A-Za-z0-9][A-Za-z0-9\\s]{1,48}[A-Za-z0-9]$|^\\.default$|^\\.unassigned$") - @key("deviceGroupName") @path + @key("deviceGroupName") @segment("deviceGroups") + @visibility("read") name: string; } -interface ProxyResourceOperationsDeviceGroups< - TResource extends ArmResource, - TListParameters extends {} = {} -> { - @doc("List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - list is ArmResourceListByParent< - TResource, - TListParameters & BaseParameters - >; - @doc("Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") +@armResourceOperations +interface DeviceGroups { + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ get is ArmResourceRead; - @doc("Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - createOrUpdate is ArmResourceCreateOrUpdateAsync; - @doc("Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - delete is ArmResourceDeleteAsync; - @doc("Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - update is ArmResourcePatchAsync; -} -@armResourceOperations -interface DeviceGroups - extends ProxyResourceOperationsDeviceGroups< - DeviceGroup, - ListQueryParameters - > { - @autoRoute - @doc("Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - @armResourceAction(DeviceGroup) - @post - countDevices( - ...ResourceInstanceParameters, - ): ArmResponse | ErrorResponse; + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + @parameterVisibility + update is ArmCustomPatchAsync; + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; - @autoRoute - @armResourceAction(DeviceGroup) - @doc("Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only.") - @extension("x-ms-long-running-operation", true) - @extension( - "x-ms-long-running-operation-options", + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + listByProduct is ArmResourceListByParent< + DeviceGroup, { - `final-state-via`: "location", + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; } - ) - @post - claimDevices( - ...ResourceInstanceParameters, - - @doc("Bulk claim devices request body.") - @body - claimDevicesRequest: ClaimDevicesRequest, - ): ArmAcceptedResponse | ErrorResponse; -} - -@doc("The properties of deviceGroup") -model DeviceGroupProperties { - @doc("Description of the device group.") - description?: string; - - @doc("Operating system feed type of the device group.") - osFeedType?: OSFeedType; - - @doc("Update policy of the device group.") - updatePolicy?: UpdatePolicy; - - @doc("Flag to define if the user allows for crash dump collection.") - allowCrashDumpsCollection?: AllowCrashDumpCollection; - - @doc("Regional data boundary for the device group.") - regionalDataBoundary?: RegionalDataBoundary; - - @visibility("read") - @doc("Deployment status for the device group.") - hasDeployment?: boolean; - - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} + >; -@doc("OS feed type values.") -enum OSFeedType { - /** Retail OS feed type. */ - Retail, - /** Retail evaluation OS feed type. */ - RetailEval, -} + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. + */ + claimDevices is ArmResourceActionNoResponseContentAsync< + DeviceGroup, + ClaimDevicesRequest + >; -@doc("Update policy values.") -enum UpdatePolicy { - /** Update all policy. */ - UpdateAll, - /** No update for 3rd party app policy. */ - No3rdPartyAppUpdates, + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + countDevices is ArmResourceActionSync< + DeviceGroup, + void, + CountDevicesResponse + >; } -// Device group models - -@doc("Request to the action call to bulk claim devices.") -model ClaimDevicesRequest { - @doc("Device identifiers of the devices to be claimed.") - deviceIdentifiers: string[]; -} +@@doc(DeviceGroups.claimDevices::parameters.body, + "Bulk claim devices request body." +); +@@encodedName(DeviceGroups.claimDevices::parameters.body, + "application/json", + "claimDevicesRequest" +); +@@extension(DeviceGroups.claimDevices::parameters.body, + "x-ms-client-name", + "claimDevicesRequest" +); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/image.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/image.tsp index 16c445ed83a..1602999d0c1 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/image.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/image.tsp @@ -1,128 +1,63 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./catalog.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -//Images -@doc("An image resource belonging to a catalog resource.") +/** + * An image resource belonging to a catalog resource. + */ @parentResource(Catalog) -model Image is ProxyResource { - @doc("Image name. Use .default for image creation.") - @key("imageName") +model Image is Azure.ResourceManager.ProxyResource { + /** + * Image name. Use an image GUID for GA versions of the API. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern" "existing api" @path + @key("imageName") @segment("images") + @visibility("read") name: string; } @armResourceOperations -interface Images - extends ProxyResourceOperationsReadListCreateDelete< - Image, - ListQueryParameters - > {} - -@doc("The properties of image") -model ImageProperties { - @doc("Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads.") - @visibility("create", "read") - image?: string; - - @doc("Image ID") - @visibility("create", "read") - imageId?: string; - - @doc("Image name") - @visibility("read") - imageName?: string; - - @doc("Regional data boundary for an image") - @visibility("create", "read") - regionalDataBoundary?: RegionalDataBoundary; - - @doc("Location the image") - @visibility("read") - uri?: string; - - @doc("The image description.") - @visibility("read") - description?: string; - - @doc("The image component id.") - @visibility("read") - componentId?: string; - - @doc("The image type.") - @visibility("read") - imageType?: ImageType; - - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} - -@doc("Image upload request body.") -model ImageUploadRequestBody { - @doc(".") - images: string; -} - -@doc("Image type values.") -enum ImageType { - /** Invalid image. */ - InvalidImageType, - /** One Bl image type */ - OneBl, - /** Pluton image type */ - PlutonRuntime, - /** Wifi firmware image type */ - WifiFirmware, - /** Security monitor image type */ - SecurityMonitor, - /** Normal world loader image type */ - NormalWorldLoader, - /** Normal world dtb image type */ - NormalWorldDtb, - /** Normal world kernel image type */ - NormalWorldKernel, - /** Root FS image type */ - RootFs, - /** Services image type */ - Services, - /** Applications image type */ - Applications, - /** FW config image type */ - FwConfig, - /** Boot manifest image type */ - BootManifest, - /** Nwfs image type */ - Nwfs, - /** Trusted key store image type */ - TrustedKeystore, - /** Policy image type */ - Policy, - /** Customer board config image type */ - CustomerBoardConfig, - /** Update certificate store image type */ - UpdateCertStore, - /** Base system update manifest image type */ - BaseSystemUpdateManifest, - /** Firmware update manifest image type */ - FirmwareUpdateManifest, - /** Customer update manifest image type */ - CustomerUpdateManifest, - /** Recovery manifest image type */ - RecoveryManifest, - /** manifest set image type */ - ManifestSet, - /** Other image type */ - Other, +interface Images { + /** + * Get a Image + */ + get is ArmResourceRead; + + /** + * Create a Image + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + /** + * Delete a Image + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; + + /** + * List Image resources by Catalog + */ + listByCatalog is ArmResourceListByParent< + Image, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; } diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/main.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/main.tsp index 7bd635ad2bb..c169d0c5d98 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/main.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/main.tsp @@ -1,30 +1,41 @@ -import "./common.tsp"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "./models.tsp"; import "./catalog.tsp"; +import "./certificate.tsp"; import "./image.tsp"; +import "./product.tsp"; import "./deviceGroup.tsp"; -import "./certificate.tsp"; import "./deployment.tsp"; import "./device.tsp"; -import "./deviceGroup.tsp"; -import "./product.tsp"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; +using TypeSpec.Http; using Azure.ResourceManager.Foundations; using Azure.Core; using Azure.ResourceManager; - +using TypeSpec.Versioning; +/** + * Azure Sphere resource management API. + */ @armProviderNamespace @service({ title: "AzureSphereProviderClient", - version: "2022-09-01-preview", }) -@doc("Azure Sphere resource management API.") -@useDependency(Azure.Core.Versions.v1_0_Preview_1) -@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@versioned(Versions) +@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) namespace Microsoft.AzureSphere; + +/** + * The available API versions. + */ +enum Versions { + /** + * The 2024-04-01 API version. + */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @useDependency(Azure.Core.Versions.v1_0_Preview_1) + v2024_04_01: "2024-04-01", +} diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/models.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/models.tsp new file mode 100644 index 00000000000..750a50b85fb --- /dev/null +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/models.tsp @@ -0,0 +1,865 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; +using OpenAPI; + +namespace Microsoft.AzureSphere; + +interface Operations extends Azure.ResourceManager.Operations {} + +/** + * Provisioning state of resource. + */ +union ProvisioningState { + string, + + /** + * Resource has been created. + */ + Succeeded: "Succeeded", + + /** + * Resource creation failed. + */ + Failed: "Failed", + + /** + * Resource creation was canceled. + */ + Canceled: "Canceled", + + /** + * The resource is being provisioned + */ + Provisioning: "Provisioning", + + /** + * The resource is being updated + */ + Updating: "Updating", + + /** + * The resource is being deleted + */ + Deleting: "Deleting", + + /** + * The resource create request has been accepted + */ + Accepted: "Accepted", +} + +/** + * Certificate status values. + */ +union CertificateStatus { + string, + + /** + * Certificate is active + */ + Active: "Active", + + /** + * Certificate is inactive + */ + Inactive: "Inactive", + + /** + * Certificate has expired + */ + Expired: "Expired", + + /** + * Certificate has been revoked + */ + Revoked: "Revoked", +} + +/** + * Regional data boundary values. + */ +union RegionalDataBoundary { + string, + + /** + * No data boundary + */ + None: "None", + + /** + * EU data boundary + */ + EU: "EU", +} + +/** + * Image type values. + */ +union ImageType { + string, + + /** + * Invalid image. + */ + InvalidImageType: "InvalidImageType", + + /** + * One Bl image type + */ + OneBl: "OneBl", + + /** + * Pluton image type + */ + PlutonRuntime: "PlutonRuntime", + + /** + * Wifi firmware image type + */ + WifiFirmware: "WifiFirmware", + + /** + * Security monitor image type + */ + SecurityMonitor: "SecurityMonitor", + + /** + * Normal world loader image type + */ + NormalWorldLoader: "NormalWorldLoader", + + /** + * Normal world dtb image type + */ + NormalWorldDtb: "NormalWorldDtb", + + /** + * Normal world kernel image type + */ + NormalWorldKernel: "NormalWorldKernel", + + /** + * Root FS image type + */ + RootFs: "RootFs", + + /** + * Services image type + */ + Services: "Services", + + /** + * Applications image type + */ + Applications: "Applications", + + /** + * FW config image type + */ + FwConfig: "FwConfig", + + /** + * Boot manifest image type + */ + BootManifest: "BootManifest", + + /** + * Nwfs image type + */ + Nwfs: "Nwfs", + + /** + * Trusted key store image type + */ + TrustedKeystore: "TrustedKeystore", + + /** + * Policy image type + */ + Policy: "Policy", + + /** + * Customer board config image type + */ + CustomerBoardConfig: "CustomerBoardConfig", + + /** + * Update certificate store image type + */ + UpdateCertStore: "UpdateCertStore", + + /** + * Base system update manifest image type + */ + BaseSystemUpdateManifest: "BaseSystemUpdateManifest", + + /** + * Firmware update manifest image type + */ + FirmwareUpdateManifest: "FirmwareUpdateManifest", + + /** + * Customer update manifest image type + */ + CustomerUpdateManifest: "CustomerUpdateManifest", + + /** + * Recovery manifest image type + */ + RecoveryManifest: "RecoveryManifest", + + /** + * manifest set image type + */ + ManifestSet: "ManifestSet", + + /** + * Other image type + */ + Other: "Other", +} + +/** + * OS feed type values. + */ +union OSFeedType { + string, + + /** + * Retail OS feed type. + */ + Retail: "Retail", + + /** + * Retail evaluation OS feed type. + */ + RetailEval: "RetailEval", +} + +/** + * Update policy values. + */ +union UpdatePolicy { + string, + + /** + * Update all policy. + */ + UpdateAll: "UpdateAll", + + /** + * No update for 3rd party app policy. + */ + No3rdPartyAppUpdates: "No3rdPartyAppUpdates", +} + +/** + * Allow crash dumps values. + */ +union AllowCrashDumpCollection { + string, + + /** + * Crash dump collection enabled + */ + Enabled: "Enabled", + + /** + * Crash dump collection disabled + */ + Disabled: "Disabled", +} + +/** + * Capability image type + */ +union CapabilityType { + string, + + /** + * Application development capability + */ + ApplicationDevelopment: "ApplicationDevelopment", + + /** + * Field servicing capability + */ + FieldServicing: "FieldServicing", +} + +/** + * Catalog properties + */ +model CatalogProperties { + /** + * The Azure Sphere tenant ID associated with the catalog. + */ + @visibility("read") + tenantId?: string; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * Common fields that are returned in the response for all Azure Resource Manager resources + */ +model Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + */ + @visibility("read") + id?: string; + + /** + * The name of the resource + */ + @visibility("read") + name?: string; + + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + */ + @visibility("read") + type?: string; + + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @visibility("read") + systemData?: SystemData; +} + +/** + * The type used for update operations of the Catalog. + */ +model CatalogUpdate { + /** + * Resource tags. + */ + tags?: Record; +} + +/** + * The properties of certificate + */ +model CertificateProperties { + /** + * The certificate as a UTF-8 encoded base 64 string. + */ + @visibility("read") + certificate?: string; + + /** + * The certificate status. + */ + @visibility("read") + status?: CertificateStatus; + + /** + * The certificate subject. + */ + @visibility("read") + subject?: string; + + /** + * The certificate thumbprint. + */ + @visibility("read") + thumbprint?: string; + + /** + * The certificate expiry date. + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + expiryUtc?: utcDateTime; + + /** + * The certificate not before date. + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + notBeforeUtc?: utcDateTime; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * The certificate chain response. + */ +model CertificateChainResponse { + /** + * The certificate chain. + */ + @visibility("read") + certificateChain?: string; +} + +/** + * Request for the proof of possession nonce + */ +model ProofOfPossessionNonceRequest { + /** + * The proof of possession nonce + */ + proofOfPossessionNonce: string; +} + +/** + * Result of the action to generate a proof of possession nonce + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatible" +model ProofOfPossessionNonceResponse extends CertificateProperties {} + +/** + * Response to the action call for count devices in a catalog. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatible" +model CountDevicesResponse extends CountElementsResponse {} + +/** + * Response of the count for elements. + */ +model CountElementsResponse { + /** + * Number of children resources in parent resource. + */ + value: int32; +} + +/** + * The properties of image + */ +model ImageProperties { + /** + * Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads. + */ + @visibility("read", "create") + image?: string; + + /** + * Image ID + */ + @visibility("read", "create") + imageId?: string; + + /** + * Image name + */ + @visibility("read") + imageName?: string; + + /** + * Regional data boundary for an image + */ + @visibility("read", "create") + regionalDataBoundary?: RegionalDataBoundary; + + /** + * Location the image + */ + @visibility("read") + uri?: string; + + /** + * The image description. + */ + @visibility("read") + description?: string; + + /** + * The image component id. + */ + @visibility("read") + componentId?: string; + + /** + * The image type. + */ + @visibility("read") + imageType?: ImageType; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * The properties of deployment + */ +model DeploymentProperties { + /** + * Deployment ID + */ + @visibility("read", "create") + deploymentId?: string; + + /** + * Images deployed + */ + @visibility("read", "create") + deployedImages?: Image[]; + + /** + * Deployment date UTC + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + deploymentDateUtc?: utcDateTime; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * Request of the action to list device groups for a catalog. + */ +model ListDeviceGroupsRequest { + /** + * Device Group name. + */ + deviceGroupName?: string; +} + +/** + * The properties of deviceGroup + */ +model DeviceGroupProperties { + /** + * Description of the device group. + */ + description?: string; + + /** + * Operating system feed type of the device group. + */ + osFeedType?: OSFeedType; + + /** + * Update policy of the device group. + */ + updatePolicy?: UpdatePolicy; + + /** + * Flag to define if the user allows for crash dump collection. + */ + allowCrashDumpsCollection?: AllowCrashDumpCollection; + + /** + * Regional data boundary for the device group. + */ + regionalDataBoundary?: RegionalDataBoundary; + + /** + * Deployment status for the device group. + */ + @visibility("read") + hasDeployment?: boolean; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * Paged collection of DeviceInsight items + */ +model PagedDeviceInsight is Azure.Core.Page; + +/** + * Device insight report. + */ +model DeviceInsight { + /** + * Device ID + */ + deviceId: string; + + /** + * Event description + */ + description: string; + + /** + * Event start timestamp + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + startTimestampUtc: utcDateTime; + + /** + * Event end timestamp + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + endTimestampUtc: utcDateTime; + + /** + * Event category + */ + eventCategory: string; + + /** + * Event class + */ + eventClass: string; + + /** + * Event type + */ + eventType: string; + + /** + * Event count + */ + eventCount: int32; +} + +/** + * The properties of device + */ +model DeviceProperties { + /** + * Device ID + */ + @visibility("read", "create") + deviceId?: string; + + /** + * SKU of the chip + */ + @visibility("read") + chipSku?: string; + + /** + * OS version available for installation when update requested + */ + @visibility("read") + lastAvailableOsVersion?: string; + + /** + * OS version running on device when update requested + */ + @visibility("read") + lastInstalledOsVersion?: string; + + /** + * Time when update requested and new OS version available + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + lastOsUpdateUtc?: utcDateTime; + + /** + * Time when update was last requested + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + lastUpdateRequestUtc?: utcDateTime; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * The properties of product + */ +model ProductProperties { + /** + * Description of the product + */ + description?: string; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * The type used for update operations of the Product. + */ +model ProductUpdate { + /** + * The updatable properties of the Product. + */ + @extension("x-ms-client-flatten", true) + properties?: ProductUpdateProperties; +} + +/** + * The updatable properties of the Product. + */ +model ProductUpdateProperties { + /** + * Description of the product + */ + description?: string; +} + +/** + * The type used for update operations of the DeviceGroup. + */ +model DeviceGroupUpdate { + /** + * The updatable properties of the DeviceGroup. + */ + @extension("x-ms-client-flatten", true) + properties?: DeviceGroupUpdateProperties; +} + +/** + * The updatable properties of the DeviceGroup. + */ +model DeviceGroupUpdateProperties { + /** + * Description of the device group. + */ + description?: string; + + /** + * Operating system feed type of the device group. + */ + osFeedType?: OSFeedType; + + /** + * Update policy of the device group. + */ + updatePolicy?: UpdatePolicy; + + /** + * Flag to define if the user allows for crash dump collection. + */ + allowCrashDumpsCollection?: AllowCrashDumpCollection; + + /** + * Regional data boundary for the device group. + */ + regionalDataBoundary?: RegionalDataBoundary; +} + +/** + * Request to the action call to bulk claim devices. + */ +model ClaimDevicesRequest { + /** + * Device identifiers of the devices to be claimed. + */ + deviceIdentifiers: string[]; +} + +/** + * The type used for update operations of the Device. + */ +model DeviceUpdate { + /** + * The updatable properties of the Device. + */ + @extension("x-ms-client-flatten", true) + properties?: DeviceUpdateProperties; +} + +/** + * The updatable properties of the Device. + */ +model DeviceUpdateProperties { + /** + * Device group id + */ + deviceGroupId?: string; +} + +/** + * Request of the action to create a signed device capability image + */ +model GenerateCapabilityImageRequest { + /** + * List of capabilities to create + */ + capabilities: CapabilityType[]; +} + +/** + * Signed device capability image response + */ +model SignedCapabilityImageResponse { + /** + * The signed device capability image as a UTF-8 encoded base 64 string. + */ + @visibility("read") + image?: string; +} + +/** + * Response to the action call for count devices in a catalog (preview API). + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatible" +model CountDeviceResponse extends CountElementsResponse {} + +/** + * Provides the custom '$filter' query parameter for list operations + */ +model CustomFilterQueryParameter { + /** + * Filter the result list using the given expression + */ + @query("$filter") + filter?: string; +} + +/** + * Provides the custom '$top' query parameter for list operations. + */ +model CustomTopQueryParameter { + /** + * The number of result items to return. + */ + @query("$top") + top?: int32; +} + +/** + * Provides the custom '$skip' query parameter for list operations. + */ +model CustomSkipQueryParameter { + /** + * The number of result items to skip. + */ + @query("$skip") + skip?: int32; +} + +/** + * Provides the custom '$maxpagesize' query parameter for list operations. + */ +model CustomMaxPageSizeQueryParameter { + /** + * The maximum number of result items per page. + */ + @query("$maxpagesize") + maxpagesize?: int32; +} diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp index 09d6c83c9da..fd663a74bb1 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp @@ -1,72 +1,74 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./catalog.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -//Products -@doc("An product resource belonging to a catalog resource.") +/** + * An product resource belonging to a catalog resource. + */ @parentResource(Catalog) -model Product is ProxyResource { - @doc("Name of product.") +model Product is Azure.ResourceManager.ProxyResource { + /** + * Name of product. + */ @pattern("^[\\w][\\w\\s]{1,48}[\\w]$|^\\.default$|^\\.unassigned$") - @key("productName") @path + @key("productName") @segment("products") + @visibility("read") name: string; } -interface ProxyResourceOperationsProducts< - TResource extends ArmResource, - TListParameters extends {} = {} -> - extends ResourceListByParent< - TResource, - TListParameters & BaseParameters - > { - @doc("Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") +@armResourceOperations +interface Products { + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ get is ArmResourceRead; - @doc("Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - createOrUpdate is ArmResourceCreateOrUpdateAsync; - @doc("Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'") - delete is ArmResourceDeleteAsync; - @doc("Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - update is ArmResourcePatchAsync; -} -@armResourceOperations -interface Products extends ProxyResourceOperationsProducts { - @autoRoute - @doc("Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - @armResourceAction(Product) - @post - generateDefaultDeviceGroups( - ...ResourceInstanceParameters, - ): ArmResponse> | ErrorResponse; + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; - @autoRoute - @doc("Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - @armResourceAction(Product) - @post - countDevices( - ...ResourceInstanceParameters, - ): ArmResponse | ErrorResponse; -} + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + @parameterVisibility + update is ArmCustomPatchAsync; -@doc("The properties of product") -model ProductProperties { - @doc("Description of the product") - description: string; + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; + /** + * List Product resources by Catalog + */ + listByCatalog is ArmResourceListByParent; + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + countDevices is ArmResourceActionSync; + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + generateDefaultDeviceGroups is ArmResourceActionSync< + Product, + void, + ResourceListResult + >; } diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/tspconfig.yaml b/packages/typespec-python/test/azure/specification/mgmt/sphere/tspconfig.yaml index dc225dbf530..e00a4055bc4 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/tspconfig.yaml +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/tspconfig.yaml @@ -1,7 +1,8 @@ emit: - - '@azure-tools/typespec-autorest' + - "@azure-tools/typespec-autorest" options: - '@azure-tools/typespec-autorest': + "@azure-tools/typespec-autorest": + omit-unreachable-types: true emitter-output-dir: "{project-root}/.." azure-resource-provider-folder: "resource-manager" output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/azuresphere.json" @@ -14,4 +15,7 @@ options: save-inputs: false clear-output-folder: true namespace: Azure.Sphere - model-namespace: false \ No newline at end of file + model-namespace: false +linter: + extends: + - "@azure-tools/typespec-azure-resource-manager/all" diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py index 85d7e471933..17cb4b64ced 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py @@ -25,6 +25,7 @@ from .. import models as _models from .._model_base import _deserialize from .._serialization import Serializer +from .._validation import api_version_validation from .._vendor import PageableClientMixinABC if sys.version_info >= (3, 9): @@ -59,6 +60,9 @@ def build_pageable_list_request(*, maxpagesize: Optional[int] = None, **kwargs: class PageableClientOperationsMixin(PageableClientMixinABC): + @api_version_validation( + params_added_on={"1.0-preview.1": ["maxpagesize"]}, + ) def list(self, **kwargs: Any) -> Iterable["_models.User"]: """List users. diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_validation.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_validation.py new file mode 100644 index 00000000000..59609bcd4fe --- /dev/null +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_validation.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Unbranded Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Unbranded (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if method_added_on > client_api_version: + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and api_version > client_api_version + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py index 8fa63322568..cc4196b8fdc 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py @@ -24,6 +24,7 @@ from ... import models as _models from ..._model_base import _deserialize from ..._operations._operations import build_pageable_list_request +from ..._validation import api_version_validation from .._vendor import PageableClientMixinABC if sys.version_info >= (3, 9): @@ -36,6 +37,9 @@ class PageableClientOperationsMixin(PageableClientMixinABC): + @api_version_validation( + params_added_on={"1.0-preview.1": ["maxpagesize"]}, + ) def list(self, **kwargs: Any) -> AsyncIterable["_models.User"]: """List users. diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py index d6952b81caf..1f01e20d2e9 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py @@ -149,6 +149,9 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) # type: ignore + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bool: """Test that grew up from accepting no parameters to an optional input parameter. @@ -202,6 +205,9 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) # pylint: disable=inconsistent-return-statements def from_one_required( # pylint: disable=inconsistent-return-statements self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: @@ -260,6 +266,9 @@ def from_one_required( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) # pylint: disable=inconsistent-return-statements def from_one_optional( # pylint: disable=inconsistent-return-statements self, *, parameter: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py index f9537e017e7..a4b7cb8f4e4 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py @@ -93,6 +93,9 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) # type: ignore + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bool: """Test that grew up from accepting no parameters to an optional input parameter. @@ -146,6 +149,9 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) # pylint: disable=inconsistent-return-statements async def from_one_required( # pylint: disable=inconsistent-return-statements self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: @@ -204,6 +210,9 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore + @api_version_validation( + params_added_on={"v2": ["new_parameter"]}, + ) # pylint: disable=inconsistent-return-statements async def from_one_optional( # pylint: disable=inconsistent-return-statements self, *, parameter: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any ) -> None: diff --git a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py index 2856262af13..cd6f54f107c 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py @@ -61,7 +61,8 @@ def __init__(self, *args, **kwargs) -> None: @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -97,7 +98,8 @@ async def v2_in_interface( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -126,7 +128,8 @@ async def v2_in_interface( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -154,7 +157,8 @@ async def v2_in_interface( """ @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -243,8 +247,7 @@ class AddedClientOperationsMixin(AddedClientMixinABC): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: _models.ModelV1, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -284,8 +287,7 @@ async def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: JSON, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -317,8 +319,7 @@ async def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: IO[bytes], *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -349,8 +350,7 @@ async def v1( """ @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, **kwargs: Any @@ -443,7 +443,8 @@ async def v1( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -479,7 +480,8 @@ async def v2( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -506,7 +508,8 @@ async def v2(self, body: JSON, *, content_type: str = "application/json", **kwar @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -532,7 +535,8 @@ async def v2(self, body: IO[bytes], *, content_type: str = "application/json", * """ @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2. diff --git a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py index 4e70b2db4dc..0e438122aa5 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py @@ -112,7 +112,8 @@ def __init__(self, *args, **kwargs): @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -148,7 +149,8 @@ def v2_in_interface( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -175,7 +177,8 @@ def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -203,7 +206,8 @@ def v2_in_interface( """ @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -292,8 +296,7 @@ class AddedClientOperationsMixin(AddedClientMixinABC): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: _models.ModelV1, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -333,8 +336,7 @@ def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: JSON, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -366,8 +368,7 @@ def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: IO[bytes], *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -398,8 +399,7 @@ def v1( """ @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1(self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, **kwargs: Any) -> _models.ModelV1: """v1. @@ -490,7 +490,8 @@ def v1(self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, * @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -524,7 +525,8 @@ def v2(self, body: _models.ModelV2, *, content_type: str = "application/json", * @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -551,7 +553,8 @@ def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: An @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -577,7 +580,8 @@ def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwarg """ @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6ae8f054334..97663f2db57 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,5 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - importers: .: @@ -61,30 +57,30 @@ importers: specifier: workspace:^ version: link:../autorest.python '@typespec/openapi3': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/versioning@0.56.0) js-yaml: specifier: ~4.1.0 version: 4.1.0 devDependencies: '@azure-tools/cadl-ranch-expect': - specifier: ~0.13.3 - version: 0.13.3(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.13.4 + version: 0.13.4(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/cadl-ranch-specs': - specifier: ~0.33.2 - version: 0.33.2(@azure-tools/cadl-ranch-expect@0.13.3)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.33.4 + version: 0.33.4(@azure-tools/cadl-ranch-expect@0.13.4)(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/typespec-autorest': - specifier: ~0.41.0 - version: 0.41.1(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.9)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.42.0 + version: 0.42.0(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@azure-tools/typespec-client-generator-core@0.42.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/typespec-azure-core': - specifier: ~0.41.0 - version: 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) + specifier: ~0.43.0-dev.1 + version: 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) '@azure-tools/typespec-azure-resource-manager': - specifier: ~0.41.0 - version: 0.41.0(@azure-tools/typespec-autorest@0.41.1)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.43.0-dev.2 + version: 0.43.0-dev.2(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/typespec-client-generator-core': - specifier: ~0.41.8 - version: 0.41.9(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.42.1 + version: 0.42.1(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@types/js-yaml': specifier: ~4.0.5 version: 4.0.5 @@ -95,29 +91,29 @@ importers: specifier: ^18.16.3 version: 18.16.3 '@typespec/compiler': - specifier: ~0.55.0 - version: 0.55.0 - '@typespec/eslint-config-typespec': - specifier: ~0.55.0 - version: 0.55.0(prettier@3.2.5) + specifier: ~0.57.0-dev.4 + version: 0.57.0-dev.4 + '@typespec/eslint-plugin': + specifier: ~0.56.0 + version: 0.56.0(eslint@8.57.0)(typescript@5.1.3) '@typespec/http': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0) + specifier: ~0.57.0-dev.2 + version: 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) '@typespec/openapi': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) '@typespec/rest': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) '@typespec/versioning': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.57.0-dev.4) c8: specifier: ~7.13.0 version: 7.13.0 eslint: - specifier: ^8.56.0 - version: 8.56.0 + specifier: ^8.57.0 + version: 8.57.0 mocha: specifier: ~10.2.0 version: 10.2.0 @@ -209,25 +205,55 @@ packages: '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) dev: true - /@azure-tools/cadl-ranch-specs@0.33.2(@azure-tools/cadl-ranch-expect@0.13.3)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-goFLjvXGeOC+r5oCOhI3csuWqQFPGO4iuhLdGmjyyB2YDiiNTdKXV19hyGVM2FYeHvmmgElBHdHY6E49+Z6wkw==} + /@azure-tools/cadl-ranch-expect@0.13.4(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-2j9Mxr8tz7zF8j8L/R/KEPhES/cJDt21wUTkQv0TKwZ4Kz5HGHBCsvnOnoBs72H7Q8DHpqOIhNDak40BHCrEGA==} engines: {node: '>=16.0.0'} peerDependencies: - '@azure-tools/cadl-ranch-expect': ~0.13.3 - '@azure-tools/typespec-azure-core': ~0.41.0 - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/rest': ~0.55.0 - '@typespec/versioning': ~0.55.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + dev: true + + /@azure-tools/cadl-ranch-expect@0.13.4(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-2j9Mxr8tz7zF8j8L/R/KEPhES/cJDt21wUTkQv0TKwZ4Kz5HGHBCsvnOnoBs72H7Q8DHpqOIhNDak40BHCrEGA==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 dependencies: - '@azure-tools/cadl-ranch': 0.12.7(@typespec/versioning@0.55.0) + '@typespec/compiler': 0.57.0-dev.4 + '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + dev: true + + /@azure-tools/cadl-ranch-specs@0.33.4(@azure-tools/cadl-ranch-expect@0.13.4)(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-xTTyZIWT8bjXNoFr1M5CA6L7yo3mLBMzSDYPepCCWk3Wx8P2bl0NkK9YS4udfTA9TKlUJPSW23DvHcQfJ2rurQ==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@azure-tools/cadl-ranch-expect': ~0.13.4 + '@azure-tools/typespec-azure-core': ~0.42.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@azure-tools/cadl-ranch': 0.12.8(@typespec/versioning@0.56.0) '@azure-tools/cadl-ranch-api': 0.4.3 - '@azure-tools/cadl-ranch-expect': 0.13.3(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) - '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@azure-tools/cadl-ranch-expect': 0.13.4(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@azure-tools/typespec-azure-core': 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) + '@typespec/compiler': 0.57.0-dev.4 + '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) transitivePeerDependencies: - '@types/express' - encoding @@ -270,76 +296,112 @@ packages: - supports-color dev: true - /@azure-tools/typespec-autorest@0.41.1(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.9)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-m2Rq8aFMvICfkG/+B1kGSDepCUDHhiQ93y1/IcE+XU1+IU2iuNoSgUd0lHgksP5Aqnvs3Wm9JDmA9nMNjOM1Ww==} - engines: {node: '>=18.0.0'} - peerDependencies: - '@azure-tools/typespec-azure-core': ~0.41.0 - '@azure-tools/typespec-client-generator-core': ~0.41.1 - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/openapi': ~0.55.0 - '@typespec/rest': ~0.55.0 - '@typespec/versioning': ~0.55.0 + /@azure-tools/cadl-ranch@0.12.8(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-dkVz6YxwFBgwmWtYqpzY1cuncuuHcvQbd8gHx1j9tvl8VjEjd5gVTAEFkp9ZuOM8P9L/VP5x4q14RlRMOMitHQ==} + engines: {node: '>=16.0.0'} + hasBin: true dependencies: - '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) - '@azure-tools/typespec-client-generator-core': 0.41.9(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@azure-tools/cadl-ranch-api': 0.4.3 + '@azure-tools/cadl-ranch-coverage-sdk': 0.8.2 + '@azure-tools/cadl-ranch-expect': 0.13.4(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@azure/identity': 3.4.2 + '@types/js-yaml': 4.0.9 + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + ajv: 8.12.0 + body-parser: 1.20.2 + deep-equal: 2.2.3 + express: 4.19.2 + express-promise-router: 4.1.1(express@4.19.2) + glob: 10.3.12 + jackspeak: 2.1.1 + js-yaml: 4.1.0 + morgan: 1.10.0 + multer: 1.4.5-lts.1 + node-fetch: 3.3.2 + picocolors: 1.0.0 + source-map-support: 0.5.21 + winston: 3.13.0 + xml2js: 0.5.0 + yargs: 17.7.2 + transitivePeerDependencies: + - '@types/express' + - '@typespec/versioning' + - encoding + - supports-color dev: true - /@azure-tools/typespec-azure-core@0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0): - resolution: {integrity: sha512-bnVrLxyjhMfKv75POL3m+lWjyqpLtWYEM9t2mrhFECHfW3+gWzTKIg98oNMKLXmev/sCc9QhbkKLs72jqxNL1Q==} + /@azure-tools/typespec-autorest@0.42.0(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@azure-tools/typespec-client-generator-core@0.42.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-3cB5SiIbRDvGXpadnxwqsNhQ4A9pteGTHIpVlKpENpvzIoWU9phe+uBmGJDiQ/9CQPiLk7JncER95XYVOvn/vA==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/rest': ~0.55.0 + '@azure-tools/typespec-azure-core': ~0.42.0 + '@azure-tools/typespec-client-generator-core': ~0.42.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/openapi': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) + '@azure-tools/typespec-client-generator-core': 0.42.1(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@typespec/compiler': 0.57.0-dev.4 + '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + '@typespec/openapi': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + dev: true + + /@azure-tools/typespec-azure-core@0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0): + resolution: {integrity: sha512-KL23ecMJMnK/Dg7WGoUsgoxD/WTjV99eOxKHgegN1d2A7/9Q/y9rYGD5qgaApe3bg8eQZ4VW/9miQy/3ZJAjDQ==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 || >=0.57.0-dev <0.57.0 + '@typespec/http': ~0.56.0 || >=0.57.0-dev <0.57.0 + '@typespec/rest': ~0.56.0 || >=0.57.0-dev <0.57.0 dependencies: - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/compiler': 0.57.0-dev.4 + '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) dev: true - /@azure-tools/typespec-azure-resource-manager@0.41.0(@azure-tools/typespec-autorest@0.41.1)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-KPeQQle+hd508bkRjWHDsUXhoLjXVJg0DQyPM9wIxf+3cE0yH0aUxWPU6aj+aTio84226ExO2Qh8IadqgoQ5qg==} + /@azure-tools/typespec-azure-resource-manager@0.43.0-dev.2(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-YjvzjZpKmpQd76uyIuv8wGsb+FBlgbwOgKlROQY47USgGrtzUox/t99JN5rwlyIEAp3TrheNunt0gZ6jyOy1PA==} engines: {node: '>=18.0.0'} peerDependencies: - '@azure-tools/typespec-autorest': ~0.41.0 - '@azure-tools/typespec-azure-core': ~0.41.0 - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/openapi': ~0.55.0 - '@typespec/rest': ~0.55.0 - '@typespec/versioning': ~0.55.0 - dependencies: - '@azure-tools/typespec-autorest': 0.41.1(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.9)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) - '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@azure-tools/typespec-azure-core': ~0.42.0 || >=0.43.0-dev <0.43.0 + '@typespec/compiler': ~0.56.0 || >=0.57.0-dev <0.57.0 + '@typespec/http': ~0.56.0 || >=0.57.0-dev <0.57.0 + '@typespec/openapi': ~0.56.0 || >=0.57.0-dev <0.57.0 + '@typespec/rest': ~0.56.0 || >=0.57.0-dev <0.57.0 + '@typespec/versioning': ~0.56.0 || >=0.57.0-dev <0.57.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) + '@typespec/compiler': 0.57.0-dev.4 + '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + '@typespec/openapi': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + change-case: 5.4.4 + pluralize: 8.0.0 dev: true - /@azure-tools/typespec-client-generator-core@0.41.9(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-OKtt0p/MwDZ4lJwN4Wz2u28vLF65iQTpbikJ2iH954K11p8bo4R2LNGI7FMoE3FQKnpVqd8CwZRejG4KZX/yvg==} + /@azure-tools/typespec-client-generator-core@0.42.1(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-2s4DrozUcShg9+n61ZWUjDQ99mhJpyG9DH/84KMpisKUcIkN/1G1bPRLJt2NKZLS2rZz0EfPLF7arcKQ95y8Ug==} engines: {node: '>=18.0.0'} peerDependencies: - '@azure-tools/typespec-azure-core': ~0.41.0 - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/rest': ~0.55.0 - '@typespec/versioning': ~0.55.0 - dependencies: - '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@azure-tools/typespec-azure-core': ~0.42.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) + '@typespec/compiler': 0.57.0-dev.4 + '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) change-case: 5.4.4 pluralize: 8.0.0 dev: true @@ -687,16 +749,6 @@ packages: kuler: 2.0.0 dev: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.56.0): - resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - dependencies: - eslint: 8.56.0 - eslint-visitor-keys: 3.4.3 - dev: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.57.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -729,11 +781,6 @@ packages: - supports-color dev: true - /@eslint/js@8.56.0: - resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - /@eslint/js@8.57.0: resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -1229,15 +1276,6 @@ packages: dev: true optional: true - /@pkgr/core@0.1.1: - resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} - engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - dev: true - - /@rushstack/eslint-patch@1.10.1: - resolution: {integrity: sha512-S3Kq8e7LqxkA9s7HKLqXGTGck1uwis5vAXan3FnU5yw1Ec5hsSGnq4s/UCaSqABPOnOTg7zASLyst7+ohgWexg==} - dev: true - /@sigstore/bundle@2.3.1: resolution: {integrity: sha512-eqV17lO3EIFqCWK3969Rz+J8MYrRZKw9IBHpSo6DEcEX2c+uzDFOgHE9f2MnyDpfs48LFO4hXmk9KhQ74JzU1g==} engines: {node: ^16.14.0 || >=18.0.0} @@ -1323,8 +1361,8 @@ packages: resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} dev: true - /@types/json-schema@7.0.12: - resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: true /@types/json5@0.0.29: @@ -1369,8 +1407,8 @@ packages: resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} dev: true - /@types/semver@7.5.0: - resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} + /@types/semver@7.5.8: + resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} dev: true /@types/triple-beam@1.3.2: @@ -1387,126 +1425,21 @@ packages: '@types/node': 18.19.29 dev: true - /@typescript-eslint/eslint-plugin@7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4): - resolution: {integrity: sha512-HpqNTH8Du34nLxbKgVMGljZMG0rJd2O9ecvr2QLYp+7512ty1j42KnsFwspPXg1Vh8an9YImf6CokUBltisZFQ==} + /@typescript-eslint/scope-manager@7.8.0: + resolution: {integrity: sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g==} engines: {node: ^18.18.0 || >=20.0.0} - peerDependencies: - '@typescript-eslint/parser': ^7.0.0 - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true dependencies: - '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.5.0(eslint@8.56.0)(typescript@5.1.3) - '@typescript-eslint/scope-manager': 7.5.0 - '@typescript-eslint/type-utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) - '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) - '@typescript-eslint/visitor-keys': 7.5.0 - debug: 4.3.4(supports-color@8.1.1) - eslint: 8.57.0 - graphemer: 1.4.0 - ignore: 5.3.1 - natural-compare: 1.4.0 - semver: 7.6.0 - ts-api-utils: 1.0.1(typescript@5.4.4) - typescript: 5.4.4 - transitivePeerDependencies: - - supports-color + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/visitor-keys': 7.8.0 dev: true - /@typescript-eslint/parser@7.5.0(eslint@8.56.0)(typescript@5.1.3): - resolution: {integrity: sha512-cj+XGhNujfD2/wzR1tabNsidnYRaFfEkcULdcIyVBYcXjBvBKOes+mpMBP7hMpOyk+gBcfXsrg4NBGAStQyxjQ==} + /@typescript-eslint/types@7.8.0: + resolution: {integrity: sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw==} engines: {node: ^18.18.0 || >=20.0.0} - peerDependencies: - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/scope-manager': 7.5.0 - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.1.3) - '@typescript-eslint/visitor-keys': 7.5.0 - debug: 4.3.4(supports-color@8.1.1) - eslint: 8.56.0 - typescript: 5.1.3 - transitivePeerDependencies: - - supports-color - dev: true - - /@typescript-eslint/scope-manager@6.21.0: - resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/visitor-keys': 6.21.0 - dev: true - - /@typescript-eslint/scope-manager@7.5.0: - resolution: {integrity: sha512-Z1r7uJY0MDeUlql9XJ6kRVgk/sP11sr3HKXn268HZyqL7i4cEfrdFuSSY/0tUqT37l5zT0tJOsuDP16kio85iA==} - engines: {node: ^18.18.0 || >=20.0.0} - dependencies: - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/visitor-keys': 7.5.0 - dev: true - - /@typescript-eslint/type-utils@7.5.0(eslint@8.57.0)(typescript@5.4.4): - resolution: {integrity: sha512-A021Rj33+G8mx2Dqh0nMO9GyjjIBK3MqgVgZ2qlKf6CJy51wY/lkkFqq3TqqnH34XyAHUkq27IjlUkWlQRpLHw==} - engines: {node: ^18.18.0 || >=20.0.0} - peerDependencies: - eslint: ^8.56.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.4) - '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) - debug: 4.3.4(supports-color@8.1.1) - eslint: 8.57.0 - ts-api-utils: 1.0.1(typescript@5.4.4) - typescript: 5.4.4 - transitivePeerDependencies: - - supports-color - dev: true - - /@typescript-eslint/types@6.21.0: - resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==} - engines: {node: ^16.0.0 || >=18.0.0} - dev: true - - /@typescript-eslint/types@7.5.0: - resolution: {integrity: sha512-tv5B4IHeAdhR7uS4+bf8Ov3k793VEVHd45viRRkehIUZxm0WF82VPiLgHzA/Xl4TGPg1ZD49vfxBKFPecD5/mg==} - engines: {node: ^18.18.0 || >=20.0.0} - dev: true - - /@typescript-eslint/typescript-estree@6.21.0(typescript@5.4.4): - resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.4(supports-color@8.1.1) - globby: 11.1.0 - is-glob: 4.0.3 - minimatch: 9.0.3 - semver: 7.6.0 - ts-api-utils: 1.0.1(typescript@5.4.4) - typescript: 5.4.4 - transitivePeerDependencies: - - supports-color dev: true - /@typescript-eslint/typescript-estree@7.5.0(typescript@5.1.3): - resolution: {integrity: sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==} + /@typescript-eslint/typescript-estree@7.8.0(typescript@5.1.3): + resolution: {integrity: sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: typescript: '*' @@ -1514,53 +1447,31 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/visitor-keys': 7.5.0 + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/visitor-keys': 7.8.0 debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 - minimatch: 9.0.3 + minimatch: 9.0.4 semver: 7.6.0 - ts-api-utils: 1.0.1(typescript@5.1.3) + ts-api-utils: 1.3.0(typescript@5.1.3) typescript: 5.1.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/typescript-estree@7.5.0(typescript@5.4.4): - resolution: {integrity: sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==} + /@typescript-eslint/utils@7.8.0(eslint@8.57.0)(typescript@5.1.3): + resolution: {integrity: sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/visitor-keys': 7.5.0 - debug: 4.3.4(supports-color@8.1.1) - globby: 11.1.0 - is-glob: 4.0.3 - minimatch: 9.0.3 - semver: 7.6.0 - ts-api-utils: 1.0.1(typescript@5.4.4) - typescript: 5.4.4 - transitivePeerDependencies: - - supports-color - dev: true - - /@typescript-eslint/utils@6.21.0(eslint@8.57.0)(typescript@5.4.4): - resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 + eslint: ^8.56.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@types/json-schema': 7.0.12 - '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 6.21.0 - '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.4) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.8 + '@typescript-eslint/scope-manager': 7.8.0 + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.1.3) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: @@ -1568,43 +1479,56 @@ packages: - typescript dev: true - /@typescript-eslint/utils@7.5.0(eslint@8.57.0)(typescript@5.4.4): - resolution: {integrity: sha512-3vZl9u0R+/FLQcpy2EHyRGNqAS/ofJ3Ji8aebilfJe+fobK8+LbIFmrHciLVDxjDoONmufDcnVSF38KwMEOjzw==} + /@typescript-eslint/visitor-keys@7.8.0: + resolution: {integrity: sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA==} engines: {node: ^18.18.0 || >=20.0.0} - peerDependencies: - eslint: ^8.56.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@types/json-schema': 7.0.12 - '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 7.5.0 - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.4) - eslint: 8.57.0 - semver: 7.6.0 - transitivePeerDependencies: - - supports-color - - typescript + '@typescript-eslint/types': 7.8.0 + eslint-visitor-keys: 3.4.3 dev: true - /@typescript-eslint/visitor-keys@6.21.0: - resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} - engines: {node: ^16.0.0 || >=18.0.0} + /@typespec/compiler@0.55.0: + resolution: {integrity: sha512-JxBkP7fTc3yzDYZ+Ms+ZHYlL2Ym22oloLDl6107SGaShNJBdQlabgE0aV8WvYRRBYt8g0RNb+sDLEcjvahj6Gw==} + engines: {node: '>=18.0.0'} + hasBin: true dependencies: - '@typescript-eslint/types': 6.21.0 - eslint-visitor-keys: 3.4.3 + '@babel/code-frame': 7.24.2 + ajv: 8.12.0 + change-case: 5.4.4 + globby: 14.0.1 + mustache: 4.2.0 + picocolors: 1.0.0 + prettier: 3.2.5 + prompts: 2.4.2 + semver: 7.6.0 + vscode-languageserver: 9.0.1 + vscode-languageserver-textdocument: 1.0.11 + yaml: 2.4.1 + yargs: 17.7.2 dev: true - /@typescript-eslint/visitor-keys@7.5.0: - resolution: {integrity: sha512-mcuHM/QircmA6O7fy6nn2w/3ditQkj+SgtOc8DW3uQ10Yfj42amm2i+6F2K4YAOPNNTmE6iM1ynM6lrSwdendA==} - engines: {node: ^18.18.0 || >=20.0.0} + /@typespec/compiler@0.56.0: + resolution: {integrity: sha512-K+VhXycoeqcoSGtB0/l1XYco4V2qRsCOOwqklVM4Yew7kTcKVfz7CT7a6a2OKWDMNg5iijZtRBoM5YF50XtQug==} + engines: {node: '>=18.0.0'} + hasBin: true dependencies: - '@typescript-eslint/types': 7.5.0 - eslint-visitor-keys: 3.4.3 + '@babel/code-frame': 7.24.2 + ajv: 8.12.0 + change-case: 5.4.4 + globby: 14.0.1 + mustache: 4.2.0 + picocolors: 1.0.0 + prettier: 3.2.5 + prompts: 2.4.2 + semver: 7.6.0 + vscode-languageserver: 9.0.1 + vscode-languageserver-textdocument: 1.0.11 + yaml: 2.4.1 + yargs: 17.7.2 dev: true - /@typespec/compiler@0.55.0: - resolution: {integrity: sha512-JxBkP7fTc3yzDYZ+Ms+ZHYlL2Ym22oloLDl6107SGaShNJBdQlabgE0aV8WvYRRBYt8g0RNb+sDLEcjvahj6Gw==} + /@typespec/compiler@0.57.0-dev.4: + resolution: {integrity: sha512-WyFvItH8aUzIvszwAUcoaAgQEI5xsJJy2YqA8KlfR7XDJBG3wtJxK0KgUuvObmRUavKze+HQP3Gca/z8rRP3tQ==} engines: {node: '>=18.0.0'} hasBin: true dependencies: @@ -1622,24 +1546,17 @@ packages: yaml: 2.4.1 yargs: 17.7.2 - /@typespec/eslint-config-typespec@0.55.0(prettier@3.2.5): - resolution: {integrity: sha512-zZI2ERGdgM9T6neL+Qdht3z89elGI38h68vSYnq5KFR3J500llSJI0Yb5NnE1G2Y7pjmBrnYWhL7UoOaGpW42A==} + /@typespec/eslint-plugin@0.56.0(eslint@8.57.0)(typescript@5.1.3): + resolution: {integrity: sha512-csQf0XG1YwqU01nVvGCaEozdvixpVoYOCsrXpl3/iBJTLlCfWEoBgnE56JtzceRfbumRtTBgxeLcOnwbpO9hxw==} + engines: {node: '>=14.0.0'} + peerDependencies: + eslint: ^8.57.0 dependencies: - '@rushstack/eslint-patch': 1.10.1 - '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4) - '@typescript-eslint/parser': 7.5.0(eslint@8.56.0)(typescript@5.1.3) + '@typescript-eslint/utils': 7.8.0(eslint@8.57.0)(typescript@5.1.3) eslint: 8.57.0 - eslint-config-prettier: 9.1.0(eslint@8.57.0) - eslint-plugin-deprecation: 2.0.0(eslint@8.57.0)(typescript@5.4.4) - eslint-plugin-prettier: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5) - eslint-plugin-unicorn: 51.0.1(eslint@8.57.0) - eslint-plugin-vitest: 0.4.1(@typescript-eslint/eslint-plugin@7.5.0)(eslint@8.57.0)(typescript@5.4.4) - typescript: 5.4.4 transitivePeerDependencies: - - '@types/eslint' - - prettier - supports-color - - vitest + - typescript dev: true /@typespec/http@0.55.0(@typespec/compiler@0.55.0): @@ -1649,32 +1566,50 @@ packages: '@typespec/compiler': ~0.55.0 dependencies: '@typespec/compiler': 0.55.0 + dev: true - /@typespec/openapi3@0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-dfn/wrKSF4Ls1dWMpAguQggoc4HGx2tf3FN2xhBln6EtahNZNgN5sOE+XY0hGPI4MCE5QexMUlXSiXpxzlNA/A==} + /@typespec/http@0.56.0(@typespec/compiler@0.56.0): + resolution: {integrity: sha512-f/tpHRWev9bnAtNPFkfCU/5SFou9glA/rPDY0m2W5bK6EG1/6/TKKKz5FoKPA4xvc2dQ5vu/ouGLb4i5UzXvWQ==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/openapi': ~0.55.0 - '@typespec/versioning': ~0.55.0 + '@typespec/compiler': ~0.56.0 dependencies: - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/compiler': 0.56.0 + dev: true + + /@typespec/http@0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4): + resolution: {integrity: sha512-OI2mFFnaLBeQxCwSZOoGwhOIeZmz9JMVU+ZwOgooXLGYBvI131DEUpfLnoK5j7fzuguHwYadCQE10U8c/hMWxg==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 || >=0.57.0-dev <0.57.0 + dependencies: + '@typespec/compiler': 0.57.0-dev.4 + + /@typespec/openapi3@0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-55JPUP7dFk4iXn4fNKZEs76j7hAdlWfoMWNPsQPRJCP//KWCtNXfTP+/TTVPVv1L/6HztbXyPV0agKZwyS7gDw==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/openapi': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@typespec/compiler': 0.57.0-dev.4 + '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + '@typespec/openapi': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) yaml: 2.4.1 dev: false - /@typespec/openapi@0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0): - resolution: {integrity: sha512-5T4VuJSOGfMFSs+1dOl3U3BC6VhKAxSTBrwcQDIEEygnqCSbj/tMFDhNfzKYKARRDotgM8ESOrZU6XH5srVR7A==} + /@typespec/openapi@0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2): + resolution: {integrity: sha512-q8+IHRglXBm3slvonRLSNYN2fX7plbWA+ugIiMJZTeyc3enqfxPqMGA8BCiAFV3kwP0uPPpIXbCSIVhHgkONbA==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 dependencies: - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/compiler': 0.57.0-dev.4 + '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) /@typespec/prettier-plugin-typespec@0.55.0: resolution: {integrity: sha512-CrrZbN3EmT4rMckthSYZ2VeIET1pi2IAM/W9jN8pPfyqvidDhc/uCEy3gfbc9wvFKejC5Ykc/qE5MO79xvgH4Q==} @@ -1693,6 +1628,28 @@ packages: '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) dev: true + /@typespec/rest@0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0): + resolution: {integrity: sha512-8w4WhWDcpEQNW8bB1BHhiBxIQUChDJtyq/n9p2OI/Bm1wncd61y/ZNOtcxmlKq8uB9d+dzHiZdEfqFCR8HF8/Q==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + dependencies: + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + dev: true + + /@typespec/rest@0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2): + resolution: {integrity: sha512-8w4WhWDcpEQNW8bB1BHhiBxIQUChDJtyq/n9p2OI/Bm1wncd61y/ZNOtcxmlKq8uB9d+dzHiZdEfqFCR8HF8/Q==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + dependencies: + '@typespec/compiler': 0.57.0-dev.4 + '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + dev: true + /@typespec/versioning@0.55.0(@typespec/compiler@0.55.0): resolution: {integrity: sha512-89LTgkA3IBLnaaM4D4qfsrcEU0g3gasE1MmkrQ2HG21fYX88zKbmR1cKWeUxQx9MIXFOH4cPC9KhA/uLknRVMQ==} engines: {node: '>=18.0.0'} @@ -1700,6 +1657,15 @@ packages: '@typespec/compiler': ~0.55.0 dependencies: '@typespec/compiler': 0.55.0 + dev: true + + /@typespec/versioning@0.56.0(@typespec/compiler@0.57.0-dev.4): + resolution: {integrity: sha512-j7IN9XFyGn3LH6IOJkinEvk9sDncsxiWPULOAe0VQ+D/dtCfLawDMUALnvklMDRKeD1OOUPSCjjUAp9OB0f7YA==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 + dependencies: + '@typespec/compiler': 0.57.0-dev.4 /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -2045,17 +2011,6 @@ packages: resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} dev: true - /browserslist@4.23.0: - resolution: {integrity: sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true - dependencies: - caniuse-lite: 1.0.30001594 - electron-to-chromium: 1.4.693 - node-releases: 2.0.14 - update-browserslist-db: 1.0.13(browserslist@4.23.0) - dev: true - /btoa-lite@1.0.0: resolution: {integrity: sha512-gvW7InbIyF8AicrqWoptdW08pUxuhq8BEgowNajy9RhiE86fmGAGl+bLKo6oB8QP0CkqHLowfN0oJdKC/J6LbA==} dev: true @@ -2156,10 +2111,6 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite@1.0.30001594: - resolution: {integrity: sha512-VblSX6nYqyJVs8DKFMldE2IVCJjZ225LW00ydtUWwh5hk9IfkTOffO6r8gJNsH0qqqeAF8KrbMYA2VEwTlGW5g==} - dev: true - /caseless@0.12.0: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} dev: true @@ -2208,11 +2159,6 @@ packages: engines: {node: '>=8'} dev: true - /ci-info@4.0.0: - resolution: {integrity: sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==} - engines: {node: '>=8'} - dev: true - /clean-regexp@1.0.0: resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==} engines: {node: '>=4'} @@ -2306,7 +2252,7 @@ packages: dev: true /concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} dev: true /concat-stream@1.6.2: @@ -2349,12 +2295,6 @@ packages: engines: {node: '>= 0.6'} dev: true - /core-js-compat@3.36.0: - resolution: {integrity: sha512-iV9Pd/PsgjNWBXeq8XRtWVSgz2tKAfhfvBs7qxYty+RlRd+OCksaWmOnc4JKrTc1cToXL1N0s3l/vwlxPtdElw==} - dependencies: - browserslist: 4.23.0 - dev: true - /core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} dev: true @@ -2605,10 +2545,6 @@ packages: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} dev: true - /electron-to-chromium@1.4.693: - resolution: {integrity: sha512-/if4Ueg0GUQlhCrW2ZlXwDAm40ipuKo+OgeHInlL8sbjt+hzISxZK949fZeJaVsheamrzANXvw1zQTvbxTvSHw==} - dev: true - /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -2778,15 +2714,6 @@ packages: engines: {node: '>=10'} dev: true - /eslint-config-prettier@9.1.0(eslint@8.57.0): - resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} - hasBin: true - peerDependencies: - eslint: '>=7.0.0' - dependencies: - eslint: 8.57.0 - dev: true - /eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} dependencies: @@ -2825,21 +2752,6 @@ packages: - supports-color dev: true - /eslint-plugin-deprecation@2.0.0(eslint@8.57.0)(typescript@5.4.4): - resolution: {integrity: sha512-OAm9Ohzbj11/ZFyICyR5N6LbOIvQMp7ZU2zI7Ej0jIc8kiGUERXPNMfw2QqqHD1ZHtjMub3yPZILovYEYucgoQ==} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - typescript: ^4.2.4 || ^5.0.0 - dependencies: - '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.4.4) - eslint: 8.57.0 - tslib: 2.6.2 - tsutils: 3.21.0(typescript@5.4.4) - typescript: 5.4.4 - transitivePeerDependencies: - - supports-color - dev: true - /eslint-plugin-import@2.29.1(eslint@8.57.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} @@ -2874,27 +2786,6 @@ packages: - supports-color dev: true - /eslint-plugin-prettier@5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5): - resolution: {integrity: sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - '@types/eslint': '>=8.0.0' - eslint: '>=8.0.0' - eslint-config-prettier: '*' - prettier: '>=3.0.0' - peerDependenciesMeta: - '@types/eslint': - optional: true - eslint-config-prettier: - optional: true - dependencies: - eslint: 8.57.0 - eslint-config-prettier: 9.1.0(eslint@8.57.0) - prettier: 3.2.5 - prettier-linter-helpers: 1.0.0 - synckit: 0.8.8 - dev: true - /eslint-plugin-unicorn@46.0.1(eslint@8.57.0): resolution: {integrity: sha512-setGhMTiLAddg1asdwjZ3hekIN5zLznNa5zll7pBPwFOka6greCKDQydfqy4fqyUhndi74wpDzClSQMEcmOaew==} engines: {node: '>=14.18'} @@ -2920,54 +2811,6 @@ packages: strip-indent: 3.0.0 dev: true - /eslint-plugin-unicorn@51.0.1(eslint@8.57.0): - resolution: {integrity: sha512-MuR/+9VuB0fydoI0nIn2RDA5WISRn4AsJyNSaNKLVwie9/ONvQhxOBbkfSICBPnzKrB77Fh6CZZXjgTt/4Latw==} - engines: {node: '>=16'} - peerDependencies: - eslint: '>=8.56.0' - dependencies: - '@babel/helper-validator-identifier': 7.22.20 - '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@eslint/eslintrc': 2.1.4 - ci-info: 4.0.0 - clean-regexp: 1.0.0 - core-js-compat: 3.36.0 - eslint: 8.57.0 - esquery: 1.5.0 - indent-string: 4.0.0 - is-builtin-module: 3.2.1 - jsesc: 3.0.2 - pluralize: 8.0.0 - read-pkg-up: 7.0.1 - regexp-tree: 0.1.27 - regjsparser: 0.10.0 - semver: 7.6.0 - strip-indent: 3.0.0 - transitivePeerDependencies: - - supports-color - dev: true - - /eslint-plugin-vitest@0.4.1(@typescript-eslint/eslint-plugin@7.5.0)(eslint@8.57.0)(typescript@5.4.4): - resolution: {integrity: sha512-+PnZ2u/BS+f5FiuHXz4zKsHPcMKHie+K+1Uvu/x91ovkCMEOJqEI8E9Tw1Wzx2QRz4MHOBHYf1ypO8N1K0aNAA==} - engines: {node: ^18.0.0 || >= 20.0.0} - peerDependencies: - '@typescript-eslint/eslint-plugin': '*' - eslint: '>=8.0.0' - vitest: '*' - peerDependenciesMeta: - '@typescript-eslint/eslint-plugin': - optional: true - vitest: - optional: true - dependencies: - '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4) - '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) - eslint: 8.57.0 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - /eslint-scope@7.2.2: resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2981,53 +2824,6 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.56.0: - resolution: {integrity: sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - hasBin: true - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) - '@eslint-community/regexpp': 4.10.0 - '@eslint/eslintrc': 2.1.4 - '@eslint/js': 8.56.0 - '@humanwhocodes/config-array': 0.11.14 - '@humanwhocodes/module-importer': 1.0.1 - '@nodelib/fs.walk': 1.2.8 - '@ungap/structured-clone': 1.2.0 - ajv: 6.12.6 - chalk: 4.1.2 - cross-spawn: 7.0.3 - debug: 4.3.4(supports-color@8.1.1) - doctrine: 3.0.0 - escape-string-regexp: 4.0.0 - eslint-scope: 7.2.2 - eslint-visitor-keys: 3.4.3 - espree: 9.6.1 - esquery: 1.5.0 - esutils: 2.0.3 - fast-deep-equal: 3.1.3 - file-entry-cache: 6.0.1 - find-up: 5.0.0 - glob-parent: 6.0.2 - globals: 13.24.0 - graphemer: 1.4.0 - ignore: 5.3.1 - imurmurhash: 0.1.4 - is-glob: 4.0.3 - is-path-inside: 3.0.3 - js-yaml: 4.1.0 - json-stable-stringify-without-jsonify: 1.0.1 - levn: 0.4.1 - lodash.merge: 4.6.2 - minimatch: 3.1.2 - natural-compare: 1.4.0 - optionator: 0.9.3 - strip-ansi: 6.0.1 - text-table: 0.2.0 - transitivePeerDependencies: - - supports-color - dev: true - /eslint@8.57.0: resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3244,10 +3040,6 @@ packages: /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - /fast-diff@1.3.0: - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - dev: true - /fast-glob@3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} @@ -3675,7 +3467,7 @@ packages: /has-property-descriptors@1.0.0: resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==} dependencies: - get-intrinsic: 1.2.1 + get-intrinsic: 1.2.4 dev: true /has-property-descriptors@1.0.2: @@ -4563,13 +4355,6 @@ packages: brace-expansion: 2.0.1 dev: true - /minimatch@9.0.3: - resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} - engines: {node: '>=16 || 14 >=14.17'} - dependencies: - brace-expansion: 2.0.1 - dev: true - /minimatch@9.0.4: resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==} engines: {node: '>=16 || 14 >=14.17'} @@ -4812,10 +4597,6 @@ packages: - supports-color dev: true - /node-releases@2.0.14: - resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} - dev: true - /nopt@7.2.0: resolution: {integrity: sha512-CVDtwCdhYIvnAzFoJ6NJ6dX3oga9/HyciQDnG1vQDjSLMeKLJ4A93ZqYKDrgYSr1FBY5/hMYC+2VCi24pgpkGA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -5228,13 +5009,6 @@ packages: engines: {node: '>= 0.8.0'} dev: true - /prettier-linter-helpers@1.0.0: - resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} - engines: {node: '>=6.0.0'} - dependencies: - fast-diff: 1.3.0 - dev: true - /prettier@2.8.8: resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} @@ -5448,13 +5222,6 @@ packages: set-function-name: 2.0.2 dev: true - /regjsparser@0.10.0: - resolution: {integrity: sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==} - hasBin: true - dependencies: - jsesc: 0.5.0 - dev: true - /regjsparser@0.9.1: resolution: {integrity: sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==} hasBin: true @@ -6022,14 +5789,6 @@ packages: engines: {node: '>= 0.4'} dev: true - /synckit@0.8.8: - resolution: {integrity: sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==} - engines: {node: ^14.18.0 || >=16.0.0} - dependencies: - '@pkgr/core': 0.1.1 - tslib: 2.6.2 - dev: true - /syncpack@9.8.6: resolution: {integrity: sha512-4S4cUoKK9WenA/Wdk9GvlekzPR9PxC7sqcsUIsK4ypsa/pIYv8Ju1vxGNvp6Y1yI2S9EdCk0QJsB3/wRB8XYVw==} engines: {node: '>=14'} @@ -6109,24 +5868,15 @@ packages: engines: {node: '>= 14.0.0'} dev: true - /ts-api-utils@1.0.1(typescript@5.1.3): - resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} - engines: {node: '>=16.13.0'} + /ts-api-utils@1.3.0(typescript@5.1.3): + resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + engines: {node: '>=16'} peerDependencies: typescript: '>=4.2.0' dependencies: typescript: 5.1.3 dev: true - /ts-api-utils@1.0.1(typescript@5.4.4): - resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} - engines: {node: '>=16.13.0'} - peerDependencies: - typescript: '>=4.2.0' - dependencies: - typescript: 5.4.4 - dev: true - /tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} dependencies: @@ -6136,23 +5886,9 @@ packages: strip-bom: 3.0.0 dev: true - /tslib@1.14.1: - resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} - dev: true - /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - /tsutils@3.21.0(typescript@5.4.4): - resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} - engines: {node: '>= 6'} - peerDependencies: - typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' - dependencies: - tslib: 1.14.1 - typescript: 5.4.4 - dev: true - /tuf-js@2.2.0: resolution: {integrity: sha512-ZSDngmP1z6zw+FIkIBjvOp/II/mIub/O7Pp12j1WNsiCpg5R5wAc//i555bBQsE44O94btLt0xM/Zr2LQjwdCg==} engines: {node: ^16.14.0 || >=18.0.0} @@ -6269,12 +6005,6 @@ packages: hasBin: true dev: true - /typescript@5.4.4: - resolution: {integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==} - engines: {node: '>=14.17'} - hasBin: true - dev: true - /unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} dependencies: @@ -6342,17 +6072,6 @@ packages: engines: {node: '>= 0.8'} dev: true - /update-browserslist-db@1.0.13(browserslist@4.23.0): - resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} - hasBin: true - peerDependencies: - browserslist: '>= 4.21.0' - dependencies: - browserslist: 4.23.0 - escalade: 3.1.1 - picocolors: 1.0.0 - dev: true - /uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: @@ -6696,3 +6415,7 @@ packages: /zod@3.22.4: resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} dev: true + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false From 03c3c2d5d5e762251efc9b9354307e02ecc4ef55 Mon Sep 17 00:00:00 2001 From: tadelesh Date: Fri, 10 May 2024 13:51:16 +0800 Subject: [PATCH 4/6] revert wrong upgrade and fix test --- packages/typespec-python/package.json | 2 +- .../mock_api_tests/test_mgmt_models_mode.py | 4 +- pnpm-lock.yaml | 400 +++++++++++++++++- 3 files changed, 391 insertions(+), 15 deletions(-) diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index 2b9b2664979..4aa213eec5c 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -70,7 +70,7 @@ "@types/js-yaml": "~4.0.5", "@types/mocha": "~10.0.1", "@types/node": "^18.16.3", - "@typespec/eslint-plugin": "~0.56.0", + "@typespec/eslint-config-typespec": "~0.55.0", "@typespec/openapi": "~0.56.0", "c8": "~7.13.0", "eslint": "^8.57.0", diff --git a/packages/typespec-python/test/azure/mock_api_tests/test_mgmt_models_mode.py b/packages/typespec-python/test/azure/mock_api_tests/test_mgmt_models_mode.py index 3fce5d43e92..a81a5c67139 100644 --- a/packages/typespec-python/test/azure/mock_api_tests/test_mgmt_models_mode.py +++ b/packages/typespec-python/test/azure/mock_api_tests/test_mgmt_models_mode.py @@ -22,6 +22,6 @@ def test_client_signature(): def test_model_mode(): from azure.mgmt.spheredpg import _model_base - from azure.mgmt.spheredpg.models import ArmResource as ArmResourceDpg + from azure.mgmt.spheredpg.models import Resource - assert isinstance(ArmResourceDpg(id="", type=""), _model_base.Model) + assert isinstance(Resource(id="", type=""), _model_base.Model) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 97663f2db57..c04d2f804cd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,9 +93,9 @@ importers: '@typespec/compiler': specifier: ~0.57.0-dev.4 version: 0.57.0-dev.4 - '@typespec/eslint-plugin': - specifier: ~0.56.0 - version: 0.56.0(eslint@8.57.0)(typescript@5.1.3) + '@typespec/eslint-config-typespec': + specifier: ~0.55.0 + version: 0.55.0(prettier@3.2.5) '@typespec/http': specifier: ~0.57.0-dev.2 version: 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) @@ -1276,6 +1276,15 @@ packages: dev: true optional: true + /@pkgr/core@0.1.1: + resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + dev: true + + /@rushstack/eslint-patch@1.10.1: + resolution: {integrity: sha512-S3Kq8e7LqxkA9s7HKLqXGTGck1uwis5vAXan3FnU5yw1Ec5hsSGnq4s/UCaSqABPOnOTg7zASLyst7+ohgWexg==} + dev: true + /@sigstore/bundle@2.3.1: resolution: {integrity: sha512-eqV17lO3EIFqCWK3969Rz+J8MYrRZKw9IBHpSo6DEcEX2c+uzDFOgHE9f2MnyDpfs48LFO4hXmk9KhQ74JzU1g==} engines: {node: ^16.14.0 || >=18.0.0} @@ -1425,6 +1434,64 @@ packages: '@types/node': 18.19.29 dev: true + /@typescript-eslint/eslint-plugin@7.8.0(@typescript-eslint/parser@7.8.0)(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-gFTT+ezJmkwutUPmB0skOj3GZJtlEGnlssems4AjkVweUPGj7jRwwqg0Hhg7++kPGJqKtTYx+R05Ftww372aIg==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + '@typescript-eslint/parser': ^7.0.0 + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@eslint-community/regexpp': 4.10.0 + '@typescript-eslint/parser': 7.8.0(eslint@8.57.0)(typescript@5.1.3) + '@typescript-eslint/scope-manager': 7.8.0 + '@typescript-eslint/type-utils': 7.8.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.8.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/visitor-keys': 7.8.0 + debug: 4.3.4(supports-color@8.1.1) + eslint: 8.57.0 + graphemer: 1.4.0 + ignore: 5.3.1 + natural-compare: 1.4.0 + semver: 7.6.0 + ts-api-utils: 1.3.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/parser@7.8.0(eslint@8.57.0)(typescript@5.1.3): + resolution: {integrity: sha512-KgKQly1pv0l4ltcftP59uQZCi4HUYswCLbTqVZEJu7uLX8CTLyswqMLqLN+2QFz4jCptqWVV4SB7vdxcH2+0kQ==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 7.8.0 + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.1.3) + '@typescript-eslint/visitor-keys': 7.8.0 + debug: 4.3.4(supports-color@8.1.1) + eslint: 8.57.0 + typescript: 5.1.3 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/scope-manager@6.21.0: + resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 + dev: true + /@typescript-eslint/scope-manager@7.8.0: resolution: {integrity: sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g==} engines: {node: ^18.18.0 || >=20.0.0} @@ -1433,11 +1500,58 @@ packages: '@typescript-eslint/visitor-keys': 7.8.0 dev: true + /@typescript-eslint/type-utils@7.8.0(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.4.5) + '@typescript-eslint/utils': 7.8.0(eslint@8.57.0)(typescript@5.4.5) + debug: 4.3.4(supports-color@8.1.1) + eslint: 8.57.0 + ts-api-utils: 1.3.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/types@6.21.0: + resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==} + engines: {node: ^16.0.0 || >=18.0.0} + dev: true + /@typescript-eslint/types@7.8.0: resolution: {integrity: sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw==} engines: {node: ^18.18.0 || >=20.0.0} dev: true + /@typescript-eslint/typescript-estree@6.21.0(typescript@5.4.5): + resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 + debug: 4.3.4(supports-color@8.1.1) + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.3 + semver: 7.6.0 + ts-api-utils: 1.3.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/typescript-estree@7.8.0(typescript@5.1.3): resolution: {integrity: sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==} engines: {node: ^18.18.0 || >=20.0.0} @@ -1460,7 +1574,48 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@7.8.0(eslint@8.57.0)(typescript@5.1.3): + /@typescript-eslint/typescript-estree@7.8.0(typescript@5.4.5): + resolution: {integrity: sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/visitor-keys': 7.8.0 + debug: 4.3.4(supports-color@8.1.1) + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.4 + semver: 7.6.0 + ts-api-utils: 1.3.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/utils@6.21.0(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.8 + '@typescript-eslint/scope-manager': 6.21.0 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.5) + eslint: 8.57.0 + semver: 7.6.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /@typescript-eslint/utils@7.8.0(eslint@8.57.0)(typescript@5.4.5): resolution: {integrity: sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: @@ -1471,7 +1626,7 @@ packages: '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 7.8.0 '@typescript-eslint/types': 7.8.0 - '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.1.3) + '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.4.5) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: @@ -1479,6 +1634,14 @@ packages: - typescript dev: true + /@typescript-eslint/visitor-keys@6.21.0: + resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.21.0 + eslint-visitor-keys: 3.4.3 + dev: true + /@typescript-eslint/visitor-keys@7.8.0: resolution: {integrity: sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA==} engines: {node: ^18.18.0 || >=20.0.0} @@ -1546,17 +1709,25 @@ packages: yaml: 2.4.1 yargs: 17.7.2 - /@typespec/eslint-plugin@0.56.0(eslint@8.57.0)(typescript@5.1.3): - resolution: {integrity: sha512-csQf0XG1YwqU01nVvGCaEozdvixpVoYOCsrXpl3/iBJTLlCfWEoBgnE56JtzceRfbumRtTBgxeLcOnwbpO9hxw==} - engines: {node: '>=14.0.0'} - peerDependencies: - eslint: ^8.57.0 + /@typespec/eslint-config-typespec@0.55.0(prettier@3.2.5): + resolution: {integrity: sha512-zZI2ERGdgM9T6neL+Qdht3z89elGI38h68vSYnq5KFR3J500llSJI0Yb5NnE1G2Y7pjmBrnYWhL7UoOaGpW42A==} + deprecated: Package is deprecated as it was meant for TypeSpec internal use only dependencies: - '@typescript-eslint/utils': 7.8.0(eslint@8.57.0)(typescript@5.1.3) + '@rushstack/eslint-patch': 1.10.1 + '@typescript-eslint/eslint-plugin': 7.8.0(@typescript-eslint/parser@7.8.0)(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.8.0(eslint@8.57.0)(typescript@5.1.3) eslint: 8.57.0 + eslint-config-prettier: 9.1.0(eslint@8.57.0) + eslint-plugin-deprecation: 2.0.0(eslint@8.57.0)(typescript@5.4.5) + eslint-plugin-prettier: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5) + eslint-plugin-unicorn: 51.0.1(eslint@8.57.0) + eslint-plugin-vitest: 0.4.1(@typescript-eslint/eslint-plugin@7.8.0)(eslint@8.57.0)(typescript@5.4.5) + typescript: 5.4.5 transitivePeerDependencies: + - '@types/eslint' + - prettier - supports-color - - typescript + - vitest dev: true /@typespec/http@0.55.0(@typespec/compiler@0.55.0): @@ -2011,6 +2182,17 @@ packages: resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} dev: true + /browserslist@4.23.0: + resolution: {integrity: sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + dependencies: + caniuse-lite: 1.0.30001617 + electron-to-chromium: 1.4.762 + node-releases: 2.0.14 + update-browserslist-db: 1.0.15(browserslist@4.23.0) + dev: true + /btoa-lite@1.0.0: resolution: {integrity: sha512-gvW7InbIyF8AicrqWoptdW08pUxuhq8BEgowNajy9RhiE86fmGAGl+bLKo6oB8QP0CkqHLowfN0oJdKC/J6LbA==} dev: true @@ -2111,6 +2293,10 @@ packages: engines: {node: '>=10'} dev: true + /caniuse-lite@1.0.30001617: + resolution: {integrity: sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA==} + dev: true + /caseless@0.12.0: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} dev: true @@ -2159,6 +2345,11 @@ packages: engines: {node: '>=8'} dev: true + /ci-info@4.0.0: + resolution: {integrity: sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==} + engines: {node: '>=8'} + dev: true + /clean-regexp@1.0.0: resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==} engines: {node: '>=4'} @@ -2295,6 +2486,12 @@ packages: engines: {node: '>= 0.6'} dev: true + /core-js-compat@3.37.0: + resolution: {integrity: sha512-vYq4L+T8aS5UuFg4UwDhc7YNRWVeVZwltad9C/jV3R2LgVOpS9BDr7l/WL6BN0dbV3k1XejPTHqqEzJgsa0frA==} + dependencies: + browserslist: 4.23.0 + dev: true + /core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} dev: true @@ -2545,6 +2742,10 @@ packages: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} dev: true + /electron-to-chromium@1.4.762: + resolution: {integrity: sha512-rrFvGweLxPwwSwJOjIopy3Vr+J3cIPtZzuc74bmlvmBIgQO3VYJDvVrlj94iKZ3ukXUH64Ex31hSfRTLqvjYJQ==} + dev: true + /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -2701,6 +2902,11 @@ packages: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} + /escalade@3.1.2: + resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} + engines: {node: '>=6'} + dev: true + /escape-html@1.0.3: resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} dev: true @@ -2714,6 +2920,15 @@ packages: engines: {node: '>=10'} dev: true + /eslint-config-prettier@9.1.0(eslint@8.57.0): + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + dependencies: + eslint: 8.57.0 + dev: true + /eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} dependencies: @@ -2752,6 +2967,21 @@ packages: - supports-color dev: true + /eslint-plugin-deprecation@2.0.0(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-OAm9Ohzbj11/ZFyICyR5N6LbOIvQMp7ZU2zI7Ej0jIc8kiGUERXPNMfw2QqqHD1ZHtjMub3yPZILovYEYucgoQ==} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + typescript: ^4.2.4 || ^5.0.0 + dependencies: + '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.4.5) + eslint: 8.57.0 + tslib: 2.6.2 + tsutils: 3.21.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + /eslint-plugin-import@2.29.1(eslint@8.57.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} @@ -2786,6 +3016,27 @@ packages: - supports-color dev: true + /eslint-plugin-prettier@5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5): + resolution: {integrity: sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + '@types/eslint': '>=8.0.0' + eslint: '>=8.0.0' + eslint-config-prettier: '*' + prettier: '>=3.0.0' + peerDependenciesMeta: + '@types/eslint': + optional: true + eslint-config-prettier: + optional: true + dependencies: + eslint: 8.57.0 + eslint-config-prettier: 9.1.0(eslint@8.57.0) + prettier: 3.2.5 + prettier-linter-helpers: 1.0.0 + synckit: 0.8.8 + dev: true + /eslint-plugin-unicorn@46.0.1(eslint@8.57.0): resolution: {integrity: sha512-setGhMTiLAddg1asdwjZ3hekIN5zLznNa5zll7pBPwFOka6greCKDQydfqy4fqyUhndi74wpDzClSQMEcmOaew==} engines: {node: '>=14.18'} @@ -2811,6 +3062,54 @@ packages: strip-indent: 3.0.0 dev: true + /eslint-plugin-unicorn@51.0.1(eslint@8.57.0): + resolution: {integrity: sha512-MuR/+9VuB0fydoI0nIn2RDA5WISRn4AsJyNSaNKLVwie9/ONvQhxOBbkfSICBPnzKrB77Fh6CZZXjgTt/4Latw==} + engines: {node: '>=16'} + peerDependencies: + eslint: '>=8.56.0' + dependencies: + '@babel/helper-validator-identifier': 7.22.20 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@eslint/eslintrc': 2.1.4 + ci-info: 4.0.0 + clean-regexp: 1.0.0 + core-js-compat: 3.37.0 + eslint: 8.57.0 + esquery: 1.5.0 + indent-string: 4.0.0 + is-builtin-module: 3.2.1 + jsesc: 3.0.2 + pluralize: 8.0.0 + read-pkg-up: 7.0.1 + regexp-tree: 0.1.27 + regjsparser: 0.10.0 + semver: 7.6.0 + strip-indent: 3.0.0 + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-plugin-vitest@0.4.1(@typescript-eslint/eslint-plugin@7.8.0)(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-+PnZ2u/BS+f5FiuHXz4zKsHPcMKHie+K+1Uvu/x91ovkCMEOJqEI8E9Tw1Wzx2QRz4MHOBHYf1ypO8N1K0aNAA==} + engines: {node: ^18.0.0 || >= 20.0.0} + peerDependencies: + '@typescript-eslint/eslint-plugin': '*' + eslint: '>=8.0.0' + vitest: '*' + peerDependenciesMeta: + '@typescript-eslint/eslint-plugin': + optional: true + vitest: + optional: true + dependencies: + '@typescript-eslint/eslint-plugin': 7.8.0(@typescript-eslint/parser@7.8.0)(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.8.0(eslint@8.57.0)(typescript@5.4.5) + eslint: 8.57.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /eslint-scope@7.2.2: resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3040,6 +3339,10 @@ packages: /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + /fast-diff@1.3.0: + resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} + dev: true + /fast-glob@3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} @@ -4355,6 +4658,13 @@ packages: brace-expansion: 2.0.1 dev: true + /minimatch@9.0.3: + resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimatch@9.0.4: resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==} engines: {node: '>=16 || 14 >=14.17'} @@ -4597,6 +4907,10 @@ packages: - supports-color dev: true + /node-releases@2.0.14: + resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} + dev: true + /nopt@7.2.0: resolution: {integrity: sha512-CVDtwCdhYIvnAzFoJ6NJ6dX3oga9/HyciQDnG1vQDjSLMeKLJ4A93ZqYKDrgYSr1FBY5/hMYC+2VCi24pgpkGA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -5009,6 +5323,13 @@ packages: engines: {node: '>= 0.8.0'} dev: true + /prettier-linter-helpers@1.0.0: + resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} + engines: {node: '>=6.0.0'} + dependencies: + fast-diff: 1.3.0 + dev: true + /prettier@2.8.8: resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} @@ -5222,6 +5543,13 @@ packages: set-function-name: 2.0.2 dev: true + /regjsparser@0.10.0: + resolution: {integrity: sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==} + hasBin: true + dependencies: + jsesc: 0.5.0 + dev: true + /regjsparser@0.9.1: resolution: {integrity: sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==} hasBin: true @@ -5789,6 +6117,14 @@ packages: engines: {node: '>= 0.4'} dev: true + /synckit@0.8.8: + resolution: {integrity: sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==} + engines: {node: ^14.18.0 || >=16.0.0} + dependencies: + '@pkgr/core': 0.1.1 + tslib: 2.6.2 + dev: true + /syncpack@9.8.6: resolution: {integrity: sha512-4S4cUoKK9WenA/Wdk9GvlekzPR9PxC7sqcsUIsK4ypsa/pIYv8Ju1vxGNvp6Y1yI2S9EdCk0QJsB3/wRB8XYVw==} engines: {node: '>=14'} @@ -5877,6 +6213,15 @@ packages: typescript: 5.1.3 dev: true + /ts-api-utils@1.3.0(typescript@5.4.5): + resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + engines: {node: '>=16'} + peerDependencies: + typescript: '>=4.2.0' + dependencies: + typescript: 5.4.5 + dev: true + /tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} dependencies: @@ -5886,9 +6231,23 @@ packages: strip-bom: 3.0.0 dev: true + /tslib@1.14.1: + resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + dev: true + /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + /tsutils@3.21.0(typescript@5.4.5): + resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} + engines: {node: '>= 6'} + peerDependencies: + typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' + dependencies: + tslib: 1.14.1 + typescript: 5.4.5 + dev: true + /tuf-js@2.2.0: resolution: {integrity: sha512-ZSDngmP1z6zw+FIkIBjvOp/II/mIub/O7Pp12j1WNsiCpg5R5wAc//i555bBQsE44O94btLt0xM/Zr2LQjwdCg==} engines: {node: ^16.14.0 || >=18.0.0} @@ -6005,6 +6364,12 @@ packages: hasBin: true dev: true + /typescript@5.4.5: + resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + /unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} dependencies: @@ -6072,6 +6437,17 @@ packages: engines: {node: '>= 0.8'} dev: true + /update-browserslist-db@1.0.15(browserslist@4.23.0): + resolution: {integrity: sha512-K9HWH62x3/EalU1U6sjSZiylm9C8tgq2mSvshZpqc7QE69RaA2qjhkW2HlNA0tFpEbtyFz7HTqbSdN4MSwUodA==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + dependencies: + browserslist: 4.23.0 + escalade: 3.1.2 + picocolors: 1.0.0 + dev: true + /uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: From 458c45a050bf531978ba2c691248cf49265c0d39 Mon Sep 17 00:00:00 2001 From: tadelesh Date: Fri, 10 May 2024 13:54:05 +0800 Subject: [PATCH 5/6] format --- packages/typespec-python/src/utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/typespec-python/src/utils.ts b/packages/typespec-python/src/utils.ts index 8ab19e90750..412119cef1a 100644 --- a/packages/typespec-python/src/utils.ts +++ b/packages/typespec-python/src/utils.ts @@ -79,7 +79,11 @@ export function getAddedOn( ): string | undefined { // since we do not support multi-service for now, we can just check the root client's api version // if type is added in the first version of the client, we do not need to add the versioning info - if (type.apiVersions[0] === context.experimental_sdkPackage.clients.find(c => c.initialization.access === "public")?.apiVersions[0]) return undefined; + if ( + type.apiVersions[0] === + context.experimental_sdkPackage.clients.find((c) => c.initialization.access === "public")?.apiVersions[0] + ) + return undefined; return type.apiVersions[0]; } From 9fc62f41a8ea1a206e702080ba23d2930e040ba3 Mon Sep 17 00:00:00 2001 From: tadelesh Date: Sat, 11 May 2024 10:08:27 +0800 Subject: [PATCH 6/6] update dep --- packages/typespec-python/package.json | 20 +-- pnpm-lock.yaml | 212 ++++++++++---------------- 2 files changed, 87 insertions(+), 145 deletions(-) diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index 4aa213eec5c..2efa34fc135 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -42,12 +42,12 @@ "get-autorest-python-path.cjs" ], "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.43.0-dev.1 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.43.0-dev.2 <1.0.0", + "@azure-tools/typespec-azure-core": ">=0.42.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.42.0 <1.0.0", "@azure-tools/typespec-autorest": ">=0.42.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.42.1 <1.0.0", - "@typespec/compiler": ">=0.57.0-dev.4 <1.0.0", - "@typespec/http": ">=0.57.0-dev.2 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.42.2 <1.0.0", + "@typespec/compiler": ">=0.56.0 <1.0.0", + "@typespec/http": ">=0.56.0 <1.0.0", "@typespec/rest": ">=0.56.0 <1.0.0", "@typespec/versioning": ">=0.56.0 <1.0.0", "@typespec/openapi": ">=0.56.0 <1.0.0" @@ -63,7 +63,7 @@ "@typespec/openapi3": "~0.56.0" }, "devDependencies": { - "@azure-tools/typespec-azure-resource-manager": "~0.43.0-dev.2", + "@azure-tools/typespec-azure-resource-manager": "~0.42.0", "@azure-tools/typespec-autorest": "~0.42.0", "@azure-tools/cadl-ranch-expect": "~0.13.4", "@azure-tools/cadl-ranch-specs": "~0.33.4", @@ -77,10 +77,10 @@ "mocha": "~10.2.0", "rimraf": "~5.0.0", "typescript": "~5.1.3", - "@azure-tools/typespec-azure-core": "~0.43.0-dev.1", - "@azure-tools/typespec-client-generator-core": "~0.42.1", - "@typespec/compiler": "~0.57.0-dev.4", - "@typespec/http": "~0.57.0-dev.2", + "@azure-tools/typespec-azure-core": "~0.42.0", + "@azure-tools/typespec-client-generator-core": "~0.42.2", + "@typespec/compiler": "~0.56.0", + "@typespec/http": "~0.56.0", "@typespec/rest": "~0.56.0", "@typespec/versioning": "~0.56.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c04d2f804cd..fad4c90a4c3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,29 +58,29 @@ importers: version: link:../autorest.python '@typespec/openapi3': specifier: ~0.56.0 - version: 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/versioning@0.56.0) + version: 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/versioning@0.56.0) js-yaml: specifier: ~4.1.0 version: 4.1.0 devDependencies: '@azure-tools/cadl-ranch-expect': specifier: ~0.13.4 - version: 0.13.4(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + version: 0.13.4(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/cadl-ranch-specs': specifier: ~0.33.4 - version: 0.33.4(@azure-tools/cadl-ranch-expect@0.13.4)(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + version: 0.33.4(@azure-tools/cadl-ranch-expect@0.13.4)(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/typespec-autorest': specifier: ~0.42.0 - version: 0.42.0(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@azure-tools/typespec-client-generator-core@0.42.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + version: 0.42.0(@azure-tools/typespec-azure-core@0.42.0)(@azure-tools/typespec-client-generator-core@0.42.2)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/typespec-azure-core': - specifier: ~0.43.0-dev.1 - version: 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) + specifier: ~0.42.0 + version: 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) '@azure-tools/typespec-azure-resource-manager': - specifier: ~0.43.0-dev.2 - version: 0.43.0-dev.2(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + specifier: ~0.42.0 + version: 0.42.0(@azure-tools/typespec-autorest@0.42.0)(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/typespec-client-generator-core': - specifier: ~0.42.1 - version: 0.42.1(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + specifier: ~0.42.2 + version: 0.42.2(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@types/js-yaml': specifier: ~4.0.5 version: 4.0.5 @@ -91,23 +91,23 @@ importers: specifier: ^18.16.3 version: 18.16.3 '@typespec/compiler': - specifier: ~0.57.0-dev.4 - version: 0.57.0-dev.4 + specifier: ~0.56.0 + version: 0.56.0 '@typespec/eslint-config-typespec': specifier: ~0.55.0 version: 0.55.0(prettier@3.2.5) '@typespec/http': - specifier: ~0.57.0-dev.2 - version: 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.56.0) '@typespec/openapi': specifier: ~0.56.0 - version: 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + version: 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) '@typespec/rest': specifier: ~0.56.0 - version: 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + version: 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) '@typespec/versioning': specifier: ~0.56.0 - version: 0.56.0(@typespec/compiler@0.57.0-dev.4) + version: 0.56.0(@typespec/compiler@0.56.0) c8: specifier: ~7.13.0 version: 7.13.0 @@ -217,25 +217,10 @@ packages: '@typespec/compiler': 0.56.0 '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) - '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) dev: true - /@azure-tools/cadl-ranch-expect@0.13.4(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): - resolution: {integrity: sha512-2j9Mxr8tz7zF8j8L/R/KEPhES/cJDt21wUTkQv0TKwZ4Kz5HGHBCsvnOnoBs72H7Q8DHpqOIhNDak40BHCrEGA==} - engines: {node: '>=16.0.0'} - peerDependencies: - '@typespec/compiler': ~0.56.0 - '@typespec/http': ~0.56.0 - '@typespec/rest': ~0.56.0 - '@typespec/versioning': ~0.56.0 - dependencies: - '@typespec/compiler': 0.57.0-dev.4 - '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) - '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) - '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) - dev: true - - /@azure-tools/cadl-ranch-specs@0.33.4(@azure-tools/cadl-ranch-expect@0.13.4)(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + /@azure-tools/cadl-ranch-specs@0.33.4(@azure-tools/cadl-ranch-expect@0.13.4)(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): resolution: {integrity: sha512-xTTyZIWT8bjXNoFr1M5CA6L7yo3mLBMzSDYPepCCWk3Wx8P2bl0NkK9YS4udfTA9TKlUJPSW23DvHcQfJ2rurQ==} engines: {node: '>=16.0.0'} peerDependencies: @@ -248,12 +233,12 @@ packages: dependencies: '@azure-tools/cadl-ranch': 0.12.8(@typespec/versioning@0.56.0) '@azure-tools/cadl-ranch-api': 0.4.3 - '@azure-tools/cadl-ranch-expect': 0.13.4(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) - '@azure-tools/typespec-azure-core': 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) - '@typespec/compiler': 0.57.0-dev.4 - '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) - '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) - '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + '@azure-tools/cadl-ranch-expect': 0.13.4(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@azure-tools/typespec-azure-core': 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) transitivePeerDependencies: - '@types/express' - encoding @@ -332,7 +317,7 @@ packages: - supports-color dev: true - /@azure-tools/typespec-autorest@0.42.0(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@azure-tools/typespec-client-generator-core@0.42.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + /@azure-tools/typespec-autorest@0.42.0(@azure-tools/typespec-azure-core@0.42.0)(@azure-tools/typespec-client-generator-core@0.42.2)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): resolution: {integrity: sha512-3cB5SiIbRDvGXpadnxwqsNhQ4A9pteGTHIpVlKpENpvzIoWU9phe+uBmGJDiQ/9CQPiLk7JncER95XYVOvn/vA==} engines: {node: '>=18.0.0'} peerDependencies: @@ -344,51 +329,53 @@ packages: '@typespec/rest': ~0.56.0 '@typespec/versioning': ~0.56.0 dependencies: - '@azure-tools/typespec-azure-core': 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) - '@azure-tools/typespec-client-generator-core': 0.42.1(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) - '@typespec/compiler': 0.57.0-dev.4 - '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) - '@typespec/openapi': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) - '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) - '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + '@azure-tools/typespec-azure-core': 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) + '@azure-tools/typespec-client-generator-core': 0.42.2(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/openapi': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) dev: true - /@azure-tools/typespec-azure-core@0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0): - resolution: {integrity: sha512-KL23ecMJMnK/Dg7WGoUsgoxD/WTjV99eOxKHgegN1d2A7/9Q/y9rYGD5qgaApe3bg8eQZ4VW/9miQy/3ZJAjDQ==} + /@azure-tools/typespec-azure-core@0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0): + resolution: {integrity: sha512-8C96RkgSWtgqsaHRMWCd2iDltFJZTGmFQiTZazZj/uRy0Wn1ikjSriSN8t1puL5SiUPd0BVJP/YXiwAfjfZYDA==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.56.0 || >=0.57.0-dev <0.57.0 - '@typespec/http': ~0.56.0 || >=0.57.0-dev <0.57.0 - '@typespec/rest': ~0.56.0 || >=0.57.0-dev <0.57.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/rest': ~0.56.0 dependencies: - '@typespec/compiler': 0.57.0-dev.4 - '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) - '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) dev: true - /@azure-tools/typespec-azure-resource-manager@0.43.0-dev.2(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): - resolution: {integrity: sha512-YjvzjZpKmpQd76uyIuv8wGsb+FBlgbwOgKlROQY47USgGrtzUox/t99JN5rwlyIEAp3TrheNunt0gZ6jyOy1PA==} + /@azure-tools/typespec-azure-resource-manager@0.42.0(@azure-tools/typespec-autorest@0.42.0)(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-RCqcrhE1yniAih5vDFOC5K4MpDr9XmG8qBB39G49/KyEKnWOQ3Nwvt/6fXaU42D9X2L6kfEAIz/AdiSJ/H5O6w==} engines: {node: '>=18.0.0'} peerDependencies: - '@azure-tools/typespec-azure-core': ~0.42.0 || >=0.43.0-dev <0.43.0 - '@typespec/compiler': ~0.56.0 || >=0.57.0-dev <0.57.0 - '@typespec/http': ~0.56.0 || >=0.57.0-dev <0.57.0 - '@typespec/openapi': ~0.56.0 || >=0.57.0-dev <0.57.0 - '@typespec/rest': ~0.56.0 || >=0.57.0-dev <0.57.0 - '@typespec/versioning': ~0.56.0 || >=0.57.0-dev <0.57.0 - dependencies: - '@azure-tools/typespec-azure-core': 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) - '@typespec/compiler': 0.57.0-dev.4 - '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) - '@typespec/openapi': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) - '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) - '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + '@azure-tools/typespec-autorest': ~0.42.0 + '@azure-tools/typespec-azure-core': ~0.42.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/openapi': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@azure-tools/typespec-autorest': 0.42.0(@azure-tools/typespec-azure-core@0.42.0)(@azure-tools/typespec-client-generator-core@0.42.2)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@azure-tools/typespec-azure-core': 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/openapi': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) change-case: 5.4.4 pluralize: 8.0.0 dev: true - /@azure-tools/typespec-client-generator-core@0.42.1(@azure-tools/typespec-azure-core@0.43.0-dev.1)(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): - resolution: {integrity: sha512-2s4DrozUcShg9+n61ZWUjDQ99mhJpyG9DH/84KMpisKUcIkN/1G1bPRLJt2NKZLS2rZz0EfPLF7arcKQ95y8Ug==} + /@azure-tools/typespec-client-generator-core@0.42.2(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-Hei86GqNFfKpFhivZPpKo1ktSRQMnZKjLoMwIumklmMpeo5KgyzEgRSpJEiS+zmPZELs2Fu07VgfvpW0IXurUg==} engines: {node: '>=18.0.0'} peerDependencies: '@azure-tools/typespec-azure-core': ~0.42.0 @@ -397,11 +384,11 @@ packages: '@typespec/rest': ~0.56.0 '@typespec/versioning': ~0.56.0 dependencies: - '@azure-tools/typespec-azure-core': 0.43.0-dev.1(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/rest@0.56.0) - '@typespec/compiler': 0.57.0-dev.4 - '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) - '@typespec/rest': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) - '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + '@azure-tools/typespec-azure-core': 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) change-case: 5.4.4 pluralize: 8.0.0 dev: true @@ -1688,26 +1675,6 @@ packages: vscode-languageserver-textdocument: 1.0.11 yaml: 2.4.1 yargs: 17.7.2 - dev: true - - /@typespec/compiler@0.57.0-dev.4: - resolution: {integrity: sha512-WyFvItH8aUzIvszwAUcoaAgQEI5xsJJy2YqA8KlfR7XDJBG3wtJxK0KgUuvObmRUavKze+HQP3Gca/z8rRP3tQ==} - engines: {node: '>=18.0.0'} - hasBin: true - dependencies: - '@babel/code-frame': 7.24.2 - ajv: 8.12.0 - change-case: 5.4.4 - globby: 14.0.1 - mustache: 4.2.0 - picocolors: 1.0.0 - prettier: 3.2.5 - prompts: 2.4.2 - semver: 7.6.0 - vscode-languageserver: 9.0.1 - vscode-languageserver-textdocument: 1.0.11 - yaml: 2.4.1 - yargs: 17.7.2 /@typespec/eslint-config-typespec@0.55.0(prettier@3.2.5): resolution: {integrity: sha512-zZI2ERGdgM9T6neL+Qdht3z89elGI38h68vSYnq5KFR3J500llSJI0Yb5NnE1G2Y7pjmBrnYWhL7UoOaGpW42A==} @@ -1746,17 +1713,8 @@ packages: '@typespec/compiler': ~0.56.0 dependencies: '@typespec/compiler': 0.56.0 - dev: true - - /@typespec/http@0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4): - resolution: {integrity: sha512-OI2mFFnaLBeQxCwSZOoGwhOIeZmz9JMVU+ZwOgooXLGYBvI131DEUpfLnoK5j7fzuguHwYadCQE10U8c/hMWxg==} - engines: {node: '>=18.0.0'} - peerDependencies: - '@typespec/compiler': ~0.56.0 || >=0.57.0-dev <0.57.0 - dependencies: - '@typespec/compiler': 0.57.0-dev.4 - /@typespec/openapi3@0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2)(@typespec/openapi@0.56.0)(@typespec/versioning@0.56.0): + /@typespec/openapi3@0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/versioning@0.56.0): resolution: {integrity: sha512-55JPUP7dFk4iXn4fNKZEs76j7hAdlWfoMWNPsQPRJCP//KWCtNXfTP+/TTVPVv1L/6HztbXyPV0agKZwyS7gDw==} engines: {node: '>=18.0.0'} peerDependencies: @@ -1765,22 +1723,22 @@ packages: '@typespec/openapi': ~0.56.0 '@typespec/versioning': ~0.56.0 dependencies: - '@typespec/compiler': 0.57.0-dev.4 - '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) - '@typespec/openapi': 0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2) - '@typespec/versioning': 0.56.0(@typespec/compiler@0.57.0-dev.4) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/openapi': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) yaml: 2.4.1 dev: false - /@typespec/openapi@0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2): + /@typespec/openapi@0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0): resolution: {integrity: sha512-q8+IHRglXBm3slvonRLSNYN2fX7plbWA+ugIiMJZTeyc3enqfxPqMGA8BCiAFV3kwP0uPPpIXbCSIVhHgkONbA==} engines: {node: '>=18.0.0'} peerDependencies: '@typespec/compiler': ~0.56.0 '@typespec/http': ~0.56.0 dependencies: - '@typespec/compiler': 0.57.0-dev.4 - '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) /@typespec/prettier-plugin-typespec@0.55.0: resolution: {integrity: sha512-CrrZbN3EmT4rMckthSYZ2VeIET1pi2IAM/W9jN8pPfyqvidDhc/uCEy3gfbc9wvFKejC5Ykc/qE5MO79xvgH4Q==} @@ -1810,17 +1768,6 @@ packages: '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) dev: true - /@typespec/rest@0.56.0(@typespec/compiler@0.57.0-dev.4)(@typespec/http@0.57.0-dev.2): - resolution: {integrity: sha512-8w4WhWDcpEQNW8bB1BHhiBxIQUChDJtyq/n9p2OI/Bm1wncd61y/ZNOtcxmlKq8uB9d+dzHiZdEfqFCR8HF8/Q==} - engines: {node: '>=18.0.0'} - peerDependencies: - '@typespec/compiler': ~0.56.0 - '@typespec/http': ~0.56.0 - dependencies: - '@typespec/compiler': 0.57.0-dev.4 - '@typespec/http': 0.57.0-dev.2(@typespec/compiler@0.57.0-dev.4) - dev: true - /@typespec/versioning@0.55.0(@typespec/compiler@0.55.0): resolution: {integrity: sha512-89LTgkA3IBLnaaM4D4qfsrcEU0g3gasE1MmkrQ2HG21fYX88zKbmR1cKWeUxQx9MIXFOH4cPC9KhA/uLknRVMQ==} engines: {node: '>=18.0.0'} @@ -1830,13 +1777,13 @@ packages: '@typespec/compiler': 0.55.0 dev: true - /@typespec/versioning@0.56.0(@typespec/compiler@0.57.0-dev.4): + /@typespec/versioning@0.56.0(@typespec/compiler@0.56.0): resolution: {integrity: sha512-j7IN9XFyGn3LH6IOJkinEvk9sDncsxiWPULOAe0VQ+D/dtCfLawDMUALnvklMDRKeD1OOUPSCjjUAp9OB0f7YA==} engines: {node: '>=18.0.0'} peerDependencies: '@typespec/compiler': ~0.56.0 dependencies: - '@typespec/compiler': 0.57.0-dev.4 + '@typespec/compiler': 0.56.0 /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -2898,14 +2845,9 @@ packages: is-symbol: 1.0.4 dev: true - /escalade@3.1.1: - resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} - engines: {node: '>=6'} - /escalade@3.1.2: resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} engines: {node: '>=6'} - dev: true /escape-html@1.0.3: resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} @@ -6759,7 +6701,7 @@ packages: engines: {node: '>=10'} dependencies: cliui: 7.0.4 - escalade: 3.1.1 + escalade: 3.1.2 get-caller-file: 2.0.5 require-directory: 2.1.1 string-width: 4.2.3 @@ -6772,7 +6714,7 @@ packages: engines: {node: '>=12'} dependencies: cliui: 8.0.1 - escalade: 3.1.1 + escalade: 3.1.2 get-caller-file: 2.0.5 require-directory: 2.1.1 string-width: 4.2.3