diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json b/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json index 52966516080f..907286909b44 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json +++ b/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json @@ -1,11 +1,11 @@ { - "commit": "cfe318beba82c1e5bda6a600f91de32cba814364", + "commit": "cd7123ceaaeebc0c122e8d933b7f0f78a27c0c31", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/containerinstance/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/containerinstance/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/containerinstance/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py index 79ddd479831a..13e427f21c23 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py @@ -26,15 +26,16 @@ class ContainerInstanceManagementClientConfiguration: # pylint: disable=too-man :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-11-01-preview". 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", "2024-05-01-preview") + api_version: str = kwargs.pop("api_version", "2024-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_container_instance_management_client.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_container_instance_management_client.py index b3dceda732e2..02de7d6c6745 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_container_instance_management_client.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_container_instance_management_client.py @@ -19,11 +19,12 @@ from ._configuration import ContainerInstanceManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( - ContainerGroupProfileOperations, - ContainerGroupProfilesOperations, + CGProfileOperations, + CGProfilesOperations, ContainerGroupsOperations, ContainersOperations, LocationOperations, + NGroupsOperations, Operations, SubnetServiceAssociationLinkOperations, ) @@ -47,19 +48,20 @@ class ContainerInstanceManagementClient: # pylint: disable=client-accepts-api-v :ivar subnet_service_association_link: SubnetServiceAssociationLinkOperations operations :vartype subnet_service_association_link: azure.mgmt.containerinstance.operations.SubnetServiceAssociationLinkOperations - :ivar container_group_profiles: ContainerGroupProfilesOperations operations - :vartype container_group_profiles: - azure.mgmt.containerinstance.operations.ContainerGroupProfilesOperations - :ivar container_group_profile: ContainerGroupProfileOperations operations - :vartype container_group_profile: - azure.mgmt.containerinstance.operations.ContainerGroupProfileOperations + :ivar ngroups: NGroupsOperations operations + :vartype ngroups: azure.mgmt.containerinstance.operations.NGroupsOperations + :ivar cg_profiles: CGProfilesOperations operations + :vartype cg_profiles: azure.mgmt.containerinstance.operations.CGProfilesOperations + :ivar cg_profile: CGProfileOperations operations + :vartype cg_profile: azure.mgmt.containerinstance.operations.CGProfileOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-11-01-preview". 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 @@ -109,12 +111,9 @@ def __init__( self.subnet_service_association_link = SubnetServiceAssociationLinkOperations( self._client, self._config, self._serialize, self._deserialize ) - self.container_group_profiles = ContainerGroupProfilesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.container_group_profile = ContainerGroupProfileOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.ngroups = NGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cg_profiles = CGProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cg_profile = CGProfileOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_version.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_version.py index a1e5cf8bc16e..e5754a47ce68 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_version.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.2.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_configuration.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_configuration.py index fb8c3202e245..042dec72ea11 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_configuration.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_configuration.py @@ -26,15 +26,16 @@ class ContainerInstanceManagementClientConfiguration: # pylint: disable=too-man :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-11-01-preview". 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", "2024-05-01-preview") + api_version: str = kwargs.pop("api_version", "2024-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_container_instance_management_client.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_container_instance_management_client.py index da75152b0ce7..062dbe5d0034 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_container_instance_management_client.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_container_instance_management_client.py @@ -19,11 +19,12 @@ from .._serialization import Deserializer, Serializer from ._configuration import ContainerInstanceManagementClientConfiguration from .operations import ( - ContainerGroupProfileOperations, - ContainerGroupProfilesOperations, + CGProfileOperations, + CGProfilesOperations, ContainerGroupsOperations, ContainersOperations, LocationOperations, + NGroupsOperations, Operations, SubnetServiceAssociationLinkOperations, ) @@ -48,19 +49,20 @@ class ContainerInstanceManagementClient: # pylint: disable=client-accepts-api-v :ivar subnet_service_association_link: SubnetServiceAssociationLinkOperations operations :vartype subnet_service_association_link: azure.mgmt.containerinstance.aio.operations.SubnetServiceAssociationLinkOperations - :ivar container_group_profiles: ContainerGroupProfilesOperations operations - :vartype container_group_profiles: - azure.mgmt.containerinstance.aio.operations.ContainerGroupProfilesOperations - :ivar container_group_profile: ContainerGroupProfileOperations operations - :vartype container_group_profile: - azure.mgmt.containerinstance.aio.operations.ContainerGroupProfileOperations + :ivar ngroups: NGroupsOperations operations + :vartype ngroups: azure.mgmt.containerinstance.aio.operations.NGroupsOperations + :ivar cg_profiles: CGProfilesOperations operations + :vartype cg_profiles: azure.mgmt.containerinstance.aio.operations.CGProfilesOperations + :ivar cg_profile: CGProfileOperations operations + :vartype cg_profile: azure.mgmt.containerinstance.aio.operations.CGProfileOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-11-01-preview". 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 @@ -110,12 +112,9 @@ def __init__( self.subnet_service_association_link = SubnetServiceAssociationLinkOperations( self._client, self._config, self._serialize, self._deserialize ) - self.container_group_profiles = ContainerGroupProfilesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.container_group_profile = ContainerGroupProfileOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.ngroups = NGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cg_profiles = CGProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.cg_profile = CGProfileOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/__init__.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/__init__.py index 7120d9b773f9..2c95c4b9cb1a 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/__init__.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/__init__.py @@ -11,8 +11,9 @@ from ._location_operations import LocationOperations from ._containers_operations import ContainersOperations from ._subnet_service_association_link_operations import SubnetServiceAssociationLinkOperations -from ._container_group_profiles_operations import ContainerGroupProfilesOperations -from ._container_group_profile_operations import ContainerGroupProfileOperations +from ._ngroups_operations import NGroupsOperations +from ._cg_profiles_operations import CGProfilesOperations +from ._cg_profile_operations import CGProfileOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -24,8 +25,9 @@ "LocationOperations", "ContainersOperations", "SubnetServiceAssociationLinkOperations", - "ContainerGroupProfilesOperations", - "ContainerGroupProfileOperations", + "NGroupsOperations", + "CGProfilesOperations", + "CGProfileOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_group_profiles_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_cg_profile_operations.py similarity index 66% rename from sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_group_profiles_operations.py rename to sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_cg_profile_operations.py index 3771af415361..8322cb6596a0 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_group_profiles_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_cg_profile_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,23 +18,27 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ...operations._container_group_profiles_operations import ( +from ...operations._cg_profile_operations import ( build_create_or_update_request, build_delete_request, + build_get_by_revision_number_request, build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_patch_request, + build_list_all_revisions_request, + build_update_request, ) if sys.version_info >= (3, 9): @@ -45,14 +49,14 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ContainerGroupProfilesOperations: +class CGProfileOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.containerinstance.aio.ContainerInstanceManagementClient`'s - :attr:`container_group_profiles` attribute. + :attr:`cg_profile` attribute. """ models = _models @@ -64,235 +68,6 @@ def __init__(self, *args, **kwargs) -> None: 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(self, **kwargs: Any) -> AsyncIterable["_models.ContainerGroupProfile"]: - """Get a list of container group profiles in the specified subscription. - - Get a list of container group profiles in the specified subscription. This operation returns - properties of each container group profile including containers, image registry credentials, - restart policy, IP address type, OS type,volumes,current revision number, etc. - - :return: An iterator like instance of either ContainerGroupProfile or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ContainerGroupProfileListResult] = 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_list_request( - subscription_id=self._config.subscription_id, - api_version=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) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerGroupProfileListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerGroupProfile"]: - """Get a list of container group profiles in the specified subscription and resource group. - - Get a list of container group profiles in a specified subscription and resource group. This - operation returns properties of each container group profile including containers, image - registry credentials, restart policy, IP address type, OS type volumes, current revision - number, etc. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ContainerGroupProfile or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ContainerGroupProfileListResult] = 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_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=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) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerGroupProfileListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any - ) -> _models.ContainerGroupProfile: - """Get the properties of the specified container group profile. - - Gets the properties of the specified container group profile in the specified subscription and - resource group. The operation returns the properties of container group profile including - containers, image registry credentials, restart policy, IP address type, OS type, volumes, - current revision number, etc. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. - :type container_group_profile_name: str - :return: ContainerGroupProfile or the result of cls(response) - :rtype: ~azure.mgmt.containerinstance.models.ContainerGroupProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ContainerGroupProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - container_group_profile_name=container_group_profile_name, - subscription_id=self._config.subscription_id, - api_version=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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @overload async def create_or_update( self, @@ -303,17 +78,15 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.ContainerGroupProfile: - """Create or update container group profiles. + """Create or Update a ContainerGroupProfile. - Create or update container group profiles with specified configurations. + Create a CGProfile if it doesn't exist or update an existing CGProfile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str - :param container_group_profile: The properties of the container group profile to be created or - updated. Required. + :param container_group_profile: The ContainerGroupProfile object. Required. :type container_group_profile: ~azure.mgmt.containerinstance.models.ContainerGroupProfile :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -333,17 +106,15 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.ContainerGroupProfile: - """Create or update container group profiles. + """Create or Update a ContainerGroupProfile. - Create or update container group profiles with specified configurations. + Create a CGProfile if it doesn't exist or update an existing CGProfile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str - :param container_group_profile: The properties of the container group profile to be created or - updated. Required. + :param container_group_profile: The ContainerGroupProfile object. Required. :type container_group_profile: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -361,17 +132,16 @@ async def create_or_update( container_group_profile: Union[_models.ContainerGroupProfile, IO[bytes]], **kwargs: Any ) -> _models.ContainerGroupProfile: - """Create or update container group profiles. + """Create or Update a ContainerGroupProfile. - Create or update container group profiles with specified configurations. + Create a CGProfile if it doesn't exist or update an existing CGProfile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str - :param container_group_profile: The properties of the container group profile to be created or - updated. Is either a ContainerGroupProfile type or a IO[bytes] type. Required. + :param container_group_profile: The ContainerGroupProfile object. Is either a + ContainerGroupProfile type or a IO[bytes] type. Required. :type container_group_profile: ~azure.mgmt.containerinstance.models.ContainerGroupProfile or IO[bytes] :return: ContainerGroupProfile or the result of cls(response) @@ -423,17 +193,23 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) 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 patch( + async def update( self, resource_group_name: str, container_group_profile_name: str, @@ -442,14 +218,13 @@ async def patch( content_type: str = "application/json", **kwargs: Any ) -> _models.ContainerGroupProfile: - """Patch container group profiles. + """Container group profile PATCH REST API. - Patches container group profile with specified properties. + Update a specified container group profile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str :param properties: The container group profile properties that need to be updated. Required. :type properties: ~azure.mgmt.containerinstance.models.ContainerGroupProfilePatch @@ -462,7 +237,7 @@ async def patch( """ @overload - async def patch( + async def update( self, resource_group_name: str, container_group_profile_name: str, @@ -471,14 +246,13 @@ async def patch( content_type: str = "application/json", **kwargs: Any ) -> _models.ContainerGroupProfile: - """Patch container group profiles. + """Container group profile PATCH REST API. - Patches container group profile with specified properties. + Update a specified container group profile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str :param properties: The container group profile properties that need to be updated. Required. :type properties: IO[bytes] @@ -491,21 +265,20 @@ async def patch( """ @distributed_trace_async - async def patch( + async def update( self, resource_group_name: str, container_group_profile_name: str, properties: Union[_models.ContainerGroupProfilePatch, IO[bytes]], **kwargs: Any ) -> _models.ContainerGroupProfile: - """Patch container group profiles. + """Container group profile PATCH REST API. - Patches container group profile with specified properties. + Update a specified container group profile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str :param properties: The container group profile properties that need to be updated. Is either a ContainerGroupProfilePatch type or a IO[bytes] type. Required. @@ -537,7 +310,7 @@ async def patch( else: _json = self._serialize.body(properties, "ContainerGroupProfilePatch") - _request = build_patch_request( + _request = build_update_request( resource_group_name=resource_group_name, container_group_profile_name=container_group_profile_name, subscription_id=self._config.subscription_id, @@ -557,6 +330,70 @@ async def patch( response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + + deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any + ) -> _models.ContainerGroupProfile: + """Display information about a specified ContainerGroupProfile. + + Get the properties of the specified container group profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_group_profile_name: ContainerGroupProfile name. Required. + :type container_group_profile_name: str + :return: ContainerGroupProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerinstance.models.ContainerGroupProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerGroupProfile] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_group_profile_name=container_group_profile_name, + subscription_id=self._config.subscription_id, + api_version=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]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -568,22 +405,229 @@ async def patch( return deserialized # type: ignore + async def _delete_initial( + self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_group_profile_name=container_group_profile_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( + self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Container group profile DELETE REST API. + + Deletes a container group profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_group_profile_name: ContainerGroupProfile name. Required. + :type container_group_profile_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_group_profile_name=container_group_profile_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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_all_revisions( self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any - ) -> None: - """Delete the specified container group profile. + ) -> AsyncIterable["_models.ContainerGroupProfile"]: + """Get a list of all the revisions of the specified container group profile in the given + subscription and resource group. - Delete the specified container group profile in the specified subscription and resource group. - The operation does not delete other resources provided by the user, such as volumes. + Get a list of all the revisions of the specified container group profile in the given + subscription and resource group. This operation returns properties of each revision of the + specified container group profile including containers, image registry credentials, restart + policy, IP address type, OS type volumes, revision number, etc. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An iterator like instance of either ContainerGroupProfile or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerGroupProfileListResult] = 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_list_all_revisions_request( + resource_group_name=resource_group_name, + container_group_profile_name=container_group_profile_name, + subscription_id=self._config.subscription_id, + api_version=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) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerGroupProfileListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_by_revision_number( + self, resource_group_name: str, container_group_profile_name: str, revision_number: str, **kwargs: Any + ) -> _models.ContainerGroupProfile: + """Get the properties of the specified revision of the container group profile. + + Gets the properties of the specified revision of the container group profile in the given + subscription and resource group. The operation returns the properties of container group + profile including containers, image registry credentials, restart policy, IP address type, OS + type, volumes, current revision number, etc. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_group_profile_name: ContainerGroupProfile name. Required. + :type container_group_profile_name: str + :param revision_number: The revision number of the container group profile. Required. + :type revision_number: str + :return: ContainerGroupProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerinstance.models.ContainerGroupProfile :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -598,11 +642,12 @@ async def delete( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.ContainerGroupProfile] = kwargs.pop("cls", None) - _request = build_delete_request( + _request = build_get_by_revision_number_request( resource_group_name=resource_group_name, container_group_profile_name=container_group_profile_name, + revision_number=revision_number, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -617,9 +662,13 @@ async def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_group_profile_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_cg_profiles_operations.py similarity index 62% rename from sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_group_profile_operations.py rename to sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_cg_profiles_operations.py index 793cb6c08182..e7633b6cc73a 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_group_profile_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_cg_profiles_operations.py @@ -22,14 +22,13 @@ from azure.core.pipeline import PipelineResponse from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ...operations._container_group_profile_operations import ( - build_get_by_revision_number_request, - build_list_all_revisions_request, +from ...operations._cg_profiles_operations import ( + build_list_by_resource_group_request, + build_list_by_subscription_request, ) if sys.version_info >= (3, 9): @@ -40,14 +39,14 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ContainerGroupProfileOperations: +class CGProfilesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.containerinstance.aio.ContainerInstanceManagementClient`'s - :attr:`container_group_profile` attribute. + :attr:`cg_profiles` attribute. """ models = _models @@ -60,22 +59,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_all_revisions( - self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerGroupProfile"]: - """Get a list of all the revisions of the specified container group profile in the given - subscription and resource group. + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ContainerGroupProfile"]: + """List container group profiles in a subscription. - Get a list of all the revisions of the specified container group profile in the given - subscription and resource group. This operation returns properties of each revision of the - specified container group profile including containers, image registry credentials, restart - policy, IP address type, OS type volumes, revision number, etc. + Gets a list of all container group profiles under a subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. - :type container_group_profile_name: str :return: An iterator like instance of either ContainerGroupProfile or the result of cls(response) :rtype: @@ -99,9 +87,7 @@ def list_all_revisions( def prepare_request(next_link=None): if not next_link: - _request = build_list_all_revisions_request( - resource_group_name=resource_group_name, - container_group_profile_name=container_group_profile_name, + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -150,28 +136,28 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def get_by_revision_number( - self, resource_group_name: str, container_group_profile_name: str, revision_number: str, **kwargs: Any - ) -> _models.ContainerGroupProfile: - """Get the properties of the specified revision of the container group profile. + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ContainerGroupProfile"]: + """List container group profiles in a resource group. - Gets the properties of the specified revision of the container group profile in the given - subscription and resource group. The operation returns the properties of container group - profile including containers, image registry credentials, restart policy, IP address type, OS - type, volumes, current revision number, etc. + Gets a list of all container group profiles under a resource group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. - :type container_group_profile_name: str - :param revision_number: The revision number of the container group profile. Required. - :type revision_number: str - :return: ContainerGroupProfile or the result of cls(response) - :rtype: ~azure.mgmt.containerinstance.models.ContainerGroupProfile + :return: An iterator like instance of either ContainerGroupProfile or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupProfile] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerGroupProfileListResult] = kwargs.pop("cls", None) + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -180,37 +166,55 @@ async def get_by_revision_number( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ContainerGroupProfile] = kwargs.pop("cls", None) + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_get_by_revision_number_request( - resource_group_name=resource_group_name, - container_group_profile_name=container_group_profile_name, - revision_number=revision_number, - subscription_id=self._config.subscription_id, - api_version=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) + _request.method = "GET" + return _request - _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 = self._deserialize("ContainerGroupProfileListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, 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 - deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, 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) diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_groups_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_groups_operations.py index a8badbbc07b9..0d3ad21bc9e4 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_groups_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_groups_operations.py @@ -175,8 +175,7 @@ def list_by_resource_group( returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :return: An iterator like instance of either ContainerGroup or the result of cls(response) :rtype: @@ -258,8 +257,7 @@ async def get(self, resource_group_name: str, container_group_name: str, **kwarg group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -389,8 +387,7 @@ async def begin_create_or_update( Create or update container groups with specified configurations. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -420,8 +417,7 @@ async def begin_create_or_update( Create or update container groups with specified configurations. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -449,8 +445,7 @@ async def begin_create_or_update( Create or update container groups with specified configurations. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -523,8 +518,7 @@ async def update( Updates container group tags with specified values. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -552,8 +546,7 @@ async def update( Updates container group tags with specified values. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -579,8 +572,7 @@ async def update( Updates container group tags with specified values. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -704,8 +696,7 @@ async def begin_delete( Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -817,8 +808,7 @@ async def begin_restart( Restarts all containers in a container group in place. If container image has updates, new image will be downloaded. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -875,8 +865,7 @@ async def stop( # pylint: disable=inconsistent-return-statements Stops all containers in a container group. Compute resources will be deallocated and billing will stop. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -981,8 +970,7 @@ async def begin_start( Starts all containers in a container group. Compute resources will be allocated and billing will start. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -1039,8 +1027,7 @@ async def get_outbound_network_dependencies_endpoints( # pylint: disable=name-t Gets all the network dependencies for this container group to allow complete control of network setting and configuration. For container groups, this will always be an empty list. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_containers_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_containers_operations.py index 4c510109dab9..fbfbf408a608 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_containers_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_containers_operations.py @@ -73,8 +73,7 @@ async def list_logs( Get the logs for a specified container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -151,8 +150,7 @@ async def execute_command( Executes a command for a specific container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -184,8 +182,7 @@ async def execute_command( Executes a command for a specific container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -215,8 +212,7 @@ async def execute_command( Executes a command for a specific container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -294,8 +290,7 @@ async def attach( Attach to the output stream of a specific container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_location_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_location_operations.py index ebaa9dbe3b5a..87efb2567b29 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_location_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_location_operations.py @@ -63,7 +63,7 @@ def __init__(self, *args, **kwargs) -> None: def list_usage(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: """Get the usage for a subscription. - :param location: The name of the Azure region. Required. + :param location: The identifier for the physical azure location. Required. :type location: str :return: An iterator like instance of either Usage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.Usage] @@ -142,7 +142,7 @@ def list_cached_images(self, location: str, **kwargs: Any) -> AsyncIterable["_mo Get the list of cached images on specific OS type for a subscription in a region. - :param location: The name of the Azure region. Required. + :param location: The identifier for the physical azure location. Required. :type location: str :return: An iterator like instance of either CachedImages or the result of cls(response) :rtype: @@ -222,7 +222,7 @@ def list_capabilities(self, location: str, **kwargs: Any) -> AsyncIterable["_mod Get the list of CPU/memory/GPU capabilities of a region. - :param location: The name of the Azure region. Required. + :param location: The identifier for the physical azure location. Required. :type location: str :return: An iterator like instance of either Capabilities or the result of cls(response) :rtype: diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_ngroups_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_ngroups_operations.py new file mode 100644 index 000000000000..bf2e0650a223 --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_ngroups_operations.py @@ -0,0 +1,1088 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._ngroups_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_restart_request, + build_start_request, + build_stop_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerinstance.aio.ContainerInstanceManagementClient`'s + :attr:`ngroups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> _models.NGroup: + """NGroups GET REST API. + + Get the properties of the specified NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: NGroup or the result of cls(response) + :rtype: ~azure.mgmt.containerinstance.models.NGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NGroup] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, resource_group_name: str, ngroups_name: str, n_group: Union[_models.NGroup, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(n_group, (IOBase, bytes)): + _content = n_group + else: + _json = self._serialize.body(n_group, "NGroup") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + 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, + ngroups_name: str, + n_group: _models.NGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NGroup]: + """NGroup PUT REST API. + + Create or update a NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Required. + :type n_group: ~azure.mgmt.containerinstance.models.NGroup + :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 either NGroup or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + ngroups_name: str, + n_group: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NGroup]: + """NGroup PUT REST API. + + Create or update a NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Required. + :type n_group: 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 either NGroup or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, ngroups_name: str, n_group: Union[_models.NGroup, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.NGroup]: + """NGroup PUT REST API. + + Create or update a NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Is either a NGroup type or a IO[bytes] type. Required. + :type n_group: ~azure.mgmt.containerinstance.models.NGroup or IO[bytes] + :return: An instance of AsyncLROPoller that returns either NGroup or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NGroup] = 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, + ngroups_name=ngroups_name, + n_group=n_group, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("NGroup", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, resource_group_name: str, ngroups_name: str, n_group: Union[_models.NGroup, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(n_group, (IOBase, bytes)): + _content = n_group + else: + _json = self._serialize.body(n_group, "NGroup") + + _request = build_update_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + 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, + ngroups_name: str, + n_group: _models.NGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NGroup]: + """NGroups PATCH REST API. + + Update a specified NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Required. + :type n_group: ~azure.mgmt.containerinstance.models.NGroup + :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 either NGroup or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + ngroups_name: str, + n_group: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NGroup]: + """NGroups PATCH REST API. + + Update a specified NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Required. + :type n_group: 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 either NGroup or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, ngroups_name: str, n_group: Union[_models.NGroup, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.NGroup]: + """NGroups PATCH REST API. + + Update a specified NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Is either a NGroup type or a IO[bytes] type. Required. + :type n_group: ~azure.mgmt.containerinstance.models.NGroup or IO[bytes] + :return: An instance of AsyncLROPoller that returns either NGroup or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NGroup] = 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, + ngroups_name=ngroups_name, + n_group=n_group, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("NGroup", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """NGroups Delete REST API. + + Deletes the NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **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 + + async def _start_initial(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_start_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Starts all container groups in the specified NGroups resource. + + Starts all container groups in the specified NGroups resource. Compute resources will be + allocated and billing will start. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[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._start_initial( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **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_async + async def stop( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ngroups_name: str, **kwargs: Any + ) -> None: + """Stops all container groups in the specified NGroups resource. + + Stops all container groups in the specified NGroups resource. Compute resources will be + deallocated and billing will stop. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_stop_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _restart_initial( + self, resource_group_name: str, ngroups_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restart_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_restart(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Restarts all container groups in the specified NGroups resource. + + Restarts all container groups in the specified NGroups resource in place. If container image + has updates, new image will be downloaded. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[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._restart_initial( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **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_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.NGroup"]: + """GET NGroups under a resource group REST API. + + Gets a list of all NGroups resources under a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :return: An iterator like instance of either NGroup or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NGroupsListResult] = 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_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=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) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NGroupsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.NGroup"]: + """List NGroups in a subscription. + + Gets a list of all NGroups resources under a subscription. + + :return: An iterator like instance of either NGroup or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NGroupsListResult] = 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_list_request( + subscription_id=self._config.subscription_id, + api_version=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) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NGroupsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_subnet_service_association_link_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_subnet_service_association_link_operations.py index 9cd84db966f1..308458c82591 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_subnet_service_association_link_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_subnet_service_association_link_operations.py @@ -117,8 +117,7 @@ async def begin_delete( Delete container group virtual network association links. The operation does not delete other resources provided by the user. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param virtual_network_name: The name of the virtual network. Required. :type virtual_network_name: str diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/__init__.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/__init__.py index a9551a9b83d2..66ffec908229 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/__init__.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/__init__.py @@ -6,6 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import ApiEntityReference +from ._models_py3 import ApplicationGateway +from ._models_py3 import ApplicationGatewayBackendAddressPool from ._models_py3 import AzureFileVolume from ._models_py3 import CachedImages from ._models_py3 import CachedImagesListResult @@ -14,7 +17,6 @@ from ._models_py3 import CapabilitiesListResult from ._models_py3 import CloudErrorBody from ._models_py3 import ConfidentialComputeProperties -from ._models_py3 import ConfigMap from ._models_py3 import Container from ._models_py3 import ContainerAttachResponse from ._models_py3 import ContainerExec @@ -28,8 +30,7 @@ from ._models_py3 import ContainerGroupProfile from ._models_py3 import ContainerGroupProfileListResult from ._models_py3 import ContainerGroupProfilePatch -from ._models_py3 import ContainerGroupProfileProperties -from ._models_py3 import ContainerGroupProfileReferenceDefinition +from ._models_py3 import ContainerGroupProfileStub from ._models_py3 import ContainerGroupProperties from ._models_py3 import ContainerGroupPropertiesInstanceView from ._models_py3 import ContainerGroupSubnetId @@ -40,9 +41,17 @@ from ._models_py3 import ContainerState from ._models_py3 import DeploymentExtensionSpec from ._models_py3 import DnsConfiguration +from ._models_py3 import ElasticProfile +from ._models_py3 import ElasticProfileContainerGroupNamingPolicy +from ._models_py3 import ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy from ._models_py3 import EncryptionProperties from ._models_py3 import EnvironmentVariable +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse from ._models_py3 import Event +from ._models_py3 import FileShare +from ._models_py3 import FileShareProperties from ._models_py3 import GitRepoVolume from ._models_py3 import GpuResource from ._models_py3 import HttpHeader @@ -50,19 +59,36 @@ from ._models_py3 import InitContainerDefinition from ._models_py3 import InitContainerPropertiesDefinitionInstanceView from ._models_py3 import IpAddress +from ._models_py3 import LoadBalancer +from ._models_py3 import LoadBalancerBackendAddressPool from ._models_py3 import LogAnalytics from ._models_py3 import Logs +from ._models_py3 import NGroup +from ._models_py3 import NGroupCGPropertyContainer +from ._models_py3 import NGroupCGPropertyContainerProperties +from ._models_py3 import NGroupCGPropertyVolume +from ._models_py3 import NGroupContainerGroupProperties +from ._models_py3 import NGroupIdentity +from ._models_py3 import NGroupSkus +from ._models_py3 import NGroupsListResult +from ._models_py3 import NGroupsSkusList +from ._models_py3 import NetworkProfile from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult +from ._models_py3 import PlacementProfile from ._models_py3 import Port from ._models_py3 import Resource from ._models_py3 import ResourceLimits from ._models_py3 import ResourceRequests from ._models_py3 import ResourceRequirements +from ._models_py3 import SecretReference from ._models_py3 import SecurityContextCapabilitiesDefinition from ._models_py3 import SecurityContextDefinition -from ._models_py3 import StandbyPoolProfileDefinition +from ._models_py3 import StorageProfile +from ._models_py3 import SystemData +from ._models_py3 import UpdateProfile +from ._models_py3 import UpdateProfileRollingUpdateProfile from ._models_py3 import Usage from ._models_py3 import UsageListResult from ._models_py3 import UsageName @@ -70,6 +96,8 @@ from ._models_py3 import Volume from ._models_py3 import VolumeMount +from ._container_instance_management_client_enums import AzureFileShareAccessTier +from ._container_instance_management_client_enums import AzureFileShareAccessType from ._container_instance_management_client_enums import ContainerGroupIpAddressType from ._container_instance_management_client_enums import ContainerGroupNetworkProtocol from ._container_instance_management_client_enums import ContainerGroupPriority @@ -77,9 +105,12 @@ from ._container_instance_management_client_enums import ContainerGroupSku from ._container_instance_management_client_enums import ContainerInstanceOperationsOrigin from ._container_instance_management_client_enums import ContainerNetworkProtocol +from ._container_instance_management_client_enums import CreatedByType from ._container_instance_management_client_enums import DnsNameLabelReusePolicy from ._container_instance_management_client_enums import GpuSku from ._container_instance_management_client_enums import LogAnalyticsLogType +from ._container_instance_management_client_enums import NGroupProvisioningState +from ._container_instance_management_client_enums import NGroupUpdateMode from ._container_instance_management_client_enums import OperatingSystemTypes from ._container_instance_management_client_enums import ResourceIdentityType from ._container_instance_management_client_enums import Scheme @@ -88,6 +119,9 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ApiEntityReference", + "ApplicationGateway", + "ApplicationGatewayBackendAddressPool", "AzureFileVolume", "CachedImages", "CachedImagesListResult", @@ -96,7 +130,6 @@ "CapabilitiesListResult", "CloudErrorBody", "ConfidentialComputeProperties", - "ConfigMap", "Container", "ContainerAttachResponse", "ContainerExec", @@ -110,8 +143,7 @@ "ContainerGroupProfile", "ContainerGroupProfileListResult", "ContainerGroupProfilePatch", - "ContainerGroupProfileProperties", - "ContainerGroupProfileReferenceDefinition", + "ContainerGroupProfileStub", "ContainerGroupProperties", "ContainerGroupPropertiesInstanceView", "ContainerGroupSubnetId", @@ -122,9 +154,17 @@ "ContainerState", "DeploymentExtensionSpec", "DnsConfiguration", + "ElasticProfile", + "ElasticProfileContainerGroupNamingPolicy", + "ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy", "EncryptionProperties", "EnvironmentVariable", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", "Event", + "FileShare", + "FileShareProperties", "GitRepoVolume", "GpuResource", "HttpHeader", @@ -132,25 +172,44 @@ "InitContainerDefinition", "InitContainerPropertiesDefinitionInstanceView", "IpAddress", + "LoadBalancer", + "LoadBalancerBackendAddressPool", "LogAnalytics", "Logs", + "NGroup", + "NGroupCGPropertyContainer", + "NGroupCGPropertyContainerProperties", + "NGroupCGPropertyVolume", + "NGroupContainerGroupProperties", + "NGroupIdentity", + "NGroupSkus", + "NGroupsListResult", + "NGroupsSkusList", + "NetworkProfile", "Operation", "OperationDisplay", "OperationListResult", + "PlacementProfile", "Port", "Resource", "ResourceLimits", "ResourceRequests", "ResourceRequirements", + "SecretReference", "SecurityContextCapabilitiesDefinition", "SecurityContextDefinition", - "StandbyPoolProfileDefinition", + "StorageProfile", + "SystemData", + "UpdateProfile", + "UpdateProfileRollingUpdateProfile", "Usage", "UsageListResult", "UsageName", "UserAssignedIdentities", "Volume", "VolumeMount", + "AzureFileShareAccessTier", + "AzureFileShareAccessType", "ContainerGroupIpAddressType", "ContainerGroupNetworkProtocol", "ContainerGroupPriority", @@ -158,9 +217,12 @@ "ContainerGroupSku", "ContainerInstanceOperationsOrigin", "ContainerNetworkProtocol", + "CreatedByType", "DnsNameLabelReusePolicy", "GpuSku", "LogAnalyticsLogType", + "NGroupProvisioningState", + "NGroupUpdateMode", "OperatingSystemTypes", "ResourceIdentityType", "Scheme", diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_container_instance_management_client_enums.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_container_instance_management_client_enums.py index b2346dedd4d4..4c90dc05ccdf 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_container_instance_management_client_enums.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_container_instance_management_client_enums.py @@ -10,6 +10,26 @@ from azure.core import CaseInsensitiveEnumMeta +class AzureFileShareAccessTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """learn more at: + https://learn.microsoft.com/en-us/rest/api/storagerp/file-shares/create?tabs=HTTP#shareaccesstier. + """ + + COOL = "cool" + HOT = "hot" + PREMIUM = "premium" + TRANSACTIONOPTIMIZED = "transactionoptimized" + + +class AzureFileShareAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies how Container Groups can access the Azure file share i.e. all CG will share same + Azure file share or going to have exclusive file share. + """ + + SHARED = "Shared" + EXCLUSIVE = "Exclusive" + + class ContainerGroupIpAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies if the IP is exposed to the public internet or private VNET.""" @@ -48,6 +68,7 @@ class ContainerGroupRestartPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ContainerGroupSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The container group SKU.""" + NOT_SPECIFIED = "NotSpecified" STANDARD = "Standard" DEDICATED = "Dedicated" CONFIDENTIAL = "Confidential" @@ -67,6 +88,15 @@ class ContainerNetworkProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): UDP = "UDP" +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + class DnsNameLabelReusePolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The value representing the security enum. The 'Unsecure' value is the default value if not selected and means the object's domain name label is not secured against subdomain takeover. @@ -100,6 +130,25 @@ class LogAnalyticsLogType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONTAINER_INSTANCE_LOGS = "ContainerInstanceLogs" +class NGroupProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state, which only appears in the response.""" + + CREATING = "Creating" + UPDATING = "Updating" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + DELETING = "Deleting" + MIGRATING = "Migrating" + + +class NGroupUpdateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """NGroupUpdateMode.""" + + MANUAL = "Manual" + ROLLING = "Rolling" + + class OperatingSystemTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type required by the containers in the container group.""" diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models_py3.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models_py3.py index 6deb8bee8d24..794a8afef093 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models_py3.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models_py3.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union @@ -23,6 +24,82 @@ JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +class ApiEntityReference(_serialization.Model): + """The API entity reference. + + :ivar id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class ApplicationGateway(_serialization.Model): + """Application Gateway the CG profile will use to interact with CGs in a backend pool. + + :ivar resource: The Application Gateway ARM resource Id. + :vartype resource: str + :ivar backend_address_pools: List of Application Gateway Backend Address Pools. + :vartype backend_address_pools: + list[~azure.mgmt.containerinstance.models.ApplicationGatewayBackendAddressPool] + """ + + _attribute_map = { + "resource": {"key": "resource", "type": "str"}, + "backend_address_pools": {"key": "backendAddressPools", "type": "[ApplicationGatewayBackendAddressPool]"}, + } + + def __init__( + self, + *, + resource: Optional[str] = None, + backend_address_pools: Optional[List["_models.ApplicationGatewayBackendAddressPool"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource: The Application Gateway ARM resource Id. + :paramtype resource: str + :keyword backend_address_pools: List of Application Gateway Backend Address Pools. + :paramtype backend_address_pools: + list[~azure.mgmt.containerinstance.models.ApplicationGatewayBackendAddressPool] + """ + super().__init__(**kwargs) + self.resource = resource + self.backend_address_pools = backend_address_pools + + +class ApplicationGatewayBackendAddressPool(_serialization.Model): + """NGroups application gateway backend address pool. + + :ivar resource: The application gateway backend address pool ARM resource Id. + :vartype resource: str + """ + + _attribute_map = { + "resource": {"key": "resource", "type": "str"}, + } + + def __init__(self, *, resource: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource: The application gateway backend address pool ARM resource Id. + :paramtype resource: str + """ + super().__init__(**kwargs) + self.resource = resource + + class AzureFileVolume(_serialization.Model): """The properties of the Azure File volume. Azure File shares are mounted as volumes. @@ -38,6 +115,9 @@ class AzureFileVolume(_serialization.Model): :vartype storage_account_name: str :ivar storage_account_key: The storage account access key used to access the Azure File share. :vartype storage_account_key: str + :ivar storage_account_key_reference: The reference to the storage account access key used to + access the Azure File share. + :vartype storage_account_key_reference: str """ _validation = { @@ -50,6 +130,7 @@ class AzureFileVolume(_serialization.Model): "read_only": {"key": "readOnly", "type": "bool"}, "storage_account_name": {"key": "storageAccountName", "type": "str"}, "storage_account_key": {"key": "storageAccountKey", "type": "str"}, + "storage_account_key_reference": {"key": "storageAccountKeyReference", "type": "str"}, } def __init__( @@ -59,6 +140,7 @@ def __init__( storage_account_name: str, read_only: Optional[bool] = None, storage_account_key: Optional[str] = None, + storage_account_key_reference: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -73,12 +155,16 @@ def __init__( :keyword storage_account_key: The storage account access key used to access the Azure File share. :paramtype storage_account_key: str + :keyword storage_account_key_reference: The reference to the storage account access key used to + access the Azure File share. + :paramtype storage_account_key_reference: str """ super().__init__(**kwargs) self.share_name = share_name self.read_only = read_only self.storage_account_name = storage_account_name self.storage_account_key = storage_account_key + self.storage_account_key_reference = storage_account_key_reference class CachedImages(_serialization.Model): @@ -323,26 +409,6 @@ def __init__(self, *, cce_policy: Optional[str] = None, **kwargs: Any) -> None: self.cce_policy = cce_policy -class ConfigMap(_serialization.Model): - """The container config map. - - :ivar key_value_pairs: The key value pairs dictionary in the config map. - :vartype key_value_pairs: dict[str, str] - """ - - _attribute_map = { - "key_value_pairs": {"key": "keyValuePairs", "type": "{str}"}, - } - - def __init__(self, *, key_value_pairs: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword key_value_pairs: The key value pairs dictionary in the config map. - :paramtype key_value_pairs: dict[str, str] - """ - super().__init__(**kwargs) - self.key_value_pairs = key_value_pairs - - class Container(_serialization.Model): # pylint: disable=too-many-instance-attributes """A container instance. @@ -352,7 +418,7 @@ class Container(_serialization.Model): # pylint: disable=too-many-instance-attr :ivar name: The user-provided name of the container instance. Required. :vartype name: str - :ivar image: The name of the image used to create the container instance. + :ivar image: The name of the image used to create the container instance. Required. :vartype image: str :ivar command: The commands to execute within the container instance in exec form. :vartype command: list[str] @@ -362,7 +428,7 @@ class Container(_serialization.Model): # pylint: disable=too-many-instance-attr :vartype environment_variables: list[~azure.mgmt.containerinstance.models.EnvironmentVariable] :ivar instance_view: The instance view of the container instance. Only valid in response. :vartype instance_view: ~azure.mgmt.containerinstance.models.ContainerPropertiesInstanceView - :ivar resources: The resource requirements of the container instance. + :ivar resources: The resource requirements of the container instance. Required. :vartype resources: ~azure.mgmt.containerinstance.models.ResourceRequirements :ivar volume_mounts: The volume mounts available to the container instance. :vartype volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] @@ -372,13 +438,13 @@ class Container(_serialization.Model): # pylint: disable=too-many-instance-attr :vartype readiness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe :ivar security_context: The container security properties. :vartype security_context: ~azure.mgmt.containerinstance.models.SecurityContextDefinition - :ivar config_map: The config map. - :vartype config_map: ~azure.mgmt.containerinstance.models.ConfigMap """ _validation = { "name": {"required": True}, + "image": {"required": True}, "instance_view": {"readonly": True}, + "resources": {"required": True}, } _attribute_map = { @@ -393,29 +459,27 @@ class Container(_serialization.Model): # pylint: disable=too-many-instance-attr "liveness_probe": {"key": "properties.livenessProbe", "type": "ContainerProbe"}, "readiness_probe": {"key": "properties.readinessProbe", "type": "ContainerProbe"}, "security_context": {"key": "properties.securityContext", "type": "SecurityContextDefinition"}, - "config_map": {"key": "properties.configMap", "type": "ConfigMap"}, } def __init__( self, *, name: str, - image: Optional[str] = None, + image: str, + resources: "_models.ResourceRequirements", command: Optional[List[str]] = None, ports: Optional[List["_models.ContainerPort"]] = None, environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, - resources: Optional["_models.ResourceRequirements"] = None, volume_mounts: Optional[List["_models.VolumeMount"]] = None, liveness_probe: Optional["_models.ContainerProbe"] = None, readiness_probe: Optional["_models.ContainerProbe"] = None, security_context: Optional["_models.SecurityContextDefinition"] = None, - config_map: Optional["_models.ConfigMap"] = None, **kwargs: Any ) -> None: """ :keyword name: The user-provided name of the container instance. Required. :paramtype name: str - :keyword image: The name of the image used to create the container instance. + :keyword image: The name of the image used to create the container instance. Required. :paramtype image: str :keyword command: The commands to execute within the container instance in exec form. :paramtype command: list[str] @@ -424,7 +488,7 @@ def __init__( :keyword environment_variables: The environment variables to set in the container instance. :paramtype environment_variables: list[~azure.mgmt.containerinstance.models.EnvironmentVariable] - :keyword resources: The resource requirements of the container instance. + :keyword resources: The resource requirements of the container instance. Required. :paramtype resources: ~azure.mgmt.containerinstance.models.ResourceRequirements :keyword volume_mounts: The volume mounts available to the container instance. :paramtype volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] @@ -434,8 +498,6 @@ def __init__( :paramtype readiness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe :keyword security_context: The container security properties. :paramtype security_context: ~azure.mgmt.containerinstance.models.SecurityContextDefinition - :keyword config_map: The config map. - :paramtype config_map: ~azure.mgmt.containerinstance.models.ConfigMap """ super().__init__(**kwargs) self.name = name @@ -449,7 +511,6 @@ def __init__( self.liveness_probe = liveness_probe self.readiness_probe = readiness_probe self.security_context = security_context - self.config_map = config_map class ContainerAttachResponse(_serialization.Model): @@ -596,6 +657,9 @@ class ContainerGroupProperties(_serialization.Model): # pylint: disable=too-man :ivar provisioning_state: The provisioning state of the container group. This only appears in the response. :vartype provisioning_state: str + :ivar secret_references: The secret references that will be referenced within the container + group. + :vartype secret_references: list[~azure.mgmt.containerinstance.models.SecretReference] :ivar containers: The containers within the container group. Required. :vartype containers: list[~azure.mgmt.containerinstance.models.Container] :ivar image_registry_credentials: The image registry credentials by which the container group @@ -613,7 +677,7 @@ class ContainerGroupProperties(_serialization.Model): # pylint: disable=too-man :ivar ip_address: The IP address type of the container group. :vartype ip_address: ~azure.mgmt.containerinstance.models.IpAddress :ivar os_type: The operating system type required by the containers in the container group. - Known values are: "Windows" and "Linux". + Required. Known values are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes :ivar volumes: The list of volumes that can be mounted by containers in this container group. :vartype volumes: list[~azure.mgmt.containerinstance.models.Volume] @@ -626,8 +690,8 @@ class ContainerGroupProperties(_serialization.Model): # pylint: disable=too-man :vartype subnet_ids: list[~azure.mgmt.containerinstance.models.ContainerGroupSubnetId] :ivar dns_config: The DNS config information for a container group. :vartype dns_config: ~azure.mgmt.containerinstance.models.DnsConfiguration - :ivar sku: The SKU for a container group. Known values are: "Standard", "Dedicated", and - "Confidential". + :ivar sku: The SKU for a container group. Known values are: "NotSpecified", "Standard", + "Dedicated", and "Confidential". :vartype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku :ivar encryption_properties: The encryption properties for a container group. :vartype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties @@ -640,27 +704,19 @@ class ContainerGroupProperties(_serialization.Model): # pylint: disable=too-man ~azure.mgmt.containerinstance.models.ConfidentialComputeProperties :ivar priority: The priority of the container group. Known values are: "Regular" and "Spot". :vartype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority - :ivar container_group_profile: The reference container group profile properties. - :vartype container_group_profile: - ~azure.mgmt.containerinstance.models.ContainerGroupProfileReferenceDefinition - :ivar standby_pool_profile: The reference standby pool profile properties. - :vartype standby_pool_profile: - ~azure.mgmt.containerinstance.models.StandbyPoolProfileDefinition - :ivar is_created_from_standby_pool: The flag indicating whether the container group is created - by standby pool. - :vartype is_created_from_standby_pool: bool """ _validation = { "provisioning_state": {"readonly": True}, "containers": {"required": True}, + "os_type": {"required": True}, "instance_view": {"readonly": True}, - "is_created_from_standby_pool": {"readonly": True}, } _attribute_map = { "identity": {"key": "identity", "type": "ContainerGroupIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "secret_references": {"key": "properties.secretReferences", "type": "[SecretReference]"}, "containers": {"key": "properties.containers", "type": "[Container]"}, "image_registry_credentials": { "key": "properties.imageRegistryCredentials", @@ -683,23 +739,18 @@ class ContainerGroupProperties(_serialization.Model): # pylint: disable=too-man "type": "ConfidentialComputeProperties", }, "priority": {"key": "properties.priority", "type": "str"}, - "container_group_profile": { - "key": "properties.containerGroupProfile", - "type": "ContainerGroupProfileReferenceDefinition", - }, - "standby_pool_profile": {"key": "properties.standbyPoolProfile", "type": "StandbyPoolProfileDefinition"}, - "is_created_from_standby_pool": {"key": "properties.isCreatedFromStandbyPool", "type": "bool"}, } def __init__( self, *, containers: List["_models.Container"], + os_type: Union[str, "_models.OperatingSystemTypes"], identity: Optional["_models.ContainerGroupIdentity"] = None, + secret_references: Optional[List["_models.SecretReference"]] = None, image_registry_credentials: Optional[List["_models.ImageRegistryCredential"]] = None, restart_policy: Optional[Union[str, "_models.ContainerGroupRestartPolicy"]] = None, ip_address: Optional["_models.IpAddress"] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, volumes: Optional[List["_models.Volume"]] = None, diagnostics: Optional["_models.ContainerGroupDiagnostics"] = None, subnet_ids: Optional[List["_models.ContainerGroupSubnetId"]] = None, @@ -710,13 +761,14 @@ def __init__( extensions: Optional[List["_models.DeploymentExtensionSpec"]] = None, confidential_compute_properties: Optional["_models.ConfidentialComputeProperties"] = None, priority: Optional[Union[str, "_models.ContainerGroupPriority"]] = None, - container_group_profile: Optional["_models.ContainerGroupProfileReferenceDefinition"] = None, - standby_pool_profile: Optional["_models.StandbyPoolProfileDefinition"] = None, **kwargs: Any ) -> None: """ :keyword identity: The identity of the container group, if configured. :paramtype identity: ~azure.mgmt.containerinstance.models.ContainerGroupIdentity + :keyword secret_references: The secret references that will be referenced within the container + group. + :paramtype secret_references: list[~azure.mgmt.containerinstance.models.SecretReference] :keyword containers: The containers within the container group. Required. :paramtype containers: list[~azure.mgmt.containerinstance.models.Container] :keyword image_registry_credentials: The image registry credentials by which the container @@ -734,7 +786,7 @@ def __init__( :keyword ip_address: The IP address type of the container group. :paramtype ip_address: ~azure.mgmt.containerinstance.models.IpAddress :keyword os_type: The operating system type required by the containers in the container group. - Known values are: "Windows" and "Linux". + Required. Known values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes :keyword volumes: The list of volumes that can be mounted by containers in this container group. @@ -745,8 +797,8 @@ def __init__( :paramtype subnet_ids: list[~azure.mgmt.containerinstance.models.ContainerGroupSubnetId] :keyword dns_config: The DNS config information for a container group. :paramtype dns_config: ~azure.mgmt.containerinstance.models.DnsConfiguration - :keyword sku: The SKU for a container group. Known values are: "Standard", "Dedicated", and - "Confidential". + :keyword sku: The SKU for a container group. Known values are: "NotSpecified", "Standard", + "Dedicated", and "Confidential". :paramtype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku :keyword encryption_properties: The encryption properties for a container group. :paramtype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties @@ -759,16 +811,11 @@ def __init__( ~azure.mgmt.containerinstance.models.ConfidentialComputeProperties :keyword priority: The priority of the container group. Known values are: "Regular" and "Spot". :paramtype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority - :keyword container_group_profile: The reference container group profile properties. - :paramtype container_group_profile: - ~azure.mgmt.containerinstance.models.ContainerGroupProfileReferenceDefinition - :keyword standby_pool_profile: The reference standby pool profile properties. - :paramtype standby_pool_profile: - ~azure.mgmt.containerinstance.models.StandbyPoolProfileDefinition """ super().__init__(**kwargs) self.identity = identity self.provisioning_state = None + self.secret_references = secret_references self.containers = containers self.image_registry_credentials = image_registry_credentials self.restart_policy = restart_policy @@ -785,9 +832,6 @@ def __init__( self.extensions = extensions self.confidential_compute_properties = confidential_compute_properties self.priority = priority - self.container_group_profile = container_group_profile - self.standby_pool_profile = standby_pool_profile - self.is_created_from_standby_pool = None class Resource(_serialization.Model): @@ -861,6 +905,9 @@ class ContainerGroup(Resource, ContainerGroupProperties): # pylint: disable=too :ivar provisioning_state: The provisioning state of the container group. This only appears in the response. :vartype provisioning_state: str + :ivar secret_references: The secret references that will be referenced within the container + group. + :vartype secret_references: list[~azure.mgmt.containerinstance.models.SecretReference] :ivar containers: The containers within the container group. Required. :vartype containers: list[~azure.mgmt.containerinstance.models.Container] :ivar image_registry_credentials: The image registry credentials by which the container group @@ -878,7 +925,7 @@ class ContainerGroup(Resource, ContainerGroupProperties): # pylint: disable=too :ivar ip_address: The IP address type of the container group. :vartype ip_address: ~azure.mgmt.containerinstance.models.IpAddress :ivar os_type: The operating system type required by the containers in the container group. - Known values are: "Windows" and "Linux". + Required. Known values are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes :ivar volumes: The list of volumes that can be mounted by containers in this container group. :vartype volumes: list[~azure.mgmt.containerinstance.models.Volume] @@ -891,8 +938,8 @@ class ContainerGroup(Resource, ContainerGroupProperties): # pylint: disable=too :vartype subnet_ids: list[~azure.mgmt.containerinstance.models.ContainerGroupSubnetId] :ivar dns_config: The DNS config information for a container group. :vartype dns_config: ~azure.mgmt.containerinstance.models.DnsConfiguration - :ivar sku: The SKU for a container group. Known values are: "Standard", "Dedicated", and - "Confidential". + :ivar sku: The SKU for a container group. Known values are: "NotSpecified", "Standard", + "Dedicated", and "Confidential". :vartype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku :ivar encryption_properties: The encryption properties for a container group. :vartype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties @@ -905,15 +952,6 @@ class ContainerGroup(Resource, ContainerGroupProperties): # pylint: disable=too ~azure.mgmt.containerinstance.models.ConfidentialComputeProperties :ivar priority: The priority of the container group. Known values are: "Regular" and "Spot". :vartype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority - :ivar container_group_profile: The reference container group profile properties. - :vartype container_group_profile: - ~azure.mgmt.containerinstance.models.ContainerGroupProfileReferenceDefinition - :ivar standby_pool_profile: The reference standby pool profile properties. - :vartype standby_pool_profile: - ~azure.mgmt.containerinstance.models.StandbyPoolProfileDefinition - :ivar is_created_from_standby_pool: The flag indicating whether the container group is created - by standby pool. - :vartype is_created_from_standby_pool: bool :ivar id: The resource id. :vartype id: str :ivar name: The resource name. @@ -931,8 +969,8 @@ class ContainerGroup(Resource, ContainerGroupProperties): # pylint: disable=too _validation = { "provisioning_state": {"readonly": True}, "containers": {"required": True}, + "os_type": {"required": True}, "instance_view": {"readonly": True}, - "is_created_from_standby_pool": {"readonly": True}, "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, @@ -941,6 +979,7 @@ class ContainerGroup(Resource, ContainerGroupProperties): # pylint: disable=too _attribute_map = { "identity": {"key": "identity", "type": "ContainerGroupIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "secret_references": {"key": "properties.secretReferences", "type": "[SecretReference]"}, "containers": {"key": "properties.containers", "type": "[Container]"}, "image_registry_credentials": { "key": "properties.imageRegistryCredentials", @@ -963,12 +1002,6 @@ class ContainerGroup(Resource, ContainerGroupProperties): # pylint: disable=too "type": "ConfidentialComputeProperties", }, "priority": {"key": "properties.priority", "type": "str"}, - "container_group_profile": { - "key": "properties.containerGroupProfile", - "type": "ContainerGroupProfileReferenceDefinition", - }, - "standby_pool_profile": {"key": "properties.standbyPoolProfile", "type": "StandbyPoolProfileDefinition"}, - "is_created_from_standby_pool": {"key": "properties.isCreatedFromStandbyPool", "type": "bool"}, "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, @@ -981,11 +1014,12 @@ def __init__( # pylint: disable=too-many-locals self, *, containers: List["_models.Container"], + os_type: Union[str, "_models.OperatingSystemTypes"], identity: Optional["_models.ContainerGroupIdentity"] = None, + secret_references: Optional[List["_models.SecretReference"]] = None, image_registry_credentials: Optional[List["_models.ImageRegistryCredential"]] = None, restart_policy: Optional[Union[str, "_models.ContainerGroupRestartPolicy"]] = None, ip_address: Optional["_models.IpAddress"] = None, - os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, volumes: Optional[List["_models.Volume"]] = None, diagnostics: Optional["_models.ContainerGroupDiagnostics"] = None, subnet_ids: Optional[List["_models.ContainerGroupSubnetId"]] = None, @@ -996,8 +1030,6 @@ def __init__( # pylint: disable=too-many-locals extensions: Optional[List["_models.DeploymentExtensionSpec"]] = None, confidential_compute_properties: Optional["_models.ConfidentialComputeProperties"] = None, priority: Optional[Union[str, "_models.ContainerGroupPriority"]] = None, - container_group_profile: Optional["_models.ContainerGroupProfileReferenceDefinition"] = None, - standby_pool_profile: Optional["_models.StandbyPoolProfileDefinition"] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, zones: Optional[List[str]] = None, @@ -1006,6 +1038,9 @@ def __init__( # pylint: disable=too-many-locals """ :keyword identity: The identity of the container group, if configured. :paramtype identity: ~azure.mgmt.containerinstance.models.ContainerGroupIdentity + :keyword secret_references: The secret references that will be referenced within the container + group. + :paramtype secret_references: list[~azure.mgmt.containerinstance.models.SecretReference] :keyword containers: The containers within the container group. Required. :paramtype containers: list[~azure.mgmt.containerinstance.models.Container] :keyword image_registry_credentials: The image registry credentials by which the container @@ -1023,7 +1058,7 @@ def __init__( # pylint: disable=too-many-locals :keyword ip_address: The IP address type of the container group. :paramtype ip_address: ~azure.mgmt.containerinstance.models.IpAddress :keyword os_type: The operating system type required by the containers in the container group. - Known values are: "Windows" and "Linux". + Required. Known values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes :keyword volumes: The list of volumes that can be mounted by containers in this container group. @@ -1034,8 +1069,8 @@ def __init__( # pylint: disable=too-many-locals :paramtype subnet_ids: list[~azure.mgmt.containerinstance.models.ContainerGroupSubnetId] :keyword dns_config: The DNS config information for a container group. :paramtype dns_config: ~azure.mgmt.containerinstance.models.DnsConfiguration - :keyword sku: The SKU for a container group. Known values are: "Standard", "Dedicated", and - "Confidential". + :keyword sku: The SKU for a container group. Known values are: "NotSpecified", "Standard", + "Dedicated", and "Confidential". :paramtype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku :keyword encryption_properties: The encryption properties for a container group. :paramtype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties @@ -1048,12 +1083,6 @@ def __init__( # pylint: disable=too-many-locals ~azure.mgmt.containerinstance.models.ConfidentialComputeProperties :keyword priority: The priority of the container group. Known values are: "Regular" and "Spot". :paramtype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority - :keyword container_group_profile: The reference container group profile properties. - :paramtype container_group_profile: - ~azure.mgmt.containerinstance.models.ContainerGroupProfileReferenceDefinition - :keyword standby_pool_profile: The reference standby pool profile properties. - :paramtype standby_pool_profile: - ~azure.mgmt.containerinstance.models.StandbyPoolProfileDefinition :keyword location: The resource location. :paramtype location: str :keyword tags: The resource tags. @@ -1066,6 +1095,7 @@ def __init__( # pylint: disable=too-many-locals tags=tags, zones=zones, identity=identity, + secret_references=secret_references, containers=containers, image_registry_credentials=image_registry_credentials, restart_policy=restart_policy, @@ -1081,12 +1111,11 @@ def __init__( # pylint: disable=too-many-locals extensions=extensions, confidential_compute_properties=confidential_compute_properties, priority=priority, - container_group_profile=container_group_profile, - standby_pool_profile=standby_pool_profile, **kwargs ) self.identity = identity self.provisioning_state = None + self.secret_references = secret_references self.containers = containers self.image_registry_credentials = image_registry_credentials self.restart_policy = restart_policy @@ -1103,9 +1132,6 @@ def __init__( # pylint: disable=too-many-locals self.extensions = extensions self.confidential_compute_properties = confidential_compute_properties self.priority = priority - self.container_group_profile = container_group_profile - self.standby_pool_profile = standby_pool_profile - self.is_created_from_standby_pool = None self.id = None self.name = None self.type = None @@ -1221,15 +1247,36 @@ def __init__( self.next_link = next_link -class ContainerGroupProfileProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The container group profile properties. +class ContainerGroupProfile(Resource): # pylint: disable=too-many-instance-attributes + """container group profile object. 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 containers: The containers within the container group. Required. + :ivar id: The resource id. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar location: The resource location. + :vartype location: str + :ivar tags: The resource tags. + :vartype tags: dict[str, str] + :ivar zones: The zones for the container group. + :vartype zones: list[str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerinstance.models.SystemData + :ivar sku: The SKU for a container group. Known values are: "NotSpecified", "Standard", + "Dedicated", and "Confidential". + :vartype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku + :ivar encryption_properties: The encryption properties for a container group. + :vartype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties + :ivar containers: The containers within the container group. :vartype containers: list[~azure.mgmt.containerinstance.models.Container] + :ivar init_containers: The init containers for a container group. + :vartype init_containers: list[~azure.mgmt.containerinstance.models.InitContainerDefinition] + :ivar extensions: extensions used by virtual kubelet. + :vartype extensions: list[~azure.mgmt.containerinstance.models.DeploymentExtensionSpec] :ivar image_registry_credentials: The image registry credentials by which the container group is created from. :vartype image_registry_credentials: @@ -1242,84 +1289,122 @@ class ContainerGroupProfileProperties(_serialization.Model): # pylint: disable= * ``Never`` Never restart. Known values are: "Always", "OnFailure", and "Never". :vartype restart_policy: str or ~azure.mgmt.containerinstance.models.ContainerGroupRestartPolicy + :ivar shutdown_grace_period: Shutdown grace period for containers in a container group. + :vartype shutdown_grace_period: ~datetime.datetime :ivar ip_address: The IP address type of the container group. :vartype ip_address: ~azure.mgmt.containerinstance.models.IpAddress + :ivar time_to_live: Post completion time to live for containers of a CG. + :vartype time_to_live: ~datetime.datetime :ivar os_type: The operating system type required by the containers in the container group. - Required. Known values are: "Windows" and "Linux". + Known values are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes :ivar volumes: The list of volumes that can be mounted by containers in this container group. :vartype volumes: list[~azure.mgmt.containerinstance.models.Volume] :ivar diagnostics: The diagnostic information for a container group. :vartype diagnostics: ~azure.mgmt.containerinstance.models.ContainerGroupDiagnostics - :ivar sku: The SKU for a container group. Known values are: "Standard", "Dedicated", and - "Confidential". - :vartype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku - :ivar encryption_properties: The encryption properties for a container group. - :vartype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties - :ivar init_containers: The init containers for a container group. - :vartype init_containers: list[~azure.mgmt.containerinstance.models.InitContainerDefinition] - :ivar extensions: extensions used by virtual kubelet. - :vartype extensions: list[~azure.mgmt.containerinstance.models.DeploymentExtensionSpec] + :ivar priority: The priority of the container group. Known values are: "Regular" and "Spot". + :vartype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority :ivar confidential_compute_properties: The properties for confidential container group. :vartype confidential_compute_properties: ~azure.mgmt.containerinstance.models.ConfidentialComputeProperties - :ivar priority: The priority of the container group. Known values are: "Regular" and "Spot". - :vartype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority - :ivar revision: The container group profile current revision number. This only appears in the - response. + :ivar security_context: The container security properties. + :vartype security_context: ~azure.mgmt.containerinstance.models.SecurityContextDefinition + :ivar revision: Container group profile current revision number. :vartype revision: int + :ivar registered_revisions: Registered revisions are calculated at request time based off the + records in the table logs. + :vartype registered_revisions: list[int] + :ivar use_krypton: Gets or sets Krypton use property. + :vartype use_krypton: bool """ _validation = { - "containers": {"required": True}, - "os_type": {"required": True}, - "revision": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "zones": {"key": "zones", "type": "[str]"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "sku": {"key": "properties.sku", "type": "str"}, + "encryption_properties": {"key": "properties.encryptionProperties", "type": "EncryptionProperties"}, "containers": {"key": "properties.containers", "type": "[Container]"}, + "init_containers": {"key": "properties.initContainers", "type": "[InitContainerDefinition]"}, + "extensions": {"key": "properties.extensions", "type": "[DeploymentExtensionSpec]"}, "image_registry_credentials": { "key": "properties.imageRegistryCredentials", "type": "[ImageRegistryCredential]", }, "restart_policy": {"key": "properties.restartPolicy", "type": "str"}, + "shutdown_grace_period": {"key": "properties.shutdownGracePeriod", "type": "iso-8601"}, "ip_address": {"key": "properties.ipAddress", "type": "IpAddress"}, + "time_to_live": {"key": "properties.timeToLive", "type": "iso-8601"}, "os_type": {"key": "properties.osType", "type": "str"}, "volumes": {"key": "properties.volumes", "type": "[Volume]"}, "diagnostics": {"key": "properties.diagnostics", "type": "ContainerGroupDiagnostics"}, - "sku": {"key": "properties.sku", "type": "str"}, - "encryption_properties": {"key": "properties.encryptionProperties", "type": "EncryptionProperties"}, - "init_containers": {"key": "properties.initContainers", "type": "[InitContainerDefinition]"}, - "extensions": {"key": "properties.extensions", "type": "[DeploymentExtensionSpec]"}, + "priority": {"key": "properties.priority", "type": "str"}, "confidential_compute_properties": { "key": "properties.confidentialComputeProperties", "type": "ConfidentialComputeProperties", }, - "priority": {"key": "properties.priority", "type": "str"}, + "security_context": {"key": "properties.securityContext", "type": "SecurityContextDefinition"}, "revision": {"key": "properties.revision", "type": "int"}, + "registered_revisions": {"key": "properties.registeredRevisions", "type": "[int]"}, + "use_krypton": {"key": "properties.useKrypton", "type": "bool"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - containers: List["_models.Container"], - os_type: Union[str, "_models.OperatingSystemTypes"], + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + sku: Optional[Union[str, "_models.ContainerGroupSku"]] = None, + encryption_properties: Optional["_models.EncryptionProperties"] = None, + containers: Optional[List["_models.Container"]] = None, + init_containers: Optional[List["_models.InitContainerDefinition"]] = None, + extensions: Optional[List["_models.DeploymentExtensionSpec"]] = None, image_registry_credentials: Optional[List["_models.ImageRegistryCredential"]] = None, restart_policy: Optional[Union[str, "_models.ContainerGroupRestartPolicy"]] = None, + shutdown_grace_period: Optional[datetime.datetime] = None, ip_address: Optional["_models.IpAddress"] = None, + time_to_live: Optional[datetime.datetime] = None, + os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, volumes: Optional[List["_models.Volume"]] = None, diagnostics: Optional["_models.ContainerGroupDiagnostics"] = None, - sku: Optional[Union[str, "_models.ContainerGroupSku"]] = None, - encryption_properties: Optional["_models.EncryptionProperties"] = None, - init_containers: Optional[List["_models.InitContainerDefinition"]] = None, - extensions: Optional[List["_models.DeploymentExtensionSpec"]] = None, - confidential_compute_properties: Optional["_models.ConfidentialComputeProperties"] = None, priority: Optional[Union[str, "_models.ContainerGroupPriority"]] = None, + confidential_compute_properties: Optional["_models.ConfidentialComputeProperties"] = None, + security_context: Optional["_models.SecurityContextDefinition"] = None, + revision: Optional[int] = None, + registered_revisions: Optional[List[int]] = None, + use_krypton: Optional[bool] = None, **kwargs: Any ) -> None: """ - :keyword containers: The containers within the container group. Required. + :keyword location: The resource location. + :paramtype location: str + :keyword tags: The resource tags. + :paramtype tags: dict[str, str] + :keyword zones: The zones for the container group. + :paramtype zones: list[str] + :keyword sku: The SKU for a container group. Known values are: "NotSpecified", "Standard", + "Dedicated", and "Confidential". + :paramtype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku + :keyword encryption_properties: The encryption properties for a container group. + :paramtype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties + :keyword containers: The containers within the container group. :paramtype containers: list[~azure.mgmt.containerinstance.models.Container] + :keyword init_containers: The init containers for a container group. + :paramtype init_containers: list[~azure.mgmt.containerinstance.models.InitContainerDefinition] + :keyword extensions: extensions used by virtual kubelet. + :paramtype extensions: list[~azure.mgmt.containerinstance.models.DeploymentExtensionSpec] :keyword image_registry_credentials: The image registry credentials by which the container group is created from. :paramtype image_registry_credentials: @@ -1332,285 +1417,88 @@ def __init__( * ``Never`` Never restart. Known values are: "Always", "OnFailure", and "Never". :paramtype restart_policy: str or ~azure.mgmt.containerinstance.models.ContainerGroupRestartPolicy + :keyword shutdown_grace_period: Shutdown grace period for containers in a container group. + :paramtype shutdown_grace_period: ~datetime.datetime :keyword ip_address: The IP address type of the container group. :paramtype ip_address: ~azure.mgmt.containerinstance.models.IpAddress + :keyword time_to_live: Post completion time to live for containers of a CG. + :paramtype time_to_live: ~datetime.datetime :keyword os_type: The operating system type required by the containers in the container group. - Required. Known values are: "Windows" and "Linux". + Known values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes :keyword volumes: The list of volumes that can be mounted by containers in this container group. :paramtype volumes: list[~azure.mgmt.containerinstance.models.Volume] :keyword diagnostics: The diagnostic information for a container group. :paramtype diagnostics: ~azure.mgmt.containerinstance.models.ContainerGroupDiagnostics - :keyword sku: The SKU for a container group. Known values are: "Standard", "Dedicated", and - "Confidential". - :paramtype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku - :keyword encryption_properties: The encryption properties for a container group. - :paramtype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties - :keyword init_containers: The init containers for a container group. - :paramtype init_containers: list[~azure.mgmt.containerinstance.models.InitContainerDefinition] - :keyword extensions: extensions used by virtual kubelet. - :paramtype extensions: list[~azure.mgmt.containerinstance.models.DeploymentExtensionSpec] + :keyword priority: The priority of the container group. Known values are: "Regular" and "Spot". + :paramtype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority :keyword confidential_compute_properties: The properties for confidential container group. :paramtype confidential_compute_properties: ~azure.mgmt.containerinstance.models.ConfidentialComputeProperties - :keyword priority: The priority of the container group. Known values are: "Regular" and "Spot". - :paramtype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority + :keyword security_context: The container security properties. + :paramtype security_context: ~azure.mgmt.containerinstance.models.SecurityContextDefinition + :keyword revision: Container group profile current revision number. + :paramtype revision: int + :keyword registered_revisions: Registered revisions are calculated at request time based off + the records in the table logs. + :paramtype registered_revisions: list[int] + :keyword use_krypton: Gets or sets Krypton use property. + :paramtype use_krypton: bool """ - super().__init__(**kwargs) + super().__init__(location=location, tags=tags, zones=zones, **kwargs) + self.system_data = None + self.sku = sku + self.encryption_properties = encryption_properties self.containers = containers + self.init_containers = init_containers + self.extensions = extensions self.image_registry_credentials = image_registry_credentials self.restart_policy = restart_policy + self.shutdown_grace_period = shutdown_grace_period self.ip_address = ip_address + self.time_to_live = time_to_live self.os_type = os_type self.volumes = volumes self.diagnostics = diagnostics - self.sku = sku - self.encryption_properties = encryption_properties - self.init_containers = init_containers - self.extensions = extensions - self.confidential_compute_properties = confidential_compute_properties self.priority = priority - self.revision = None + self.confidential_compute_properties = confidential_compute_properties + self.security_context = security_context + self.revision = revision + self.registered_revisions = registered_revisions + self.use_krypton = use_krypton -class ContainerGroupProfile(Resource, ContainerGroupProfileProperties): # pylint: disable=too-many-instance-attributes - """A container group profile. +class ContainerGroupProfileListResult(_serialization.Model): + """The container group profile list response. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar value: The list of ContainerGroupProfiles under a subscription or resource group. + :vartype value: list[~azure.mgmt.containerinstance.models.ContainerGroupProfile] + :ivar next_link: The URI to fetch the next page of Container Group Profiles. + :vartype next_link: str + """ - All required parameters must be populated in order to send to server. + _attribute_map = { + "value": {"key": "value", "type": "[ContainerGroupProfile]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } - :ivar containers: The containers within the container group. Required. - :vartype containers: list[~azure.mgmt.containerinstance.models.Container] - :ivar image_registry_credentials: The image registry credentials by which the container group - is created from. - :vartype image_registry_credentials: - list[~azure.mgmt.containerinstance.models.ImageRegistryCredential] - :ivar restart_policy: Restart policy for all containers within the container group. - - - * ``Always`` Always restart - * ``OnFailure`` Restart on failure - * ``Never`` Never restart. Known values are: "Always", "OnFailure", and "Never". - :vartype restart_policy: str or - ~azure.mgmt.containerinstance.models.ContainerGroupRestartPolicy - :ivar ip_address: The IP address type of the container group. - :vartype ip_address: ~azure.mgmt.containerinstance.models.IpAddress - :ivar os_type: The operating system type required by the containers in the container group. - Required. Known values are: "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes - :ivar volumes: The list of volumes that can be mounted by containers in this container group. - :vartype volumes: list[~azure.mgmt.containerinstance.models.Volume] - :ivar diagnostics: The diagnostic information for a container group. - :vartype diagnostics: ~azure.mgmt.containerinstance.models.ContainerGroupDiagnostics - :ivar sku: The SKU for a container group. Known values are: "Standard", "Dedicated", and - "Confidential". - :vartype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku - :ivar encryption_properties: The encryption properties for a container group. - :vartype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties - :ivar init_containers: The init containers for a container group. - :vartype init_containers: list[~azure.mgmt.containerinstance.models.InitContainerDefinition] - :ivar extensions: extensions used by virtual kubelet. - :vartype extensions: list[~azure.mgmt.containerinstance.models.DeploymentExtensionSpec] - :ivar confidential_compute_properties: The properties for confidential container group. - :vartype confidential_compute_properties: - ~azure.mgmt.containerinstance.models.ConfidentialComputeProperties - :ivar priority: The priority of the container group. Known values are: "Regular" and "Spot". - :vartype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority - :ivar revision: The container group profile current revision number. This only appears in the - response. - :vartype revision: int - :ivar id: The resource id. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar location: The resource location. - :vartype location: str - :ivar tags: The resource tags. - :vartype tags: dict[str, str] - :ivar zones: The zones for the container group. - :vartype zones: list[str] - """ - - _validation = { - "containers": {"required": True}, - "os_type": {"required": True}, - "revision": {"readonly": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "containers": {"key": "properties.containers", "type": "[Container]"}, - "image_registry_credentials": { - "key": "properties.imageRegistryCredentials", - "type": "[ImageRegistryCredential]", - }, - "restart_policy": {"key": "properties.restartPolicy", "type": "str"}, - "ip_address": {"key": "properties.ipAddress", "type": "IpAddress"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "volumes": {"key": "properties.volumes", "type": "[Volume]"}, - "diagnostics": {"key": "properties.diagnostics", "type": "ContainerGroupDiagnostics"}, - "sku": {"key": "properties.sku", "type": "str"}, - "encryption_properties": {"key": "properties.encryptionProperties", "type": "EncryptionProperties"}, - "init_containers": {"key": "properties.initContainers", "type": "[InitContainerDefinition]"}, - "extensions": {"key": "properties.extensions", "type": "[DeploymentExtensionSpec]"}, - "confidential_compute_properties": { - "key": "properties.confidentialComputeProperties", - "type": "ConfidentialComputeProperties", - }, - "priority": {"key": "properties.priority", "type": "str"}, - "revision": {"key": "properties.revision", "type": "int"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "zones": {"key": "zones", "type": "[str]"}, - } - - def __init__( - self, - *, - containers: List["_models.Container"], - os_type: Union[str, "_models.OperatingSystemTypes"], - image_registry_credentials: Optional[List["_models.ImageRegistryCredential"]] = None, - restart_policy: Optional[Union[str, "_models.ContainerGroupRestartPolicy"]] = None, - ip_address: Optional["_models.IpAddress"] = None, - volumes: Optional[List["_models.Volume"]] = None, - diagnostics: Optional["_models.ContainerGroupDiagnostics"] = None, - sku: Optional[Union[str, "_models.ContainerGroupSku"]] = None, - encryption_properties: Optional["_models.EncryptionProperties"] = None, - init_containers: Optional[List["_models.InitContainerDefinition"]] = None, - extensions: Optional[List["_models.DeploymentExtensionSpec"]] = None, - confidential_compute_properties: Optional["_models.ConfidentialComputeProperties"] = None, - priority: Optional[Union[str, "_models.ContainerGroupPriority"]] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - zones: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword containers: The containers within the container group. Required. - :paramtype containers: list[~azure.mgmt.containerinstance.models.Container] - :keyword image_registry_credentials: The image registry credentials by which the container - group is created from. - :paramtype image_registry_credentials: - list[~azure.mgmt.containerinstance.models.ImageRegistryCredential] - :keyword restart_policy: Restart policy for all containers within the container group. - - - * ``Always`` Always restart - * ``OnFailure`` Restart on failure - * ``Never`` Never restart. Known values are: "Always", "OnFailure", and "Never". - :paramtype restart_policy: str or - ~azure.mgmt.containerinstance.models.ContainerGroupRestartPolicy - :keyword ip_address: The IP address type of the container group. - :paramtype ip_address: ~azure.mgmt.containerinstance.models.IpAddress - :keyword os_type: The operating system type required by the containers in the container group. - Required. Known values are: "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes - :keyword volumes: The list of volumes that can be mounted by containers in this container - group. - :paramtype volumes: list[~azure.mgmt.containerinstance.models.Volume] - :keyword diagnostics: The diagnostic information for a container group. - :paramtype diagnostics: ~azure.mgmt.containerinstance.models.ContainerGroupDiagnostics - :keyword sku: The SKU for a container group. Known values are: "Standard", "Dedicated", and - "Confidential". - :paramtype sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku - :keyword encryption_properties: The encryption properties for a container group. - :paramtype encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties - :keyword init_containers: The init containers for a container group. - :paramtype init_containers: list[~azure.mgmt.containerinstance.models.InitContainerDefinition] - :keyword extensions: extensions used by virtual kubelet. - :paramtype extensions: list[~azure.mgmt.containerinstance.models.DeploymentExtensionSpec] - :keyword confidential_compute_properties: The properties for confidential container group. - :paramtype confidential_compute_properties: - ~azure.mgmt.containerinstance.models.ConfidentialComputeProperties - :keyword priority: The priority of the container group. Known values are: "Regular" and "Spot". - :paramtype priority: str or ~azure.mgmt.containerinstance.models.ContainerGroupPriority - :keyword location: The resource location. - :paramtype location: str - :keyword tags: The resource tags. - :paramtype tags: dict[str, str] - :keyword zones: The zones for the container group. - :paramtype zones: list[str] - """ - super().__init__( - location=location, - tags=tags, - zones=zones, - containers=containers, - image_registry_credentials=image_registry_credentials, - restart_policy=restart_policy, - ip_address=ip_address, - os_type=os_type, - volumes=volumes, - diagnostics=diagnostics, - sku=sku, - encryption_properties=encryption_properties, - init_containers=init_containers, - extensions=extensions, - confidential_compute_properties=confidential_compute_properties, - priority=priority, - **kwargs - ) - self.containers = containers - self.image_registry_credentials = image_registry_credentials - self.restart_policy = restart_policy - self.ip_address = ip_address - self.os_type = os_type - self.volumes = volumes - self.diagnostics = diagnostics - self.sku = sku - self.encryption_properties = encryption_properties - self.init_containers = init_containers - self.extensions = extensions - self.confidential_compute_properties = confidential_compute_properties - self.priority = priority - self.revision = None - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.zones = zones - - -class ContainerGroupProfileListResult(_serialization.Model): - """The container group profile list response that contains the container group profile properties. - - :ivar value: The list of container group profiles. - :vartype value: list[~azure.mgmt.containerinstance.models.ContainerGroupProfile] - :ivar next_link: The URI to fetch the next page of container group profiles. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ContainerGroupProfile]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ContainerGroupProfile"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of container group profiles. - :paramtype value: list[~azure.mgmt.containerinstance.models.ContainerGroupProfile] - :keyword next_link: The URI to fetch the next page of container group profiles. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link + def __init__( + self, + *, + value: Optional[List["_models.ContainerGroupProfile"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of ContainerGroupProfiles under a subscription or resource group. + :paramtype value: list[~azure.mgmt.containerinstance.models.ContainerGroupProfile] + :keyword next_link: The URI to fetch the next page of Container Group Profiles. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link class ContainerGroupProfilePatch(_serialization.Model): @@ -1633,39 +1521,66 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N self.tags = tags -class ContainerGroupProfileReferenceDefinition(_serialization.Model): - """The container group profile reference. +class ContainerGroupProfileStub(_serialization.Model): + """The object that contains a reference to a Container Group Profile and it's other related + properties. - :ivar id: The container group profile reference id.This will be an ARM resource id in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}'. # pylint: disable=line-too-long - :vartype id: str - :ivar revision: The container group profile reference revision. + :ivar resource: A reference to the container group profile ARM resource hosted in ACI RP. + :vartype resource: ~azure.mgmt.containerinstance.models.ApiEntityReference + :ivar revision: The revision of the CG profile is an optional property. If customer does not to + provide a revision then NGroups will pickup the latest revision of CGProfile. :vartype revision: int + :ivar network_profile: A network profile for network settings of a ContainerGroupProfile. + :vartype network_profile: ~azure.mgmt.containerinstance.models.NetworkProfile + :ivar storage_profile: Storage profile for storage related settings of a container group + profile. + :vartype storage_profile: ~azure.mgmt.containerinstance.models.StorageProfile + :ivar container_group_properties: Container Group properties which can be set while creating or + updating the NGroups. + :vartype container_group_properties: + ~azure.mgmt.containerinstance.models.NGroupContainerGroupProperties """ _attribute_map = { - "id": {"key": "id", "type": "str"}, + "resource": {"key": "resource", "type": "ApiEntityReference"}, "revision": {"key": "revision", "type": "int"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, + "storage_profile": {"key": "storageProfile", "type": "StorageProfile"}, + "container_group_properties": {"key": "containerGroupProperties", "type": "NGroupContainerGroupProperties"}, } def __init__( self, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin + resource: Optional["_models.ApiEntityReference"] = None, revision: Optional[int] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + storage_profile: Optional["_models.StorageProfile"] = None, + container_group_properties: Optional["_models.NGroupContainerGroupProperties"] = None, **kwargs: Any ) -> None: """ - :keyword id: The container group profile reference id.This will be an ARM resource id in the - form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}'. # pylint: disable=line-too-long - :paramtype id: str - :keyword revision: The container group profile reference revision. + :keyword resource: A reference to the container group profile ARM resource hosted in ACI RP. + :paramtype resource: ~azure.mgmt.containerinstance.models.ApiEntityReference + :keyword revision: The revision of the CG profile is an optional property. If customer does not + to provide a revision then NGroups will pickup the latest revision of CGProfile. :paramtype revision: int + :keyword network_profile: A network profile for network settings of a ContainerGroupProfile. + :paramtype network_profile: ~azure.mgmt.containerinstance.models.NetworkProfile + :keyword storage_profile: Storage profile for storage related settings of a container group + profile. + :paramtype storage_profile: ~azure.mgmt.containerinstance.models.StorageProfile + :keyword container_group_properties: Container Group properties which can be set while creating + or updating the NGroups. + :paramtype container_group_properties: + ~azure.mgmt.containerinstance.models.NGroupContainerGroupProperties """ super().__init__(**kwargs) - self.id = id + self.resource = resource self.revision = revision + self.network_profile = network_profile + self.storage_profile = storage_profile + self.container_group_properties = container_group_properties class ContainerGroupPropertiesInstanceView(_serialization.Model): @@ -2069,6 +1984,113 @@ def __init__( self.options = options +class ElasticProfile(_serialization.Model): + """Describes the elastic profile of the NGroup. + + :ivar desired_count: + :vartype desired_count: int + :ivar maintain_desired_count: Flag that indicates whether desiredCount should be maintained + when customer deletes SPECIFIC container groups (CGs) from the NGroups. In this case, new CGs + will be created by NGroup to compensate for the specific deleted ones. + :vartype maintain_desired_count: bool + :ivar container_group_naming_policy: Container Groups are named on a generic guid based naming + scheme/policy. Customer can modify naming policy to add prefix to CG names during scale out + operation. + :vartype container_group_naming_policy: + ~azure.mgmt.containerinstance.models.ElasticProfileContainerGroupNamingPolicy + """ + + _attribute_map = { + "desired_count": {"key": "desiredCount", "type": "int"}, + "maintain_desired_count": {"key": "maintainDesiredCount", "type": "bool"}, + "container_group_naming_policy": { + "key": "containerGroupNamingPolicy", + "type": "ElasticProfileContainerGroupNamingPolicy", + }, + } + + def __init__( + self, + *, + desired_count: Optional[int] = None, + maintain_desired_count: Optional[bool] = None, + container_group_naming_policy: Optional["_models.ElasticProfileContainerGroupNamingPolicy"] = None, + **kwargs: Any + ) -> None: + """ + :keyword desired_count: + :paramtype desired_count: int + :keyword maintain_desired_count: Flag that indicates whether desiredCount should be maintained + when customer deletes SPECIFIC container groups (CGs) from the NGroups. In this case, new CGs + will be created by NGroup to compensate for the specific deleted ones. + :paramtype maintain_desired_count: bool + :keyword container_group_naming_policy: Container Groups are named on a generic guid based + naming scheme/policy. Customer can modify naming policy to add prefix to CG names during scale + out operation. + :paramtype container_group_naming_policy: + ~azure.mgmt.containerinstance.models.ElasticProfileContainerGroupNamingPolicy + """ + super().__init__(**kwargs) + self.desired_count = desired_count + self.maintain_desired_count = maintain_desired_count + self.container_group_naming_policy = container_group_naming_policy + + +class ElasticProfileContainerGroupNamingPolicy(_serialization.Model): + """Container Groups are named on a generic guid based naming scheme/policy. Customer can modify + naming policy to add prefix to CG names during scale out operation. + + :ivar guid_naming_policy: + :vartype guid_naming_policy: + ~azure.mgmt.containerinstance.models.ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy + """ + + _attribute_map = { + "guid_naming_policy": { + "key": "guidNamingPolicy", + "type": "ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy", + }, + } + + def __init__( + self, + *, + guid_naming_policy: Optional["_models.ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy"] = None, + **kwargs: Any + ) -> None: + """ + :keyword guid_naming_policy: + :paramtype guid_naming_policy: + ~azure.mgmt.containerinstance.models.ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy + """ + super().__init__(**kwargs) + self.guid_naming_policy = guid_naming_policy + + +class ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy(_serialization.Model): # pylint: disable=name-too-long + """ElasticProfileContainerGroupNamingPolicyGuidNamingPolicy. + + :ivar prefix: The prefix can be used when there are tooling limitations (e.g. on the Azure + portal where CGs from multiple NGroups exist in the same RG). The prefix with the suffixed + resource name must still follow Azure resource naming guidelines. + :vartype prefix: str + """ + + _attribute_map = { + "prefix": {"key": "prefix", "type": "str"}, + } + + def __init__(self, *, prefix: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword prefix: The prefix can be used when there are tooling limitations (e.g. on the Azure + portal where CGs from multiple NGroups exist in the same RG). The prefix with the suffixed + resource name must still follow Azure resource naming guidelines. + :paramtype prefix: str + """ + super().__init__(**kwargs) + self.prefix = prefix + + class EncryptionProperties(_serialization.Model): """The container group encryption properties. @@ -2128,6 +2150,8 @@ class EnvironmentVariable(_serialization.Model): :vartype value: str :ivar secure_value: The value of the secure environment variable. :vartype secure_value: str + :ivar secure_value_reference: The reference of the secure environment variable. + :vartype secure_value_reference: str """ _validation = { @@ -2138,10 +2162,17 @@ class EnvironmentVariable(_serialization.Model): "name": {"key": "name", "type": "str"}, "value": {"key": "value", "type": "str"}, "secure_value": {"key": "secureValue", "type": "str"}, + "secure_value_reference": {"key": "secureValueReference", "type": "str"}, } def __init__( - self, *, name: str, value: Optional[str] = None, secure_value: Optional[str] = None, **kwargs: Any + self, + *, + name: str, + value: Optional[str] = None, + secure_value: Optional[str] = None, + secure_value_reference: Optional[str] = None, + **kwargs: Any ) -> None: """ :keyword name: The name of the environment variable. Required. @@ -2150,28 +2181,123 @@ def __init__( :paramtype value: str :keyword secure_value: The value of the secure environment variable. :paramtype secure_value: str + :keyword secure_value_reference: The reference of the secure environment variable. + :paramtype secure_value_reference: str """ super().__init__(**kwargs) self.name = name self.value = value self.secure_value = secure_value + self.secure_value_reference = secure_value_reference -class Event(_serialization.Model): - """A container group or container instance event. +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. - :ivar count: The count of the event. - :vartype count: int - :ivar first_timestamp: The date-time of the earliest logged event. - :vartype first_timestamp: ~datetime.datetime - :ivar last_timestamp: The date-time of the latest logged event. - :vartype last_timestamp: ~datetime.datetime - :ivar name: The event name. - :vartype name: str - :ivar message: The event message. - :vartype message: str + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.containerinstance.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.containerinstance.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.containerinstance.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.containerinstance.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class Event(_serialization.Model): + """A container group or container instance event. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar count: The count of the event. + :vartype count: int + :ivar first_timestamp: The date-time of the earliest logged event. + :vartype first_timestamp: ~datetime.datetime + :ivar last_timestamp: The date-time of the latest logged event. + :vartype last_timestamp: ~datetime.datetime + :ivar name: The event name. + :vartype name: str + :ivar message: The event message. + :vartype message: str :ivar type: The event type. :vartype type: str """ @@ -2205,6 +2331,96 @@ def __init__(self, **kwargs: Any) -> None: self.type = None +class FileShare(_serialization.Model): + """File shares that can be mounted on container groups. + + :ivar name: + :vartype name: str + :ivar resource_group_name: + :vartype resource_group_name: str + :ivar storage_account_name: + :vartype storage_account_name: str + :ivar properties: + :vartype properties: ~azure.mgmt.containerinstance.models.FileShareProperties + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "resource_group_name": {"key": "resourceGroupName", "type": "str"}, + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "properties": {"key": "properties", "type": "FileShareProperties"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + resource_group_name: Optional[str] = None, + storage_account_name: Optional[str] = None, + properties: Optional["_models.FileShareProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: + :paramtype name: str + :keyword resource_group_name: + :paramtype resource_group_name: str + :keyword storage_account_name: + :paramtype storage_account_name: str + :keyword properties: + :paramtype properties: ~azure.mgmt.containerinstance.models.FileShareProperties + """ + super().__init__(**kwargs) + self.name = name + self.resource_group_name = resource_group_name + self.storage_account_name = storage_account_name + self.properties = properties + + +class FileShareProperties(_serialization.Model): + """FileShareProperties. + + :ivar share_access_type: Specifies how Container Groups can access the Azure file share i.e. + all CG will share same Azure file share or going to have exclusive file share. Known values + are: "Shared" and "Exclusive". + :vartype share_access_type: str or + ~azure.mgmt.containerinstance.models.AzureFileShareAccessType + :ivar share_access_tier: learn more at: + https://learn.microsoft.com/en-us/rest/api/storagerp/file-shares/create?tabs=HTTP#shareaccesstier. + Known values are: "cool", "hot", "premium", and "transactionoptimized". + :vartype share_access_tier: str or + ~azure.mgmt.containerinstance.models.AzureFileShareAccessTier + """ + + _attribute_map = { + "share_access_type": {"key": "shareAccessType", "type": "str"}, + "share_access_tier": {"key": "shareAccessTier", "type": "str"}, + } + + def __init__( + self, + *, + share_access_type: Optional[Union[str, "_models.AzureFileShareAccessType"]] = None, + share_access_tier: Optional[Union[str, "_models.AzureFileShareAccessTier"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword share_access_type: Specifies how Container Groups can access the Azure file share i.e. + all CG will share same Azure file share or going to have exclusive file share. Known values + are: "Shared" and "Exclusive". + :paramtype share_access_type: str or + ~azure.mgmt.containerinstance.models.AzureFileShareAccessType + :keyword share_access_tier: learn more at: + https://learn.microsoft.com/en-us/rest/api/storagerp/file-shares/create?tabs=HTTP#shareaccesstier. + Known values are: "cool", "hot", "premium", and "transactionoptimized". + :paramtype share_access_tier: str or + ~azure.mgmt.containerinstance.models.AzureFileShareAccessTier + """ + super().__init__(**kwargs) + self.share_access_type = share_access_type + self.share_access_tier = share_access_tier + + class GitRepoVolume(_serialization.Model): """Represents a volume that is populated with the contents of a git repository. @@ -2321,6 +2537,8 @@ class ImageRegistryCredential(_serialization.Model): :vartype username: str :ivar password: The password for the private registry. :vartype password: str + :ivar password_reference: The reference for the private registry password. + :vartype password_reference: str :ivar identity: The identity for the private registry. :vartype identity: str :ivar identity_url: The identity URL for the private registry. @@ -2335,6 +2553,7 @@ class ImageRegistryCredential(_serialization.Model): "server": {"key": "server", "type": "str"}, "username": {"key": "username", "type": "str"}, "password": {"key": "password", "type": "str"}, + "password_reference": {"key": "passwordReference", "type": "str"}, "identity": {"key": "identity", "type": "str"}, "identity_url": {"key": "identityUrl", "type": "str"}, } @@ -2345,6 +2564,7 @@ def __init__( server: str, username: Optional[str] = None, password: Optional[str] = None, + password_reference: Optional[str] = None, identity: Optional[str] = None, identity_url: Optional[str] = None, **kwargs: Any @@ -2357,6 +2577,8 @@ def __init__( :paramtype username: str :keyword password: The password for the private registry. :paramtype password: str + :keyword password_reference: The reference for the private registry password. + :paramtype password_reference: str :keyword identity: The identity for the private registry. :paramtype identity: str :keyword identity_url: The identity URL for the private registry. @@ -2366,6 +2588,7 @@ def __init__( self.server = server self.username = username self.password = password + self.password_reference = password_reference self.identity = identity self.identity_url = identity_url @@ -2570,6 +2793,50 @@ def __init__( self.fqdn = None +class LoadBalancer(_serialization.Model): + """LoadBalancer the CG profile will use to interact with CGs in a backend pool. + + :ivar backend_address_pools: List of Load Balancer Backend Address Pools. + :vartype backend_address_pools: + list[~azure.mgmt.containerinstance.models.LoadBalancerBackendAddressPool] + """ + + _attribute_map = { + "backend_address_pools": {"key": "backendAddressPools", "type": "[LoadBalancerBackendAddressPool]"}, + } + + def __init__( + self, *, backend_address_pools: Optional[List["_models.LoadBalancerBackendAddressPool"]] = None, **kwargs: Any + ) -> None: + """ + :keyword backend_address_pools: List of Load Balancer Backend Address Pools. + :paramtype backend_address_pools: + list[~azure.mgmt.containerinstance.models.LoadBalancerBackendAddressPool] + """ + super().__init__(**kwargs) + self.backend_address_pools = backend_address_pools + + +class LoadBalancerBackendAddressPool(_serialization.Model): + """NGroups load balancer backend address pool. + + :ivar resource: The Load Balancer backend address pool ARM resource Id. + :vartype resource: str + """ + + _attribute_map = { + "resource": {"key": "resource", "type": "str"}, + } + + def __init__(self, *, resource: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource: The Load Balancer backend address pool ARM resource Id. + :paramtype resource: str + """ + super().__init__(**kwargs) + self.resource = resource + + class LogAnalytics(_serialization.Model): """Container group log analytics information. @@ -2652,6 +2919,441 @@ def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: self.content = content +class NetworkProfile(_serialization.Model): + """A network profile for network settings of a ContainerGroupProfile. Used to manage load balancer + and application gateway backend pools, specifically updating the IP addresses of CGs within the + backend pool. + + :ivar load_balancer: LoadBalancer the CG profile will use to interact with CGs in a backend + pool. + :vartype load_balancer: ~azure.mgmt.containerinstance.models.LoadBalancer + :ivar application_gateway: Application Gateway the CG profile will use to interact with CGs in + a backend pool. + :vartype application_gateway: ~azure.mgmt.containerinstance.models.ApplicationGateway + """ + + _attribute_map = { + "load_balancer": {"key": "loadBalancer", "type": "LoadBalancer"}, + "application_gateway": {"key": "applicationGateway", "type": "ApplicationGateway"}, + } + + def __init__( + self, + *, + load_balancer: Optional["_models.LoadBalancer"] = None, + application_gateway: Optional["_models.ApplicationGateway"] = None, + **kwargs: Any + ) -> None: + """ + :keyword load_balancer: LoadBalancer the CG profile will use to interact with CGs in a backend + pool. + :paramtype load_balancer: ~azure.mgmt.containerinstance.models.LoadBalancer + :keyword application_gateway: Application Gateway the CG profile will use to interact with CGs + in a backend pool. + :paramtype application_gateway: ~azure.mgmt.containerinstance.models.ApplicationGateway + """ + super().__init__(**kwargs) + self.load_balancer = load_balancer + self.application_gateway = application_gateway + + +class NGroup(Resource): # pylint: disable=too-many-instance-attributes + """Describes the NGroups resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource id. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar tags: The resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.containerinstance.models.SystemData + :ivar identity: The identity of the NGroup, if configured. + :vartype identity: ~azure.mgmt.containerinstance.models.NGroupIdentity + :ivar zones: The NGroups zones. NOTE: Availability zones can only be set when you create the + scale set. + :vartype zones: list[str] + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar elastic_profile: The elastic profile. + :vartype elastic_profile: ~azure.mgmt.containerinstance.models.ElasticProfile + :ivar placement_profile: Provides options w.r.t allocation and management w.r.t certain + placement policies. These utilize capabilities provided by the underlying Azure infrastructure. + They are typically used for high availability scenarios. E.g., distributing CGs across fault + domains. + :vartype placement_profile: ~azure.mgmt.containerinstance.models.PlacementProfile + :ivar container_group_profiles: The Container Group Profiles that could be used in the NGroups + resource. + :vartype container_group_profiles: + list[~azure.mgmt.containerinstance.models.ContainerGroupProfileStub] + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Failed", "Succeeded", "Canceled", "Deleting", and + "Migrating". + :vartype provisioning_state: str or + ~azure.mgmt.containerinstance.models.NGroupProvisioningState + :ivar update_profile: Used by the customer to specify the way to update the Container Groups in + NGroup. + :vartype update_profile: ~azure.mgmt.containerinstance.models.UpdateProfile + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "NGroupIdentity"}, + "zones": {"key": "zones", "type": "[str]"}, + "location": {"key": "location", "type": "str"}, + "elastic_profile": {"key": "properties.elasticProfile", "type": "ElasticProfile"}, + "placement_profile": {"key": "properties.placementProfile", "type": "PlacementProfile"}, + "container_group_profiles": {"key": "properties.containerGroupProfiles", "type": "[ContainerGroupProfileStub]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "update_profile": {"key": "properties.updateProfile", "type": "UpdateProfile"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.NGroupIdentity"] = None, + zones: Optional[List[str]] = None, + location: Optional[str] = None, + elastic_profile: Optional["_models.ElasticProfile"] = None, + placement_profile: Optional["_models.PlacementProfile"] = None, + container_group_profiles: Optional[List["_models.ContainerGroupProfileStub"]] = None, + update_profile: Optional["_models.UpdateProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: The resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the NGroup, if configured. + :paramtype identity: ~azure.mgmt.containerinstance.models.NGroupIdentity + :keyword zones: The NGroups zones. NOTE: Availability zones can only be set when you create the + scale set. + :paramtype zones: list[str] + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword elastic_profile: The elastic profile. + :paramtype elastic_profile: ~azure.mgmt.containerinstance.models.ElasticProfile + :keyword placement_profile: Provides options w.r.t allocation and management w.r.t certain + placement policies. These utilize capabilities provided by the underlying Azure infrastructure. + They are typically used for high availability scenarios. E.g., distributing CGs across fault + domains. + :paramtype placement_profile: ~azure.mgmt.containerinstance.models.PlacementProfile + :keyword container_group_profiles: The Container Group Profiles that could be used in the + NGroups resource. + :paramtype container_group_profiles: + list[~azure.mgmt.containerinstance.models.ContainerGroupProfileStub] + :keyword update_profile: Used by the customer to specify the way to update the Container Groups + in NGroup. + :paramtype update_profile: ~azure.mgmt.containerinstance.models.UpdateProfile + """ + super().__init__(tags=tags, **kwargs) + self.system_data = None + self.identity = identity + self.zones = zones + self.location = location + self.elastic_profile = elastic_profile + self.placement_profile = placement_profile + self.container_group_profiles = container_group_profiles + self.provisioning_state = None + self.update_profile = update_profile + + +class NGroupCGPropertyContainer(_serialization.Model): + """Container properties that can be provided with NGroups object. + + :ivar name: container name. + :vartype name: str + :ivar properties: container properties. + :vartype properties: ~azure.mgmt.containerinstance.models.NGroupCGPropertyContainerProperties + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "NGroupCGPropertyContainerProperties"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.NGroupCGPropertyContainerProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: container name. + :paramtype name: str + :keyword properties: container properties. + :paramtype properties: ~azure.mgmt.containerinstance.models.NGroupCGPropertyContainerProperties + """ + super().__init__(**kwargs) + self.name = name + self.properties = properties + + +class NGroupCGPropertyContainerProperties(_serialization.Model): + """container properties. + + :ivar volume_mounts: + :vartype volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] + """ + + _attribute_map = { + "volume_mounts": {"key": "volumeMounts", "type": "[VolumeMount]"}, + } + + def __init__(self, *, volume_mounts: Optional[List["_models.VolumeMount"]] = None, **kwargs: Any) -> None: + """ + :keyword volume_mounts: + :paramtype volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] + """ + super().__init__(**kwargs) + self.volume_mounts = volume_mounts + + +class NGroupCGPropertyVolume(_serialization.Model): + """Contains information about the volumes that can be mounted by Containers in the Container + Groups. + + All required parameters must be populated in order to send to server. + + :ivar name: The name of the volume. Required. + :vartype name: str + :ivar azure_file: The Azure File volume. + :vartype azure_file: ~azure.mgmt.containerinstance.models.AzureFileVolume + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "azure_file": {"key": "azureFile", "type": "AzureFileVolume"}, + } + + def __init__(self, *, name: str, azure_file: Optional["_models.AzureFileVolume"] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of the volume. Required. + :paramtype name: str + :keyword azure_file: The Azure File volume. + :paramtype azure_file: ~azure.mgmt.containerinstance.models.AzureFileVolume + """ + super().__init__(**kwargs) + self.name = name + self.azure_file = azure_file + + +class NGroupContainerGroupProperties(_serialization.Model): + """Container Group properties which can be set while creating or updating the NGroups. + + :ivar subnet_ids: Contains information about Virtual Network Subnet ARM Resource. + :vartype subnet_ids: list[~azure.mgmt.containerinstance.models.ContainerGroupSubnetId] + :ivar volumes: Contains information about the volumes that can be mounted by Containers in the + Container Groups. + :vartype volumes: list[~azure.mgmt.containerinstance.models.NGroupCGPropertyVolume] + :ivar containers: Contains information about Container which can be set while creating or + updating the NGroups. + :vartype containers: list[~azure.mgmt.containerinstance.models.NGroupCGPropertyContainer] + """ + + _attribute_map = { + "subnet_ids": {"key": "subnetIds", "type": "[ContainerGroupSubnetId]"}, + "volumes": {"key": "volumes", "type": "[NGroupCGPropertyVolume]"}, + "containers": {"key": "containers", "type": "[NGroupCGPropertyContainer]"}, + } + + def __init__( + self, + *, + subnet_ids: Optional[List["_models.ContainerGroupSubnetId"]] = None, + volumes: Optional[List["_models.NGroupCGPropertyVolume"]] = None, + containers: Optional[List["_models.NGroupCGPropertyContainer"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword subnet_ids: Contains information about Virtual Network Subnet ARM Resource. + :paramtype subnet_ids: list[~azure.mgmt.containerinstance.models.ContainerGroupSubnetId] + :keyword volumes: Contains information about the volumes that can be mounted by Containers in + the Container Groups. + :paramtype volumes: list[~azure.mgmt.containerinstance.models.NGroupCGPropertyVolume] + :keyword containers: Contains information about Container which can be set while creating or + updating the NGroups. + :paramtype containers: list[~azure.mgmt.containerinstance.models.NGroupCGPropertyContainer] + """ + super().__init__(**kwargs) + self.subnet_ids = subnet_ids + self.volumes = volumes + self.containers = containers + + +class NGroupIdentity(_serialization.Model): + """Identity for the NGroup. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of the NGroup identity. This property will only be + provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id associated with the NGroup. This property will only be provided + for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of identity used for the NGroup. The type 'SystemAssigned, UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. The type + 'None' will remove any identities from the NGroup. Known values are: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.containerinstance.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the NGroup. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.containerinstance.models.UserAssignedIdentities] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentities}"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentities"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The type of identity used for the NGroup. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the NGroup. Known values are: + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", and "None". + :paramtype type: str or ~azure.mgmt.containerinstance.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the NGroup. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerinstance.models.UserAssignedIdentities] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class NGroupSkus(_serialization.Model): + """The container probe, for liveness or readiness. + + :ivar resource_type: The type of resource the sku is applied to. + :vartype resource_type: str + :ivar sku: The sku of the resource type. + :vartype sku: str + :ivar sku_capacity: The number of container groups of the NGroups. + :vartype sku_capacity: str + """ + + _attribute_map = { + "resource_type": {"key": "resourceType", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + "sku_capacity": {"key": "skuCapacity", "type": "str"}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + sku: Optional[str] = None, + sku_capacity: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_type: The type of resource the sku is applied to. + :paramtype resource_type: str + :keyword sku: The sku of the resource type. + :paramtype sku: str + :keyword sku_capacity: The number of container groups of the NGroups. + :paramtype sku_capacity: str + """ + super().__init__(**kwargs) + self.resource_type = resource_type + self.sku = sku + self.sku_capacity = sku_capacity + + +class NGroupsListResult(_serialization.Model): + """The NGroups list response that contains the NGroups properties. + + :ivar value: The list of NGroups. + :vartype value: list[~azure.mgmt.containerinstance.models.NGroup] + :ivar next_link: The URI to fetch the next page of NGroups. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NGroup"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of NGroups. + :paramtype value: list[~azure.mgmt.containerinstance.models.NGroup] + :keyword next_link: The URI to fetch the next page of NGroups. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NGroupsSkusList(_serialization.Model): + """List of SKU definitions. NGroups offer a single sku. + + :ivar value: The list of NGroups SKUs. + :vartype value: list[~azure.mgmt.containerinstance.models.NGroupSkus] + :ivar next_link: The URI to fetch the next page of NGroups SKUs. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NGroupSkus]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.NGroupSkus"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of NGroups SKUs. + :paramtype value: list[~azure.mgmt.containerinstance.models.NGroupSkus] + :keyword next_link: The URI to fetch the next page of NGroups SKUs. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class Operation(_serialization.Model): """An operation for Azure Container Instance service. @@ -2780,6 +3482,31 @@ def __init__( self.next_link = next_link +class PlacementProfile(_serialization.Model): + """Provides options w.r.t allocation and management w.r.t certain placement policies. These + utilize capabilities provided by the underlying Azure infrastructure. They are typically used + for high availability scenarios. E.g., distributing CGs across fault domains. + + :ivar fault_domain_count: The number of fault domains to be used to spread CGs in the NGroups + resource. This can only be specified during NGroup creation and is immutable after that. + :vartype fault_domain_count: int + """ + + _attribute_map = { + "fault_domain_count": {"key": "faultDomainCount", "type": "int"}, + } + + def __init__(self, *, fault_domain_count: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword fault_domain_count: The number of fault domains to be used to spread CGs in the + NGroups resource. This can only be specified during NGroup creation and is immutable after + that. + :paramtype fault_domain_count: int + """ + super().__init__(**kwargs) + self.fault_domain_count = fault_domain_count + + class Port(_serialization.Model): """The port exposed on the container group. @@ -2932,6 +3659,48 @@ def __init__( self.limits = limits +class SecretReference(_serialization.Model): + """A secret reference. + + All required parameters must be populated in order to send to server. + + :ivar name: The identifier of the secret reference. Required. + :vartype name: str + :ivar identity: The ARM resource id of the managed identity that has access to the secret in + the key vault. Required. + :vartype identity: str + :ivar secret_reference_uri: The URI to the secret in key vault. Required. + :vartype secret_reference_uri: str + """ + + _validation = { + "name": {"required": True}, + "identity": {"required": True}, + "secret_reference_uri": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "identity": {"key": "identity", "type": "str"}, + "secret_reference_uri": {"key": "secretReferenceUri", "type": "str"}, + } + + def __init__(self, *, name: str, identity: str, secret_reference_uri: str, **kwargs: Any) -> None: + """ + :keyword name: The identifier of the secret reference. Required. + :paramtype name: str + :keyword identity: The ARM resource id of the managed identity that has access to the secret in + the key vault. Required. + :paramtype identity: str + :keyword secret_reference_uri: The URI to the secret in key vault. Required. + :paramtype secret_reference_uri: str + """ + super().__init__(**kwargs) + self.name = name + self.identity = identity + self.secret_reference_uri = secret_reference_uri + + class SecurityContextCapabilitiesDefinition(_serialization.Model): """The capabilities to add or drop from a container. @@ -3025,43 +3794,180 @@ def __init__( self.seccomp_profile = seccomp_profile -class StandbyPoolProfileDefinition(_serialization.Model): - """The standby pool profile reference. +class StorageProfile(_serialization.Model): + """Storage profile for storage related settings of a container group profile. - :ivar id: The standby pool profile reference id.This will be an ARM resource id in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyPoolName}'. # pylint: disable=line-too-long - :vartype id: str - :ivar fail_container_group_create_on_reuse_failure: The flag to determine whether ACI should - fail the create request if the container group can not be obtained from standby pool. - :vartype fail_container_group_create_on_reuse_failure: bool + :ivar file_shares: + :vartype file_shares: list[~azure.mgmt.containerinstance.models.FileShare] """ _attribute_map = { - "id": {"key": "id", "type": "str"}, - "fail_container_group_create_on_reuse_failure": { - "key": "failContainerGroupCreateOnReuseFailure", - "type": "bool", - }, + "file_shares": {"key": "fileShares", "type": "[FileShare]"}, + } + + def __init__(self, *, file_shares: Optional[List["_models.FileShare"]] = None, **kwargs: Any) -> None: + """ + :keyword file_shares: + :paramtype file_shares: list[~azure.mgmt.containerinstance.models.FileShare] + """ + super().__init__(**kwargs) + self.file_shares = file_shares + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.containerinstance.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.containerinstance.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, } def __init__( self, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - fail_container_group_create_on_reuse_failure: Optional[bool] = None, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, **kwargs: Any ) -> None: """ - :keyword id: The standby pool profile reference id.This will be an ARM resource id in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyPoolName}'. # pylint: disable=line-too-long - :paramtype id: str - :keyword fail_container_group_create_on_reuse_failure: The flag to determine whether ACI should - fail the create request if the container group can not be obtained from standby pool. - :paramtype fail_container_group_create_on_reuse_failure: bool + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.containerinstance.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.containerinstance.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime """ super().__init__(**kwargs) - self.id = id - self.fail_container_group_create_on_reuse_failure = fail_container_group_create_on_reuse_failure + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UpdateProfile(_serialization.Model): + """Used by the customer to specify the way to update the Container Groups in NGroup. + + :ivar update_mode: Known values are: "Manual" and "Rolling". + :vartype update_mode: str or ~azure.mgmt.containerinstance.models.NGroupUpdateMode + :ivar rolling_update_profile: This profile allows the customers to customize the rolling + update. + :vartype rolling_update_profile: + ~azure.mgmt.containerinstance.models.UpdateProfileRollingUpdateProfile + """ + + _attribute_map = { + "update_mode": {"key": "updateMode", "type": "str"}, + "rolling_update_profile": {"key": "rollingUpdateProfile", "type": "UpdateProfileRollingUpdateProfile"}, + } + + def __init__( + self, + *, + update_mode: Optional[Union[str, "_models.NGroupUpdateMode"]] = None, + rolling_update_profile: Optional["_models.UpdateProfileRollingUpdateProfile"] = None, + **kwargs: Any + ) -> None: + """ + :keyword update_mode: Known values are: "Manual" and "Rolling". + :paramtype update_mode: str or ~azure.mgmt.containerinstance.models.NGroupUpdateMode + :keyword rolling_update_profile: This profile allows the customers to customize the rolling + update. + :paramtype rolling_update_profile: + ~azure.mgmt.containerinstance.models.UpdateProfileRollingUpdateProfile + """ + super().__init__(**kwargs) + self.update_mode = update_mode + self.rolling_update_profile = rolling_update_profile + + +class UpdateProfileRollingUpdateProfile(_serialization.Model): + """This profile allows the customers to customize the rolling update. + + :ivar max_batch_percent: Maximum percentage of total Container Groups which can be updated + simultaneously by rolling update in one batch. + :vartype max_batch_percent: int + :ivar max_unhealthy_percent: Maximum percentage of the updated Container Groups which can be in + unhealthy state after each batch is updated. + :vartype max_unhealthy_percent: int + :ivar pause_time_between_batches: The wait time between batches after completing the one batch + of the rolling update and starting the next batch. The time duration should be specified in ISO + 8601 format for duration. + :vartype pause_time_between_batches: str + :ivar in_place_update: Default is false. If set to true, the CGs will be updated in-place + instead of creating new CG and deleting old ones. + :vartype in_place_update: bool + """ + + _attribute_map = { + "max_batch_percent": {"key": "maxBatchPercent", "type": "int"}, + "max_unhealthy_percent": {"key": "maxUnhealthyPercent", "type": "int"}, + "pause_time_between_batches": {"key": "pauseTimeBetweenBatches", "type": "str"}, + "in_place_update": {"key": "inPlaceUpdate", "type": "bool"}, + } + + def __init__( + self, + *, + max_batch_percent: Optional[int] = None, + max_unhealthy_percent: Optional[int] = None, + pause_time_between_batches: Optional[str] = None, + in_place_update: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_batch_percent: Maximum percentage of total Container Groups which can be updated + simultaneously by rolling update in one batch. + :paramtype max_batch_percent: int + :keyword max_unhealthy_percent: Maximum percentage of the updated Container Groups which can be + in unhealthy state after each batch is updated. + :paramtype max_unhealthy_percent: int + :keyword pause_time_between_batches: The wait time between batches after completing the one + batch of the rolling update and starting the next batch. The time duration should be specified + in ISO 8601 format for duration. + :paramtype pause_time_between_batches: str + :keyword in_place_update: Default is false. If set to true, the CGs will be updated in-place + instead of creating new CG and deleting old ones. + :paramtype in_place_update: bool + """ + super().__init__(**kwargs) + self.max_batch_percent = max_batch_percent + self.max_unhealthy_percent = max_unhealthy_percent + self.pause_time_between_batches = pause_time_between_batches + self.in_place_update = in_place_update class Usage(_serialization.Model): @@ -3201,6 +4107,8 @@ class Volume(_serialization.Model): :vartype empty_dir: JSON :ivar secret: The secret volume. :vartype secret: dict[str, str] + :ivar secret_reference: The secret reference volume. + :vartype secret_reference: dict[str, str] :ivar git_repo: The git repo volume. :vartype git_repo: ~azure.mgmt.containerinstance.models.GitRepoVolume """ @@ -3214,6 +4122,7 @@ class Volume(_serialization.Model): "azure_file": {"key": "azureFile", "type": "AzureFileVolume"}, "empty_dir": {"key": "emptyDir", "type": "object"}, "secret": {"key": "secret", "type": "{str}"}, + "secret_reference": {"key": "secretReference", "type": "{str}"}, "git_repo": {"key": "gitRepo", "type": "GitRepoVolume"}, } @@ -3224,6 +4133,7 @@ def __init__( azure_file: Optional["_models.AzureFileVolume"] = None, empty_dir: Optional[JSON] = None, secret: Optional[Dict[str, str]] = None, + secret_reference: Optional[Dict[str, str]] = None, git_repo: Optional["_models.GitRepoVolume"] = None, **kwargs: Any ) -> None: @@ -3236,6 +4146,8 @@ def __init__( :paramtype empty_dir: JSON :keyword secret: The secret volume. :paramtype secret: dict[str, str] + :keyword secret_reference: The secret reference volume. + :paramtype secret_reference: dict[str, str] :keyword git_repo: The git repo volume. :paramtype git_repo: ~azure.mgmt.containerinstance.models.GitRepoVolume """ @@ -3244,6 +4156,7 @@ def __init__( self.azure_file = azure_file self.empty_dir = empty_dir self.secret = secret + self.secret_reference = secret_reference self.git_repo = git_repo diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/__init__.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/__init__.py index 7120d9b773f9..2c95c4b9cb1a 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/__init__.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/__init__.py @@ -11,8 +11,9 @@ from ._location_operations import LocationOperations from ._containers_operations import ContainersOperations from ._subnet_service_association_link_operations import SubnetServiceAssociationLinkOperations -from ._container_group_profiles_operations import ContainerGroupProfilesOperations -from ._container_group_profile_operations import ContainerGroupProfileOperations +from ._ngroups_operations import NGroupsOperations +from ._cg_profiles_operations import CGProfilesOperations +from ._cg_profile_operations import CGProfileOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -24,8 +25,9 @@ "LocationOperations", "ContainersOperations", "SubnetServiceAssociationLinkOperations", - "ContainerGroupProfilesOperations", - "ContainerGroupProfileOperations", + "NGroupsOperations", + "CGProfilesOperations", + "CGProfileOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_group_profiles_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_cg_profile_operations.py similarity index 69% rename from sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_group_profiles_operations.py rename to sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_cg_profile_operations.py index a759ea9e9238..8b06dd1b0de6 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_group_profiles_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_cg_profile_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,14 +17,18 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer @@ -40,19 +44,32 @@ _SERIALIZER.client_side_validation = False -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_request( + resource_group_name: str, container_group_profile_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroupProfiles" + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}", ) # 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"), + "containerGroupProfileName": _SERIALIZER.url( + "container_group_profile_name", + container_group_profile_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -61,27 +78,38 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _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_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_update_request( + resource_group_name: str, container_group_profile_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "containerGroupProfileName": _SERIALIZER.url( + "container_group_profile_name", + container_group_profile_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), } @@ -91,9 +119,11 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _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_get_request( @@ -102,7 +132,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,16 +142,14 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupProfileName": _SERIALIZER.url( "container_group_profile_name", container_group_profile_name, "str", max_length=63, min_length=1, - pattern=r"^(?!.*--)[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), } @@ -136,14 +164,13 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( +def build_delete_request( resource_group_name: str, container_group_profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-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-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,16 +180,14 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupProfileName": _SERIALIZER.url( "container_group_profile_name", container_group_profile_name, "str", max_length=63, min_length=1, - pattern=r"^(?!.*--)[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), } @@ -172,40 +197,35 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_patch_request( +def build_list_all_revisions_request( resource_group_name: str, container_group_profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-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-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}/revisions", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupProfileName": _SERIALIZER.url( "container_group_profile_name", container_group_profile_name, "str", max_length=63, min_length=1, - pattern=r"^(?!.*--)[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), } @@ -215,40 +235,41 @@ def build_patch_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, container_group_profile_name: str, subscription_id: str, **kwargs: Any +def build_get_by_revision_number_request( + resource_group_name: str, + container_group_profile_name: str, + revision_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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}/revisions/{revisionNumber}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupProfileName": _SERIALIZER.url( "container_group_profile_name", container_group_profile_name, "str", max_length=63, min_length=1, - pattern=r"^(?!.*--)[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), + "revisionNumber": _SERIALIZER.url("revision_number", revision_number, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -259,17 +280,17 @@ def build_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) -class ContainerGroupProfilesOperations: +class CGProfileOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.containerinstance.ContainerInstanceManagementClient`'s - :attr:`container_group_profiles` attribute. + :attr:`cg_profile` attribute. """ models = _models @@ -281,235 +302,6 @@ def __init__(self, *args, **kwargs): 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(self, **kwargs: Any) -> Iterable["_models.ContainerGroupProfile"]: - """Get a list of container group profiles in the specified subscription. - - Get a list of container group profiles in the specified subscription. This operation returns - properties of each container group profile including containers, image registry credentials, - restart policy, IP address type, OS type,volumes,current revision number, etc. - - :return: An iterator like instance of either ContainerGroupProfile or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ContainerGroupProfileListResult] = 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_list_request( - subscription_id=self._config.subscription_id, - api_version=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) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerGroupProfileListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerGroupProfile"]: - """Get a list of container group profiles in the specified subscription and resource group. - - Get a list of container group profiles in a specified subscription and resource group. This - operation returns properties of each container group profile including containers, image - registry credentials, restart policy, IP address type, OS type volumes, current revision - number, etc. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ContainerGroupProfile or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ContainerGroupProfileListResult] = 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_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=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) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ContainerGroupProfileListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any - ) -> _models.ContainerGroupProfile: - """Get the properties of the specified container group profile. - - Gets the properties of the specified container group profile in the specified subscription and - resource group. The operation returns the properties of container group profile including - containers, image registry credentials, restart policy, IP address type, OS type, volumes, - current revision number, etc. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. - :type container_group_profile_name: str - :return: ContainerGroupProfile or the result of cls(response) - :rtype: ~azure.mgmt.containerinstance.models.ContainerGroupProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ContainerGroupProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - container_group_profile_name=container_group_profile_name, - subscription_id=self._config.subscription_id, - api_version=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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @overload def create_or_update( self, @@ -520,17 +312,15 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.ContainerGroupProfile: - """Create or update container group profiles. + """Create or Update a ContainerGroupProfile. - Create or update container group profiles with specified configurations. + Create a CGProfile if it doesn't exist or update an existing CGProfile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str - :param container_group_profile: The properties of the container group profile to be created or - updated. Required. + :param container_group_profile: The ContainerGroupProfile object. Required. :type container_group_profile: ~azure.mgmt.containerinstance.models.ContainerGroupProfile :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -550,17 +340,15 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.ContainerGroupProfile: - """Create or update container group profiles. + """Create or Update a ContainerGroupProfile. - Create or update container group profiles with specified configurations. + Create a CGProfile if it doesn't exist or update an existing CGProfile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str - :param container_group_profile: The properties of the container group profile to be created or - updated. Required. + :param container_group_profile: The ContainerGroupProfile object. Required. :type container_group_profile: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -578,17 +366,16 @@ def create_or_update( container_group_profile: Union[_models.ContainerGroupProfile, IO[bytes]], **kwargs: Any ) -> _models.ContainerGroupProfile: - """Create or update container group profiles. + """Create or Update a ContainerGroupProfile. - Create or update container group profiles with specified configurations. + Create a CGProfile if it doesn't exist or update an existing CGProfile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str - :param container_group_profile: The properties of the container group profile to be created or - updated. Is either a ContainerGroupProfile type or a IO[bytes] type. Required. + :param container_group_profile: The ContainerGroupProfile object. Is either a + ContainerGroupProfile type or a IO[bytes] type. Required. :type container_group_profile: ~azure.mgmt.containerinstance.models.ContainerGroupProfile or IO[bytes] :return: ContainerGroupProfile or the result of cls(response) @@ -640,17 +427,23 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def patch( + def update( self, resource_group_name: str, container_group_profile_name: str, @@ -659,14 +452,13 @@ def patch( content_type: str = "application/json", **kwargs: Any ) -> _models.ContainerGroupProfile: - """Patch container group profiles. + """Container group profile PATCH REST API. - Patches container group profile with specified properties. + Update a specified container group profile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str :param properties: The container group profile properties that need to be updated. Required. :type properties: ~azure.mgmt.containerinstance.models.ContainerGroupProfilePatch @@ -679,7 +471,7 @@ def patch( """ @overload - def patch( + def update( self, resource_group_name: str, container_group_profile_name: str, @@ -688,14 +480,13 @@ def patch( content_type: str = "application/json", **kwargs: Any ) -> _models.ContainerGroupProfile: - """Patch container group profiles. + """Container group profile PATCH REST API. - Patches container group profile with specified properties. + Update a specified container group profile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str :param properties: The container group profile properties that need to be updated. Required. :type properties: IO[bytes] @@ -708,21 +499,20 @@ def patch( """ @distributed_trace - def patch( + def update( self, resource_group_name: str, container_group_profile_name: str, properties: Union[_models.ContainerGroupProfilePatch, IO[bytes]], **kwargs: Any ) -> _models.ContainerGroupProfile: - """Patch container group profiles. + """Container group profile PATCH REST API. - Patches container group profile with specified properties. + Update a specified container group profile. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str :param properties: The container group profile properties that need to be updated. Is either a ContainerGroupProfilePatch type or a IO[bytes] type. Required. @@ -754,7 +544,7 @@ def patch( else: _json = self._serialize.body(properties, "ContainerGroupProfilePatch") - _request = build_patch_request( + _request = build_update_request( resource_group_name=resource_group_name, container_group_profile_name=container_group_profile_name, subscription_id=self._config.subscription_id, @@ -774,6 +564,70 @@ def patch( response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + + deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any + ) -> _models.ContainerGroupProfile: + """Display information about a specified ContainerGroupProfile. + + Get the properties of the specified container group profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_group_profile_name: ContainerGroupProfile name. Required. + :type container_group_profile_name: str + :return: ContainerGroupProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerinstance.models.ContainerGroupProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerGroupProfile] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_group_profile_name=container_group_profile_name, + subscription_id=self._config.subscription_id, + api_version=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]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -785,22 +639,229 @@ def patch( return deserialized # type: ignore + def _delete_initial( + self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any + ) -> Iterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_group_profile_name=container_group_profile_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any - ) -> None: - """Delete the specified container group profile. + ) -> LROPoller[None]: + """Container group profile DELETE REST API. + + Deletes a container group profile. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_group_profile_name: ContainerGroupProfile name. Required. + :type container_group_profile_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_group_profile_name=container_group_profile_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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_all_revisions( + self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any + ) -> Iterable["_models.ContainerGroupProfile"]: + """Get a list of all the revisions of the specified container group profile in the given + subscription and resource group. + + Get a list of all the revisions of the specified container group profile in the given + subscription and resource group. This operation returns properties of each revision of the + specified container group profile including containers, image registry credentials, restart + policy, IP address type, OS type volumes, revision number, etc. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param container_group_profile_name: ContainerGroupProfile name. Required. + :type container_group_profile_name: str + :return: An iterator like instance of either ContainerGroupProfile or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerGroupProfileListResult] = 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_list_all_revisions_request( + resource_group_name=resource_group_name, + container_group_profile_name=container_group_profile_name, + subscription_id=self._config.subscription_id, + api_version=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) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerGroupProfileListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) - Delete the specified container group profile in the specified subscription and resource group. - The operation does not delete other resources provided by the user, such as volumes. + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_by_revision_number( + self, resource_group_name: str, container_group_profile_name: str, revision_number: str, **kwargs: Any + ) -> _models.ContainerGroupProfile: + """Get the properties of the specified revision of the container group profile. + + Gets the properties of the specified revision of the container group profile in the given + subscription and resource group. The operation returns the properties of container group + profile including containers, image registry credentials, restart policy, IP address type, OS + type, volumes, current revision number, etc. + + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. + :param container_group_profile_name: ContainerGroupProfile name. Required. :type container_group_profile_name: str - :return: None or the result of cls(response) - :rtype: None + :param revision_number: The revision number of the container group profile. Required. + :type revision_number: str + :return: ContainerGroupProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerinstance.models.ContainerGroupProfile :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -815,11 +876,12 @@ def delete( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.ContainerGroupProfile] = kwargs.pop("cls", None) - _request = build_delete_request( + _request = build_get_by_revision_number_request( resource_group_name=resource_group_name, container_group_profile_name=container_group_profile_name, + revision_number=revision_number, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -834,9 +896,13 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_group_profile_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_cg_profiles_operations.py similarity index 61% rename from sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_group_profile_operations.py rename to sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_cg_profiles_operations.py index ea2f7ca60b95..f7509e3387b6 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_group_profile_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_cg_profiles_operations.py @@ -39,33 +39,19 @@ _SERIALIZER.client_side_validation = False -def build_list_all_revisions_request( - resource_group_name: str, container_group_profile_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_by_subscription_request(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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}/revisions", + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroupProfiles" ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "containerGroupProfileName": _SERIALIZER.url( - "container_group_profile_name", - container_group_profile_name, - "str", - max_length=63, - min_length=1, - pattern=r"^(?!.*--)[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -79,38 +65,21 @@ def build_list_all_revisions_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_by_revision_number_request( - resource_group_name: str, - container_group_profile_name: str, - revision_number: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_list_by_resource_group_request(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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}/revisions/{revisionNumber}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "containerGroupProfileName": _SERIALIZER.url( - "container_group_profile_name", - container_group_profile_name, - "str", - max_length=63, - min_length=1, - pattern=r"^(?!.*--)[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - "revisionNumber": _SERIALIZER.url("revision_number", revision_number, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -124,14 +93,14 @@ def build_get_by_revision_number_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class ContainerGroupProfileOperations: +class CGProfilesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.containerinstance.ContainerInstanceManagementClient`'s - :attr:`container_group_profile` attribute. + :attr:`cg_profiles` attribute. """ models = _models @@ -144,22 +113,11 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_all_revisions( - self, resource_group_name: str, container_group_profile_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerGroupProfile"]: - """Get a list of all the revisions of the specified container group profile in the given - subscription and resource group. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ContainerGroupProfile"]: + """List container group profiles in a subscription. - Get a list of all the revisions of the specified container group profile in the given - subscription and resource group. This operation returns properties of each revision of the - specified container group profile including containers, image registry credentials, restart - policy, IP address type, OS type volumes, revision number, etc. + Gets a list of all container group profiles under a subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. - :type container_group_profile_name: str :return: An iterator like instance of either ContainerGroupProfile or the result of cls(response) :rtype: @@ -183,9 +141,7 @@ def list_all_revisions( def prepare_request(next_link=None): if not next_link: - _request = build_list_all_revisions_request( - resource_group_name=resource_group_name, - container_group_profile_name=container_group_profile_name, + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -235,27 +191,27 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_by_revision_number( - self, resource_group_name: str, container_group_profile_name: str, revision_number: str, **kwargs: Any - ) -> _models.ContainerGroupProfile: - """Get the properties of the specified revision of the container group profile. - - Gets the properties of the specified revision of the container group profile in the given - subscription and resource group. The operation returns the properties of container group - profile including containers, image registry credentials, restart policy, IP address type, OS - type, volumes, current revision number, etc. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ContainerGroupProfile"]: + """List container group profiles in a resource group. + + Gets a list of all container group profiles under a resource group. + + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param container_group_profile_name: The name of the container group profile. Required. - :type container_group_profile_name: str - :param revision_number: The revision number of the container group profile. Required. - :type revision_number: str - :return: ContainerGroupProfile or the result of cls(response) - :rtype: ~azure.mgmt.containerinstance.models.ContainerGroupProfile + :return: An iterator like instance of either ContainerGroupProfile or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupProfile] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerGroupProfileListResult] = kwargs.pop("cls", None) + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -264,37 +220,55 @@ def get_by_revision_number( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ContainerGroupProfile] = kwargs.pop("cls", None) + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_get_by_revision_number_request( - resource_group_name=resource_group_name, - container_group_profile_name=container_group_profile_name, - revision_number=revision_number, - subscription_id=self._config.subscription_id, - api_version=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) + _request.method = "GET" + 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 = self._deserialize("ContainerGroupProfileListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, 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 - deserialized = self._deserialize("ContainerGroupProfile", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_groups_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_groups_operations.py index 4ae227c0b153..bc78dab64a70 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_groups_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_container_groups_operations.py @@ -48,7 +48,7 @@ def build_list_request(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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,9 +84,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -106,7 +104,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,9 +114,7 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), } @@ -139,7 +135,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -150,9 +146,7 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), } @@ -175,7 +169,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,9 +180,7 @@ def build_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), } @@ -211,7 +203,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -221,9 +213,7 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), } @@ -244,7 +234,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,9 +244,7 @@ def build_restart_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), } @@ -277,7 +265,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -287,9 +275,7 @@ def build_stop_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), } @@ -310,7 +296,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -320,9 +306,7 @@ def build_start_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), } @@ -343,7 +327,7 @@ def build_get_outbound_network_dependencies_endpoints_request( # pylint: disabl _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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -353,9 +337,7 @@ def build_get_outbound_network_dependencies_endpoints_request( # pylint: disabl ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), } @@ -475,8 +457,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :return: An iterator like instance of either ContainerGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.ContainerGroup] @@ -557,8 +538,7 @@ def get(self, resource_group_name: str, container_group_name: str, **kwargs: Any group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -688,8 +668,7 @@ def begin_create_or_update( Create or update container groups with specified configurations. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -719,8 +698,7 @@ def begin_create_or_update( Create or update container groups with specified configurations. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -748,8 +726,7 @@ def begin_create_or_update( Create or update container groups with specified configurations. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -822,8 +799,7 @@ def update( Updates container group tags with specified values. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -851,8 +827,7 @@ def update( Updates container group tags with specified values. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -878,8 +853,7 @@ def update( Updates container group tags with specified values. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -1001,8 +975,7 @@ def begin_delete( Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -1110,8 +1083,7 @@ def begin_restart(self, resource_group_name: str, container_group_name: str, **k Restarts all containers in a container group in place. If container image has updates, new image will be downloaded. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -1168,8 +1140,7 @@ def stop( # pylint: disable=inconsistent-return-statements Stops all containers in a container group. Compute resources will be deallocated and billing will stop. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -1270,8 +1241,7 @@ def begin_start(self, resource_group_name: str, container_group_name: str, **kwa Starts all containers in a container group. Compute resources will be allocated and billing will start. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -1328,8 +1298,7 @@ def get_outbound_network_dependencies_endpoints( # pylint: disable=name-too-lon Gets all the network dependencies for this container group to allow complete control of network setting and configuration. For container groups, this will always be an empty list. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_containers_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_containers_operations.py index 402c91e64a96..e5ae8afe423b 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_containers_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_containers_operations.py @@ -51,7 +51,7 @@ def build_list_logs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,9 +61,7 @@ def build_list_logs_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), "containerName": _SERIALIZER.url("container_name", container_name, "str"), } @@ -89,7 +87,7 @@ def build_execute_command_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -100,9 +98,7 @@ def build_execute_command_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), "containerName": _SERIALIZER.url("container_name", container_name, "str"), } @@ -126,7 +122,7 @@ def build_attach_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,9 +132,7 @@ def build_attach_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, "str"), "containerName": _SERIALIZER.url("container_name", container_name, "str"), } @@ -188,8 +182,7 @@ def list_logs( Get the logs for a specified container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -266,8 +259,7 @@ def execute_command( Executes a command for a specific container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -299,8 +291,7 @@ def execute_command( Executes a command for a specific container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -330,8 +321,7 @@ def execute_command( Executes a command for a specific container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str @@ -409,8 +399,7 @@ def attach( Attach to the output stream of a specific container instance in a specified resource group and container group. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param container_group_name: The name of the container group. Required. :type container_group_name: str diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_location_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_location_operations.py index b7ad2e02b809..991e338b7905 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_location_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_location_operations.py @@ -43,7 +43,7 @@ def build_list_usage_request(location: str, subscription_id: str, **kwargs: Any) _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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +53,7 @@ def build_list_usage_request(location: str, subscription_id: str, **kwargs: Any) ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -71,7 +71,7 @@ def build_list_cached_images_request(location: str, subscription_id: str, **kwar _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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_list_cached_images_request(location: str, subscription_id: str, **kwar ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -99,7 +99,7 @@ def build_list_capabilities_request(location: str, subscription_id: str, **kwarg _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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_list_capabilities_request(location: str, subscription_id: str, **kwarg ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -146,7 +146,7 @@ def __init__(self, *args, **kwargs): def list_usage(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: """Get the usage for a subscription. - :param location: The name of the Azure region. Required. + :param location: The identifier for the physical azure location. Required. :type location: str :return: An iterator like instance of either Usage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.Usage] @@ -225,7 +225,7 @@ def list_cached_images(self, location: str, **kwargs: Any) -> Iterable["_models. Get the list of cached images on specific OS type for a subscription in a region. - :param location: The name of the Azure region. Required. + :param location: The identifier for the physical azure location. Required. :type location: str :return: An iterator like instance of either CachedImages or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.CachedImages] @@ -304,7 +304,7 @@ def list_capabilities(self, location: str, **kwargs: Any) -> Iterable["_models.C Get the list of CPU/memory/GPU capabilities of a region. - :param location: The name of the Azure region. Required. + :param location: The identifier for the physical azure location. Required. :type location: str :return: An iterator like instance of either Capabilities or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.Capabilities] diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_ngroups_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_ngroups_operations.py new file mode 100644 index 000000000000..bbcf6ef992ac --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_ngroups_operations.py @@ -0,0 +1,1387 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, ngroups_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/ngroups/{ngroupsName}", + ) # 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"), + "ngroupsName": _SERIALIZER.url( + "ngroups_name", + ngroups_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, ngroups_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-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/ngroups/{ngroupsName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ngroupsName": _SERIALIZER.url( + "ngroups_name", + ngroups_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, ngroups_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-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/ngroups/{ngroupsName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ngroupsName": _SERIALIZER.url( + "ngroups_name", + ngroups_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, ngroups_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/ngroups/{ngroupsName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "ngroupsName": _SERIALIZER.url( + "ngroups_name", + ngroups_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_request( + resource_group_name: str, ngroups_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/ngroups/{ngroupsName}/start", + ) # 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"), + "ngroupsName": _SERIALIZER.url( + "ngroups_name", + ngroups_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request(resource_group_name: str, ngroups_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/ngroups/{ngroupsName}/stop", + ) # 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"), + "ngroupsName": _SERIALIZER.url( + "ngroups_name", + ngroups_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restart_request( + resource_group_name: str, ngroups_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/ngroups/{ngroupsName}/restart", + ) # 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"), + "ngroupsName": _SERIALIZER.url( + "ngroups_name", + ngroups_name, + "str", + max_length=63, + min_length=1, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/ngroups", + ) # 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/ngroups") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class NGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerinstance.ContainerInstanceManagementClient`'s + :attr:`ngroups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> _models.NGroup: + """NGroups GET REST API. + + Get the properties of the specified NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: NGroup or the result of cls(response) + :rtype: ~azure.mgmt.containerinstance.models.NGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NGroup] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, resource_group_name: str, ngroups_name: str, n_group: Union[_models.NGroup, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(n_group, (IOBase, bytes)): + _content = n_group + else: + _json = self._serialize.body(n_group, "NGroup") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + 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, + ngroups_name: str, + n_group: _models.NGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NGroup]: + """NGroup PUT REST API. + + Create or update a NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Required. + :type n_group: ~azure.mgmt.containerinstance.models.NGroup + :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 either NGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + ngroups_name: str, + n_group: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NGroup]: + """NGroup PUT REST API. + + Create or update a NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Required. + :type n_group: 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 either NGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, ngroups_name: str, n_group: Union[_models.NGroup, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.NGroup]: + """NGroup PUT REST API. + + Create or update a NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Is either a NGroup type or a IO[bytes] type. Required. + :type n_group: ~azure.mgmt.containerinstance.models.NGroup or IO[bytes] + :return: An instance of LROPoller that returns either NGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NGroup] = 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, + ngroups_name=ngroups_name, + n_group=n_group, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("NGroup", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, resource_group_name: str, ngroups_name: str, n_group: Union[_models.NGroup, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(n_group, (IOBase, bytes)): + _content = n_group + else: + _json = self._serialize.body(n_group, "NGroup") + + _request = build_update_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + ngroups_name: str, + n_group: _models.NGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NGroup]: + """NGroups PATCH REST API. + + Update a specified NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Required. + :type n_group: ~azure.mgmt.containerinstance.models.NGroup + :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 either NGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + ngroups_name: str, + n_group: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NGroup]: + """NGroups PATCH REST API. + + Update a specified NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Required. + :type n_group: 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 either NGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, ngroups_name: str, n_group: Union[_models.NGroup, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.NGroup]: + """NGroups PATCH REST API. + + Update a specified NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :param n_group: The NGroup object. Is either a NGroup type or a IO[bytes] type. Required. + :type n_group: ~azure.mgmt.containerinstance.models.NGroup or IO[bytes] + :return: An instance of LROPoller that returns either NGroup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NGroup] = 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, + ngroups_name=ngroups_name, + n_group=n_group, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("NGroup", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> Iterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> LROPoller[None]: + """NGroups Delete REST API. + + Deletes the NGroups resource. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _start_initial(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> Iterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_start_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> LROPoller[None]: + """Starts all container groups in the specified NGroups resource. + + Starts all container groups in the specified NGroups resource. Compute resources will be + allocated and billing will start. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[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._start_initial( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **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 stop( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, ngroups_name: str, **kwargs: Any + ) -> None: + """Stops all container groups in the specified NGroups resource. + + Stops all container groups in the specified NGroups resource. Compute resources will be + deallocated and billing will stop. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_stop_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _restart_initial(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> Iterator[bytes]: + 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_restart_request( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_restart(self, resource_group_name: str, ngroups_name: str, **kwargs: Any) -> LROPoller[None]: + """Restarts all container groups in the specified NGroups resource. + + Restarts all container groups in the specified NGroups resource in place. If container image + has updates, new image will be downloaded. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param ngroups_name: The NGroups name. Required. + :type ngroups_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[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._restart_initial( + resource_group_name=resource_group_name, + ngroups_name=ngroups_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **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_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.NGroup"]: + """GET NGroups under a resource group REST API. + + Gets a list of all NGroups resources under a resource group. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :return: An iterator like instance of either NGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NGroupsListResult] = 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_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=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) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NGroupsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.NGroup"]: + """List NGroups in a subscription. + + Gets a list of all NGroups resources under a subscription. + + :return: An iterator like instance of either NGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.NGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NGroupsListResult] = 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_list_request( + subscription_id=self._config.subscription_id, + api_version=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) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NGroupsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_operations.py index 3b750f69232c..fc0141133418 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_operations.py @@ -43,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_subnet_service_association_link_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_subnet_service_association_link_operations.py index eccbeed67ad0..9cd34e1cb360 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_subnet_service_association_link_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/_subnet_service_association_link_operations.py @@ -47,7 +47,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,9 +57,7 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), "subnetName": _SERIALIZER.url("subnet_name", subnet_name, "str"), } @@ -154,8 +152,7 @@ def begin_delete( Delete container group virtual network association links. The operation does not delete other resources provided by the user. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. + :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str :param virtual_network_name: The name of the virtual network. Required. :type virtual_network_name: str diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/cached_images_list.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/cached_images_list.py index f111cbec9718..4d4d9a00b978 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/cached_images_list.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/cached_images_list.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.location.list_cached_images( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CachedImagesList.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/CachedImagesList.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/capabilities_list.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/capabilities_list.py index c62ac513402f..da1ac3356a07 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/capabilities_list.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/capabilities_list.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.location.list_capabilities( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CapabilitiesList.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/CapabilitiesList.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_attach.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_attach.py index b7a778451025..10ac6d1f4bf0 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_attach.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_attach.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.containers.attach( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerAttach.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerAttach.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_exec.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_exec.py index 8bde95f563ef..983bf0e11a69 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_exec.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_exec.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.containers.execute_command( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerExec.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerExec.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_create_confidential.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_create_confidential.py index 8595e0e0f8cc..ced36507fed4 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_create_confidential.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_create_confidential.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.begin_create_or_update( @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateConfidential.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupCreateConfidential.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_create_or_update_standby_pool.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_create_or_update_standby_pool.py deleted file mode 100644 index 9995a99cedea..000000000000 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_create_or_update_standby_pool.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerinstance import ContainerInstanceManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerinstance -# USAGE - python container_group_create_or_update_standby_pool.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerInstanceManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.container_groups.begin_create_or_update( - resource_group_name="demo", - container_group_name="demo1", - container_group={ - "location": "west us", - "properties": { - "containerGroupProfile": { - "id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp", - "revision": 1, - }, - "containers": [{"name": "demo1", "properties": {"configMap": {"keyValuePairs": {"Newkey": "value"}}}}], - "standbyPoolProfile": { - "id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool" - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateOrUpdateStandbyPool.json -if __name__ == "__main__": - main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_encryption_properties.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_encryption_properties.py index b912076f1e40..720a891ca8c5 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_encryption_properties.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_encryption_properties.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.begin_create_or_update( @@ -69,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupEncryptionProperties.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupEncryptionProperties.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_extensions.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_extensions.py index c2715df00e72..aa8276375193 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_extensions.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_extensions.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.begin_create_or_update( @@ -77,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupExtensions.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupExtensions.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_create_or_update_create_confidential.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_create_or_update_create_confidential.py deleted file mode 100644 index 7b92f39dad8a..000000000000 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_create_or_update_create_confidential.py +++ /dev/null @@ -1,68 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerinstance import ContainerInstanceManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerinstance -# USAGE - python container_group_profile_create_or_update_create_confidential.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerInstanceManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.container_group_profiles.create_or_update( - resource_group_name="demo", - container_group_profile_name="demo1", - container_group_profile={ - "location": "westeurope", - "properties": { - "confidentialComputeProperties": { - "ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19" - }, - "containers": [ - { - "name": "accdemo", - "properties": { - "command": [], - "environmentVariables": [], - "image": "confiimage", - "ports": [{"port": 8000}], - "resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}}, - "securityContext": {"capabilities": {"add": ["CAP_NET_ADMIN"]}, "privileged": False}, - }, - } - ], - "imageRegistryCredentials": [], - "ipAddress": {"ports": [{"port": 8000, "protocol": "TCP"}], "type": "Public"}, - "osType": "Linux", - "sku": "Confidential", - }, - "zones": ["1"], - }, - ) - print(response) - - -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_CreateConfidential.json -if __name__ == "__main__": - main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_create_or_update_encryption_properties.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_create_or_update_encryption_properties.py deleted file mode 100644 index ec7389df39d0..000000000000 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_create_or_update_encryption_properties.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerinstance import ContainerInstanceManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerinstance -# USAGE - python container_group_profile_create_or_update_encryption_properties.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerInstanceManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.container_group_profiles.create_or_update( - resource_group_name="demo", - container_group_profile_name="demo1", - container_group_profile={ - "location": "eastus2", - "properties": { - "containers": [ - { - "name": "demo1", - "properties": { - "command": [], - "environmentVariables": [], - "image": "nginx", - "ports": [{"port": 80}], - "resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}}, - }, - } - ], - "encryptionProperties": { - "identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity", - "keyName": "test-key", - "keyVersion": "", - "vaultBaseUrl": "https://testkeyvault.vault.azure.net", - }, - "imageRegistryCredentials": [], - "ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Public"}, - "osType": "Linux", - }, - "zones": ["1"], - }, - ) - print(response) - - -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_EncryptionProperties.json -if __name__ == "__main__": - main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_create_or_update_extensions.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_create_or_update_extensions.py deleted file mode 100644 index acf5e175be98..000000000000 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_create_or_update_extensions.py +++ /dev/null @@ -1,78 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerinstance import ContainerInstanceManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerinstance -# USAGE - python container_group_profile_create_or_update_extensions.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerInstanceManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.container_group_profiles.create_or_update( - resource_group_name="demo", - container_group_profile_name="demo1", - container_group_profile={ - "location": "eastus2", - "properties": { - "containers": [ - { - "name": "demo1", - "properties": { - "command": [], - "environmentVariables": [], - "image": "nginx", - "ports": [{"port": 80}], - "resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}}, - }, - } - ], - "extensions": [ - { - "name": "kube-proxy", - "properties": { - "extensionType": "kube-proxy", - "protectedSettings": {"kubeConfig": ""}, - "settings": {"clusterCidr": "10.240.0.0/16", "kubeVersion": "v1.9.10"}, - "version": "1.0", - }, - }, - { - "name": "vk-realtime-metrics", - "properties": {"extensionType": "realtime-metrics", "version": "1.0"}, - }, - ], - "imageRegistryCredentials": [], - "ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Private"}, - "osType": "Linux", - }, - "zones": ["1"], - }, - ) - print(response) - - -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_Extensions.json -if __name__ == "__main__": - main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_get_by_revision_number.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_get_by_revision_number.py index c32a0dd2f7df..0347da3ef010 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_get_by_revision_number.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_get_by_revision_number.py @@ -30,7 +30,7 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.container_group_profile.get_by_revision_number( + response = client.cg_profile.get_by_revision_number( resource_group_name="demo", container_group_profile_name="demo1", revision_number="1", @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileGetByRevisionNumber.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupProfileGetByRevisionNumber.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_list_all_revisions.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_list_all_revisions.py index af8ac8248b1e..0dc3d0d11efa 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_list_all_revisions.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profile_list_all_revisions.py @@ -30,7 +30,7 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.container_group_profile.list_all_revisions( + response = client.cg_profile.list_all_revisions( resource_group_name="demo", container_group_profile_name="demo1", ) @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileListAllRevisions.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupProfileListAllRevisions.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_create_or_update.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_create_or_update.py deleted file mode 100644 index 79a9668b4f80..000000000000 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_create_or_update.py +++ /dev/null @@ -1,92 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerinstance import ContainerInstanceManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerinstance -# USAGE - python container_group_profiles_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerInstanceManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.container_group_profiles.create_or_update( - resource_group_name="demo", - container_group_profile_name="demo1", - container_group_profile={ - "location": "west us", - "properties": { - "containers": [ - { - "name": "demo1", - "properties": { - "command": [], - "environmentVariables": [], - "image": "nginx", - "ports": [{"port": 80}], - "resources": {"requests": {"cpu": 1, "gpu": {"count": 1, "sku": "K80"}, "memoryInGB": 1.5}}, - "volumeMounts": [ - {"mountPath": "/mnt/volume1", "name": "volume1", "readOnly": False}, - {"mountPath": "/mnt/volume2", "name": "volume2", "readOnly": False}, - {"mountPath": "/mnt/volume3", "name": "volume3", "readOnly": True}, - ], - }, - } - ], - "diagnostics": { - "logAnalytics": { - "logType": "ContainerInsights", - "metadata": {"pod-uuid": "test-metadata-value"}, - "workspaceId": "workspaceid", - "workspaceKey": "workspaceKey", - "workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace", - } - }, - "imageRegistryCredentials": [], - "ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Public"}, - "osType": "Linux", - "volumes": [ - { - "azureFile": { - "shareName": "shareName", - "storageAccountKey": "accountKey", - "storageAccountName": "accountName", - }, - "name": "volume1", - }, - {"emptyDir": {}, "name": "volume2"}, - { - "name": "volume3", - "secret": {"secretKey1": "SecretValue1InBase64", "secretKey2": "SecretValue2InBase64"}, - }, - ], - }, - "zones": ["1"], - }, - ) - print(response) - - -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesCreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_delete.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_delete.py index 6d6b02fbfe75..ce387d15c701 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_delete.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_delete.py @@ -30,12 +30,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - client.container_group_profiles.delete( + client.cg_profile.begin_delete( resource_group_name="demo", container_group_profile_name="demo1", - ) + ).result() -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesDelete.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupProfilesDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_get.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_get.py index 32106f87ab66..2325ae6fdc2a 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_get.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_get.py @@ -30,13 +30,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.container_group_profiles.get( + response = client.cg_profile.get( resource_group_name="demo", container_group_profile_name="demo1", ) print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGet.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupProfilesGet.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_get_priority.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_get_priority.py index 42cd14fffda8..286848eaa465 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_get_priority.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_get_priority.py @@ -30,13 +30,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.container_group_profiles.get( + response = client.cg_profile.get( resource_group_name="demo", container_group_profile_name="demo1", ) print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGetPriority.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupProfilesGetPriority.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_list.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_list.py index 4206aaef6772..aa78ee81ae6d 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_list.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_list.py @@ -30,11 +30,11 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.container_group_profiles.list() + response = client.cg_profiles.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesList.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupProfilesList.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_list_by_resource_group.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_list_by_resource_group.py index 888588bd2c92..421df2bc6e23 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_list_by_resource_group.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_list_by_resource_group.py @@ -30,13 +30,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.container_group_profiles.list_by_resource_group( + response = client.cg_profiles.list_by_resource_group( resource_group_name="demo", ) for item in response: print(item) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesListByResourceGroup.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupProfilesListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_patch.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_patch.py index ba009fb17d70..6eb3056facec 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_patch.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_profiles_patch.py @@ -30,7 +30,7 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.container_group_profiles.patch( + response = client.cg_profile.update( resource_group_name="demoResource", container_group_profile_name="demo1", properties={"tags": {"tag1key": "tag1Value", "tag2key": "tag2Value"}}, @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesPatch.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupProfilesPatch.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_usage.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_usage.py index 9acf3f8bac12..b8cd18616e7f 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_usage.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_group_usage.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.location.list_usage( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupUsage.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupUsage.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_or_update.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_or_update.py index 9f0f1547cc1c..60ac31ef0749 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_or_update.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_or_update.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.begin_create_or_update( @@ -107,6 +107,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreateOrUpdate.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_or_update_secret_reference.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_or_update_secret_reference.py new file mode 100644 index 000000000000..718b8eef822d --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_or_update_secret_reference.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.containerinstance import ContainerInstanceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerinstance +# USAGE + python container_groups_create_or_update_secret_reference.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerInstanceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.container_groups.begin_create_or_update( + resource_group_name="demo", + container_group_name="demo1", + container_group={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {} + }, + }, + "location": "west us", + "properties": { + "containers": [ + { + "name": "demo1", + "properties": { + "command": [], + "environmentVariables": [{"name": "envSecret", "secureValueReference": "envSecretRef"}], + "image": "privateRegistryImage", + "ports": [{"port": 80}], + "resources": {"requests": {"cpu": 1, "gpu": {"count": 1, "sku": "K80"}, "memoryInGB": 1.5}}, + "volumeMounts": [ + {"mountPath": "/mnt/volume1", "name": "volume1", "readOnly": False}, + {"mountPath": "/mnt/volume2", "name": "volume2", "readOnly": False}, + {"mountPath": "/mnt/volume3", "name": "volume3", "readOnly": True}, + ], + }, + } + ], + "diagnostics": { + "logAnalytics": { + "logType": "ContainerInsights", + "metadata": {"test-key": "test-metadata-value"}, + "workspaceId": "workspaceid", + "workspaceKey": "workspaceKey", + "workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace", + } + }, + "dnsConfig": { + "nameServers": ["1.1.1.1"], + "options": "ndots:2", + "searchDomains": "cluster.local svc.cluster.local", + }, + "imageRegistryCredentials": [ + { + "passwordReference": "privateRegistryKeyRef", + "server": "demoregistry.azurecr.io", + "username": "registryUserName", + } + ], + "ipAddress": { + "autoGeneratedDomainNameLabelScope": "Unsecure", + "dnsNameLabel": "dnsnamelabel1", + "ports": [{"port": 80, "protocol": "TCP"}], + "type": "Public", + }, + "osType": "Linux", + "secretReferences": [ + { + "identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name", + "name": "envSecretRef", + "secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/envSecret", + }, + { + "identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name", + "name": "accountKeyRef", + "secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/accountKey", + }, + { + "identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name", + "name": "volumeSecretRef", + "secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/volumeSecret", + }, + { + "identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name", + "name": "privateRegistryKeyRef", + "secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/privateRegistryKey", + }, + ], + "subnetIds": [ + { + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]" + } + ], + "volumes": [ + { + "azureFile": { + "shareName": "shareName", + "storageAccountKeyReference": "accountKeyRef", + "storageAccountName": "accountName", + }, + "name": "volume1", + }, + {"emptyDir": {}, "name": "volume2"}, + { + "name": "volume3", + "secret": {"secretKey1": "SecretValue1InBase64"}, + "secretReference": {"secretKey2": "volumeSecretRef"}, + }, + ], + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsCreateOrUpdateSecretReference.json +if __name__ == "__main__": + main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_priority.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_priority.py index 7afd66c684c9..0d00c7f019e7 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_priority.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_create_priority.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.begin_create_or_update( @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreatePriority.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsCreatePriority.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_delete.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_delete.py index 15f8c832302c..557728743dc0 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_delete.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_delete.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.begin_delete( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsDelete.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_failed.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_failed.py index 56c75cb1046c..820803b502a1 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_failed.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_failed.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Failed.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsGet_Failed.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_priority.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_priority.py index 7bbcc1a466bc..d5585286d4ed 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_priority.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_priority.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGetPriority.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsGetPriority.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_succeeded.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_succeeded.py index b534f3bb1227..b4b84f917725 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_succeeded.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_get_succeeded.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Succeeded.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsGet_Succeeded.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_list.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_list.py index 546844ad6e15..0f0441abfc9a 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_list.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_list.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsList.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsList.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_list_by_resource_group.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_list_by_resource_group.py index ef1b0431b9d7..801eec2d3a3f 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_list_by_resource_group.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_list_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.container_groups.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsListByResourceGroup.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_profile_create_or_update_create_priority.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_profile_create_or_update_create_priority.py deleted file mode 100644 index d913940cd4a1..000000000000 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_profile_create_or_update_create_priority.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerinstance import ContainerInstanceManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerinstance -# USAGE - python container_groups_profile_create_or_update_create_priority.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerInstanceManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.container_group_profiles.create_or_update( - resource_group_name="demo", - container_group_profile_name="demo1", - container_group_profile={ - "location": "eastus", - "properties": { - "containers": [ - { - "name": "test-container-001", - "properties": { - "command": ["/bin/sh", "-c", "sleep 10"], - "image": "alpine:latest", - "resources": {"requests": {"cpu": 1, "memoryInGB": 1}}, - }, - } - ], - "osType": "Linux", - "priority": "Spot", - "restartPolicy": "Never", - "sku": "Standard", - }, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsProfileCreateOrUpdate_CreatePriority.json -if __name__ == "__main__": - main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_restart.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_restart.py index 978ab25144b5..22285aa2a342 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_restart.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_restart.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) client.container_groups.begin_restart( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsRestart.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsRestart.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_start.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_start.py index d40773c08b2b..56dce24b6c93 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_start.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_start.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) client.container_groups.begin_start( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStart.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsStart.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_stop.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_stop.py index 5b5969ca0aac..a9b12540d156 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_stop.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_groups_stop.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) client.container_groups.stop( @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStop.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerGroupsStop.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_list_logs.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_list_logs.py index 855578377701..2963d6f481c8 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_list_logs.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/container_list_logs.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) response = client.containers.list_logs( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerListLogs.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/ContainerListLogs.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/operations_list.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/operations_list.py index a02cb7e8094c..cc6ad63f22e8 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/operations_list.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/OperationsList.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/subnet_service_association_link_delete.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/subnet_service_association_link_delete.py index 3f588b61c869..2cc6b9bae197 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/subnet_service_association_link_delete.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_samples/subnet_service_association_link_delete.py @@ -27,7 +27,7 @@ def main(): client = ContainerInstanceManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) client.subnet_service_association_link.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/SubnetServiceAssociationLinkDelete.json +# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-11-01-preview/examples/SubnetServiceAssociationLinkDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profile_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profile_operations.py new file mode 100644 index 000000000000..96a31ad5efa4 --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profile_operations.py @@ -0,0 +1,304 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerinstance import ContainerInstanceManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerInstanceManagementCGProfileOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerInstanceManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.cg_profile.create_or_update( + resource_group_name=resource_group.name, + container_group_profile_name="str", + container_group_profile={ + "confidentialComputeProperties": {"ccePolicy": "str"}, + "containers": [ + { + "image": "str", + "name": "str", + "resources": { + "requests": {"cpu": 0.0, "memoryInGB": 0.0, "gpu": {"count": 0, "sku": "str"}}, + "limits": {"cpu": 0.0, "gpu": {"count": 0, "sku": "str"}, "memoryInGB": 0.0}, + }, + "command": ["str"], + "environmentVariables": [ + {"name": "str", "secureValue": "str", "secureValueReference": "str", "value": "str"} + ], + "instanceView": { + "currentState": { + "detailStatus": "str", + "exitCode": 0, + "finishTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "events": [ + { + "count": 0, + "firstTimestamp": "2020-02-20 00:00:00", + "lastTimestamp": "2020-02-20 00:00:00", + "message": "str", + "name": "str", + "type": "str", + } + ], + "previousState": { + "detailStatus": "str", + "exitCode": 0, + "finishTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "restartCount": 0, + }, + "livenessProbe": { + "exec": {"command": ["str"]}, + "failureThreshold": 0, + "httpGet": { + "port": 0, + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "ports": [{"port": 0, "protocol": "str"}], + "readinessProbe": { + "exec": {"command": ["str"]}, + "failureThreshold": 0, + "httpGet": { + "port": 0, + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "securityContext": { + "allowPrivilegeEscalation": bool, + "capabilities": {"add": ["str"], "drop": ["str"]}, + "privileged": bool, + "runAsGroup": 0, + "runAsUser": 0, + "seccompProfile": "str", + }, + "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}], + } + ], + "diagnostics": { + "logAnalytics": { + "workspaceId": "str", + "workspaceKey": "str", + "logType": "str", + "metadata": {"str": "str"}, + "workspaceResourceId": "str", + } + }, + "encryptionProperties": { + "keyName": "str", + "keyVersion": "str", + "vaultBaseUrl": "str", + "identity": "str", + }, + "extensions": [ + {"name": "str", "extensionType": "str", "protectedSettings": {}, "settings": {}, "version": "str"} + ], + "id": "str", + "imageRegistryCredentials": [ + { + "server": "str", + "identity": "str", + "identityUrl": "str", + "password": "str", + "passwordReference": "str", + "username": "str", + } + ], + "initContainers": [ + { + "name": "str", + "command": ["str"], + "environmentVariables": [ + {"name": "str", "secureValue": "str", "secureValueReference": "str", "value": "str"} + ], + "image": "str", + "instanceView": { + "currentState": { + "detailStatus": "str", + "exitCode": 0, + "finishTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "events": [ + { + "count": 0, + "firstTimestamp": "2020-02-20 00:00:00", + "lastTimestamp": "2020-02-20 00:00:00", + "message": "str", + "name": "str", + "type": "str", + } + ], + "previousState": { + "detailStatus": "str", + "exitCode": 0, + "finishTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "restartCount": 0, + }, + "securityContext": { + "allowPrivilegeEscalation": bool, + "capabilities": {"add": ["str"], "drop": ["str"]}, + "privileged": bool, + "runAsGroup": 0, + "runAsUser": 0, + "seccompProfile": "str", + }, + "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}], + } + ], + "ipAddress": { + "ports": [{"port": 0, "protocol": "str"}], + "type": "str", + "autoGeneratedDomainNameLabelScope": "Unsecure", + "dnsNameLabel": "str", + "fqdn": "str", + "ip": "str", + }, + "location": "str", + "name": "str", + "osType": "str", + "priority": "str", + "registeredRevisions": [0], + "restartPolicy": "str", + "revision": 0, + "securityContext": { + "allowPrivilegeEscalation": bool, + "capabilities": {"add": ["str"], "drop": ["str"]}, + "privileged": bool, + "runAsGroup": 0, + "runAsUser": 0, + "seccompProfile": "str", + }, + "shutdownGracePeriod": "2020-02-20 00:00:00", + "sku": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "timeToLive": "2020-02-20 00:00:00", + "type": "str", + "useKrypton": bool, + "volumes": [ + { + "name": "str", + "azureFile": { + "shareName": "str", + "storageAccountName": "str", + "readOnly": bool, + "storageAccountKey": "str", + "storageAccountKeyReference": "str", + }, + "emptyDir": {}, + "gitRepo": {"repository": "str", "directory": "str", "revision": "str"}, + "secret": {"str": "str"}, + "secretReference": {"str": "str"}, + } + ], + "zones": ["str"], + }, + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.cg_profile.update( + resource_group_name=resource_group.name, + container_group_profile_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.cg_profile.get( + resource_group_name=resource_group.name, + container_group_profile_name="str", + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.cg_profile.begin_delete( + resource_group_name=resource_group.name, + container_group_profile_name="str", + api_version="2024-11-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_all_revisions(self, resource_group): + response = self.client.cg_profile.list_all_revisions( + resource_group_name=resource_group.name, + container_group_profile_name="str", + api_version="2024-11-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_revision_number(self, resource_group): + response = self.client.cg_profile.get_by_revision_number( + resource_group_name=resource_group.name, + container_group_profile_name="str", + revision_number="str", + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profile_operations_async.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profile_operations_async.py new file mode 100644 index 000000000000..9024bf05c743 --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profile_operations_async.py @@ -0,0 +1,307 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerinstance.aio import ContainerInstanceManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerInstanceManagementCGProfileOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerInstanceManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.cg_profile.create_or_update( + resource_group_name=resource_group.name, + container_group_profile_name="str", + container_group_profile={ + "confidentialComputeProperties": {"ccePolicy": "str"}, + "containers": [ + { + "image": "str", + "name": "str", + "resources": { + "requests": {"cpu": 0.0, "memoryInGB": 0.0, "gpu": {"count": 0, "sku": "str"}}, + "limits": {"cpu": 0.0, "gpu": {"count": 0, "sku": "str"}, "memoryInGB": 0.0}, + }, + "command": ["str"], + "environmentVariables": [ + {"name": "str", "secureValue": "str", "secureValueReference": "str", "value": "str"} + ], + "instanceView": { + "currentState": { + "detailStatus": "str", + "exitCode": 0, + "finishTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "events": [ + { + "count": 0, + "firstTimestamp": "2020-02-20 00:00:00", + "lastTimestamp": "2020-02-20 00:00:00", + "message": "str", + "name": "str", + "type": "str", + } + ], + "previousState": { + "detailStatus": "str", + "exitCode": 0, + "finishTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "restartCount": 0, + }, + "livenessProbe": { + "exec": {"command": ["str"]}, + "failureThreshold": 0, + "httpGet": { + "port": 0, + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "ports": [{"port": 0, "protocol": "str"}], + "readinessProbe": { + "exec": {"command": ["str"]}, + "failureThreshold": 0, + "httpGet": { + "port": 0, + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "timeoutSeconds": 0, + }, + "securityContext": { + "allowPrivilegeEscalation": bool, + "capabilities": {"add": ["str"], "drop": ["str"]}, + "privileged": bool, + "runAsGroup": 0, + "runAsUser": 0, + "seccompProfile": "str", + }, + "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}], + } + ], + "diagnostics": { + "logAnalytics": { + "workspaceId": "str", + "workspaceKey": "str", + "logType": "str", + "metadata": {"str": "str"}, + "workspaceResourceId": "str", + } + }, + "encryptionProperties": { + "keyName": "str", + "keyVersion": "str", + "vaultBaseUrl": "str", + "identity": "str", + }, + "extensions": [ + {"name": "str", "extensionType": "str", "protectedSettings": {}, "settings": {}, "version": "str"} + ], + "id": "str", + "imageRegistryCredentials": [ + { + "server": "str", + "identity": "str", + "identityUrl": "str", + "password": "str", + "passwordReference": "str", + "username": "str", + } + ], + "initContainers": [ + { + "name": "str", + "command": ["str"], + "environmentVariables": [ + {"name": "str", "secureValue": "str", "secureValueReference": "str", "value": "str"} + ], + "image": "str", + "instanceView": { + "currentState": { + "detailStatus": "str", + "exitCode": 0, + "finishTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "events": [ + { + "count": 0, + "firstTimestamp": "2020-02-20 00:00:00", + "lastTimestamp": "2020-02-20 00:00:00", + "message": "str", + "name": "str", + "type": "str", + } + ], + "previousState": { + "detailStatus": "str", + "exitCode": 0, + "finishTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + "restartCount": 0, + }, + "securityContext": { + "allowPrivilegeEscalation": bool, + "capabilities": {"add": ["str"], "drop": ["str"]}, + "privileged": bool, + "runAsGroup": 0, + "runAsUser": 0, + "seccompProfile": "str", + }, + "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}], + } + ], + "ipAddress": { + "ports": [{"port": 0, "protocol": "str"}], + "type": "str", + "autoGeneratedDomainNameLabelScope": "Unsecure", + "dnsNameLabel": "str", + "fqdn": "str", + "ip": "str", + }, + "location": "str", + "name": "str", + "osType": "str", + "priority": "str", + "registeredRevisions": [0], + "restartPolicy": "str", + "revision": 0, + "securityContext": { + "allowPrivilegeEscalation": bool, + "capabilities": {"add": ["str"], "drop": ["str"]}, + "privileged": bool, + "runAsGroup": 0, + "runAsUser": 0, + "seccompProfile": "str", + }, + "shutdownGracePeriod": "2020-02-20 00:00:00", + "sku": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "timeToLive": "2020-02-20 00:00:00", + "type": "str", + "useKrypton": bool, + "volumes": [ + { + "name": "str", + "azureFile": { + "shareName": "str", + "storageAccountName": "str", + "readOnly": bool, + "storageAccountKey": "str", + "storageAccountKeyReference": "str", + }, + "emptyDir": {}, + "gitRepo": {"repository": "str", "directory": "str", "revision": "str"}, + "secret": {"str": "str"}, + "secretReference": {"str": "str"}, + } + ], + "zones": ["str"], + }, + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.cg_profile.update( + resource_group_name=resource_group.name, + container_group_profile_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.cg_profile.get( + resource_group_name=resource_group.name, + container_group_profile_name="str", + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.cg_profile.begin_delete( + resource_group_name=resource_group.name, + container_group_profile_name="str", + api_version="2024-11-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_all_revisions(self, resource_group): + response = self.client.cg_profile.list_all_revisions( + resource_group_name=resource_group.name, + container_group_profile_name="str", + api_version="2024-11-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_by_revision_number(self, resource_group): + response = await self.client.cg_profile.get_by_revision_number( + resource_group_name=resource_group.name, + container_group_profile_name="str", + revision_number="str", + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profiles_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profiles_operations.py new file mode 100644 index 000000000000..de853facb66a --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profiles_operations.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerinstance import ContainerInstanceManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerInstanceManagementCGProfilesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerInstanceManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.cg_profiles.list_by_subscription( + api_version="2024-11-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.cg_profiles.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profiles_operations_async.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profiles_operations_async.py new file mode 100644 index 000000000000..d123b4f56e16 --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_cg_profiles_operations_async.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerinstance.aio import ContainerInstanceManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerInstanceManagementCGProfilesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerInstanceManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.cg_profiles.list_by_subscription( + api_version="2024-11-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.cg_profiles.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_container_groups_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_container_groups_operations.py index 5aa36a394fc9..70f221f6f4fc 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_container_groups_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_container_groups_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list(self, resource_group): response = self.client.container_groups.list( - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_list(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.container_groups.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): response = self.client.container_groups.get( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -60,11 +60,16 @@ def test_begin_create_or_update(self, resource_group): container_group={ "containers": [ { + "image": "str", "name": "str", + "resources": { + "requests": {"cpu": 0.0, "memoryInGB": 0.0, "gpu": {"count": 0, "sku": "str"}}, + "limits": {"cpu": 0.0, "gpu": {"count": 0, "sku": "str"}, "memoryInGB": 0.0}, + }, "command": ["str"], - "configMap": {"keyValuePairs": {"str": "str"}}, - "environmentVariables": [{"name": "str", "secureValue": "str", "value": "str"}], - "image": "str", + "environmentVariables": [ + {"name": "str", "secureValue": "str", "secureValueReference": "str", "value": "str"} + ], "instanceView": { "currentState": { "detailStatus": "str", @@ -121,10 +126,6 @@ def test_begin_create_or_update(self, resource_group): "successThreshold": 0, "timeoutSeconds": 0, }, - "resources": { - "requests": {"cpu": 0.0, "memoryInGB": 0.0, "gpu": {"count": 0, "sku": "str"}}, - "limits": {"cpu": 0.0, "gpu": {"count": 0, "sku": "str"}, "memoryInGB": 0.0}, - }, "securityContext": { "allowPrivilegeEscalation": bool, "capabilities": {"add": ["str"], "drop": ["str"]}, @@ -136,8 +137,8 @@ def test_begin_create_or_update(self, resource_group): "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}], } ], + "osType": "str", "confidentialComputeProperties": {"ccePolicy": "str"}, - "containerGroupProfile": {"id": "str", "revision": 0}, "diagnostics": { "logAnalytics": { "workspaceId": "str", @@ -165,13 +166,22 @@ def test_begin_create_or_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "imageRegistryCredentials": [ - {"server": "str", "identity": "str", "identityUrl": "str", "password": "str", "username": "str"} + { + "server": "str", + "identity": "str", + "identityUrl": "str", + "password": "str", + "passwordReference": "str", + "username": "str", + } ], "initContainers": [ { "name": "str", "command": ["str"], - "environmentVariables": [{"name": "str", "secureValue": "str", "value": "str"}], + "environmentVariables": [ + {"name": "str", "secureValue": "str", "secureValueReference": "str", "value": "str"} + ], "image": "str", "instanceView": { "currentState": { @@ -232,15 +242,13 @@ def test_begin_create_or_update(self, resource_group): "fqdn": "str", "ip": "str", }, - "isCreatedFromStandbyPool": bool, "location": "str", "name": "str", - "osType": "str", "priority": "str", "provisioningState": "str", "restartPolicy": "str", + "secretReferences": [{"identity": "str", "name": "str", "secretReferenceUri": "str"}], "sku": "str", - "standbyPoolProfile": {"failContainerGroupCreateOnReuseFailure": bool, "id": "str"}, "subnetIds": [{"id": "str", "name": "str"}], "tags": {"str": "str"}, "type": "str", @@ -252,15 +260,17 @@ def test_begin_create_or_update(self, resource_group): "storageAccountName": "str", "readOnly": bool, "storageAccountKey": "str", + "storageAccountKeyReference": "str", }, "emptyDir": {}, "gitRepo": {"repository": "str", "directory": "str", "revision": "str"}, "secret": {"str": "str"}, + "secretReference": {"str": "str"}, } ], "zones": ["str"], }, - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -280,7 +290,7 @@ def test_update(self, resource_group): "type": "str", "zones": ["str"], }, - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -292,7 +302,7 @@ def test_begin_delete(self, resource_group): response = self.client.container_groups.begin_delete( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -304,7 +314,7 @@ def test_begin_restart(self, resource_group): response = self.client.container_groups.begin_restart( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -316,7 +326,7 @@ def test_stop(self, resource_group): response = self.client.container_groups.stop( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -328,7 +338,7 @@ def test_begin_start(self, resource_group): response = self.client.container_groups.begin_start( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -340,7 +350,7 @@ def test_get_outbound_network_dependencies_endpoints(self, resource_group): response = self.client.container_groups.get_outbound_network_dependencies_endpoints( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_container_groups_operations_async.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_container_groups_operations_async.py index 483ef447d8b1..cb0bf0acd658 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_container_groups_operations_async.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_container_groups_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.container_groups.list( - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_list(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.container_groups.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): response = await self.client.container_groups.get( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -62,11 +62,16 @@ async def test_begin_create_or_update(self, resource_group): container_group={ "containers": [ { + "image": "str", "name": "str", + "resources": { + "requests": {"cpu": 0.0, "memoryInGB": 0.0, "gpu": {"count": 0, "sku": "str"}}, + "limits": {"cpu": 0.0, "gpu": {"count": 0, "sku": "str"}, "memoryInGB": 0.0}, + }, "command": ["str"], - "configMap": {"keyValuePairs": {"str": "str"}}, - "environmentVariables": [{"name": "str", "secureValue": "str", "value": "str"}], - "image": "str", + "environmentVariables": [ + {"name": "str", "secureValue": "str", "secureValueReference": "str", "value": "str"} + ], "instanceView": { "currentState": { "detailStatus": "str", @@ -123,10 +128,6 @@ async def test_begin_create_or_update(self, resource_group): "successThreshold": 0, "timeoutSeconds": 0, }, - "resources": { - "requests": {"cpu": 0.0, "memoryInGB": 0.0, "gpu": {"count": 0, "sku": "str"}}, - "limits": {"cpu": 0.0, "gpu": {"count": 0, "sku": "str"}, "memoryInGB": 0.0}, - }, "securityContext": { "allowPrivilegeEscalation": bool, "capabilities": {"add": ["str"], "drop": ["str"]}, @@ -138,8 +139,8 @@ async def test_begin_create_or_update(self, resource_group): "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}], } ], + "osType": "str", "confidentialComputeProperties": {"ccePolicy": "str"}, - "containerGroupProfile": {"id": "str", "revision": 0}, "diagnostics": { "logAnalytics": { "workspaceId": "str", @@ -173,13 +174,22 @@ async def test_begin_create_or_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "imageRegistryCredentials": [ - {"server": "str", "identity": "str", "identityUrl": "str", "password": "str", "username": "str"} + { + "server": "str", + "identity": "str", + "identityUrl": "str", + "password": "str", + "passwordReference": "str", + "username": "str", + } ], "initContainers": [ { "name": "str", "command": ["str"], - "environmentVariables": [{"name": "str", "secureValue": "str", "value": "str"}], + "environmentVariables": [ + {"name": "str", "secureValue": "str", "secureValueReference": "str", "value": "str"} + ], "image": "str", "instanceView": { "currentState": { @@ -240,15 +250,13 @@ async def test_begin_create_or_update(self, resource_group): "fqdn": "str", "ip": "str", }, - "isCreatedFromStandbyPool": bool, "location": "str", "name": "str", - "osType": "str", "priority": "str", "provisioningState": "str", "restartPolicy": "str", + "secretReferences": [{"identity": "str", "name": "str", "secretReferenceUri": "str"}], "sku": "str", - "standbyPoolProfile": {"failContainerGroupCreateOnReuseFailure": bool, "id": "str"}, "subnetIds": [{"id": "str", "name": "str"}], "tags": {"str": "str"}, "type": "str", @@ -260,15 +268,17 @@ async def test_begin_create_or_update(self, resource_group): "storageAccountName": "str", "readOnly": bool, "storageAccountKey": "str", + "storageAccountKeyReference": "str", }, "emptyDir": {}, "gitRepo": {"repository": "str", "directory": "str", "revision": "str"}, "secret": {"str": "str"}, + "secretReference": {"str": "str"}, } ], "zones": ["str"], }, - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -289,7 +299,7 @@ async def test_update(self, resource_group): "type": "str", "zones": ["str"], }, - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -302,7 +312,7 @@ async def test_begin_delete(self, resource_group): await self.client.container_groups.begin_delete( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -316,7 +326,7 @@ async def test_begin_restart(self, resource_group): await self.client.container_groups.begin_restart( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -329,7 +339,7 @@ async def test_stop(self, resource_group): response = await self.client.container_groups.stop( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -342,7 +352,7 @@ async def test_begin_start(self, resource_group): await self.client.container_groups.begin_start( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -355,7 +365,7 @@ async def test_get_outbound_network_dependencies_endpoints(self, resource_group) response = await self.client.container_groups.get_outbound_network_dependencies_endpoints( resource_group_name=resource_group.name, container_group_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_containers_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_containers_operations.py index 7d98e5b3708d..d31035a78fc1 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_containers_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_containers_operations.py @@ -25,7 +25,7 @@ def test_list_logs(self, resource_group): resource_group_name=resource_group.name, container_group_name="str", container_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -39,7 +39,7 @@ def test_execute_command(self, resource_group): container_group_name="str", container_name="str", container_exec_request={"command": "str", "terminalSize": {"cols": 0, "rows": 0}}, - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -52,7 +52,7 @@ def test_attach(self, resource_group): resource_group_name=resource_group.name, container_group_name="str", container_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_containers_operations_async.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_containers_operations_async.py index 7953336c2ad3..ad90138d4a9b 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_containers_operations_async.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_containers_operations_async.py @@ -26,7 +26,7 @@ async def test_list_logs(self, resource_group): resource_group_name=resource_group.name, container_group_name="str", container_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -40,7 +40,7 @@ async def test_execute_command(self, resource_group): container_group_name="str", container_name="str", container_exec_request={"command": "str", "terminalSize": {"cols": 0, "rows": 0}}, - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself @@ -53,7 +53,7 @@ async def test_attach(self, resource_group): resource_group_name=resource_group.name, container_group_name="str", container_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_location_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_location_operations.py index 67413abe1b7e..13d155e7a1e3 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_location_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_location_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_list_usage(self, resource_group): response = self.client.location.list_usage( location="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ def test_list_usage(self, resource_group): def test_list_cached_images(self, resource_group): response = self.client.location.list_cached_images( location="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_list_cached_images(self, resource_group): def test_list_capabilities(self, resource_group): response = self.client.location.list_capabilities( location="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_location_operations_async.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_location_operations_async.py index ab4c08275d34..535483dda591 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_location_operations_async.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_location_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_list_usage(self, resource_group): response = self.client.location.list_usage( location="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -35,7 +35,7 @@ async def test_list_usage(self, resource_group): async def test_list_cached_images(self, resource_group): response = self.client.location.list_cached_images( location="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_list_cached_images(self, resource_group): async def test_list_capabilities(self, resource_group): response = self.client.location.list_capabilities( location="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_ngroups_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_ngroups_operations.py new file mode 100644 index 000000000000..b2688e2e1103 --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_ngroups_operations.py @@ -0,0 +1,286 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerinstance import ContainerInstanceManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerInstanceManagementNGroupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerInstanceManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.ngroups.get( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.ngroups.begin_create_or_update( + resource_group_name=resource_group.name, + ngroups_name="str", + n_group={ + "containerGroupProfiles": [ + { + "containerGroupProperties": { + "containers": [ + { + "name": "str", + "properties": { + "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}] + }, + } + ], + "subnetIds": [{"id": "str", "name": "str"}], + "volumes": [ + { + "name": "str", + "azureFile": { + "shareName": "str", + "storageAccountName": "str", + "readOnly": bool, + "storageAccountKey": "str", + "storageAccountKeyReference": "str", + }, + } + ], + }, + "networkProfile": { + "applicationGateway": {"backendAddressPools": [{"resource": "str"}], "resource": "str"}, + "loadBalancer": {"backendAddressPools": [{"resource": "str"}]}, + }, + "resource": {"id": "str"}, + "revision": 0, + "storageProfile": { + "fileShares": [ + { + "name": "str", + "properties": {"shareAccessTier": "str", "shareAccessType": "str"}, + "resourceGroupName": "str", + "storageAccountName": "str", + } + ] + }, + } + ], + "elasticProfile": { + "containerGroupNamingPolicy": {"guidNamingPolicy": {"prefix": "str"}}, + "desiredCount": 0, + "maintainDesiredCount": bool, + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "placementProfile": {"faultDomainCount": 0}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "updateProfile": { + "rollingUpdateProfile": { + "inPlaceUpdate": bool, + "maxBatchPercent": 0, + "maxUnhealthyPercent": 0, + "pauseTimeBetweenBatches": "str", + }, + "updateMode": "str", + }, + "zones": ["str"], + }, + api_version="2024-11-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.ngroups.begin_update( + resource_group_name=resource_group.name, + ngroups_name="str", + n_group={ + "containerGroupProfiles": [ + { + "containerGroupProperties": { + "containers": [ + { + "name": "str", + "properties": { + "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}] + }, + } + ], + "subnetIds": [{"id": "str", "name": "str"}], + "volumes": [ + { + "name": "str", + "azureFile": { + "shareName": "str", + "storageAccountName": "str", + "readOnly": bool, + "storageAccountKey": "str", + "storageAccountKeyReference": "str", + }, + } + ], + }, + "networkProfile": { + "applicationGateway": {"backendAddressPools": [{"resource": "str"}], "resource": "str"}, + "loadBalancer": {"backendAddressPools": [{"resource": "str"}]}, + }, + "resource": {"id": "str"}, + "revision": 0, + "storageProfile": { + "fileShares": [ + { + "name": "str", + "properties": {"shareAccessTier": "str", "shareAccessType": "str"}, + "resourceGroupName": "str", + "storageAccountName": "str", + } + ] + }, + } + ], + "elasticProfile": { + "containerGroupNamingPolicy": {"guidNamingPolicy": {"prefix": "str"}}, + "desiredCount": 0, + "maintainDesiredCount": bool, + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "placementProfile": {"faultDomainCount": 0}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "updateProfile": { + "rollingUpdateProfile": { + "inPlaceUpdate": bool, + "maxBatchPercent": 0, + "maxUnhealthyPercent": 0, + "pauseTimeBetweenBatches": "str", + }, + "updateMode": "str", + }, + "zones": ["str"], + }, + api_version="2024-11-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.ngroups.begin_delete( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.ngroups.begin_start( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop(self, resource_group): + response = self.client.ngroups.stop( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restart(self, resource_group): + response = self.client.ngroups.begin_restart( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.ngroups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.ngroups.list( + api_version="2024-11-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_ngroups_operations_async.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_ngroups_operations_async.py new file mode 100644 index 000000000000..a2c38680a19a --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_ngroups_operations_async.py @@ -0,0 +1,297 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerinstance.aio import ContainerInstanceManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerInstanceManagementNGroupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerInstanceManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.ngroups.get( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.ngroups.begin_create_or_update( + resource_group_name=resource_group.name, + ngroups_name="str", + n_group={ + "containerGroupProfiles": [ + { + "containerGroupProperties": { + "containers": [ + { + "name": "str", + "properties": { + "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}] + }, + } + ], + "subnetIds": [{"id": "str", "name": "str"}], + "volumes": [ + { + "name": "str", + "azureFile": { + "shareName": "str", + "storageAccountName": "str", + "readOnly": bool, + "storageAccountKey": "str", + "storageAccountKeyReference": "str", + }, + } + ], + }, + "networkProfile": { + "applicationGateway": {"backendAddressPools": [{"resource": "str"}], "resource": "str"}, + "loadBalancer": {"backendAddressPools": [{"resource": "str"}]}, + }, + "resource": {"id": "str"}, + "revision": 0, + "storageProfile": { + "fileShares": [ + { + "name": "str", + "properties": {"shareAccessTier": "str", "shareAccessType": "str"}, + "resourceGroupName": "str", + "storageAccountName": "str", + } + ] + }, + } + ], + "elasticProfile": { + "containerGroupNamingPolicy": {"guidNamingPolicy": {"prefix": "str"}}, + "desiredCount": 0, + "maintainDesiredCount": bool, + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "placementProfile": {"faultDomainCount": 0}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "updateProfile": { + "rollingUpdateProfile": { + "inPlaceUpdate": bool, + "maxBatchPercent": 0, + "maxUnhealthyPercent": 0, + "pauseTimeBetweenBatches": "str", + }, + "updateMode": "str", + }, + "zones": ["str"], + }, + api_version="2024-11-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.ngroups.begin_update( + resource_group_name=resource_group.name, + ngroups_name="str", + n_group={ + "containerGroupProfiles": [ + { + "containerGroupProperties": { + "containers": [ + { + "name": "str", + "properties": { + "volumeMounts": [{"mountPath": "str", "name": "str", "readOnly": bool}] + }, + } + ], + "subnetIds": [{"id": "str", "name": "str"}], + "volumes": [ + { + "name": "str", + "azureFile": { + "shareName": "str", + "storageAccountName": "str", + "readOnly": bool, + "storageAccountKey": "str", + "storageAccountKeyReference": "str", + }, + } + ], + }, + "networkProfile": { + "applicationGateway": {"backendAddressPools": [{"resource": "str"}], "resource": "str"}, + "loadBalancer": {"backendAddressPools": [{"resource": "str"}]}, + }, + "resource": {"id": "str"}, + "revision": 0, + "storageProfile": { + "fileShares": [ + { + "name": "str", + "properties": {"shareAccessTier": "str", "shareAccessType": "str"}, + "resourceGroupName": "str", + "storageAccountName": "str", + } + ] + }, + } + ], + "elasticProfile": { + "containerGroupNamingPolicy": {"guidNamingPolicy": {"prefix": "str"}}, + "desiredCount": 0, + "maintainDesiredCount": bool, + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "placementProfile": {"faultDomainCount": 0}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "updateProfile": { + "rollingUpdateProfile": { + "inPlaceUpdate": bool, + "maxBatchPercent": 0, + "maxUnhealthyPercent": 0, + "pauseTimeBetweenBatches": "str", + }, + "updateMode": "str", + }, + "zones": ["str"], + }, + api_version="2024-11-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.ngroups.begin_delete( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.ngroups.begin_start( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop(self, resource_group): + response = await self.client.ngroups.stop( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restart(self, resource_group): + response = await ( + await self.client.ngroups.begin_restart( + resource_group_name=resource_group.name, + ngroups_name="str", + api_version="2024-11-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.ngroups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.ngroups.list( + api_version="2024-11-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_operations.py index cf615891fc51..89daea5faede 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_operations_async.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_operations_async.py index 07bc78bc7caa..257b1e5b5644 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_operations_async.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_subnet_service_association_link_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_subnet_service_association_link_operations.py index 1a5d0c197c99..3542683d89d2 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_subnet_service_association_link_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_subnet_service_association_link_operations.py @@ -25,7 +25,7 @@ def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, virtual_network_name="str", subnet_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_subnet_service_association_link_operations_async.py b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_subnet_service_association_link_operations_async.py index 6f689761a71c..0b9418cc3755 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_subnet_service_association_link_operations_async.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/generated_tests/test_container_instance_management_subnet_service_association_link_operations_async.py @@ -27,7 +27,7 @@ async def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, virtual_network_name="str", subnet_name="str", - api_version="2024-05-01-preview", + api_version="2024-11-01-preview", ) ).result() # call '.result()' to poll until service return final result