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..85465c9e06ec 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 @@ -59,7 +59,6 @@ def __init__( 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.container_groups = ContainerGroupsOperations( 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..5b8def8f37de --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/_metadata.json @@ -0,0 +1,64 @@ +{ + "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": true + }, + "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, # type: \"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, # 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 + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "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 + }, + "operation_groups": { + "container_groups": "ContainerGroupsOperations", + "operations": "Operations", + "location": "LocationOperations", + "containers": "ContainersOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ 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..c0b8ec4a82ce 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 @@ -56,7 +56,6 @@ def __init__( 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.container_groups = ContainerGroupsOperations( 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..7cd69620e7ff 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 @@ -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): @@ -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): @@ -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 @@ -261,7 +261,7 @@ async 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" @@ -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" @@ -458,7 +458,7 @@ async 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 @@ -577,7 +577,7 @@ async 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 @@ -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 @@ -746,7 +746,7 @@ async 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 @@ -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) 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..bf035fda853a 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,6 +46,7 @@ async def list_logs( container_group_name: str, container_name: str, tail: Optional[int] = None, + timestamps: Optional[bool] = None, **kwargs ) -> "_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] @@ -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 + ) -> "_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..cdc52c0dc326 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 @@ -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): @@ -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): @@ -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..05621230d257 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 @@ -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..a5d6e6d96d8c 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 @@ -16,6 +16,7 @@ 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 @@ -66,6 +68,7 @@ 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 @@ -131,6 +135,7 @@ '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..b3a48e03a58b 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 @@ -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): 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..6079cabaf3d9 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 @@ -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): 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..db2000802981 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" @@ -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 @@ -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 @@ -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) 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):