From fbd8b9e436efafda3c0fec64db5d413632e5058b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 10:03:56 +0000 Subject: [PATCH] CodeGen from PR 16847 in Azure/azure-rest-api-specs Add Track2 release go tag (#16847) * Add Track2 release go tag * recover --- .../azure-mgmt-containerinstance/_meta.json | 10 +- .../azure/mgmt/containerinstance/__init__.py | 9 +- .../mgmt/containerinstance/_configuration.py | 19 +- .../_container_instance_management_client.py | 95 +- .../mgmt/containerinstance/_metadata.json | 21 +- .../azure/mgmt/containerinstance/_patch.py | 31 + .../azure/mgmt/containerinstance/_vendor.py | 27 + .../azure/mgmt/containerinstance/_version.py | 2 +- .../mgmt/containerinstance/aio/__init__.py | 5 + .../containerinstance/aio/_configuration.py | 6 +- .../_container_instance_management_client.py | 84 +- .../mgmt/containerinstance/aio/_patch.py | 31 + .../_container_groups_operations.py | 467 ++--- .../aio/operations/_containers_operations.py | 121 +- .../aio/operations/_location_operations.py | 156 +- .../aio/operations/_operations.py | 45 +- .../mgmt/containerinstance/models/__init__.py | 156 +- ...tainer_instance_management_client_enums.py | 41 +- .../mgmt/containerinstance/models/_models.py | 1821 ----------------- .../containerinstance/models/_models_py3.py | 949 ++++++--- .../_container_groups_operations.py | 967 +++++---- .../operations/_containers_operations.py | 300 ++- .../operations/_location_operations.py | 284 ++- .../operations/_operations.py | 83 +- 24 files changed, 2385 insertions(+), 3345 deletions(-) create mode 100644 sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_patch.py create mode 100644 sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_vendor.py create mode 100644 sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_patch.py delete mode 100644 sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models.py diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json b/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json index 57fa769091f25..e731b7ed8ceb7 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json +++ b/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "314f28163917b9cfc527f7776b5e4a1dea69d295", + "commit": "6acc7e2e59b3777da22e417149d0c71d05054bff", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/containerinstance/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/containerinstance/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/containerinstance/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/__init__.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/__init__.py index e7209cd9806c4..ee4609bc2aba1 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/__init__.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ContainerInstanceManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() 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 4b765c2e00b90..628ec516fffb9 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class ContainerInstanceManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerInstanceManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerInstanceManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 058e3d527f216..b127cd6868b8d 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 @@ -6,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ContainerInstanceManagementClientConfiguration +from .operations import ContainerGroupsOperations, ContainersOperations, LocationOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ContainerInstanceManagementClientConfiguration -from .operations import ContainerGroupsOperations -from .operations import Operations -from .operations import LocationOperations -from .operations import ContainersOperations -from . import models - -class ContainerInstanceManagementClient(object): +class ContainerInstanceManagementClient: """ContainerInstanceManagementClient. :ivar container_groups: ContainerGroupsOperations operations @@ -39,56 +34,60 @@ class ContainerInstanceManagementClient(object): :vartype containers: azure.mgmt.containerinstance.operations.ContainersOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerInstanceManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerInstanceManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.container_groups = ContainerGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.location = LocationOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_groups = ContainerGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.location = LocationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_metadata.json b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_metadata.json index 1eb181be18a29..695500886de31 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_metadata.json +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_metadata.json @@ -5,13 +5,13 @@ "name": "ContainerInstanceManagementClient", "filename": "_container_instance_management_client", "description": "ContainerInstanceManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerInstanceManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerInstanceManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerInstanceManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerInstanceManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "container_groups": "ContainerGroupsOperations", diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_patch.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_vendor.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) 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 f89ed38360abd..e5754a47ce68f 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 = "9.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/__init__.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/__init__.py index 025e9575c71bd..15e3f49794f23 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/__init__.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/__init__.py @@ -8,3 +8,8 @@ from ._container_instance_management_client import ContainerInstanceManagementClient __all__ = ['ContainerInstanceManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() 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 dc2e019f6f592..4d0fb29093521 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 @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ContainerInstanceManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ContainerInstanceManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) 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 9e50056c82847..8018736f83952 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 @@ -6,29 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ContainerInstanceManagementClientConfiguration +from .operations import ContainerGroupsOperations, ContainersOperations, LocationOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ContainerInstanceManagementClientConfiguration -from .operations import ContainerGroupsOperations -from .operations import Operations -from .operations import LocationOperations -from .operations import ContainersOperations -from .. import models - - -class ContainerInstanceManagementClient(object): +class ContainerInstanceManagementClient: """ContainerInstanceManagementClient. :ivar container_groups: ContainerGroupsOperations operations - :vartype container_groups: azure.mgmt.containerinstance.aio.operations.ContainerGroupsOperations + :vartype container_groups: + azure.mgmt.containerinstance.aio.operations.ContainerGroupsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.containerinstance.aio.operations.Operations :ivar location: LocationOperations operations @@ -37,54 +35,60 @@ class ContainerInstanceManagementClient(object): :vartype containers: azure.mgmt.containerinstance.aio.operations.ContainersOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ContainerInstanceManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerInstanceManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.container_groups = ContainerGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.location = LocationOperations(self._client, self._config, self._serialize, self._deserialize) + self.containers = ContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.container_groups = ContainerGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.location = LocationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.containers = ContainersOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_patch.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file 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 b9e6bf801ae26..b5a227ca25963 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 @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._container_groups_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_outbound_network_dependencies_endpoints_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -54,8 +60,10 @@ def list( address type, OS type, state, and volumes. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContainerGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupListResult] + :return: An iterator like instance of either ContainerGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerGroupListResult"] @@ -63,34 +71,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerGroupListResult', pipeline_response) + deserialized = self._deserialize("ContainerGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,11 +111,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -127,8 +132,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContainerGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupListResult] + :return: An iterator like instance of either ContainerGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerGroupListResult"] @@ -136,35 +143,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerGroupListResult', pipeline_response) + deserialized = self._deserialize("ContainerGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -182,11 +185,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -213,27 +218,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,8 +242,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -261,32 +258,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(container_group, 'ContainerGroup') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container_group, 'ContainerGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,8 +291,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -325,15 +315,19 @@ async def begin_create_or_update( :type container_group: ~azure.mgmt.containerinstance.models.ContainerGroup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ContainerGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerGroup or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerinstance.models.ContainerGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -345,27 +339,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, container_group_name=container_group_name, container_group=container_group, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ContainerGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,8 +365,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -406,32 +396,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'Resource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'Resource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -445,8 +425,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -458,27 +440,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -494,8 +466,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -513,15 +488,18 @@ async def begin_delete( :type container_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ContainerGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerGroup or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerinstance.models.ContainerGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -535,24 +513,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ContainerGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -564,6 +535,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore async def _restart_initial( @@ -577,27 +549,17 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -610,6 +572,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -627,15 +591,17 @@ async def begin_restart( :type container_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -649,21 +615,14 @@ async def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -675,8 +634,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/restart'} # type: ignore + @distributed_trace_async async def stop( self, resource_group_name: str, @@ -702,27 +663,17 @@ async def stop( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.stop.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self.stop.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -735,6 +686,7 @@ async def stop( stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/stop'} # type: ignore + async def _start_initial( self, resource_group_name: str, @@ -746,27 +698,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -779,6 +721,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -796,15 +740,17 @@ async def begin_start( :type container_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -818,21 +764,14 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -844,8 +783,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start'} # type: ignore + @distributed_trace_async async def get_outbound_network_dependencies_endpoints( self, resource_group_name: str, @@ -871,27 +812,17 @@ async def get_outbound_network_dependencies_endpoints( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.get_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self.get_outbound_network_dependencies_endpoints.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -905,4 +836,6 @@ async def get_outbound_network_dependencies_endpoints( return cls(pipeline_response, deserialized, {}) return deserialized + get_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/outboundNetworkDependenciesEndpoints'} # type: ignore + 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 94b3ca2db99d5..b2c891faa5ecb 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 @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._containers_operations import build_attach_request, build_execute_command_request, build_list_logs_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_logs( self, resource_group_name: str, @@ -76,32 +81,20 @@ async def list_logs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.list_logs.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if tail is not None: - query_parameters['tail'] = self._serialize.query("tail", tail, 'int') - if timestamps is not None: - query_parameters['timestamps'] = self._serialize.query("timestamps", timestamps, 'bool') + + request = build_list_logs_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + container_name=container_name, + tail=tail, + timestamps=timestamps, + template_url=self.list_logs.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,8 +108,11 @@ async def list_logs( return cls(pipeline_response, deserialized, {}) return deserialized + list_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs'} # type: ignore + + @distributed_trace_async async def execute_command( self, resource_group_name: str, @@ -148,33 +144,23 @@ async def execute_command( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.execute_command.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container_exec_request, 'ContainerExecRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_execute_command_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + container_name=container_name, + content_type=content_type, + json=_json, + template_url=self.execute_command.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container_exec_request, 'ContainerExecRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -188,8 +174,11 @@ async def execute_command( return cls(pipeline_response, deserialized, {}) return deserialized + execute_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'} # type: ignore + + @distributed_trace_async async def attach( self, resource_group_name: str, @@ -218,28 +207,18 @@ async def attach( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.attach.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_attach_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + container_name=container_name, + template_url=self.attach.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,4 +232,6 @@ async def attach( return cls(pipeline_response, deserialized, {}) return deserialized + attach.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach'} # type: ignore + 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 a723a9e9522c6..00dcf1673d3fd 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 @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._location_operations import build_list_cached_images_request, build_list_capabilities_request, build_list_usage_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_usage( self, location: str, @@ -52,7 +58,8 @@ def list_usage( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.UsageListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.UsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] @@ -60,35 +67,31 @@ def list_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_usage_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_usage.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_usage_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +109,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_usage.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages'} # type: ignore + @distributed_trace def list_cached_images( self, location: str, @@ -123,8 +128,10 @@ def list_cached_images( :param location: The identifier for the physical azure location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CachedImagesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.CachedImagesListResult] + :return: An iterator like instance of either CachedImagesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.CachedImagesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CachedImagesListResult"] @@ -132,35 +139,31 @@ def list_cached_images( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_cached_images.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_cached_images_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_cached_images.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_cached_images_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CachedImagesListResult', pipeline_response) + deserialized = self._deserialize("CachedImagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -178,11 +181,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_cached_images.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages'} # type: ignore + @distributed_trace def list_capabilities( self, location: str, @@ -195,8 +200,10 @@ def list_capabilities( :param location: The identifier for the physical azure location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapabilitiesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.CapabilitiesListResult] + :return: An iterator like instance of either CapabilitiesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.CapabilitiesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilitiesListResult"] @@ -204,35 +211,31 @@ def list_capabilities( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_capabilities.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_capabilities_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_capabilities.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_capabilities_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapabilitiesListResult', pipeline_response) + deserialized = self._deserialize("CapabilitiesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -250,6 +253,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_operations.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_operations.py index f1833cbf3b08f..56c26b2924ba6 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_operations.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerinstance.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 557f8bf362dde..d9edabf834494 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,110 +6,58 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AzureFileVolume - from ._models_py3 import CachedImages - from ._models_py3 import CachedImagesListResult - from ._models_py3 import Capabilities - from ._models_py3 import CapabilitiesCapabilities - from ._models_py3 import CapabilitiesListResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties - from ._models_py3 import Container - from ._models_py3 import ContainerAttachResponse - from ._models_py3 import ContainerExec - from ._models_py3 import ContainerExecRequest - from ._models_py3 import ContainerExecRequestTerminalSize - from ._models_py3 import ContainerExecResponse - from ._models_py3 import ContainerGroup - from ._models_py3 import ContainerGroupDiagnostics - from ._models_py3 import ContainerGroupIdentity - from ._models_py3 import ContainerGroupListResult - from ._models_py3 import ContainerGroupPropertiesInstanceView - from ._models_py3 import ContainerGroupSubnetId - from ._models_py3 import ContainerHttpGet - from ._models_py3 import ContainerPort - from ._models_py3 import ContainerProbe - from ._models_py3 import ContainerPropertiesInstanceView - from ._models_py3 import ContainerState - from ._models_py3 import DnsConfiguration - from ._models_py3 import EncryptionProperties - from ._models_py3 import EnvironmentVariable - from ._models_py3 import Event - from ._models_py3 import GitRepoVolume - from ._models_py3 import GpuResource - from ._models_py3 import HttpHeader - from ._models_py3 import ImageRegistryCredential - from ._models_py3 import InitContainerDefinition - from ._models_py3 import InitContainerPropertiesDefinitionInstanceView - from ._models_py3 import IpAddress - from ._models_py3 import LogAnalytics - from ._models_py3 import Logs - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - 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 Usage - from ._models_py3 import UsageListResult - from ._models_py3 import UsageName - from ._models_py3 import Volume - from ._models_py3 import VolumeMount -except (SyntaxError, ImportError): - from ._models import AzureFileVolume # type: ignore - from ._models import CachedImages # type: ignore - from ._models import CachedImagesListResult # type: ignore - from ._models import Capabilities # type: ignore - from ._models import CapabilitiesCapabilities # type: ignore - from ._models import CapabilitiesListResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore - from ._models import Container # type: ignore - from ._models import ContainerAttachResponse # type: ignore - from ._models import ContainerExec # type: ignore - from ._models import ContainerExecRequest # type: ignore - from ._models import ContainerExecRequestTerminalSize # type: ignore - from ._models import ContainerExecResponse # type: ignore - from ._models import ContainerGroup # type: ignore - from ._models import ContainerGroupDiagnostics # type: ignore - from ._models import ContainerGroupIdentity # type: ignore - from ._models import ContainerGroupListResult # type: ignore - from ._models import ContainerGroupPropertiesInstanceView # type: ignore - from ._models import ContainerGroupSubnetId # type: ignore - from ._models import ContainerHttpGet # type: ignore - from ._models import ContainerPort # type: ignore - from ._models import ContainerProbe # type: ignore - from ._models import ContainerPropertiesInstanceView # type: ignore - from ._models import ContainerState # type: ignore - from ._models import DnsConfiguration # type: ignore - from ._models import EncryptionProperties # type: ignore - from ._models import EnvironmentVariable # type: ignore - from ._models import Event # type: ignore - from ._models import GitRepoVolume # type: ignore - from ._models import GpuResource # type: ignore - from ._models import HttpHeader # type: ignore - from ._models import ImageRegistryCredential # type: ignore - from ._models import InitContainerDefinition # type: ignore - from ._models import InitContainerPropertiesDefinitionInstanceView # type: ignore - from ._models import IpAddress # type: ignore - from ._models import LogAnalytics # type: ignore - from ._models import Logs # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Port # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceLimits # type: ignore - from ._models import ResourceRequests # type: ignore - from ._models import ResourceRequirements # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageListResult # type: ignore - from ._models import UsageName # type: ignore - from ._models import Volume # type: ignore - from ._models import VolumeMount # type: ignore +from ._models_py3 import AzureFileVolume +from ._models_py3 import CachedImages +from ._models_py3 import CachedImagesListResult +from ._models_py3 import Capabilities +from ._models_py3 import CapabilitiesCapabilities +from ._models_py3 import CapabilitiesListResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties +from ._models_py3 import Container +from ._models_py3 import ContainerAttachResponse +from ._models_py3 import ContainerExec +from ._models_py3 import ContainerExecRequest +from ._models_py3 import ContainerExecRequestTerminalSize +from ._models_py3 import ContainerExecResponse +from ._models_py3 import ContainerGroup +from ._models_py3 import ContainerGroupDiagnostics +from ._models_py3 import ContainerGroupIdentity +from ._models_py3 import ContainerGroupListResult +from ._models_py3 import ContainerGroupPropertiesInstanceView +from ._models_py3 import ContainerGroupSubnetId +from ._models_py3 import ContainerHttpGet +from ._models_py3 import ContainerPort +from ._models_py3 import ContainerProbe +from ._models_py3 import ContainerPropertiesInstanceView +from ._models_py3 import ContainerState +from ._models_py3 import DnsConfiguration +from ._models_py3 import EncryptionProperties +from ._models_py3 import EnvironmentVariable +from ._models_py3 import Event +from ._models_py3 import GitRepoVolume +from ._models_py3 import GpuResource +from ._models_py3 import HttpHeader +from ._models_py3 import ImageRegistryCredential +from ._models_py3 import InitContainerDefinition +from ._models_py3 import InitContainerPropertiesDefinitionInstanceView +from ._models_py3 import IpAddress +from ._models_py3 import LogAnalytics +from ._models_py3 import Logs +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +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 Usage +from ._models_py3 import UsageListResult +from ._models_py3 import UsageName +from ._models_py3 import Volume +from ._models_py3 import VolumeMount + from ._container_instance_management_client_enums import ( ContainerGroupIpAddressType, 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 1fc21d9e5a686..6e36955990f3f 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 @@ -6,41 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ContainerGroupIpAddressType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerGroupIpAddressType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies if the IP is exposed to the public internet or private VNET. """ PUBLIC = "Public" PRIVATE = "Private" -class ContainerGroupNetworkProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerGroupNetworkProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol associated with the port. """ TCP = "TCP" UDP = "UDP" -class ContainerGroupRestartPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerGroupRestartPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Restart policy for all containers within the container group. @@ -53,28 +38,28 @@ class ContainerGroupRestartPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, ON_FAILURE = "OnFailure" NEVER = "Never" -class ContainerGroupSku(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerGroupSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The container group SKU. """ STANDARD = "Standard" DEDICATED = "Dedicated" -class ContainerInstanceOperationsOrigin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerInstanceOperationsOrigin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The intended executor of the operation. """ USER = "User" SYSTEM = "System" -class ContainerNetworkProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContainerNetworkProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol associated with the port. """ TCP = "TCP" UDP = "UDP" -class GpuSku(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GpuSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The SKU of the GPU resource. """ @@ -82,21 +67,21 @@ class GpuSku(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): P100 = "P100" V100 = "V100" -class LogAnalyticsLogType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogAnalyticsLogType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The log type to be used. """ CONTAINER_INSIGHTS = "ContainerInsights" CONTAINER_INSTANCE_LOGS = "ContainerInstanceLogs" -class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operating system type required by the containers in the container group. """ WINDOWS = "Windows" LINUX = "Linux" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity used for the container group. 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 container group. @@ -107,7 +92,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class Scheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Scheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scheme. """ diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models.py deleted file mode 100644 index 4cbd203bf8c92..0000000000000 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models.py +++ /dev/null @@ -1,1821 +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. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AzureFileVolume(msrest.serialization.Model): - """The properties of the Azure File volume. Azure File shares are mounted as volumes. - - All required parameters must be populated in order to send to Azure. - - :param share_name: Required. The name of the Azure File share to be mounted as a volume. - :type share_name: str - :param read_only: The flag indicating whether the Azure File shared mounted as a volume is - read-only. - :type read_only: bool - :param storage_account_name: Required. The name of the storage account that contains the Azure - File share. - :type storage_account_name: str - :param storage_account_key: The storage account access key used to access the Azure File share. - :type storage_account_key: str - """ - - _validation = { - 'share_name': {'required': True}, - 'storage_account_name': {'required': True}, - } - - _attribute_map = { - 'share_name': {'key': 'shareName', 'type': 'str'}, - 'read_only': {'key': 'readOnly', 'type': 'bool'}, - 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, - 'storage_account_key': {'key': 'storageAccountKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureFileVolume, self).__init__(**kwargs) - self.share_name = kwargs['share_name'] - self.read_only = kwargs.get('read_only', None) - self.storage_account_name = kwargs['storage_account_name'] - self.storage_account_key = kwargs.get('storage_account_key', None) - - -class CachedImages(msrest.serialization.Model): - """The cached image and OS type. - - All required parameters must be populated in order to send to Azure. - - :param os_type: Required. The OS type of the cached image. - :type os_type: str - :param image: Required. The cached image name. - :type image: str - """ - - _validation = { - 'os_type': {'required': True}, - 'image': {'required': True}, - } - - _attribute_map = { - 'os_type': {'key': 'osType', 'type': 'str'}, - 'image': {'key': 'image', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CachedImages, self).__init__(**kwargs) - self.os_type = kwargs['os_type'] - self.image = kwargs['image'] - - -class CachedImagesListResult(msrest.serialization.Model): - """The response containing cached images. - - :param value: The list of cached images. - :type value: list[~azure.mgmt.containerinstance.models.CachedImages] - :param next_link: The URI to fetch the next page of cached images. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CachedImages]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CachedImagesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class Capabilities(msrest.serialization.Model): - """The regional capabilities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The resource type that this capability describes. - :vartype resource_type: str - :ivar os_type: The OS type that this capability describes. - :vartype os_type: str - :ivar location: The resource location. - :vartype location: str - :ivar ip_address_type: The ip address type that this capability describes. - :vartype ip_address_type: str - :ivar gpu: The GPU sku that this capability describes. - :vartype gpu: str - :ivar capabilities: The supported capabilities. - :vartype capabilities: ~azure.mgmt.containerinstance.models.CapabilitiesCapabilities - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'os_type': {'readonly': True}, - 'location': {'readonly': True}, - 'ip_address_type': {'readonly': True}, - 'gpu': {'readonly': True}, - 'capabilities': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'ip_address_type': {'key': 'ipAddressType', 'type': 'str'}, - 'gpu': {'key': 'gpu', 'type': 'str'}, - 'capabilities': {'key': 'capabilities', 'type': 'CapabilitiesCapabilities'}, - } - - def __init__( - self, - **kwargs - ): - super(Capabilities, self).__init__(**kwargs) - self.resource_type = None - self.os_type = None - self.location = None - self.ip_address_type = None - self.gpu = None - self.capabilities = None - - -class CapabilitiesCapabilities(msrest.serialization.Model): - """The supported capabilities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar max_memory_in_gb: The maximum allowed memory request in GB. - :vartype max_memory_in_gb: float - :ivar max_cpu: The maximum allowed CPU request in cores. - :vartype max_cpu: float - :ivar max_gpu_count: The maximum allowed GPU count. - :vartype max_gpu_count: float - """ - - _validation = { - 'max_memory_in_gb': {'readonly': True}, - 'max_cpu': {'readonly': True}, - 'max_gpu_count': {'readonly': True}, - } - - _attribute_map = { - 'max_memory_in_gb': {'key': 'maxMemoryInGB', 'type': 'float'}, - 'max_cpu': {'key': 'maxCpu', 'type': 'float'}, - 'max_gpu_count': {'key': 'maxGpuCount', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(CapabilitiesCapabilities, self).__init__(**kwargs) - self.max_memory_in_gb = None - self.max_cpu = None - self.max_gpu_count = None - - -class CapabilitiesListResult(msrest.serialization.Model): - """The response containing list of capabilities. - - :param value: The list of capabilities. - :type value: list[~azure.mgmt.containerinstance.models.Capabilities] - :param next_link: The URI to fetch the next page of capabilities. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Capabilities]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapabilitiesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the Container Instance service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.containerinstance.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): - """Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class Container(msrest.serialization.Model): - """A container instance. - - 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 Azure. - - :param name: Required. The user-provided name of the container instance. - :type name: str - :param image: Required. The name of the image used to create the container instance. - :type image: str - :param command: The commands to execute within the container instance in exec form. - :type command: list[str] - :param ports: The exposed ports on the container instance. - :type ports: list[~azure.mgmt.containerinstance.models.ContainerPort] - :param environment_variables: The environment variables to set in the container instance. - :type 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 - :param resources: Required. The resource requirements of the container instance. - :type resources: ~azure.mgmt.containerinstance.models.ResourceRequirements - :param volume_mounts: The volume mounts available to the container instance. - :type volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] - :param liveness_probe: The liveness probe. - :type liveness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe - :param readiness_probe: The readiness probe. - :type readiness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe - """ - - _validation = { - 'name': {'required': True}, - 'image': {'required': True}, - 'instance_view': {'readonly': True}, - 'resources': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'image': {'key': 'properties.image', 'type': 'str'}, - 'command': {'key': 'properties.command', 'type': '[str]'}, - 'ports': {'key': 'properties.ports', 'type': '[ContainerPort]'}, - 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'ContainerPropertiesInstanceView'}, - 'resources': {'key': 'properties.resources', 'type': 'ResourceRequirements'}, - 'volume_mounts': {'key': 'properties.volumeMounts', 'type': '[VolumeMount]'}, - 'liveness_probe': {'key': 'properties.livenessProbe', 'type': 'ContainerProbe'}, - 'readiness_probe': {'key': 'properties.readinessProbe', 'type': 'ContainerProbe'}, - } - - def __init__( - self, - **kwargs - ): - super(Container, self).__init__(**kwargs) - self.name = kwargs['name'] - self.image = kwargs['image'] - self.command = kwargs.get('command', None) - self.ports = kwargs.get('ports', None) - self.environment_variables = kwargs.get('environment_variables', None) - self.instance_view = None - self.resources = kwargs['resources'] - self.volume_mounts = kwargs.get('volume_mounts', None) - self.liveness_probe = kwargs.get('liveness_probe', None) - self.readiness_probe = kwargs.get('readiness_probe', None) - - -class ContainerAttachResponse(msrest.serialization.Model): - """The information for the output stream from container attach. - - :param web_socket_uri: The uri for the output stream from the attach. - :type web_socket_uri: str - :param password: The password to the output stream from the attach. Send as an Authorization - header value when connecting to the websocketUri. - :type password: str - """ - - _attribute_map = { - 'web_socket_uri': {'key': 'webSocketUri', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerAttachResponse, self).__init__(**kwargs) - self.web_socket_uri = kwargs.get('web_socket_uri', None) - self.password = kwargs.get('password', None) - - -class ContainerExec(msrest.serialization.Model): - """The container execution command, for liveness or readiness probe. - - :param command: The commands to execute within the container. - :type command: list[str] - """ - - _attribute_map = { - 'command': {'key': 'command', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerExec, self).__init__(**kwargs) - self.command = kwargs.get('command', None) - - -class ContainerExecRequest(msrest.serialization.Model): - """The container exec request. - - :param command: The command to be executed. - :type command: str - :param terminal_size: The size of the terminal. - :type terminal_size: ~azure.mgmt.containerinstance.models.ContainerExecRequestTerminalSize - """ - - _attribute_map = { - 'command': {'key': 'command', 'type': 'str'}, - 'terminal_size': {'key': 'terminalSize', 'type': 'ContainerExecRequestTerminalSize'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerExecRequest, self).__init__(**kwargs) - self.command = kwargs.get('command', None) - self.terminal_size = kwargs.get('terminal_size', None) - - -class ContainerExecRequestTerminalSize(msrest.serialization.Model): - """The size of the terminal. - - :param rows: The row size of the terminal. - :type rows: int - :param cols: The column size of the terminal. - :type cols: int - """ - - _attribute_map = { - 'rows': {'key': 'rows', 'type': 'int'}, - 'cols': {'key': 'cols', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerExecRequestTerminalSize, self).__init__(**kwargs) - self.rows = kwargs.get('rows', None) - self.cols = kwargs.get('cols', None) - - -class ContainerExecResponse(msrest.serialization.Model): - """The information for the container exec command. - - :param web_socket_uri: The uri for the exec websocket. - :type web_socket_uri: str - :param password: The password to start the exec command. - :type password: str - """ - - _attribute_map = { - 'web_socket_uri': {'key': 'webSocketUri', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerExecResponse, self).__init__(**kwargs) - self.web_socket_uri = kwargs.get('web_socket_uri', None) - self.password = kwargs.get('password', None) - - -class Resource(msrest.serialization.Model): - """The Resource model definition. - - 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 - :param location: The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param zones: The zones for the container group. - :type zones: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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]'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.zones = kwargs.get('zones', None) - - -class ContainerGroup(Resource): - """A container group. - - 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 Azure. - - :ivar id: The resource id. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param zones: The zones for the container group. - :type zones: list[str] - :param identity: The identity of the container group, if configured. - :type identity: ~azure.mgmt.containerinstance.models.ContainerGroupIdentity - :ivar provisioning_state: The provisioning state of the container group. This only appears in - the response. - :vartype provisioning_state: str - :param containers: Required. The containers within the container group. - :type containers: list[~azure.mgmt.containerinstance.models.Container] - :param image_registry_credentials: The image registry credentials by which the container group - is created from. - :type image_registry_credentials: - list[~azure.mgmt.containerinstance.models.ImageRegistryCredential] - :param restart_policy: Restart policy for all containers within the container group. - - - * ``Always`` Always restart - * ``OnFailure`` Restart on failure - * ``Never`` Never restart. Possible values include: "Always", "OnFailure", "Never". - :type restart_policy: str or ~azure.mgmt.containerinstance.models.ContainerGroupRestartPolicy - :param ip_address: The IP address type of the container group. - :type ip_address: ~azure.mgmt.containerinstance.models.IpAddress - :param os_type: Required. The operating system type required by the containers in the container - group. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes - :param volumes: The list of volumes that can be mounted by containers in this container group. - :type volumes: list[~azure.mgmt.containerinstance.models.Volume] - :ivar instance_view: The instance view of the container group. Only valid in response. - :vartype instance_view: - ~azure.mgmt.containerinstance.models.ContainerGroupPropertiesInstanceView - :param diagnostics: The diagnostic information for a container group. - :type diagnostics: ~azure.mgmt.containerinstance.models.ContainerGroupDiagnostics - :param subnet_ids: The subnet resource IDs for a container group. - :type subnet_ids: list[~azure.mgmt.containerinstance.models.ContainerGroupSubnetId] - :param dns_config: The DNS config information for a container group. - :type dns_config: ~azure.mgmt.containerinstance.models.DnsConfiguration - :param sku: The SKU for a container group. Possible values include: "Standard", "Dedicated". - :type sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku - :param encryption_properties: The encryption properties for a container group. - :type encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties - :param init_containers: The init containers for a container group. - :type init_containers: list[~azure.mgmt.containerinstance.models.InitContainerDefinition] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'containers': {'required': True}, - 'os_type': {'required': True}, - 'instance_view': {'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]'}, - 'identity': {'key': 'identity', 'type': 'ContainerGroupIdentity'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - '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]'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'ContainerGroupPropertiesInstanceView'}, - 'diagnostics': {'key': 'properties.diagnostics', 'type': 'ContainerGroupDiagnostics'}, - 'subnet_ids': {'key': 'properties.subnetIds', 'type': '[ContainerGroupSubnetId]'}, - 'dns_config': {'key': 'properties.dnsConfig', 'type': 'DnsConfiguration'}, - 'sku': {'key': 'properties.sku', 'type': 'str'}, - 'encryption_properties': {'key': 'properties.encryptionProperties', 'type': 'EncryptionProperties'}, - 'init_containers': {'key': 'properties.initContainers', 'type': '[InitContainerDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerGroup, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.provisioning_state = None - self.containers = kwargs['containers'] - self.image_registry_credentials = kwargs.get('image_registry_credentials', None) - self.restart_policy = kwargs.get('restart_policy', None) - self.ip_address = kwargs.get('ip_address', None) - self.os_type = kwargs['os_type'] - self.volumes = kwargs.get('volumes', None) - self.instance_view = None - self.diagnostics = kwargs.get('diagnostics', None) - self.subnet_ids = kwargs.get('subnet_ids', None) - self.dns_config = kwargs.get('dns_config', None) - self.sku = kwargs.get('sku', None) - self.encryption_properties = kwargs.get('encryption_properties', None) - self.init_containers = kwargs.get('init_containers', None) - - -class ContainerGroupDiagnostics(msrest.serialization.Model): - """Container group diagnostic information. - - :param log_analytics: Container group log analytics information. - :type log_analytics: ~azure.mgmt.containerinstance.models.LogAnalytics - """ - - _attribute_map = { - 'log_analytics': {'key': 'logAnalytics', 'type': 'LogAnalytics'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerGroupDiagnostics, self).__init__(**kwargs) - self.log_analytics = kwargs.get('log_analytics', None) - - -class ContainerGroupIdentity(msrest.serialization.Model): - """Identity for the container group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the container group 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 container group. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :param type: The type of identity used for the container group. 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 container group. Possible - values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.containerinstance.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the container - group. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.containerinstance.models.Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties] - """ - - _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': '{Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerGroupIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ContainerGroupListResult(msrest.serialization.Model): - """The container group list response that contains the container group properties. - - :param value: The list of container groups. - :type value: list[~azure.mgmt.containerinstance.models.ContainerGroup] - :param next_link: The URI to fetch the next page of container groups. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ContainerGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerGroupListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ContainerGroupPropertiesInstanceView(msrest.serialization.Model): - """The instance view of the container group. Only valid in response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar events: The events of this container group. - :vartype events: list[~azure.mgmt.containerinstance.models.Event] - :ivar state: The state of the container group. Only valid in response. - :vartype state: str - """ - - _validation = { - 'events': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'events': {'key': 'events', 'type': '[Event]'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerGroupPropertiesInstanceView, self).__init__(**kwargs) - self.events = None - self.state = None - - -class ContainerGroupSubnetId(msrest.serialization.Model): - """Container group subnet information. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Resource ID of virtual network and subnet. - :type id: str - :param name: Friendly name for the subnet. - :type name: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerGroupSubnetId, self).__init__(**kwargs) - self.id = kwargs['id'] - self.name = kwargs.get('name', None) - - -class ContainerHttpGet(msrest.serialization.Model): - """The container Http Get settings, for liveness or readiness probe. - - All required parameters must be populated in order to send to Azure. - - :param path: The path to probe. - :type path: str - :param port: Required. The port number to probe. - :type port: int - :param scheme: The scheme. Possible values include: "http", "https". - :type scheme: str or ~azure.mgmt.containerinstance.models.Scheme - :param http_headers: The HTTP headers. - :type http_headers: list[~azure.mgmt.containerinstance.models.HttpHeader] - """ - - _validation = { - 'port': {'required': True}, - } - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'scheme': {'key': 'scheme', 'type': 'str'}, - 'http_headers': {'key': 'httpHeaders', 'type': '[HttpHeader]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerHttpGet, self).__init__(**kwargs) - self.path = kwargs.get('path', None) - self.port = kwargs['port'] - self.scheme = kwargs.get('scheme', None) - self.http_headers = kwargs.get('http_headers', None) - - -class ContainerPort(msrest.serialization.Model): - """The port exposed on the container instance. - - All required parameters must be populated in order to send to Azure. - - :param protocol: The protocol associated with the port. Possible values include: "TCP", "UDP". - :type protocol: str or ~azure.mgmt.containerinstance.models.ContainerNetworkProtocol - :param port: Required. The port number exposed within the container group. - :type port: int - """ - - _validation = { - 'port': {'required': True}, - } - - _attribute_map = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerPort, self).__init__(**kwargs) - self.protocol = kwargs.get('protocol', None) - self.port = kwargs['port'] - - -class ContainerProbe(msrest.serialization.Model): - """The container probe, for liveness or readiness. - - :param exec_property: The execution command to probe. - :type exec_property: ~azure.mgmt.containerinstance.models.ContainerExec - :param http_get: The Http Get settings to probe. - :type http_get: ~azure.mgmt.containerinstance.models.ContainerHttpGet - :param initial_delay_seconds: The initial delay seconds. - :type initial_delay_seconds: int - :param period_seconds: The period seconds. - :type period_seconds: int - :param failure_threshold: The failure threshold. - :type failure_threshold: int - :param success_threshold: The success threshold. - :type success_threshold: int - :param timeout_seconds: The timeout seconds. - :type timeout_seconds: int - """ - - _attribute_map = { - 'exec_property': {'key': 'exec', 'type': 'ContainerExec'}, - 'http_get': {'key': 'httpGet', 'type': 'ContainerHttpGet'}, - 'initial_delay_seconds': {'key': 'initialDelaySeconds', 'type': 'int'}, - 'period_seconds': {'key': 'periodSeconds', 'type': 'int'}, - 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, - 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, - 'timeout_seconds': {'key': 'timeoutSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerProbe, self).__init__(**kwargs) - self.exec_property = kwargs.get('exec_property', None) - self.http_get = kwargs.get('http_get', None) - self.initial_delay_seconds = kwargs.get('initial_delay_seconds', None) - self.period_seconds = kwargs.get('period_seconds', None) - self.failure_threshold = kwargs.get('failure_threshold', None) - self.success_threshold = kwargs.get('success_threshold', None) - self.timeout_seconds = kwargs.get('timeout_seconds', None) - - -class ContainerPropertiesInstanceView(msrest.serialization.Model): - """The instance view of the container instance. Only valid in response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar restart_count: The number of times that the container instance has been restarted. - :vartype restart_count: int - :ivar current_state: Current container instance state. - :vartype current_state: ~azure.mgmt.containerinstance.models.ContainerState - :ivar previous_state: Previous container instance state. - :vartype previous_state: ~azure.mgmt.containerinstance.models.ContainerState - :ivar events: The events of the container instance. - :vartype events: list[~azure.mgmt.containerinstance.models.Event] - """ - - _validation = { - 'restart_count': {'readonly': True}, - 'current_state': {'readonly': True}, - 'previous_state': {'readonly': True}, - 'events': {'readonly': True}, - } - - _attribute_map = { - 'restart_count': {'key': 'restartCount', 'type': 'int'}, - 'current_state': {'key': 'currentState', 'type': 'ContainerState'}, - 'previous_state': {'key': 'previousState', 'type': 'ContainerState'}, - 'events': {'key': 'events', 'type': '[Event]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerPropertiesInstanceView, self).__init__(**kwargs) - self.restart_count = None - self.current_state = None - self.previous_state = None - self.events = None - - -class ContainerState(msrest.serialization.Model): - """The container instance state. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: The state of the container instance. - :vartype state: str - :ivar start_time: The date-time when the container instance state started. - :vartype start_time: ~datetime.datetime - :ivar exit_code: The container instance exit codes correspond to those from the ``docker run`` - command. - :vartype exit_code: int - :ivar finish_time: The date-time when the container instance state finished. - :vartype finish_time: ~datetime.datetime - :ivar detail_status: The human-readable status of the container instance state. - :vartype detail_status: str - """ - - _validation = { - 'state': {'readonly': True}, - 'start_time': {'readonly': True}, - 'exit_code': {'readonly': True}, - 'finish_time': {'readonly': True}, - 'detail_status': {'readonly': True}, - } - - _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'exit_code': {'key': 'exitCode', 'type': 'int'}, - 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, - 'detail_status': {'key': 'detailStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContainerState, self).__init__(**kwargs) - self.state = None - self.start_time = None - self.exit_code = None - self.finish_time = None - self.detail_status = None - - -class DnsConfiguration(msrest.serialization.Model): - """DNS configuration for the container group. - - All required parameters must be populated in order to send to Azure. - - :param name_servers: Required. The DNS servers for the container group. - :type name_servers: list[str] - :param search_domains: The DNS search domains for hostname lookup in the container group. - :type search_domains: str - :param options: The DNS options for the container group. - :type options: str - """ - - _validation = { - 'name_servers': {'required': True}, - } - - _attribute_map = { - 'name_servers': {'key': 'nameServers', 'type': '[str]'}, - 'search_domains': {'key': 'searchDomains', 'type': 'str'}, - 'options': {'key': 'options', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DnsConfiguration, self).__init__(**kwargs) - self.name_servers = kwargs['name_servers'] - self.search_domains = kwargs.get('search_domains', None) - self.options = kwargs.get('options', None) - - -class EncryptionProperties(msrest.serialization.Model): - """The container group encryption properties. - - All required parameters must be populated in order to send to Azure. - - :param vault_base_url: Required. The keyvault base url. - :type vault_base_url: str - :param key_name: Required. The encryption key name. - :type key_name: str - :param key_version: Required. The encryption key version. - :type key_version: str - """ - - _validation = { - 'vault_base_url': {'required': True}, - 'key_name': {'required': True}, - 'key_version': {'required': True}, - } - - _attribute_map = { - 'vault_base_url': {'key': 'vaultBaseUrl', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionProperties, self).__init__(**kwargs) - self.vault_base_url = kwargs['vault_base_url'] - self.key_name = kwargs['key_name'] - self.key_version = kwargs['key_version'] - - -class EnvironmentVariable(msrest.serialization.Model): - """The environment variable to set within the container instance. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the environment variable. - :type name: str - :param value: The value of the environment variable. - :type value: str - :param secure_value: The value of the secure environment variable. - :type secure_value: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'secure_value': {'key': 'secureValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EnvironmentVariable, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs.get('value', None) - self.secure_value = kwargs.get('secure_value', None) - - -class Event(msrest.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 - """ - - _validation = { - 'count': {'readonly': True}, - 'first_timestamp': {'readonly': True}, - 'last_timestamp': {'readonly': True}, - 'name': {'readonly': True}, - 'message': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'first_timestamp': {'key': 'firstTimestamp', 'type': 'iso-8601'}, - 'last_timestamp': {'key': 'lastTimestamp', 'type': 'iso-8601'}, - 'name': {'key': 'name', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Event, self).__init__(**kwargs) - self.count = None - self.first_timestamp = None - self.last_timestamp = None - self.name = None - self.message = None - self.type = None - - -class GitRepoVolume(msrest.serialization.Model): - """Represents a volume that is populated with the contents of a git repository. - - All required parameters must be populated in order to send to Azure. - - :param directory: Target directory name. Must not contain or start with '..'. If '.' is - supplied, the volume directory will be the git repository. Otherwise, if specified, the volume - will contain the git repository in the subdirectory with the given name. - :type directory: str - :param repository: Required. Repository URL. - :type repository: str - :param revision: Commit hash for the specified revision. - :type revision: str - """ - - _validation = { - 'repository': {'required': True}, - } - - _attribute_map = { - 'directory': {'key': 'directory', 'type': 'str'}, - 'repository': {'key': 'repository', 'type': 'str'}, - 'revision': {'key': 'revision', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GitRepoVolume, self).__init__(**kwargs) - self.directory = kwargs.get('directory', None) - self.repository = kwargs['repository'] - self.revision = kwargs.get('revision', None) - - -class GpuResource(msrest.serialization.Model): - """The GPU resource. - - All required parameters must be populated in order to send to Azure. - - :param count: Required. The count of the GPU resource. - :type count: int - :param sku: Required. The SKU of the GPU resource. Possible values include: "K80", "P100", - "V100". - :type sku: str or ~azure.mgmt.containerinstance.models.GpuSku - """ - - _validation = { - 'count': {'required': True}, - 'sku': {'required': True}, - } - - _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'sku': {'key': 'sku', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GpuResource, self).__init__(**kwargs) - self.count = kwargs['count'] - self.sku = kwargs['sku'] - - -class HttpHeader(msrest.serialization.Model): - """The HTTP header. - - :param name: The header name. - :type name: str - :param value: The header value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HttpHeader, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class ImageRegistryCredential(msrest.serialization.Model): - """Image registry credential. - - All required parameters must be populated in order to send to Azure. - - :param server: Required. The Docker image registry server without a protocol such as "http" and - "https". - :type server: str - :param username: Required. The username for the private registry. - :type username: str - :param password: The password for the private registry. - :type password: str - :param identity: The identity for the private registry. - :type identity: str - :param identity_url: The identity URL for the private registry. - :type identity_url: str - """ - - _validation = { - 'server': {'required': True}, - 'username': {'required': True}, - } - - _attribute_map = { - 'server': {'key': 'server', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'str'}, - 'identity_url': {'key': 'identityUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageRegistryCredential, self).__init__(**kwargs) - self.server = kwargs['server'] - self.username = kwargs['username'] - self.password = kwargs.get('password', None) - self.identity = kwargs.get('identity', None) - self.identity_url = kwargs.get('identity_url', None) - - -class InitContainerDefinition(msrest.serialization.Model): - """The init container definition. - - 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 Azure. - - :param name: Required. The name for the init container. - :type name: str - :param image: The image of the init container. - :type image: str - :param command: The command to execute within the init container in exec form. - :type command: list[str] - :param environment_variables: The environment variables to set in the init container. - :type environment_variables: list[~azure.mgmt.containerinstance.models.EnvironmentVariable] - :ivar instance_view: The instance view of the init container. Only valid in response. - :vartype instance_view: - ~azure.mgmt.containerinstance.models.InitContainerPropertiesDefinitionInstanceView - :param volume_mounts: The volume mounts available to the init container. - :type volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] - """ - - _validation = { - 'name': {'required': True}, - 'instance_view': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'image': {'key': 'properties.image', 'type': 'str'}, - 'command': {'key': 'properties.command', 'type': '[str]'}, - 'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'}, - 'instance_view': {'key': 'properties.instanceView', 'type': 'InitContainerPropertiesDefinitionInstanceView'}, - 'volume_mounts': {'key': 'properties.volumeMounts', 'type': '[VolumeMount]'}, - } - - def __init__( - self, - **kwargs - ): - super(InitContainerDefinition, self).__init__(**kwargs) - self.name = kwargs['name'] - self.image = kwargs.get('image', None) - self.command = kwargs.get('command', None) - self.environment_variables = kwargs.get('environment_variables', None) - self.instance_view = None - self.volume_mounts = kwargs.get('volume_mounts', None) - - -class InitContainerPropertiesDefinitionInstanceView(msrest.serialization.Model): - """The instance view of the init container. Only valid in response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar restart_count: The number of times that the init container has been restarted. - :vartype restart_count: int - :ivar current_state: The current state of the init container. - :vartype current_state: ~azure.mgmt.containerinstance.models.ContainerState - :ivar previous_state: The previous state of the init container. - :vartype previous_state: ~azure.mgmt.containerinstance.models.ContainerState - :ivar events: The events of the init container. - :vartype events: list[~azure.mgmt.containerinstance.models.Event] - """ - - _validation = { - 'restart_count': {'readonly': True}, - 'current_state': {'readonly': True}, - 'previous_state': {'readonly': True}, - 'events': {'readonly': True}, - } - - _attribute_map = { - 'restart_count': {'key': 'restartCount', 'type': 'int'}, - 'current_state': {'key': 'currentState', 'type': 'ContainerState'}, - 'previous_state': {'key': 'previousState', 'type': 'ContainerState'}, - 'events': {'key': 'events', 'type': '[Event]'}, - } - - def __init__( - self, - **kwargs - ): - super(InitContainerPropertiesDefinitionInstanceView, self).__init__(**kwargs) - self.restart_count = None - self.current_state = None - self.previous_state = None - self.events = None - - -class IpAddress(msrest.serialization.Model): - """IP address for the container group. - - 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 Azure. - - :param ports: Required. The list of ports exposed on the container group. - :type ports: list[~azure.mgmt.containerinstance.models.Port] - :param type: Required. Specifies if the IP is exposed to the public internet or private VNET. - Possible values include: "Public", "Private". - :type type: str or ~azure.mgmt.containerinstance.models.ContainerGroupIpAddressType - :param ip: The IP exposed to the public internet. - :type ip: str - :param dns_name_label: The Dns name label for the IP. - :type dns_name_label: str - :ivar fqdn: The FQDN for the IP. - :vartype fqdn: str - """ - - _validation = { - 'ports': {'required': True}, - 'type': {'required': True}, - 'fqdn': {'readonly': True}, - } - - _attribute_map = { - 'ports': {'key': 'ports', 'type': '[Port]'}, - 'type': {'key': 'type', 'type': 'str'}, - 'ip': {'key': 'ip', 'type': 'str'}, - 'dns_name_label': {'key': 'dnsNameLabel', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IpAddress, self).__init__(**kwargs) - self.ports = kwargs['ports'] - self.type = kwargs['type'] - self.ip = kwargs.get('ip', None) - self.dns_name_label = kwargs.get('dns_name_label', None) - self.fqdn = None - - -class LogAnalytics(msrest.serialization.Model): - """Container group log analytics information. - - All required parameters must be populated in order to send to Azure. - - :param workspace_id: Required. The workspace id for log analytics. - :type workspace_id: str - :param workspace_key: Required. The workspace key for log analytics. - :type workspace_key: str - :param log_type: The log type to be used. Possible values include: "ContainerInsights", - "ContainerInstanceLogs". - :type log_type: str or ~azure.mgmt.containerinstance.models.LogAnalyticsLogType - :param metadata: Metadata for log analytics. - :type metadata: dict[str, str] - :param workspace_resource_id: The workspace resource id for log analytics. - :type workspace_resource_id: str - """ - - _validation = { - 'workspace_id': {'required': True}, - 'workspace_key': {'required': True}, - } - - _attribute_map = { - 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, - 'workspace_key': {'key': 'workspaceKey', 'type': 'str'}, - 'log_type': {'key': 'logType', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': '{str}'}, - 'workspace_resource_id': {'key': 'workspaceResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogAnalytics, self).__init__(**kwargs) - self.workspace_id = kwargs['workspace_id'] - self.workspace_key = kwargs['workspace_key'] - self.log_type = kwargs.get('log_type', None) - self.metadata = kwargs.get('metadata', None) - self.workspace_resource_id = kwargs.get('workspace_resource_id', None) - - -class Logs(msrest.serialization.Model): - """The logs. - - :param content: The content of the log. - :type content: str - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Logs, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - - -class Operation(msrest.serialization.Model): - """An operation for Azure Container Instance service. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the operation. - :type name: str - :param display: Required. The display information of the operation. - :type display: ~azure.mgmt.containerinstance.models.OperationDisplay - :param properties: The additional properties. - :type properties: any - :param origin: The intended executor of the operation. Possible values include: "User", - "System". - :type origin: str or ~azure.mgmt.containerinstance.models.ContainerInstanceOperationsOrigin - """ - - _validation = { - 'name': {'required': True}, - 'display': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'properties': {'key': 'properties', 'type': 'object'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.display = kwargs['display'] - self.properties = kwargs.get('properties', None) - self.origin = kwargs.get('origin', None) - - -class OperationDisplay(msrest.serialization.Model): - """The display information of the operation. - - :param provider: The name of the provider of the operation. - :type provider: str - :param resource: The name of the resource type of the operation. - :type resource: str - :param operation: The friendly name of the operation. - :type operation: str - :param description: The description of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """The operation list response that contains all operations for Azure Container Instance service. - - :param value: The list of operations. - :type value: list[~azure.mgmt.containerinstance.models.Operation] - :param next_link: The URI to fetch the next page of operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class Port(msrest.serialization.Model): - """The port exposed on the container group. - - All required parameters must be populated in order to send to Azure. - - :param protocol: The protocol associated with the port. Possible values include: "TCP", "UDP". - :type protocol: str or ~azure.mgmt.containerinstance.models.ContainerGroupNetworkProtocol - :param port: Required. The port number. - :type port: int - """ - - _validation = { - 'port': {'required': True}, - } - - _attribute_map = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Port, self).__init__(**kwargs) - self.protocol = kwargs.get('protocol', None) - self.port = kwargs['port'] - - -class ResourceLimits(msrest.serialization.Model): - """The resource limits. - - :param memory_in_gb: The memory limit in GB of this container instance. - :type memory_in_gb: float - :param cpu: The CPU limit of this container instance. - :type cpu: float - :param gpu: The GPU limit of this container instance. - :type gpu: ~azure.mgmt.containerinstance.models.GpuResource - """ - - _attribute_map = { - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'float'}, - 'cpu': {'key': 'cpu', 'type': 'float'}, - 'gpu': {'key': 'gpu', 'type': 'GpuResource'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceLimits, self).__init__(**kwargs) - self.memory_in_gb = kwargs.get('memory_in_gb', None) - self.cpu = kwargs.get('cpu', None) - self.gpu = kwargs.get('gpu', None) - - -class ResourceRequests(msrest.serialization.Model): - """The resource requests. - - All required parameters must be populated in order to send to Azure. - - :param memory_in_gb: Required. The memory request in GB of this container instance. - :type memory_in_gb: float - :param cpu: Required. The CPU request of this container instance. - :type cpu: float - :param gpu: The GPU request of this container instance. - :type gpu: ~azure.mgmt.containerinstance.models.GpuResource - """ - - _validation = { - 'memory_in_gb': {'required': True}, - 'cpu': {'required': True}, - } - - _attribute_map = { - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'float'}, - 'cpu': {'key': 'cpu', 'type': 'float'}, - 'gpu': {'key': 'gpu', 'type': 'GpuResource'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceRequests, self).__init__(**kwargs) - self.memory_in_gb = kwargs['memory_in_gb'] - self.cpu = kwargs['cpu'] - self.gpu = kwargs.get('gpu', None) - - -class ResourceRequirements(msrest.serialization.Model): - """The resource requirements. - - All required parameters must be populated in order to send to Azure. - - :param requests: Required. The resource requests of this container instance. - :type requests: ~azure.mgmt.containerinstance.models.ResourceRequests - :param limits: The resource limits of this container instance. - :type limits: ~azure.mgmt.containerinstance.models.ResourceLimits - """ - - _validation = { - 'requests': {'required': True}, - } - - _attribute_map = { - 'requests': {'key': 'requests', 'type': 'ResourceRequests'}, - 'limits': {'key': 'limits', 'type': 'ResourceLimits'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceRequirements, self).__init__(**kwargs) - self.requests = kwargs['requests'] - self.limits = kwargs.get('limits', None) - - -class Usage(msrest.serialization.Model): - """A single usage result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: Unit of the usage result. - :vartype unit: str - :ivar current_value: The current usage of the resource. - :vartype current_value: int - :ivar limit: The maximum permitted usage of the resource. - :vartype limit: int - :ivar name: The name object of the resource. - :vartype name: ~azure.mgmt.containerinstance.models.UsageName - """ - - _validation = { - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = None - self.current_value = None - self.limit = None - self.name = None - - -class UsageListResult(msrest.serialization.Model): - """The response containing the usage data. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The usage data. - :vartype value: list[~azure.mgmt.containerinstance.models.Usage] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageListResult, self).__init__(**kwargs) - self.value = None - - -class UsageName(msrest.serialization.Model): - """The name object of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The name of the resource. - :vartype value: str - :ivar localized_value: The localized name of the resource. - :vartype localized_value: str - """ - - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = None - self.localized_value = None - - -class Volume(msrest.serialization.Model): - """The properties of the volume. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the volume. - :type name: str - :param azure_file: The Azure File volume. - :type azure_file: ~azure.mgmt.containerinstance.models.AzureFileVolume - :param empty_dir: The empty directory volume. - :type empty_dir: any - :param secret: The secret volume. - :type secret: dict[str, str] - :param git_repo: The git repo volume. - :type git_repo: ~azure.mgmt.containerinstance.models.GitRepoVolume - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'azure_file': {'key': 'azureFile', 'type': 'AzureFileVolume'}, - 'empty_dir': {'key': 'emptyDir', 'type': 'object'}, - 'secret': {'key': 'secret', 'type': '{str}'}, - 'git_repo': {'key': 'gitRepo', 'type': 'GitRepoVolume'}, - } - - def __init__( - self, - **kwargs - ): - super(Volume, self).__init__(**kwargs) - self.name = kwargs['name'] - self.azure_file = kwargs.get('azure_file', None) - self.empty_dir = kwargs.get('empty_dir', None) - self.secret = kwargs.get('secret', None) - self.git_repo = kwargs.get('git_repo', None) - - -class VolumeMount(msrest.serialization.Model): - """The properties of the volume mount. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the volume mount. - :type name: str - :param mount_path: Required. The path within the container where the volume should be mounted. - Must not contain colon (:). - :type mount_path: str - :param read_only: The flag indicating whether the volume mount is read-only. - :type read_only: bool - """ - - _validation = { - 'name': {'required': True}, - 'mount_path': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'mount_path': {'key': 'mountPath', 'type': 'str'}, - 'read_only': {'key': 'readOnly', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumeMount, self).__init__(**kwargs) - self.name = kwargs['name'] - self.mount_path = kwargs['mount_path'] - self.read_only = kwargs.get('read_only', None) 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 3b8719a4d3c69..6701e9b6a6c87 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 @@ -18,16 +18,16 @@ class AzureFileVolume(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_name: Required. The name of the Azure File share to be mounted as a volume. - :type share_name: str - :param read_only: The flag indicating whether the Azure File shared mounted as a volume is + :ivar share_name: Required. The name of the Azure File share to be mounted as a volume. + :vartype share_name: str + :ivar read_only: The flag indicating whether the Azure File shared mounted as a volume is read-only. - :type read_only: bool - :param storage_account_name: Required. The name of the storage account that contains the Azure + :vartype read_only: bool + :ivar storage_account_name: Required. The name of the storage account that contains the Azure File share. - :type storage_account_name: str - :param storage_account_key: The storage account access key used to access the Azure File share. - :type storage_account_key: str + :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 """ _validation = { @@ -51,6 +51,19 @@ def __init__( storage_account_key: Optional[str] = None, **kwargs ): + """ + :keyword share_name: Required. The name of the Azure File share to be mounted as a volume. + :paramtype share_name: str + :keyword read_only: The flag indicating whether the Azure File shared mounted as a volume is + read-only. + :paramtype read_only: bool + :keyword storage_account_name: Required. The name of the storage account that contains the + Azure File share. + :paramtype storage_account_name: str + :keyword storage_account_key: The storage account access key used to access the Azure File + share. + :paramtype storage_account_key: str + """ super(AzureFileVolume, self).__init__(**kwargs) self.share_name = share_name self.read_only = read_only @@ -63,10 +76,10 @@ class CachedImages(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param os_type: Required. The OS type of the cached image. - :type os_type: str - :param image: Required. The cached image name. - :type image: str + :ivar os_type: Required. The OS type of the cached image. + :vartype os_type: str + :ivar image: Required. The cached image name. + :vartype image: str """ _validation = { @@ -86,6 +99,12 @@ def __init__( image: str, **kwargs ): + """ + :keyword os_type: Required. The OS type of the cached image. + :paramtype os_type: str + :keyword image: Required. The cached image name. + :paramtype image: str + """ super(CachedImages, self).__init__(**kwargs) self.os_type = os_type self.image = image @@ -94,10 +113,10 @@ def __init__( class CachedImagesListResult(msrest.serialization.Model): """The response containing cached images. - :param value: The list of cached images. - :type value: list[~azure.mgmt.containerinstance.models.CachedImages] - :param next_link: The URI to fetch the next page of cached images. - :type next_link: str + :ivar value: The list of cached images. + :vartype value: list[~azure.mgmt.containerinstance.models.CachedImages] + :ivar next_link: The URI to fetch the next page of cached images. + :vartype next_link: str """ _attribute_map = { @@ -112,6 +131,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of cached images. + :paramtype value: list[~azure.mgmt.containerinstance.models.CachedImages] + :keyword next_link: The URI to fetch the next page of cached images. + :paramtype next_link: str + """ super(CachedImagesListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -158,6 +183,8 @@ def __init__( self, **kwargs ): + """ + """ super(Capabilities, self).__init__(**kwargs) self.resource_type = None self.os_type = None @@ -196,6 +223,8 @@ def __init__( self, **kwargs ): + """ + """ super(CapabilitiesCapabilities, self).__init__(**kwargs) self.max_memory_in_gb = None self.max_cpu = None @@ -205,10 +234,10 @@ def __init__( class CapabilitiesListResult(msrest.serialization.Model): """The response containing list of capabilities. - :param value: The list of capabilities. - :type value: list[~azure.mgmt.containerinstance.models.Capabilities] - :param next_link: The URI to fetch the next page of capabilities. - :type next_link: str + :ivar value: The list of capabilities. + :vartype value: list[~azure.mgmt.containerinstance.models.Capabilities] + :ivar next_link: The URI to fetch the next page of capabilities. + :vartype next_link: str """ _attribute_map = { @@ -223,6 +252,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of capabilities. + :paramtype value: list[~azure.mgmt.containerinstance.models.Capabilities] + :keyword next_link: The URI to fetch the next page of capabilities. + :paramtype next_link: str + """ super(CapabilitiesListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -231,17 +266,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the Container Instance service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.containerinstance.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.containerinstance.models.CloudErrorBody] """ _attribute_map = { @@ -260,6 +295,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.containerinstance.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -292,6 +340,8 @@ def __init__( self, **kwargs ): + """ + """ super(Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -304,26 +354,26 @@ class Container(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The user-provided name of the container instance. - :type name: str - :param image: Required. The name of the image used to create the container instance. - :type image: str - :param command: The commands to execute within the container instance in exec form. - :type command: list[str] - :param ports: The exposed ports on the container instance. - :type ports: list[~azure.mgmt.containerinstance.models.ContainerPort] - :param environment_variables: The environment variables to set in the container instance. - :type environment_variables: list[~azure.mgmt.containerinstance.models.EnvironmentVariable] + :ivar name: Required. The user-provided name of the container instance. + :vartype name: str + :ivar image: Required. The name of the image used to create the container instance. + :vartype image: str + :ivar command: The commands to execute within the container instance in exec form. + :vartype command: list[str] + :ivar ports: The exposed ports on the container instance. + :vartype ports: list[~azure.mgmt.containerinstance.models.ContainerPort] + :ivar environment_variables: The environment variables to set in the container instance. + :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 - :param resources: Required. The resource requirements of the container instance. - :type resources: ~azure.mgmt.containerinstance.models.ResourceRequirements - :param volume_mounts: The volume mounts available to the container instance. - :type volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] - :param liveness_probe: The liveness probe. - :type liveness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe - :param readiness_probe: The readiness probe. - :type readiness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe + :ivar resources: Required. The resource requirements of the container instance. + :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] + :ivar liveness_probe: The liveness probe. + :vartype liveness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe + :ivar readiness_probe: The readiness probe. + :vartype readiness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe """ _validation = { @@ -360,6 +410,27 @@ def __init__( readiness_probe: Optional["ContainerProbe"] = None, **kwargs ): + """ + :keyword name: Required. The user-provided name of the container instance. + :paramtype name: str + :keyword image: Required. The name of the image used to create the container instance. + :paramtype image: str + :keyword command: The commands to execute within the container instance in exec form. + :paramtype command: list[str] + :keyword ports: The exposed ports on the container instance. + :paramtype ports: list[~azure.mgmt.containerinstance.models.ContainerPort] + :keyword environment_variables: The environment variables to set in the container instance. + :paramtype environment_variables: + list[~azure.mgmt.containerinstance.models.EnvironmentVariable] + :keyword resources: Required. The resource requirements of the container instance. + :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] + :keyword liveness_probe: The liveness probe. + :paramtype liveness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe + :keyword readiness_probe: The readiness probe. + :paramtype readiness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe + """ super(Container, self).__init__(**kwargs) self.name = name self.image = image @@ -376,11 +447,11 @@ def __init__( class ContainerAttachResponse(msrest.serialization.Model): """The information for the output stream from container attach. - :param web_socket_uri: The uri for the output stream from the attach. - :type web_socket_uri: str - :param password: The password to the output stream from the attach. Send as an Authorization + :ivar web_socket_uri: The uri for the output stream from the attach. + :vartype web_socket_uri: str + :ivar password: The password to the output stream from the attach. Send as an Authorization header value when connecting to the websocketUri. - :type password: str + :vartype password: str """ _attribute_map = { @@ -395,6 +466,13 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword web_socket_uri: The uri for the output stream from the attach. + :paramtype web_socket_uri: str + :keyword password: The password to the output stream from the attach. Send as an Authorization + header value when connecting to the websocketUri. + :paramtype password: str + """ super(ContainerAttachResponse, self).__init__(**kwargs) self.web_socket_uri = web_socket_uri self.password = password @@ -403,8 +481,8 @@ def __init__( class ContainerExec(msrest.serialization.Model): """The container execution command, for liveness or readiness probe. - :param command: The commands to execute within the container. - :type command: list[str] + :ivar command: The commands to execute within the container. + :vartype command: list[str] """ _attribute_map = { @@ -417,6 +495,10 @@ def __init__( command: Optional[List[str]] = None, **kwargs ): + """ + :keyword command: The commands to execute within the container. + :paramtype command: list[str] + """ super(ContainerExec, self).__init__(**kwargs) self.command = command @@ -424,10 +506,10 @@ def __init__( class ContainerExecRequest(msrest.serialization.Model): """The container exec request. - :param command: The command to be executed. - :type command: str - :param terminal_size: The size of the terminal. - :type terminal_size: ~azure.mgmt.containerinstance.models.ContainerExecRequestTerminalSize + :ivar command: The command to be executed. + :vartype command: str + :ivar terminal_size: The size of the terminal. + :vartype terminal_size: ~azure.mgmt.containerinstance.models.ContainerExecRequestTerminalSize """ _attribute_map = { @@ -442,6 +524,12 @@ def __init__( terminal_size: Optional["ContainerExecRequestTerminalSize"] = None, **kwargs ): + """ + :keyword command: The command to be executed. + :paramtype command: str + :keyword terminal_size: The size of the terminal. + :paramtype terminal_size: ~azure.mgmt.containerinstance.models.ContainerExecRequestTerminalSize + """ super(ContainerExecRequest, self).__init__(**kwargs) self.command = command self.terminal_size = terminal_size @@ -450,10 +538,10 @@ def __init__( class ContainerExecRequestTerminalSize(msrest.serialization.Model): """The size of the terminal. - :param rows: The row size of the terminal. - :type rows: int - :param cols: The column size of the terminal. - :type cols: int + :ivar rows: The row size of the terminal. + :vartype rows: int + :ivar cols: The column size of the terminal. + :vartype cols: int """ _attribute_map = { @@ -468,6 +556,12 @@ def __init__( cols: Optional[int] = None, **kwargs ): + """ + :keyword rows: The row size of the terminal. + :paramtype rows: int + :keyword cols: The column size of the terminal. + :paramtype cols: int + """ super(ContainerExecRequestTerminalSize, self).__init__(**kwargs) self.rows = rows self.cols = cols @@ -476,10 +570,10 @@ def __init__( class ContainerExecResponse(msrest.serialization.Model): """The information for the container exec command. - :param web_socket_uri: The uri for the exec websocket. - :type web_socket_uri: str - :param password: The password to start the exec command. - :type password: str + :ivar web_socket_uri: The uri for the exec websocket. + :vartype web_socket_uri: str + :ivar password: The password to start the exec command. + :vartype password: str """ _attribute_map = { @@ -494,6 +588,12 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword web_socket_uri: The uri for the exec websocket. + :paramtype web_socket_uri: str + :keyword password: The password to start the exec command. + :paramtype password: str + """ super(ContainerExecResponse, self).__init__(**kwargs) self.web_socket_uri = web_socket_uri self.password = password @@ -510,12 +610,12 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param zones: The zones for the container group. - :type zones: list[str] + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar zones: The zones for the container group. + :vartype zones: list[str] """ _validation = { @@ -541,6 +641,14 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: The resource location. + :paramtype location: str + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword zones: The zones for the container group. + :paramtype zones: list[str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -563,52 +671,53 @@ class ContainerGroup(Resource): :vartype name: str :ivar type: The resource type. :vartype type: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param zones: The zones for the container group. - :type zones: list[str] - :param identity: The identity of the container group, if configured. - :type identity: ~azure.mgmt.containerinstance.models.ContainerGroupIdentity + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar zones: The zones for the container group. + :vartype zones: list[str] + :ivar identity: The identity of the container group, if configured. + :vartype identity: ~azure.mgmt.containerinstance.models.ContainerGroupIdentity :ivar provisioning_state: The provisioning state of the container group. This only appears in the response. :vartype provisioning_state: str - :param containers: Required. The containers within the container group. - :type containers: list[~azure.mgmt.containerinstance.models.Container] - :param image_registry_credentials: The image registry credentials by which the container group + :ivar containers: Required. The containers within the container group. + :vartype containers: list[~azure.mgmt.containerinstance.models.Container] + :ivar image_registry_credentials: The image registry credentials by which the container group is created from. - :type image_registry_credentials: + :vartype image_registry_credentials: list[~azure.mgmt.containerinstance.models.ImageRegistryCredential] - :param restart_policy: Restart policy for all containers within the container group. + :ivar restart_policy: Restart policy for all containers within the container group. * ``Always`` Always restart * ``OnFailure`` Restart on failure * ``Never`` Never restart. Possible values include: "Always", "OnFailure", "Never". - :type restart_policy: str or ~azure.mgmt.containerinstance.models.ContainerGroupRestartPolicy - :param ip_address: The IP address type of the container group. - :type ip_address: ~azure.mgmt.containerinstance.models.IpAddress - :param os_type: Required. The operating system type required by the containers in the container + :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: Required. The operating system type required by the containers in the container group. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.containerinstance.models.OperatingSystemTypes - :param volumes: The list of volumes that can be mounted by containers in this container group. - :type volumes: list[~azure.mgmt.containerinstance.models.Volume] + :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 instance_view: The instance view of the container group. Only valid in response. :vartype instance_view: ~azure.mgmt.containerinstance.models.ContainerGroupPropertiesInstanceView - :param diagnostics: The diagnostic information for a container group. - :type diagnostics: ~azure.mgmt.containerinstance.models.ContainerGroupDiagnostics - :param subnet_ids: The subnet resource IDs for a container group. - :type subnet_ids: list[~azure.mgmt.containerinstance.models.ContainerGroupSubnetId] - :param dns_config: The DNS config information for a container group. - :type dns_config: ~azure.mgmt.containerinstance.models.DnsConfiguration - :param sku: The SKU for a container group. Possible values include: "Standard", "Dedicated". - :type sku: str or ~azure.mgmt.containerinstance.models.ContainerGroupSku - :param encryption_properties: The encryption properties for a container group. - :type encryption_properties: ~azure.mgmt.containerinstance.models.EncryptionProperties - :param init_containers: The init containers for a container group. - :type init_containers: list[~azure.mgmt.containerinstance.models.InitContainerDefinition] + :ivar diagnostics: The diagnostic information for a container group. + :vartype diagnostics: ~azure.mgmt.containerinstance.models.ContainerGroupDiagnostics + :ivar subnet_ids: The subnet resource IDs for a container group. + :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. Possible values include: "Standard", "Dedicated". + :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] """ _validation = { @@ -666,6 +775,50 @@ def __init__( init_containers: Optional[List["InitContainerDefinition"]] = None, **kwargs ): + """ + :keyword location: The resource location. + :paramtype location: str + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword zones: The zones for the container group. + :paramtype zones: list[str] + :keyword identity: The identity of the container group, if configured. + :paramtype identity: ~azure.mgmt.containerinstance.models.ContainerGroupIdentity + :keyword containers: Required. The containers within the container group. + :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. Possible values include: "Always", "OnFailure", "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: Required. The operating system type required by the containers in the + container group. Possible values include: "Windows", "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 subnet_ids: The subnet resource IDs for a container group. + :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. Possible values include: "Standard", "Dedicated". + :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] + """ super(ContainerGroup, self).__init__(location=location, tags=tags, zones=zones, **kwargs) self.identity = identity self.provisioning_state = None @@ -687,8 +840,8 @@ def __init__( class ContainerGroupDiagnostics(msrest.serialization.Model): """Container group diagnostic information. - :param log_analytics: Container group log analytics information. - :type log_analytics: ~azure.mgmt.containerinstance.models.LogAnalytics + :ivar log_analytics: Container group log analytics information. + :vartype log_analytics: ~azure.mgmt.containerinstance.models.LogAnalytics """ _attribute_map = { @@ -701,6 +854,10 @@ def __init__( log_analytics: Optional["LogAnalytics"] = None, **kwargs ): + """ + :keyword log_analytics: Container group log analytics information. + :paramtype log_analytics: ~azure.mgmt.containerinstance.models.LogAnalytics + """ super(ContainerGroupDiagnostics, self).__init__(**kwargs) self.log_analytics = log_analytics @@ -716,15 +873,15 @@ class ContainerGroupIdentity(msrest.serialization.Model): :ivar tenant_id: The tenant id associated with the container group. This property will only be provided for a system assigned identity. :vartype tenant_id: str - :param type: The type of identity used for the container group. The type 'SystemAssigned, + :ivar type: The type of identity used for the container group. 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 container group. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.containerinstance.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the container + :vartype type: str or ~azure.mgmt.containerinstance.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.containerinstance.models.Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties] """ @@ -747,6 +904,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, **kwargs ): + """ + :keyword type: The type of identity used for the container group. 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 container group. Possible + values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.containerinstance.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the container + group. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerinstance.models.Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties] + """ super(ContainerGroupIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -757,10 +926,10 @@ def __init__( class ContainerGroupListResult(msrest.serialization.Model): """The container group list response that contains the container group properties. - :param value: The list of container groups. - :type value: list[~azure.mgmt.containerinstance.models.ContainerGroup] - :param next_link: The URI to fetch the next page of container groups. - :type next_link: str + :ivar value: The list of container groups. + :vartype value: list[~azure.mgmt.containerinstance.models.ContainerGroup] + :ivar next_link: The URI to fetch the next page of container groups. + :vartype next_link: str """ _attribute_map = { @@ -775,6 +944,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of container groups. + :paramtype value: list[~azure.mgmt.containerinstance.models.ContainerGroup] + :keyword next_link: The URI to fetch the next page of container groups. + :paramtype next_link: str + """ super(ContainerGroupListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -805,6 +980,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerGroupPropertiesInstanceView, self).__init__(**kwargs) self.events = None self.state = None @@ -815,10 +992,10 @@ class ContainerGroupSubnetId(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Resource ID of virtual network and subnet. - :type id: str - :param name: Friendly name for the subnet. - :type name: str + :ivar id: Required. Resource ID of virtual network and subnet. + :vartype id: str + :ivar name: Friendly name for the subnet. + :vartype name: str """ _validation = { @@ -837,6 +1014,12 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword id: Required. Resource ID of virtual network and subnet. + :paramtype id: str + :keyword name: Friendly name for the subnet. + :paramtype name: str + """ super(ContainerGroupSubnetId, self).__init__(**kwargs) self.id = id self.name = name @@ -847,14 +1030,14 @@ class ContainerHttpGet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param path: The path to probe. - :type path: str - :param port: Required. The port number to probe. - :type port: int - :param scheme: The scheme. Possible values include: "http", "https". - :type scheme: str or ~azure.mgmt.containerinstance.models.Scheme - :param http_headers: The HTTP headers. - :type http_headers: list[~azure.mgmt.containerinstance.models.HttpHeader] + :ivar path: The path to probe. + :vartype path: str + :ivar port: Required. The port number to probe. + :vartype port: int + :ivar scheme: The scheme. Possible values include: "http", "https". + :vartype scheme: str or ~azure.mgmt.containerinstance.models.Scheme + :ivar http_headers: The HTTP headers. + :vartype http_headers: list[~azure.mgmt.containerinstance.models.HttpHeader] """ _validation = { @@ -877,6 +1060,16 @@ def __init__( http_headers: Optional[List["HttpHeader"]] = None, **kwargs ): + """ + :keyword path: The path to probe. + :paramtype path: str + :keyword port: Required. The port number to probe. + :paramtype port: int + :keyword scheme: The scheme. Possible values include: "http", "https". + :paramtype scheme: str or ~azure.mgmt.containerinstance.models.Scheme + :keyword http_headers: The HTTP headers. + :paramtype http_headers: list[~azure.mgmt.containerinstance.models.HttpHeader] + """ super(ContainerHttpGet, self).__init__(**kwargs) self.path = path self.port = port @@ -889,10 +1082,10 @@ class ContainerPort(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param protocol: The protocol associated with the port. Possible values include: "TCP", "UDP". - :type protocol: str or ~azure.mgmt.containerinstance.models.ContainerNetworkProtocol - :param port: Required. The port number exposed within the container group. - :type port: int + :ivar protocol: The protocol associated with the port. Possible values include: "TCP", "UDP". + :vartype protocol: str or ~azure.mgmt.containerinstance.models.ContainerNetworkProtocol + :ivar port: Required. The port number exposed within the container group. + :vartype port: int """ _validation = { @@ -911,6 +1104,13 @@ def __init__( protocol: Optional[Union[str, "ContainerNetworkProtocol"]] = None, **kwargs ): + """ + :keyword protocol: The protocol associated with the port. Possible values include: "TCP", + "UDP". + :paramtype protocol: str or ~azure.mgmt.containerinstance.models.ContainerNetworkProtocol + :keyword port: Required. The port number exposed within the container group. + :paramtype port: int + """ super(ContainerPort, self).__init__(**kwargs) self.protocol = protocol self.port = port @@ -919,20 +1119,20 @@ def __init__( class ContainerProbe(msrest.serialization.Model): """The container probe, for liveness or readiness. - :param exec_property: The execution command to probe. - :type exec_property: ~azure.mgmt.containerinstance.models.ContainerExec - :param http_get: The Http Get settings to probe. - :type http_get: ~azure.mgmt.containerinstance.models.ContainerHttpGet - :param initial_delay_seconds: The initial delay seconds. - :type initial_delay_seconds: int - :param period_seconds: The period seconds. - :type period_seconds: int - :param failure_threshold: The failure threshold. - :type failure_threshold: int - :param success_threshold: The success threshold. - :type success_threshold: int - :param timeout_seconds: The timeout seconds. - :type timeout_seconds: int + :ivar exec_property: The execution command to probe. + :vartype exec_property: ~azure.mgmt.containerinstance.models.ContainerExec + :ivar http_get: The Http Get settings to probe. + :vartype http_get: ~azure.mgmt.containerinstance.models.ContainerHttpGet + :ivar initial_delay_seconds: The initial delay seconds. + :vartype initial_delay_seconds: int + :ivar period_seconds: The period seconds. + :vartype period_seconds: int + :ivar failure_threshold: The failure threshold. + :vartype failure_threshold: int + :ivar success_threshold: The success threshold. + :vartype success_threshold: int + :ivar timeout_seconds: The timeout seconds. + :vartype timeout_seconds: int """ _attribute_map = { @@ -957,6 +1157,22 @@ def __init__( timeout_seconds: Optional[int] = None, **kwargs ): + """ + :keyword exec_property: The execution command to probe. + :paramtype exec_property: ~azure.mgmt.containerinstance.models.ContainerExec + :keyword http_get: The Http Get settings to probe. + :paramtype http_get: ~azure.mgmt.containerinstance.models.ContainerHttpGet + :keyword initial_delay_seconds: The initial delay seconds. + :paramtype initial_delay_seconds: int + :keyword period_seconds: The period seconds. + :paramtype period_seconds: int + :keyword failure_threshold: The failure threshold. + :paramtype failure_threshold: int + :keyword success_threshold: The success threshold. + :paramtype success_threshold: int + :keyword timeout_seconds: The timeout seconds. + :paramtype timeout_seconds: int + """ super(ContainerProbe, self).__init__(**kwargs) self.exec_property = exec_property self.http_get = http_get @@ -1000,6 +1216,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerPropertiesInstanceView, self).__init__(**kwargs) self.restart_count = None self.current_state = None @@ -1045,6 +1263,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContainerState, self).__init__(**kwargs) self.state = None self.start_time = None @@ -1058,12 +1278,12 @@ class DnsConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name_servers: Required. The DNS servers for the container group. - :type name_servers: list[str] - :param search_domains: The DNS search domains for hostname lookup in the container group. - :type search_domains: str - :param options: The DNS options for the container group. - :type options: str + :ivar name_servers: Required. The DNS servers for the container group. + :vartype name_servers: list[str] + :ivar search_domains: The DNS search domains for hostname lookup in the container group. + :vartype search_domains: str + :ivar options: The DNS options for the container group. + :vartype options: str """ _validation = { @@ -1084,6 +1304,14 @@ def __init__( options: Optional[str] = None, **kwargs ): + """ + :keyword name_servers: Required. The DNS servers for the container group. + :paramtype name_servers: list[str] + :keyword search_domains: The DNS search domains for hostname lookup in the container group. + :paramtype search_domains: str + :keyword options: The DNS options for the container group. + :paramtype options: str + """ super(DnsConfiguration, self).__init__(**kwargs) self.name_servers = name_servers self.search_domains = search_domains @@ -1095,12 +1323,12 @@ class EncryptionProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param vault_base_url: Required. The keyvault base url. - :type vault_base_url: str - :param key_name: Required. The encryption key name. - :type key_name: str - :param key_version: Required. The encryption key version. - :type key_version: str + :ivar vault_base_url: Required. The keyvault base url. + :vartype vault_base_url: str + :ivar key_name: Required. The encryption key name. + :vartype key_name: str + :ivar key_version: Required. The encryption key version. + :vartype key_version: str """ _validation = { @@ -1123,6 +1351,14 @@ def __init__( key_version: str, **kwargs ): + """ + :keyword vault_base_url: Required. The keyvault base url. + :paramtype vault_base_url: str + :keyword key_name: Required. The encryption key name. + :paramtype key_name: str + :keyword key_version: Required. The encryption key version. + :paramtype key_version: str + """ super(EncryptionProperties, self).__init__(**kwargs) self.vault_base_url = vault_base_url self.key_name = key_name @@ -1134,12 +1370,12 @@ class EnvironmentVariable(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the environment variable. - :type name: str - :param value: The value of the environment variable. - :type value: str - :param secure_value: The value of the secure environment variable. - :type secure_value: str + :ivar name: Required. The name of the environment variable. + :vartype name: str + :ivar value: The value of the environment variable. + :vartype value: str + :ivar secure_value: The value of the secure environment variable. + :vartype secure_value: str """ _validation = { @@ -1160,6 +1396,14 @@ def __init__( secure_value: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The name of the environment variable. + :paramtype name: str + :keyword value: The value of the environment variable. + :paramtype value: str + :keyword secure_value: The value of the secure environment variable. + :paramtype secure_value: str + """ super(EnvironmentVariable, self).__init__(**kwargs) self.name = name self.value = value @@ -1207,6 +1451,8 @@ def __init__( self, **kwargs ): + """ + """ super(Event, self).__init__(**kwargs) self.count = None self.first_timestamp = None @@ -1221,14 +1467,14 @@ class GitRepoVolume(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory: Target directory name. Must not contain or start with '..'. If '.' is + :ivar directory: Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. - :type directory: str - :param repository: Required. Repository URL. - :type repository: str - :param revision: Commit hash for the specified revision. - :type revision: str + :vartype directory: str + :ivar repository: Required. Repository URL. + :vartype repository: str + :ivar revision: Commit hash for the specified revision. + :vartype revision: str """ _validation = { @@ -1249,6 +1495,16 @@ def __init__( revision: Optional[str] = None, **kwargs ): + """ + :keyword directory: Target directory name. Must not contain or start with '..'. If '.' is + supplied, the volume directory will be the git repository. Otherwise, if specified, the volume + will contain the git repository in the subdirectory with the given name. + :paramtype directory: str + :keyword repository: Required. Repository URL. + :paramtype repository: str + :keyword revision: Commit hash for the specified revision. + :paramtype revision: str + """ super(GitRepoVolume, self).__init__(**kwargs) self.directory = directory self.repository = repository @@ -1260,11 +1516,11 @@ class GpuResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param count: Required. The count of the GPU resource. - :type count: int - :param sku: Required. The SKU of the GPU resource. Possible values include: "K80", "P100", + :ivar count: Required. The count of the GPU resource. + :vartype count: int + :ivar sku: Required. The SKU of the GPU resource. Possible values include: "K80", "P100", "V100". - :type sku: str or ~azure.mgmt.containerinstance.models.GpuSku + :vartype sku: str or ~azure.mgmt.containerinstance.models.GpuSku """ _validation = { @@ -1284,6 +1540,13 @@ def __init__( sku: Union[str, "GpuSku"], **kwargs ): + """ + :keyword count: Required. The count of the GPU resource. + :paramtype count: int + :keyword sku: Required. The SKU of the GPU resource. Possible values include: "K80", "P100", + "V100". + :paramtype sku: str or ~azure.mgmt.containerinstance.models.GpuSku + """ super(GpuResource, self).__init__(**kwargs) self.count = count self.sku = sku @@ -1292,10 +1555,10 @@ def __init__( class HttpHeader(msrest.serialization.Model): """The HTTP header. - :param name: The header name. - :type name: str - :param value: The header value. - :type value: str + :ivar name: The header name. + :vartype name: str + :ivar value: The header value. + :vartype value: str """ _attribute_map = { @@ -1310,6 +1573,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The header name. + :paramtype name: str + :keyword value: The header value. + :paramtype value: str + """ super(HttpHeader, self).__init__(**kwargs) self.name = name self.value = value @@ -1320,17 +1589,17 @@ class ImageRegistryCredential(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param server: Required. The Docker image registry server without a protocol such as "http" and + :ivar server: Required. The Docker image registry server without a protocol such as "http" and "https". - :type server: str - :param username: Required. The username for the private registry. - :type username: str - :param password: The password for the private registry. - :type password: str - :param identity: The identity for the private registry. - :type identity: str - :param identity_url: The identity URL for the private registry. - :type identity_url: str + :vartype server: str + :ivar username: Required. The username for the private registry. + :vartype username: str + :ivar password: The password for the private registry. + :vartype password: str + :ivar identity: The identity for the private registry. + :vartype identity: str + :ivar identity_url: The identity URL for the private registry. + :vartype identity_url: str """ _validation = { @@ -1356,6 +1625,19 @@ def __init__( identity_url: Optional[str] = None, **kwargs ): + """ + :keyword server: Required. The Docker image registry server without a protocol such as "http" + and "https". + :paramtype server: str + :keyword username: Required. The username for the private registry. + :paramtype username: str + :keyword password: The password for the private registry. + :paramtype password: str + :keyword identity: The identity for the private registry. + :paramtype identity: str + :keyword identity_url: The identity URL for the private registry. + :paramtype identity_url: str + """ super(ImageRegistryCredential, self).__init__(**kwargs) self.server = server self.username = username @@ -1371,19 +1653,19 @@ class InitContainerDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name for the init container. - :type name: str - :param image: The image of the init container. - :type image: str - :param command: The command to execute within the init container in exec form. - :type command: list[str] - :param environment_variables: The environment variables to set in the init container. - :type environment_variables: list[~azure.mgmt.containerinstance.models.EnvironmentVariable] + :ivar name: Required. The name for the init container. + :vartype name: str + :ivar image: The image of the init container. + :vartype image: str + :ivar command: The command to execute within the init container in exec form. + :vartype command: list[str] + :ivar environment_variables: The environment variables to set in the init container. + :vartype environment_variables: list[~azure.mgmt.containerinstance.models.EnvironmentVariable] :ivar instance_view: The instance view of the init container. Only valid in response. :vartype instance_view: ~azure.mgmt.containerinstance.models.InitContainerPropertiesDefinitionInstanceView - :param volume_mounts: The volume mounts available to the init container. - :type volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] + :ivar volume_mounts: The volume mounts available to the init container. + :vartype volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] """ _validation = { @@ -1410,6 +1692,19 @@ def __init__( volume_mounts: Optional[List["VolumeMount"]] = None, **kwargs ): + """ + :keyword name: Required. The name for the init container. + :paramtype name: str + :keyword image: The image of the init container. + :paramtype image: str + :keyword command: The command to execute within the init container in exec form. + :paramtype command: list[str] + :keyword environment_variables: The environment variables to set in the init container. + :paramtype environment_variables: + list[~azure.mgmt.containerinstance.models.EnvironmentVariable] + :keyword volume_mounts: The volume mounts available to the init container. + :paramtype volume_mounts: list[~azure.mgmt.containerinstance.models.VolumeMount] + """ super(InitContainerDefinition, self).__init__(**kwargs) self.name = name self.image = image @@ -1452,6 +1747,8 @@ def __init__( self, **kwargs ): + """ + """ super(InitContainerPropertiesDefinitionInstanceView, self).__init__(**kwargs) self.restart_count = None self.current_state = None @@ -1466,15 +1763,15 @@ class IpAddress(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ports: Required. The list of ports exposed on the container group. - :type ports: list[~azure.mgmt.containerinstance.models.Port] - :param type: Required. Specifies if the IP is exposed to the public internet or private VNET. + :ivar ports: Required. The list of ports exposed on the container group. + :vartype ports: list[~azure.mgmt.containerinstance.models.Port] + :ivar type: Required. Specifies if the IP is exposed to the public internet or private VNET. Possible values include: "Public", "Private". - :type type: str or ~azure.mgmt.containerinstance.models.ContainerGroupIpAddressType - :param ip: The IP exposed to the public internet. - :type ip: str - :param dns_name_label: The Dns name label for the IP. - :type dns_name_label: str + :vartype type: str or ~azure.mgmt.containerinstance.models.ContainerGroupIpAddressType + :ivar ip: The IP exposed to the public internet. + :vartype ip: str + :ivar dns_name_label: The Dns name label for the IP. + :vartype dns_name_label: str :ivar fqdn: The FQDN for the IP. :vartype fqdn: str """ @@ -1502,6 +1799,17 @@ def __init__( dns_name_label: Optional[str] = None, **kwargs ): + """ + :keyword ports: Required. The list of ports exposed on the container group. + :paramtype ports: list[~azure.mgmt.containerinstance.models.Port] + :keyword type: Required. Specifies if the IP is exposed to the public internet or private VNET. + Possible values include: "Public", "Private". + :paramtype type: str or ~azure.mgmt.containerinstance.models.ContainerGroupIpAddressType + :keyword ip: The IP exposed to the public internet. + :paramtype ip: str + :keyword dns_name_label: The Dns name label for the IP. + :paramtype dns_name_label: str + """ super(IpAddress, self).__init__(**kwargs) self.ports = ports self.type = type @@ -1515,17 +1823,17 @@ class LogAnalytics(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param workspace_id: Required. The workspace id for log analytics. - :type workspace_id: str - :param workspace_key: Required. The workspace key for log analytics. - :type workspace_key: str - :param log_type: The log type to be used. Possible values include: "ContainerInsights", + :ivar workspace_id: Required. The workspace id for log analytics. + :vartype workspace_id: str + :ivar workspace_key: Required. The workspace key for log analytics. + :vartype workspace_key: str + :ivar log_type: The log type to be used. Possible values include: "ContainerInsights", "ContainerInstanceLogs". - :type log_type: str or ~azure.mgmt.containerinstance.models.LogAnalyticsLogType - :param metadata: Metadata for log analytics. - :type metadata: dict[str, str] - :param workspace_resource_id: The workspace resource id for log analytics. - :type workspace_resource_id: str + :vartype log_type: str or ~azure.mgmt.containerinstance.models.LogAnalyticsLogType + :ivar metadata: Metadata for log analytics. + :vartype metadata: dict[str, str] + :ivar workspace_resource_id: The workspace resource id for log analytics. + :vartype workspace_resource_id: str """ _validation = { @@ -1551,6 +1859,19 @@ def __init__( workspace_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword workspace_id: Required. The workspace id for log analytics. + :paramtype workspace_id: str + :keyword workspace_key: Required. The workspace key for log analytics. + :paramtype workspace_key: str + :keyword log_type: The log type to be used. Possible values include: "ContainerInsights", + "ContainerInstanceLogs". + :paramtype log_type: str or ~azure.mgmt.containerinstance.models.LogAnalyticsLogType + :keyword metadata: Metadata for log analytics. + :paramtype metadata: dict[str, str] + :keyword workspace_resource_id: The workspace resource id for log analytics. + :paramtype workspace_resource_id: str + """ super(LogAnalytics, self).__init__(**kwargs) self.workspace_id = workspace_id self.workspace_key = workspace_key @@ -1562,8 +1883,8 @@ def __init__( class Logs(msrest.serialization.Model): """The logs. - :param content: The content of the log. - :type content: str + :ivar content: The content of the log. + :vartype content: str """ _attribute_map = { @@ -1576,6 +1897,10 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of the log. + :paramtype content: str + """ super(Logs, self).__init__(**kwargs) self.content = content @@ -1585,15 +1910,15 @@ class Operation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the operation. - :type name: str - :param display: Required. The display information of the operation. - :type display: ~azure.mgmt.containerinstance.models.OperationDisplay - :param properties: The additional properties. - :type properties: any - :param origin: The intended executor of the operation. Possible values include: "User", + :ivar name: Required. The name of the operation. + :vartype name: str + :ivar display: Required. The display information of the operation. + :vartype display: ~azure.mgmt.containerinstance.models.OperationDisplay + :ivar properties: The additional properties. + :vartype properties: any + :ivar origin: The intended executor of the operation. Possible values include: "User", "System". - :type origin: str or ~azure.mgmt.containerinstance.models.ContainerInstanceOperationsOrigin + :vartype origin: str or ~azure.mgmt.containerinstance.models.ContainerInstanceOperationsOrigin """ _validation = { @@ -1617,6 +1942,18 @@ def __init__( origin: Optional[Union[str, "ContainerInstanceOperationsOrigin"]] = None, **kwargs ): + """ + :keyword name: Required. The name of the operation. + :paramtype name: str + :keyword display: Required. The display information of the operation. + :paramtype display: ~azure.mgmt.containerinstance.models.OperationDisplay + :keyword properties: The additional properties. + :paramtype properties: any + :keyword origin: The intended executor of the operation. Possible values include: "User", + "System". + :paramtype origin: str or + ~azure.mgmt.containerinstance.models.ContainerInstanceOperationsOrigin + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1627,14 +1964,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The display information of the operation. - :param provider: The name of the provider of the operation. - :type provider: str - :param resource: The name of the resource type of the operation. - :type resource: str - :param operation: The friendly name of the operation. - :type operation: str - :param description: The description of the operation. - :type description: str + :ivar provider: The name of the provider of the operation. + :vartype provider: str + :ivar resource: The name of the resource type of the operation. + :vartype resource: str + :ivar operation: The friendly name of the operation. + :vartype operation: str + :ivar description: The description of the operation. + :vartype description: str """ _attribute_map = { @@ -1653,6 +1990,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The name of the provider of the operation. + :paramtype provider: str + :keyword resource: The name of the resource type of the operation. + :paramtype resource: str + :keyword operation: The friendly name of the operation. + :paramtype operation: str + :keyword description: The description of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1663,10 +2010,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """The operation list response that contains all operations for Azure Container Instance service. - :param value: The list of operations. - :type value: list[~azure.mgmt.containerinstance.models.Operation] - :param next_link: The URI to fetch the next page of operations. - :type next_link: str + :ivar value: The list of operations. + :vartype value: list[~azure.mgmt.containerinstance.models.Operation] + :ivar next_link: The URI to fetch the next page of operations. + :vartype next_link: str """ _attribute_map = { @@ -1681,6 +2028,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of operations. + :paramtype value: list[~azure.mgmt.containerinstance.models.Operation] + :keyword next_link: The URI to fetch the next page of operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1691,10 +2044,10 @@ class Port(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param protocol: The protocol associated with the port. Possible values include: "TCP", "UDP". - :type protocol: str or ~azure.mgmt.containerinstance.models.ContainerGroupNetworkProtocol - :param port: Required. The port number. - :type port: int + :ivar protocol: The protocol associated with the port. Possible values include: "TCP", "UDP". + :vartype protocol: str or ~azure.mgmt.containerinstance.models.ContainerGroupNetworkProtocol + :ivar port: Required. The port number. + :vartype port: int """ _validation = { @@ -1713,6 +2066,13 @@ def __init__( protocol: Optional[Union[str, "ContainerGroupNetworkProtocol"]] = None, **kwargs ): + """ + :keyword protocol: The protocol associated with the port. Possible values include: "TCP", + "UDP". + :paramtype protocol: str or ~azure.mgmt.containerinstance.models.ContainerGroupNetworkProtocol + :keyword port: Required. The port number. + :paramtype port: int + """ super(Port, self).__init__(**kwargs) self.protocol = protocol self.port = port @@ -1721,12 +2081,12 @@ def __init__( class ResourceLimits(msrest.serialization.Model): """The resource limits. - :param memory_in_gb: The memory limit in GB of this container instance. - :type memory_in_gb: float - :param cpu: The CPU limit of this container instance. - :type cpu: float - :param gpu: The GPU limit of this container instance. - :type gpu: ~azure.mgmt.containerinstance.models.GpuResource + :ivar memory_in_gb: The memory limit in GB of this container instance. + :vartype memory_in_gb: float + :ivar cpu: The CPU limit of this container instance. + :vartype cpu: float + :ivar gpu: The GPU limit of this container instance. + :vartype gpu: ~azure.mgmt.containerinstance.models.GpuResource """ _attribute_map = { @@ -1743,6 +2103,14 @@ def __init__( gpu: Optional["GpuResource"] = None, **kwargs ): + """ + :keyword memory_in_gb: The memory limit in GB of this container instance. + :paramtype memory_in_gb: float + :keyword cpu: The CPU limit of this container instance. + :paramtype cpu: float + :keyword gpu: The GPU limit of this container instance. + :paramtype gpu: ~azure.mgmt.containerinstance.models.GpuResource + """ super(ResourceLimits, self).__init__(**kwargs) self.memory_in_gb = memory_in_gb self.cpu = cpu @@ -1754,12 +2122,12 @@ class ResourceRequests(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param memory_in_gb: Required. The memory request in GB of this container instance. - :type memory_in_gb: float - :param cpu: Required. The CPU request of this container instance. - :type cpu: float - :param gpu: The GPU request of this container instance. - :type gpu: ~azure.mgmt.containerinstance.models.GpuResource + :ivar memory_in_gb: Required. The memory request in GB of this container instance. + :vartype memory_in_gb: float + :ivar cpu: Required. The CPU request of this container instance. + :vartype cpu: float + :ivar gpu: The GPU request of this container instance. + :vartype gpu: ~azure.mgmt.containerinstance.models.GpuResource """ _validation = { @@ -1781,6 +2149,14 @@ def __init__( gpu: Optional["GpuResource"] = None, **kwargs ): + """ + :keyword memory_in_gb: Required. The memory request in GB of this container instance. + :paramtype memory_in_gb: float + :keyword cpu: Required. The CPU request of this container instance. + :paramtype cpu: float + :keyword gpu: The GPU request of this container instance. + :paramtype gpu: ~azure.mgmt.containerinstance.models.GpuResource + """ super(ResourceRequests, self).__init__(**kwargs) self.memory_in_gb = memory_in_gb self.cpu = cpu @@ -1792,10 +2168,10 @@ class ResourceRequirements(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param requests: Required. The resource requests of this container instance. - :type requests: ~azure.mgmt.containerinstance.models.ResourceRequests - :param limits: The resource limits of this container instance. - :type limits: ~azure.mgmt.containerinstance.models.ResourceLimits + :ivar requests: Required. The resource requests of this container instance. + :vartype requests: ~azure.mgmt.containerinstance.models.ResourceRequests + :ivar limits: The resource limits of this container instance. + :vartype limits: ~azure.mgmt.containerinstance.models.ResourceLimits """ _validation = { @@ -1814,6 +2190,12 @@ def __init__( limits: Optional["ResourceLimits"] = None, **kwargs ): + """ + :keyword requests: Required. The resource requests of this container instance. + :paramtype requests: ~azure.mgmt.containerinstance.models.ResourceRequests + :keyword limits: The resource limits of this container instance. + :paramtype limits: ~azure.mgmt.containerinstance.models.ResourceLimits + """ super(ResourceRequirements, self).__init__(**kwargs) self.requests = requests self.limits = limits @@ -1852,6 +2234,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -1880,6 +2264,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageListResult, self).__init__(**kwargs) self.value = None @@ -1909,6 +2295,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -1919,16 +2307,16 @@ class Volume(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the volume. - :type name: str - :param azure_file: The Azure File volume. - :type azure_file: ~azure.mgmt.containerinstance.models.AzureFileVolume - :param empty_dir: The empty directory volume. - :type empty_dir: any - :param secret: The secret volume. - :type secret: dict[str, str] - :param git_repo: The git repo volume. - :type git_repo: ~azure.mgmt.containerinstance.models.GitRepoVolume + :ivar name: Required. The name of the volume. + :vartype name: str + :ivar azure_file: The Azure File volume. + :vartype azure_file: ~azure.mgmt.containerinstance.models.AzureFileVolume + :ivar empty_dir: The empty directory volume. + :vartype empty_dir: any + :ivar secret: The secret volume. + :vartype secret: dict[str, str] + :ivar git_repo: The git repo volume. + :vartype git_repo: ~azure.mgmt.containerinstance.models.GitRepoVolume """ _validation = { @@ -1953,6 +2341,18 @@ def __init__( git_repo: Optional["GitRepoVolume"] = None, **kwargs ): + """ + :keyword name: Required. The name of the volume. + :paramtype name: str + :keyword azure_file: The Azure File volume. + :paramtype azure_file: ~azure.mgmt.containerinstance.models.AzureFileVolume + :keyword empty_dir: The empty directory volume. + :paramtype empty_dir: any + :keyword secret: The secret volume. + :paramtype secret: dict[str, str] + :keyword git_repo: The git repo volume. + :paramtype git_repo: ~azure.mgmt.containerinstance.models.GitRepoVolume + """ super(Volume, self).__init__(**kwargs) self.name = name self.azure_file = azure_file @@ -1966,13 +2366,13 @@ class VolumeMount(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the volume mount. - :type name: str - :param mount_path: Required. The path within the container where the volume should be mounted. + :ivar name: Required. The name of the volume mount. + :vartype name: str + :ivar mount_path: Required. The path within the container where the volume should be mounted. Must not contain colon (:). - :type mount_path: str - :param read_only: The flag indicating whether the volume mount is read-only. - :type read_only: bool + :vartype mount_path: str + :ivar read_only: The flag indicating whether the volume mount is read-only. + :vartype read_only: bool """ _validation = { @@ -1994,6 +2394,15 @@ def __init__( read_only: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. The name of the volume mount. + :paramtype name: str + :keyword mount_path: Required. The path within the container where the volume should be + mounted. Must not contain colon (:). + :paramtype mount_path: str + :keyword read_only: The flag indicating whether the volume mount is read-only. + :paramtype read_only: bool + """ super(VolumeMount, self).__init__(**kwargs) self.name = name self.mount_path = mount_path 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 6fa601fa064b3..4bec237f37e9c 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 @@ -5,25 +5,390 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/restart') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_outbound_network_dependencies_endpoints_request( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/outboundNetworkDependenciesEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "containerGroupName": _SERIALIZER.url("container_group_name", container_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContainerGroupsOperations(object): """ContainerGroupsOperations operations. @@ -47,11 +412,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContainerGroupListResult"] + **kwargs: Any + ) -> Iterable["_models.ContainerGroupListResult"]: """Get a list of container groups in the specified subscription. Get a list of container groups in the specified subscription. This operation returns properties @@ -59,8 +424,10 @@ def list( address type, OS type, state, and volumes. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContainerGroupListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupListResult] + :return: An iterator like instance of either ContainerGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerGroupListResult"] @@ -68,34 +435,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerGroupListResult', pipeline_response) + deserialized = self._deserialize("ContainerGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,17 +475,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContainerGroupListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContainerGroupListResult"]: """Get a list of container groups in the specified subscription and resource group. Get a list of container groups in a specified subscription and resource group. This operation @@ -133,8 +496,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContainerGroupListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupListResult] + :return: An iterator like instance of either ContainerGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.ContainerGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerGroupListResult"] @@ -142,35 +507,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContainerGroupListResult', pipeline_response) + deserialized = self._deserialize("ContainerGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -188,18 +549,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - container_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ContainerGroup" + resource_group_name: str, + container_group_name: str, + **kwargs: Any + ) -> "_models.ContainerGroup": """Get the properties of the specified container group. Gets the properties of the specified container group in the specified subscription and resource @@ -220,27 +582,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,47 +606,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - container_group_name, # type: str - container_group, # type: "_models.ContainerGroup" - **kwargs # type: Any - ): - # type: (...) -> "_models.ContainerGroup" + resource_group_name: str, + container_group_name: str, + container_group: "_models.ContainerGroup", + **kwargs: Any + ) -> "_models.ContainerGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container_group, 'ContainerGroup') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container_group, 'ContainerGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,16 +655,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - container_group_name, # type: str - container_group, # type: "_models.ContainerGroup" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ContainerGroup"] + resource_group_name: str, + container_group_name: str, + container_group: "_models.ContainerGroup", + **kwargs: Any + ) -> LROPoller["_models.ContainerGroup"]: """Create or update container groups. Create or update container groups with specified configurations. @@ -334,15 +679,19 @@ def begin_create_or_update( :type container_group: ~azure.mgmt.containerinstance.models.ContainerGroup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ContainerGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ContainerGroup or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerinstance.models.ContainerGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -354,27 +703,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, container_group_name=container_group_name, container_group=container_group, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ContainerGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,16 +729,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - container_group_name, # type: str - resource, # type: "_models.Resource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ContainerGroup" + resource_group_name: str, + container_group_name: str, + resource: "_models.Resource", + **kwargs: Any + ) -> "_models.ContainerGroup": """Update container groups. Updates container group tags with specified values. @@ -416,32 +760,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'Resource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'Resource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -455,41 +789,32 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - container_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ContainerGroup"] + resource_group_name: str, + container_group_name: str, + **kwargs: Any + ) -> Optional["_models.ContainerGroup"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ContainerGroup"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -505,15 +830,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - container_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ContainerGroup"] + resource_group_name: str, + container_group_name: str, + **kwargs: Any + ) -> LROPoller["_models.ContainerGroup"]: """Delete the specified container group. Delete the specified container group in the specified subscription and resource group. The @@ -525,15 +852,18 @@ def begin_delete( :type container_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ContainerGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ContainerGroup or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerinstance.models.ContainerGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -547,24 +877,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ContainerGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -576,41 +899,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} # type: ignore def _restart_initial( self, - resource_group_name, # type: str - container_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + container_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -623,13 +936,14 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - container_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + container_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restarts all containers in a container group. Restarts all containers in a container group in place. If container image has updates, new @@ -641,15 +955,17 @@ def begin_restart( :type container_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -663,21 +979,14 @@ def begin_restart( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -689,15 +998,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/restart'} # type: ignore + @distributed_trace def stop( self, - resource_group_name, # type: str - container_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + container_group_name: str, + **kwargs: Any + ) -> None: """Stops all containers in a container group. Stops all containers in a container group. Compute resources will be deallocated and billing @@ -717,27 +1027,17 @@ def stop( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.stop.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self.stop.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -750,39 +1050,29 @@ def stop( stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/stop'} # type: ignore + def _start_initial( self, - resource_group_name, # type: str - container_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + container_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -795,13 +1085,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - container_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + container_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts all containers in a container group. Starts all containers in a container group. Compute resources will be allocated and billing @@ -813,15 +1104,17 @@ def begin_start( :type container_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -835,21 +1128,14 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -861,15 +1147,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start'} # type: ignore + @distributed_trace def get_outbound_network_dependencies_endpoints( self, - resource_group_name, # type: str - container_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List[str] + resource_group_name: str, + container_group_name: str, + **kwargs: Any + ) -> List[str]: """Get all network dependencies for container group. Gets all the network dependencies for this container group to allow complete control of network @@ -889,27 +1176,17 @@ def get_outbound_network_dependencies_endpoints( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.get_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + template_url=self.get_outbound_network_dependencies_endpoints.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -923,4 +1200,6 @@ def get_outbound_network_dependencies_endpoints( return cls(pipeline_response, deserialized, {}) return deserialized + get_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/outboundNetworkDependenciesEndpoints'} # type: ignore + 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 9f1d183aa00e5..279e84157db77 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 @@ -5,22 +5,152 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_logs_request( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + container_name: str, + *, + tail: Optional[int] = None, + timestamps: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "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'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if tail is not None: + query_parameters['tail'] = _SERIALIZER.query("tail", tail, 'int') + if timestamps is not None: + query_parameters['timestamps'] = _SERIALIZER.query("timestamps", timestamps, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_execute_command_request( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + container_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "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'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_attach_request( + subscription_id: str, + resource_group_name: str, + container_group_name: str, + container_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "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'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContainersOperations(object): """ContainersOperations operations. @@ -44,16 +174,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_logs( self, - resource_group_name, # type: str - container_group_name, # type: str - container_name, # type: str - tail=None, # type: Optional[int] - timestamps=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> "_models.Logs" + resource_group_name: str, + container_group_name: str, + container_name: str, + tail: Optional[int] = None, + timestamps: Optional[bool] = None, + **kwargs: Any + ) -> "_models.Logs": """Get the logs for a specified container instance. Get the logs for a specified container instance in a specified resource group and container @@ -81,32 +211,20 @@ def list_logs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.list_logs.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if tail is not None: - query_parameters['tail'] = self._serialize.query("tail", tail, 'int') - if timestamps is not None: - query_parameters['timestamps'] = self._serialize.query("timestamps", timestamps, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_logs_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + container_name=container_name, + tail=tail, + timestamps=timestamps, + template_url=self.list_logs.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,17 +238,19 @@ def list_logs( return cls(pipeline_response, deserialized, {}) return deserialized + list_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs'} # type: ignore + + @distributed_trace def execute_command( self, - resource_group_name, # type: str - container_group_name, # type: str - container_name, # type: str - container_exec_request, # type: "_models.ContainerExecRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.ContainerExecResponse" + resource_group_name: str, + container_group_name: str, + container_name: str, + container_exec_request: "_models.ContainerExecRequest", + **kwargs: Any + ) -> "_models.ContainerExecResponse": """Executes a command in a specific container instance. Executes a command for a specific container instance in a specified resource group and @@ -154,33 +274,23 @@ def execute_command( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.execute_command.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(container_exec_request, 'ContainerExecRequest') + + request = build_execute_command_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + container_name=container_name, + content_type=content_type, + json=_json, + template_url=self.execute_command.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(container_exec_request, 'ContainerExecRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -194,16 +304,18 @@ def execute_command( return cls(pipeline_response, deserialized, {}) return deserialized + execute_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'} # type: ignore + + @distributed_trace def attach( self, - resource_group_name, # type: str - container_group_name, # type: str - container_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ContainerAttachResponse" + resource_group_name: str, + container_group_name: str, + container_name: str, + **kwargs: Any + ) -> "_models.ContainerAttachResponse": """Attach to the output of a specific container instance. Attach to the output stream of a specific container instance in a specified resource group and @@ -225,28 +337,18 @@ def attach( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - - # Construct URL - url = self.attach.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str'), - 'containerName': self._serialize.url("container_name", container_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_attach_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_group_name=container_group_name, + container_name=container_name, + template_url=self.attach.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -260,4 +362,6 @@ def attach( return cls(pipeline_response, deserialized, {}) return deserialized + attach.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach'} # type: ignore + 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 f57eeae93ba02..7850797036b51 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 @@ -5,23 +5,124 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_usage_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_cached_images_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_capabilities_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LocationOperations(object): """LocationOperations operations. @@ -45,12 +146,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_usage( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsageListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.UsageListResult"]: """Get the usage for a subscription. :param location: The identifier for the physical azure location. @@ -65,35 +166,31 @@ def list_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_usage_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_usage.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_usage_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UsageListResult', pipeline_response) + deserialized = self._deserialize("UsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,17 +208,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_usage.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages'} # type: ignore + @distributed_trace def list_cached_images( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CachedImagesListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.CachedImagesListResult"]: """Get the list of cached images. Get the list of cached images on specific OS type for a subscription in a region. @@ -129,8 +227,10 @@ def list_cached_images( :param location: The identifier for the physical azure location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CachedImagesListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.CachedImagesListResult] + :return: An iterator like instance of either CachedImagesListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.CachedImagesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CachedImagesListResult"] @@ -138,35 +238,31 @@ def list_cached_images( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_cached_images.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_cached_images_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_cached_images.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_cached_images_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CachedImagesListResult', pipeline_response) + deserialized = self._deserialize("CachedImagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -184,17 +280,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_cached_images.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages'} # type: ignore + @distributed_trace def list_capabilities( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapabilitiesListResult"] + location: str, + **kwargs: Any + ) -> Iterable["_models.CapabilitiesListResult"]: """Get the list of capabilities of the location. Get the list of CPU/memory/GPU capabilities of a region. @@ -202,8 +299,10 @@ def list_capabilities( :param location: The identifier for the physical azure location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapabilitiesListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.CapabilitiesListResult] + :return: An iterator like instance of either CapabilitiesListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerinstance.models.CapabilitiesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilitiesListResult"] @@ -211,35 +310,31 @@ def list_capabilities( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_capabilities.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_capabilities_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list_capabilities.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_capabilities_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapabilitiesListResult', pipeline_response) + deserialized = self._deserialize("CapabilitiesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -257,6 +352,7 @@ def get_next(next_link=None): 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 0b507d151a2eb..e5d463132fa18 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 @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ContainerInstance/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """List the operations for Azure Container Instance service. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +127,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data )