diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/MANIFEST.in b/sdk/containerinstance/azure-mgmt-containerinstance/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/MANIFEST.in +++ b/sdk/containerinstance/azure-mgmt-containerinstance/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json b/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json new file mode 100644 index 000000000000..9cc101495ebc --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "09d35de8dd3318687eee441d7ddc54a33bf1a9fa", + "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", + "readme": "specification/containerinstance/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py index 5900b9d875b1..c642e925cf62 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_configuration.py @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-12-01" + self.api_version = "2021-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-containerinstance/{}'.format(VERSION)) self._configure(**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 04b0cec7f224..058e3d527f21 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 @@ -16,6 +16,7 @@ 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 @@ -71,6 +72,24 @@ def __init__( self.containers = ContainersOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, 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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + def close(self): # type: () -> None self._client.close() diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_metadata.json b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_metadata.json new file mode 100644 index 000000000000..9cdc3dc38bbd --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_metadata.json @@ -0,0 +1,106 @@ +{ + "chosen_version": "2021-03-01", + "total_api_version_list": ["2021-03-01"], + "client": { + "name": "ContainerInstanceManagementClient", + "filename": "_container_instance_management_client", + "description": "ContainerInstanceManagementClient.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": 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\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "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\"]}}}" + }, + "operation_groups": { + "container_groups": "ContainerGroupsOperations", + "operations": "Operations", + "location": "LocationOperations", + "containers": "ContainersOperations" + } +} \ No newline at end of file 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 364f3c906cf9..c47f66669f1b 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 = "7.0.0" +VERSION = "1.0.0" 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 da5f81c5f7df..c7ca7065d7fc 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 @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-12-01" + self.api_version = "2021-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-containerinstance/{}'.format(VERSION)) self._configure(**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 aba7c8e8d34c..9e50056c8284 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 @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -68,6 +69,23 @@ def __init__( self.containers = ContainersOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> 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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + async def close(self) -> None: await self._client.close() 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 aad717a3593e..7916c2e1c15f 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 @@ -45,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ContainerGroupListResult"]: """Get a list of container groups in the specified subscription. @@ -63,7 +63,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -116,7 +116,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ContainerGroupListResult"]: """Get a list of container groups in the specified subscription and resource group. @@ -136,7 +136,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -191,7 +191,7 @@ async def get( self, resource_group_name: str, container_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.ContainerGroup": """Get the properties of the specified container group. @@ -213,7 +213,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -254,14 +254,14 @@ async def _create_or_update_initial( resource_group_name: str, container_group_name: str, container_group: "_models.ContainerGroup", - **kwargs + **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 = "2019-12-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -311,7 +311,7 @@ async def begin_create_or_update( resource_group_name: str, container_group_name: str, container_group: "_models.ContainerGroup", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ContainerGroup"]: """Create or update container groups. @@ -325,8 +325,8 @@ 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: True for ARMPolling, False for no polling, or a - polling object for 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) @@ -384,7 +384,7 @@ async def update( resource_group_name: str, container_group_name: str, resource: "_models.Resource", - **kwargs + **kwargs: Any ) -> "_models.ContainerGroup": """Update container groups. @@ -406,7 +406,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -451,14 +451,14 @@ async def _delete_initial( self, resource_group_name: str, container_group_name: str, - **kwargs + **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 = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -500,7 +500,7 @@ async def begin_delete( self, resource_group_name: str, container_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ContainerGroup"]: """Delete the specified container group. @@ -513,8 +513,8 @@ 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: True for ARMPolling, False for no polling, or a - polling object for 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) @@ -570,14 +570,14 @@ async def _restart_initial( self, resource_group_name: str, container_group_name: str, - **kwargs + **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 = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -614,7 +614,7 @@ async def begin_restart( self, resource_group_name: str, container_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Restarts all containers in a container group. @@ -627,8 +627,8 @@ 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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) @@ -681,7 +681,7 @@ async def stop( self, resource_group_name: str, container_group_name: str, - **kwargs + **kwargs: Any ) -> None: """Stops all containers in a container group. @@ -702,7 +702,7 @@ async def stop( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -739,14 +739,14 @@ async def _start_initial( self, resource_group_name: str, container_group_name: str, - **kwargs + **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 = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -770,7 +770,7 @@ async def _start_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -783,7 +783,7 @@ async def begin_start( self, resource_group_name: str, container_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Starts all containers in a container group. @@ -796,8 +796,8 @@ 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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) 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 4bf6e283ad09..ab2659ece42d 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 @@ -46,7 +46,8 @@ async def list_logs( container_group_name: str, container_name: str, tail: Optional[int] = None, - **kwargs + timestamps: Optional[bool] = None, + **kwargs: Any ) -> "_models.Logs": """Get the logs for a specified container instance. @@ -62,6 +63,9 @@ async def list_logs( :param tail: The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb. :type tail: int + :param timestamps: If true, adds a timestamp at the beginning of every line of log output. If + not provided, defaults to false. + :type timestamps: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: Logs, or the result of cls(response) :rtype: ~azure.mgmt.containerinstance.models.Logs @@ -72,7 +76,7 @@ async def list_logs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -90,6 +94,8 @@ async def list_logs( 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] @@ -117,7 +123,7 @@ async def execute_command( container_group_name: str, container_name: str, container_exec_request: "_models.ContainerExecRequest", - **kwargs + **kwargs: Any ) -> "_models.ContainerExecResponse": """Executes a command in a specific container instance. @@ -142,7 +148,7 @@ async def execute_command( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -183,3 +189,68 @@ async def execute_command( return deserialized execute_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'} # type: ignore + + async def attach( + self, + 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 + container group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param container_group_name: The name of the container group. + :type container_group_name: str + :param container_name: The name of the container instance. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerAttachResponse, or the result of cls(response) + :rtype: ~azure.mgmt.containerinstance.models.ContainerAttachResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAttachResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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') + + # 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 + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ContainerAttachResponse', pipeline_response) + + if cls: + 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 c8ed09c58a2d..38498aa5991b 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 @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_usage( self, location: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UsageListResult"]: """Get the usage for a subscription. @@ -60,7 +60,7 @@ def list_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -114,7 +114,7 @@ async def get_next(next_link=None): def list_cached_images( self, location: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.CachedImagesListResult"]: """Get the list of cached images. @@ -132,7 +132,7 @@ def list_cached_images( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -186,7 +186,7 @@ async def get_next(next_link=None): def list_capabilities( self, location: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.CapabilitiesListResult"]: """Get the list of capabilities of the location. @@ -204,7 +204,7 @@ def list_capabilities( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): 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 4f4a93615262..f626eefc3e2b 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 @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """List the operations for Azure Container Instance service. @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): 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 ad671ed57819..3b15358fd76b 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 @@ -11,11 +11,12 @@ from ._models_py3 import CachedImages from ._models_py3 import CachedImagesListResult from ._models_py3 import Capabilities - from ._models_py3 import CapabilitiesAutoGenerated + 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 @@ -37,6 +38,7 @@ from ._models_py3 import Event from ._models_py3 import GitRepoVolume from ._models_py3 import GpuResource + from ._models_py3 import HttpHeaders from ._models_py3 import ImageRegistryCredential from ._models_py3 import InitContainerDefinition from ._models_py3 import InitContainerPropertiesDefinitionInstanceView @@ -61,11 +63,12 @@ from ._models import CachedImages # type: ignore from ._models import CachedImagesListResult # type: ignore from ._models import Capabilities # type: ignore - from ._models import CapabilitiesAutoGenerated # 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 @@ -87,6 +90,7 @@ from ._models import Event # type: ignore from ._models import GitRepoVolume # type: ignore from ._models import GpuResource # type: ignore + from ._models import HttpHeaders # type: ignore from ._models import ImageRegistryCredential # type: ignore from ._models import InitContainerDefinition # type: ignore from ._models import InitContainerPropertiesDefinitionInstanceView # type: ignore @@ -126,11 +130,12 @@ 'CachedImages', 'CachedImagesListResult', 'Capabilities', - 'CapabilitiesAutoGenerated', + 'CapabilitiesCapabilities', 'CapabilitiesListResult', 'CloudErrorBody', 'Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties', 'Container', + 'ContainerAttachResponse', 'ContainerExec', 'ContainerExecRequest', 'ContainerExecRequestTerminalSize', @@ -152,6 +157,7 @@ 'Event', 'GitRepoVolume', 'GpuResource', + 'HttpHeaders', 'ImageRegistryCredential', 'InitContainerDefinition', 'InitContainerPropertiesDefinitionInstanceView', 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 index aab8016e9ec0..eea10ab2cfb1 100644 --- a/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models.py +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/_models.py @@ -118,7 +118,7 @@ class Capabilities(msrest.serialization.Model): :ivar gpu: The GPU sku that this capability describes. :vartype gpu: str :ivar capabilities: The supported capabilities. - :vartype capabilities: ~azure.mgmt.containerinstance.models.CapabilitiesAutoGenerated + :vartype capabilities: ~azure.mgmt.containerinstance.models.CapabilitiesCapabilities """ _validation = { @@ -136,7 +136,7 @@ class Capabilities(msrest.serialization.Model): 'location': {'key': 'location', 'type': 'str'}, 'ip_address_type': {'key': 'ipAddressType', 'type': 'str'}, 'gpu': {'key': 'gpu', 'type': 'str'}, - 'capabilities': {'key': 'capabilities', 'type': 'CapabilitiesAutoGenerated'}, + 'capabilities': {'key': 'capabilities', 'type': 'CapabilitiesCapabilities'}, } def __init__( @@ -152,7 +152,7 @@ def __init__( self.capabilities = None -class CapabilitiesAutoGenerated(msrest.serialization.Model): +class CapabilitiesCapabilities(msrest.serialization.Model): """The supported capabilities. Variables are only populated by the server, and will be ignored when sending a request. @@ -181,7 +181,7 @@ def __init__( self, **kwargs ): - super(CapabilitiesAutoGenerated, self).__init__(**kwargs) + super(CapabilitiesCapabilities, self).__init__(**kwargs) self.max_memory_in_gb = None self.max_cpu = None self.max_gpu_count = None @@ -340,6 +340,30 @@ def __init__( 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. @@ -739,6 +763,8 @@ class ContainerHttpGet(msrest.serialization.Model): :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: ~azure.mgmt.containerinstance.models.HttpHeaders """ _validation = { @@ -749,6 +775,7 @@ class ContainerHttpGet(msrest.serialization.Model): 'path': {'key': 'path', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, 'scheme': {'key': 'scheme', 'type': 'str'}, + 'http_headers': {'key': 'httpHeaders', 'type': 'HttpHeaders'}, } def __init__( @@ -759,6 +786,7 @@ def __init__( 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): @@ -1136,6 +1164,29 @@ def __init__( self.sku = kwargs['sku'] +class HttpHeaders(msrest.serialization.Model): + """The HTTP headers. + + :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(HttpHeaders, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + class ImageRegistryCredential(msrest.serialization.Model): """Image registry credential. @@ -1320,6 +1371,8 @@ class LogAnalytics(msrest.serialization.Model): :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: dict[str, str] """ _validation = { @@ -1332,6 +1385,7 @@ class LogAnalytics(msrest.serialization.Model): '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__( @@ -1343,6 +1397,7 @@ def __init__( 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): @@ -1374,7 +1429,7 @@ class Operation(msrest.serialization.Model): :param display: Required. The display information of the operation. :type display: ~azure.mgmt.containerinstance.models.OperationDisplay :param properties: The additional properties. - :type properties: object + :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 @@ -1681,7 +1736,7 @@ class Volume(msrest.serialization.Model): :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: object + :type empty_dir: any :param secret: The secret volume. :type secret: dict[str, str] :param git_repo: The git repo volume. 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 43e8d118d0cf..e8d132d5eba6 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 @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union import msrest.serialization @@ -133,7 +133,7 @@ class Capabilities(msrest.serialization.Model): :ivar gpu: The GPU sku that this capability describes. :vartype gpu: str :ivar capabilities: The supported capabilities. - :vartype capabilities: ~azure.mgmt.containerinstance.models.CapabilitiesAutoGenerated + :vartype capabilities: ~azure.mgmt.containerinstance.models.CapabilitiesCapabilities """ _validation = { @@ -151,7 +151,7 @@ class Capabilities(msrest.serialization.Model): 'location': {'key': 'location', 'type': 'str'}, 'ip_address_type': {'key': 'ipAddressType', 'type': 'str'}, 'gpu': {'key': 'gpu', 'type': 'str'}, - 'capabilities': {'key': 'capabilities', 'type': 'CapabilitiesAutoGenerated'}, + 'capabilities': {'key': 'capabilities', 'type': 'CapabilitiesCapabilities'}, } def __init__( @@ -167,7 +167,7 @@ def __init__( self.capabilities = None -class CapabilitiesAutoGenerated(msrest.serialization.Model): +class CapabilitiesCapabilities(msrest.serialization.Model): """The supported capabilities. Variables are only populated by the server, and will be ignored when sending a request. @@ -196,7 +196,7 @@ def __init__( self, **kwargs ): - super(CapabilitiesAutoGenerated, self).__init__(**kwargs) + super(CapabilitiesCapabilities, self).__init__(**kwargs) self.max_memory_in_gb = None self.max_cpu = None self.max_gpu_count = None @@ -373,6 +373,33 @@ def __init__( self.readiness_probe = readiness_probe +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, + *, + web_socket_uri: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): + super(ContainerAttachResponse, self).__init__(**kwargs) + self.web_socket_uri = web_socket_uri + self.password = password + + class ContainerExec(msrest.serialization.Model): """The container execution command, for liveness or readiness probe. @@ -812,6 +839,8 @@ class ContainerHttpGet(msrest.serialization.Model): :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: ~azure.mgmt.containerinstance.models.HttpHeaders """ _validation = { @@ -822,6 +851,7 @@ class ContainerHttpGet(msrest.serialization.Model): 'path': {'key': 'path', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, 'scheme': {'key': 'scheme', 'type': 'str'}, + 'http_headers': {'key': 'httpHeaders', 'type': 'HttpHeaders'}, } def __init__( @@ -830,12 +860,14 @@ def __init__( port: int, path: Optional[str] = None, scheme: Optional[Union[str, "Scheme"]] = None, + http_headers: Optional["HttpHeaders"] = None, **kwargs ): super(ContainerHttpGet, self).__init__(**kwargs) self.path = path self.port = port self.scheme = scheme + self.http_headers = http_headers class ContainerPort(msrest.serialization.Model): @@ -1243,6 +1275,32 @@ def __init__( self.sku = sku +class HttpHeaders(msrest.serialization.Model): + """The HTTP headers. + + :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, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + super(HttpHeaders, self).__init__(**kwargs) + self.name = name + self.value = value + + class ImageRegistryCredential(msrest.serialization.Model): """Image registry credential. @@ -1442,6 +1500,8 @@ class LogAnalytics(msrest.serialization.Model): :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: dict[str, str] """ _validation = { @@ -1454,6 +1514,7 @@ class LogAnalytics(msrest.serialization.Model): '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__( @@ -1463,6 +1524,7 @@ def __init__( workspace_key: str, log_type: Optional[Union[str, "LogAnalyticsLogType"]] = None, metadata: Optional[Dict[str, str]] = None, + workspace_resource_id: Optional[Dict[str, str]] = None, **kwargs ): super(LogAnalytics, self).__init__(**kwargs) @@ -1470,6 +1532,7 @@ def __init__( self.workspace_key = workspace_key self.log_type = log_type self.metadata = metadata + self.workspace_resource_id = workspace_resource_id class Logs(msrest.serialization.Model): @@ -1503,7 +1566,7 @@ class Operation(msrest.serialization.Model): :param display: Required. The display information of the operation. :type display: ~azure.mgmt.containerinstance.models.OperationDisplay :param properties: The additional properties. - :type properties: object + :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 @@ -1526,7 +1589,7 @@ def __init__( *, name: str, display: "OperationDisplay", - properties: Optional[object] = None, + properties: Optional[Any] = None, origin: Optional[Union[str, "ContainerInstanceOperationsOrigin"]] = None, **kwargs ): @@ -1837,7 +1900,7 @@ class Volume(msrest.serialization.Model): :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: object + :type empty_dir: any :param secret: The secret volume. :type secret: dict[str, str] :param git_repo: The git repo volume. @@ -1861,7 +1924,7 @@ def __init__( *, name: str, azure_file: Optional["AzureFileVolume"] = None, - empty_dir: Optional[object] = None, + empty_dir: Optional[Any] = None, secret: Optional[Dict[str, str]] = None, git_repo: Optional["GitRepoVolume"] = None, **kwargs 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 59906b9894fe..182f2be6964d 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 @@ -68,7 +68,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -142,7 +142,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -220,7 +220,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -269,7 +269,7 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -334,8 +334,8 @@ 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: True for ARMPolling, False for no polling, or a - polling object for 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) @@ -416,7 +416,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -469,7 +469,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -525,8 +525,8 @@ 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: True for ARMPolling, False for no polling, or a - polling object for 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) @@ -590,7 +590,7 @@ def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -641,8 +641,8 @@ 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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) @@ -717,7 +717,7 @@ def stop( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -762,7 +762,7 @@ def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -786,7 +786,7 @@ def _start_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -813,8 +813,8 @@ 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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) 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 d9853d1682a0..3384f34790e6 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 @@ -50,6 +50,7 @@ def list_logs( 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" @@ -67,6 +68,9 @@ def list_logs( :param tail: The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb. :type tail: int + :param timestamps: If true, adds a timestamp at the beginning of every line of log output. If + not provided, defaults to false. + :type timestamps: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: Logs, or the result of cls(response) :rtype: ~azure.mgmt.containerinstance.models.Logs @@ -77,7 +81,7 @@ def list_logs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -95,6 +99,8 @@ def list_logs( 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] @@ -148,7 +154,7 @@ def execute_command( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -189,3 +195,69 @@ def execute_command( return deserialized execute_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'} # type: ignore + + def attach( + self, + resource_group_name, # type: str + container_group_name, # type: str + container_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 + container group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param container_group_name: The name of the container group. + :type container_group_name: str + :param container_name: The name of the container instance. + :type container_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerAttachResponse, or the result of cls(response) + :rtype: ~azure.mgmt.containerinstance.models.ContainerAttachResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAttachResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-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') + + # 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 + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ContainerAttachResponse', pipeline_response) + + if cls: + 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 f59aa5703189..0bb44178526c 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 @@ -65,7 +65,7 @@ def list_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -138,7 +138,7 @@ def list_cached_images( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -211,7 +211,7 @@ def list_capabilities( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): 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 0cfd5000452f..c7069eeea575 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 @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-12-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None):