diff --git a/.vscode/settings.json b/.vscode/settings.json index 86be745c112b..e8c154f4987c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,4 +2,4 @@ "git.ignoreLimitWarning": true, "python.unitTest.pyTestArgs": [], "python.unitTest.pyTestEnabled": true -} \ No newline at end of file +} diff --git a/azure-mgmt-containerinstance/HISTORY.rst b/azure-mgmt-containerinstance/HISTORY.rst index e1dd07392c15..3dc7e1e3cc22 100644 --- a/azure-mgmt-containerinstance/HISTORY.rst +++ b/azure-mgmt-containerinstance/HISTORY.rst @@ -3,6 +3,17 @@ Release History =============== +1.1.0 (2018-09-06) +++++++++++++++++++ + +**Features** + +- Model LogAnalytics has a new parameter log_type +- Model LogAnalytics has a new parameter metadata +- Model ContainerGroup has a new parameter network_profile +- Added operation ContainerGroupsOperations.stop +- Added operation ContainerGroupsOperations.restart + 1.0.0 (2018-06-13) ++++++++++++++++++ diff --git a/azure-mgmt-containerinstance/README.rst b/azure-mgmt-containerinstance/README.rst index e4f5739fbc89..9f61b79d2a9b 100644 --- a/azure-mgmt-containerinstance/README.rst +++ b/azure-mgmt-containerinstance/README.rst @@ -6,7 +6,7 @@ This is the Microsoft Azure Container Instance Client Library. Azure Resource Manager (ARM) is the next generation of management APIs that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5 and 3.6. +This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. For the older Azure Service Management (ASM) libraries, see `azure-servicemanagement-legacy `__ library. diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/container_instance_management_client.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/container_instance_management_client.py index a969d13ac371..5c9d34847435 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/container_instance_management_client.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/container_instance_management_client.py @@ -86,7 +86,7 @@ def __init__( super(ContainerInstanceManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-06-01' + self.api_version = '2018-09-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/__init__.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/__init__.py index 1ba2cf55de82..497cd6a01d8f 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/__init__.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/__init__.py @@ -32,6 +32,7 @@ from .container_group_properties_instance_view_py3 import ContainerGroupPropertiesInstanceView from .log_analytics_py3 import LogAnalytics from .container_group_diagnostics_py3 import ContainerGroupDiagnostics + from .container_group_network_profile_py3 import ContainerGroupNetworkProfile from .container_group_py3 import ContainerGroup from .operation_display_py3 import OperationDisplay from .operation_py3 import Operation @@ -67,6 +68,7 @@ from .container_group_properties_instance_view import ContainerGroupPropertiesInstanceView from .log_analytics import LogAnalytics from .container_group_diagnostics import ContainerGroupDiagnostics + from .container_group_network_profile import ContainerGroupNetworkProfile from .container_group import ContainerGroup from .operation_display import OperationDisplay from .operation import Operation @@ -84,7 +86,9 @@ ContainerNetworkProtocol, ContainerGroupRestartPolicy, ContainerGroupNetworkProtocol, + ContainerGroupIpAddressType, OperatingSystemTypes, + LogAnalyticsLogType, ContainerInstanceOperationsOrigin, ) @@ -111,6 +115,7 @@ 'ContainerGroupPropertiesInstanceView', 'LogAnalytics', 'ContainerGroupDiagnostics', + 'ContainerGroupNetworkProfile', 'ContainerGroup', 'OperationDisplay', 'Operation', @@ -127,6 +132,8 @@ 'ContainerNetworkProtocol', 'ContainerGroupRestartPolicy', 'ContainerGroupNetworkProtocol', + 'ContainerGroupIpAddressType', 'OperatingSystemTypes', + 'LogAnalyticsLogType', 'ContainerInstanceOperationsOrigin', ] diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group.py index fa4a94d911e0..47260a4a39ac 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group.py @@ -64,6 +64,10 @@ class ContainerGroup(Resource): :param diagnostics: The diagnostic information for a container group. :type diagnostics: ~azure.mgmt.containerinstance.models.ContainerGroupDiagnostics + :param network_profile: The network profile information for a container + group. + :type network_profile: + ~azure.mgmt.containerinstance.models.ContainerGroupNetworkProfile """ _validation = { @@ -91,6 +95,7 @@ class ContainerGroup(Resource): 'volumes': {'key': 'properties.volumes', 'type': '[Volume]'}, 'instance_view': {'key': 'properties.instanceView', 'type': 'ContainerGroupPropertiesInstanceView'}, 'diagnostics': {'key': 'properties.diagnostics', 'type': 'ContainerGroupDiagnostics'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerGroupNetworkProfile'}, } def __init__(self, **kwargs): @@ -104,3 +109,4 @@ def __init__(self, **kwargs): self.volumes = kwargs.get('volumes', None) self.instance_view = None self.diagnostics = kwargs.get('diagnostics', None) + self.network_profile = kwargs.get('network_profile', None) diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_network_profile.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_network_profile.py new file mode 100644 index 000000000000..026387cb17a8 --- /dev/null +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_network_profile.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ContainerGroupNetworkProfile(Model): + """Container group network profile information. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The identifier for a network profile. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ContainerGroupNetworkProfile, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_network_profile_py3.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_network_profile_py3.py new file mode 100644 index 000000000000..72e54d274eec --- /dev/null +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_network_profile_py3.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ContainerGroupNetworkProfile(Model): + """Container group network profile information. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The identifier for a network profile. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(ContainerGroupNetworkProfile, self).__init__(**kwargs) + self.id = id diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_py3.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_py3.py index da93f1668143..c50598dbd643 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_py3.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_group_py3.py @@ -64,6 +64,10 @@ class ContainerGroup(Resource): :param diagnostics: The diagnostic information for a container group. :type diagnostics: ~azure.mgmt.containerinstance.models.ContainerGroupDiagnostics + :param network_profile: The network profile information for a container + group. + :type network_profile: + ~azure.mgmt.containerinstance.models.ContainerGroupNetworkProfile """ _validation = { @@ -91,9 +95,10 @@ class ContainerGroup(Resource): 'volumes': {'key': 'properties.volumes', 'type': '[Volume]'}, 'instance_view': {'key': 'properties.instanceView', 'type': 'ContainerGroupPropertiesInstanceView'}, 'diagnostics': {'key': 'properties.diagnostics', 'type': 'ContainerGroupDiagnostics'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerGroupNetworkProfile'}, } - def __init__(self, *, containers, os_type, location: str=None, tags=None, image_registry_credentials=None, restart_policy=None, ip_address=None, volumes=None, diagnostics=None, **kwargs) -> None: + def __init__(self, *, containers, os_type, location: str=None, tags=None, image_registry_credentials=None, restart_policy=None, ip_address=None, volumes=None, diagnostics=None, network_profile=None, **kwargs) -> None: super(ContainerGroup, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.containers = containers @@ -104,3 +109,4 @@ def __init__(self, *, containers, os_type, location: str=None, tags=None, image_ self.volumes = volumes self.instance_view = None self.diagnostics = diagnostics + self.network_profile = network_profile diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_instance_management_client_enums.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_instance_management_client_enums.py index 04280f098e01..773b5b98d246 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_instance_management_client_enums.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/container_instance_management_client_enums.py @@ -31,12 +31,24 @@ class ContainerGroupNetworkProtocol(str, Enum): udp = "UDP" +class ContainerGroupIpAddressType(str, Enum): + + public = "Public" + private = "Private" + + class OperatingSystemTypes(str, Enum): windows = "Windows" linux = "Linux" +class LogAnalyticsLogType(str, Enum): + + container_insights = "ContainerInsights" + container_instance_logs = "ContainerInstanceLogs" + + class ContainerInstanceOperationsOrigin(str, Enum): user = "User" diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/ip_address.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/ip_address.py index 07d02792b719..44737b213cc8 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/ip_address.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/ip_address.py @@ -22,9 +22,10 @@ class IpAddress(Model): :param ports: Required. The list of ports exposed on the container group. :type ports: list[~azure.mgmt.containerinstance.models.Port] - :ivar type: Required. Specifies if the IP is exposed to the public - internet. Default value: "Public" . - :vartype type: str + :param type: Required. Specifies if the IP is exposed to the public + internet. Possible values include: 'Public', 'Private' + :type type: str or + ~azure.mgmt.containerinstance.models.ContainerGroupIpAddressType :param ip: The IP exposed to the public internet. :type ip: str :param dns_name_label: The Dns name label for the IP. @@ -35,7 +36,7 @@ class IpAddress(Model): _validation = { 'ports': {'required': True}, - 'type': {'required': True, 'constant': True}, + 'type': {'required': True}, 'fqdn': {'readonly': True}, } @@ -47,11 +48,10 @@ class IpAddress(Model): 'fqdn': {'key': 'fqdn', 'type': 'str'}, } - type = "Public" - def __init__(self, **kwargs): super(IpAddress, self).__init__(**kwargs) self.ports = kwargs.get('ports', None) + self.type = kwargs.get('type', None) self.ip = kwargs.get('ip', None) self.dns_name_label = kwargs.get('dns_name_label', None) self.fqdn = None diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/ip_address_py3.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/ip_address_py3.py index 752618b68479..6b7f214facaa 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/ip_address_py3.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/ip_address_py3.py @@ -22,9 +22,10 @@ class IpAddress(Model): :param ports: Required. The list of ports exposed on the container group. :type ports: list[~azure.mgmt.containerinstance.models.Port] - :ivar type: Required. Specifies if the IP is exposed to the public - internet. Default value: "Public" . - :vartype type: str + :param type: Required. Specifies if the IP is exposed to the public + internet. Possible values include: 'Public', 'Private' + :type type: str or + ~azure.mgmt.containerinstance.models.ContainerGroupIpAddressType :param ip: The IP exposed to the public internet. :type ip: str :param dns_name_label: The Dns name label for the IP. @@ -35,7 +36,7 @@ class IpAddress(Model): _validation = { 'ports': {'required': True}, - 'type': {'required': True, 'constant': True}, + 'type': {'required': True}, 'fqdn': {'readonly': True}, } @@ -47,11 +48,10 @@ class IpAddress(Model): 'fqdn': {'key': 'fqdn', 'type': 'str'}, } - type = "Public" - - def __init__(self, *, ports, ip: str=None, dns_name_label: str=None, **kwargs) -> None: + def __init__(self, *, ports, type, ip: str=None, dns_name_label: str=None, **kwargs) -> None: super(IpAddress, self).__init__(**kwargs) self.ports = ports + self.type = type self.ip = ip self.dns_name_label = dns_name_label self.fqdn = None diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/log_analytics.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/log_analytics.py index 7179478dda9d..b83202bc1dde 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/log_analytics.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/log_analytics.py @@ -21,6 +21,12 @@ class LogAnalytics(Model): :type workspace_id: str :param workspace_key: Required. The workspace key for log analytics :type workspace_key: str + :param log_type: The log type to be used. Possible values include: + 'ContainerInsights', 'ContainerInstanceLogs' + :type log_type: str or + ~azure.mgmt.containerinstance.models.LogAnalyticsLogType + :param metadata: Metadata for log analytics. + :type metadata: dict[str, str] """ _validation = { @@ -31,9 +37,13 @@ class LogAnalytics(Model): _attribute_map = { 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, 'workspace_key': {'key': 'workspaceKey', 'type': 'str'}, + 'log_type': {'key': 'logType', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } def __init__(self, **kwargs): super(LogAnalytics, self).__init__(**kwargs) self.workspace_id = kwargs.get('workspace_id', None) self.workspace_key = kwargs.get('workspace_key', None) + self.log_type = kwargs.get('log_type', None) + self.metadata = kwargs.get('metadata', None) diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/log_analytics_py3.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/log_analytics_py3.py index a628d09e0d45..c04a396961c3 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/log_analytics_py3.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/log_analytics_py3.py @@ -21,6 +21,12 @@ class LogAnalytics(Model): :type workspace_id: str :param workspace_key: Required. The workspace key for log analytics :type workspace_key: str + :param log_type: The log type to be used. Possible values include: + 'ContainerInsights', 'ContainerInstanceLogs' + :type log_type: str or + ~azure.mgmt.containerinstance.models.LogAnalyticsLogType + :param metadata: Metadata for log analytics. + :type metadata: dict[str, str] """ _validation = { @@ -31,9 +37,13 @@ class LogAnalytics(Model): _attribute_map = { 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, 'workspace_key': {'key': 'workspaceKey', 'type': 'str'}, + 'log_type': {'key': 'logType', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } - def __init__(self, *, workspace_id: str, workspace_key: str, **kwargs) -> None: + def __init__(self, *, workspace_id: str, workspace_key: str, log_type=None, metadata=None, **kwargs) -> None: super(LogAnalytics, self).__init__(**kwargs) self.workspace_id = workspace_id self.workspace_key = workspace_key + self.log_type = log_type + self.metadata = metadata diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_group_usage_operations.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_group_usage_operations.py index 42b2710e9d49..faa702e28f5a 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_group_usage_operations.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_group_usage_operations.py @@ -23,7 +23,7 @@ class ContainerGroupUsageOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-06-01". + :ivar api_version: Client API version. Constant value: "2018-09-01". """ models = models @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01" + self.api_version = "2018-09-01" self.config = config @@ -67,7 +67,7 @@ def list( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -76,8 +76,8 @@ def list( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_groups_operations.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_groups_operations.py index 2c5e3b6647f3..5e42762bc234 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_groups_operations.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_groups_operations.py @@ -25,7 +25,7 @@ class ContainerGroupsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-06-01". + :ivar api_version: Client API version. Constant value: "2018-09-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01" + self.api_version = "2018-09-01" self.config = config @@ -78,7 +78,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -87,9 +87,8 @@ def internal_paging(next_link=None, raw=False): header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -152,7 +151,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -161,9 +160,8 @@ def internal_paging(next_link=None, raw=False): header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -222,7 +220,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -231,8 +229,8 @@ def get( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -269,6 +267,7 @@ def _create_or_update_initial( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) @@ -281,9 +280,8 @@ def _create_or_update_initial( body_content = self._serialize.body(container_group, 'ContainerGroup') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -398,6 +396,7 @@ def update( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) @@ -410,9 +409,8 @@ def update( body_content = self._serialize.body(resource, 'Resource') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -468,7 +466,7 @@ def delete( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -477,8 +475,8 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 204]: exp = CloudError(response) @@ -496,3 +494,141 @@ def delete( return deserialized delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'} + + + def _restart_initial( + self, resource_group_name, container_group_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.restart.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def restart( + self, resource_group_name, container_group_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Restarts all containers in a container group. + + Restarts all containers in a container group in place. If container + image has updates, new image will be downloaded. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param container_group_name: The name of the container group. + :type container_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + container_group_name=container_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/restart'} + + def stop( + self, resource_group_name, container_group_name, custom_headers=None, raw=False, **operation_config): + """Stops all containers in a container group. + + Stops all containers in a container group. Compute resources will be + deallocated and billing will stop. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param container_group_name: The name of the container group. + :type container_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.stop.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'containerGroupName': self._serialize.url("container_group_name", container_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/stop'} diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_operations.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_operations.py index a6d9457580e7..67df85731647 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_operations.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/container_operations.py @@ -23,7 +23,7 @@ class ContainerOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-06-01". + :ivar api_version: Client API version. Constant value: "2018-09-01". """ models = models @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01" + self.api_version = "2018-09-01" self.config = config @@ -82,7 +82,7 @@ def list_logs( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -91,8 +91,8 @@ def list_logs( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -157,6 +157,7 @@ def execute_command( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) @@ -169,9 +170,8 @@ def execute_command( body_content = self._serialize.body(container_exec_request, 'ContainerExecRequest') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/operations.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/operations.py index 9de4177e731e..d80cbac84d72 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/operations.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/operations/operations.py @@ -23,7 +23,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-06-01". + :ivar api_version: Client API version. Constant value: "2018-09-01". """ models = models @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01" + self.api_version = "2018-09-01" self.config = config @@ -60,7 +60,7 @@ def list( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -69,8 +69,8 @@ def list( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/version.py b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/version.py index a39916c162ce..24b9de3384da 100644 --- a/azure-mgmt-containerinstance/azure/mgmt/containerinstance/version.py +++ b/azure-mgmt-containerinstance/azure/mgmt/containerinstance/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/azure-mgmt-containerinstance/setup.py b/azure-mgmt-containerinstance/setup.py index 1f016a4e02ef..72097fec5cdd 100644 --- a/azure-mgmt-containerinstance/setup.py +++ b/azure-mgmt-containerinstance/setup.py @@ -72,12 +72,14 @@ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'License :: OSI Approved :: MIT License', ], zip_safe=False, packages=find_packages(exclude=["tests"]), install_requires=[ - 'msrestazure>=0.4.27,<2.0.0', + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', ], cmdclass=cmdclass diff --git a/azure-mgmt-containerinstance/tests/recordings/test_mgmt_containerinstance.test_container_instance.yaml b/azure-mgmt-containerinstance/tests/recordings/test_mgmt_containerinstance.test_container_instance.yaml index 5957bb309e7e..378c3bc23262 100644 --- a/azure-mgmt-containerinstance/tests/recordings/test_mgmt_containerinstance.test_container_instance.yaml +++ b/azure-mgmt-containerinstance/tests/recordings/test_mgmt_containerinstance.test_container_instance.yaml @@ -13,20 +13,19 @@ interactions: Connection: [keep-alive] Content-Length: ['542'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.2 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.5.0 - msrest_azure/0.4.31 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] + User-Agent: [python/3.6.2 (Windows-10-10.0.17134-SP0) requests/2.18.4 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] accept-language: [en-US] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510?api-version=2018-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510?api-version=2018-09-01 response: body: {string: '{"properties":{"provisioningState":"Pending","containers":[{"name":"pycontainer26441510","properties":{"image":"alpine:latest","ports":[],"environmentVariables":[],"resources":{"requests":{"memoryInGB":1.0,"cpu":1.0}},"volumeMounts":[{"name":"empty-volume","mountPath":"/mnt/mydir"}],"livenessProbe":{"exec":{"command":["cat/tmp/healthy"]},"periodSeconds":5}}}],"restartPolicy":"OnFailure","osType":"Linux","volumes":[{"name":"empty-volume","emptyDir":{}}],"instanceView":{"state":"Pending"},"diagnostics":{"logAnalytics":{"workspaceId":"workspaceId"}}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510","name":"pycontainer26441510","type":"Microsoft.ContainerInstance/containerGroups","location":"westus"}'} headers: - azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerInstance/locations/West - US/operations/38a57cb2-77ab-4dc6-bc1d-c9267e266050?api-version=2018-02-01-preview'] + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerInstance/locations/westus/operations/0358f7db-0bd3-4096-91f1-8576ea65d12e?api-version=2018-06-01'] cache-control: [no-cache] content-length: ['864'] content-type: [application/json; charset=utf-8] - date: ['Wed, 20 Jun 2018 17:04:01 GMT'] + date: ['Thu, 06 Sep 2018 18:02:53 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -41,21 +40,21 @@ interactions: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - User-Agent: [python/3.6.2 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.5.0 - msrest_azure/0.4.31 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] + User-Agent: [python/3.6.2 (Windows-10-10.0.17134-SP0) requests/2.18.4 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerInstance/locations/West%20US/operations/38a57cb2-77ab-4dc6-bc1d-c9267e266050?api-version=2018-02-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerInstance/locations/westus/operations/0358f7db-0bd3-4096-91f1-8576ea65d12e?api-version=2018-06-01 response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510","status":"Succeeded","startTime":"2018-06-20T17:04:01.7830474Z","properties":{"events":[{"count":1,"firstTimestamp":"2018-06-20T17:04:06Z","lastTimestamp":"2018-06-20T17:04:06Z","name":"Pulling","message":"pulling - image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-06-20T17:04:08Z","lastTimestamp":"2018-06-20T17:04:08Z","name":"Pulled","message":"Successfully - pulled image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-06-20T17:04:08Z","lastTimestamp":"2018-06-20T17:04:08Z","name":"Created","message":"Created - container with id d4c98fbf2fac00198db4b3c803f6a959fc9e3dac9b470f67ffe58ffa29f75f5f","type":"Normal"},{"count":1,"firstTimestamp":"2018-06-20T17:04:09Z","lastTimestamp":"2018-06-20T17:04:09Z","name":"Started","message":"Started - container with id d4c98fbf2fac00198db4b3c803f6a959fc9e3dac9b470f67ffe58ffa29f75f5f","type":"Normal"}]}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510","status":"Succeeded","startTime":"2018-09-06T18:02:53.7066979Z","properties":{"events":[{"count":1,"firstTimestamp":"2018-09-06T18:03:11Z","lastTimestamp":"2018-09-06T18:03:11Z","name":"Pulling","message":"pulling + image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Pulled","message":"Successfully + pulled image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Created","message":"Created + container with id 41b7e27558992017cd679361313de8157a2b35a3dc76ac79a6d4235dc9835e67","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Started","message":"Started + container with id 41b7e27558992017cd679361313de8157a2b35a3dc76ac79a6d4235dc9835e67","type":"Normal"}]}}'} headers: cache-control: [no-cache] content-length: ['1100'] content-type: [application/json; charset=utf-8] - date: ['Wed, 20 Jun 2018 17:04:32 GMT'] + date: ['Thu, 06 Sep 2018 18:03:24 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -69,21 +68,21 @@ interactions: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - User-Agent: [python/3.6.2 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.5.0 - msrest_azure/0.4.31 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] + User-Agent: [python/3.6.2 (Windows-10-10.0.17134-SP0) requests/2.18.4 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510?api-version=2018-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510?api-version=2018-09-01 response: - body: {string: '{"properties":{"provisioningState":"Succeeded","containers":[{"name":"pycontainer26441510","properties":{"image":"alpine:latest","ports":[],"environmentVariables":[],"instanceView":{"restartCount":0,"currentState":{"state":"Terminated","startTime":"2018-06-20T17:04:09Z","exitCode":0,"finishTime":"2018-06-20T17:04:09Z","detailStatus":"Completed"},"events":[{"count":1,"firstTimestamp":"2018-06-20T17:04:06Z","lastTimestamp":"2018-06-20T17:04:06Z","name":"Pulling","message":"pulling - image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-06-20T17:04:08Z","lastTimestamp":"2018-06-20T17:04:08Z","name":"Pulled","message":"Successfully - pulled image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-06-20T17:04:08Z","lastTimestamp":"2018-06-20T17:04:08Z","name":"Created","message":"Created - container with id d4c98fbf2fac00198db4b3c803f6a959fc9e3dac9b470f67ffe58ffa29f75f5f","type":"Normal"},{"count":1,"firstTimestamp":"2018-06-20T17:04:09Z","lastTimestamp":"2018-06-20T17:04:09Z","name":"Started","message":"Started - container with id d4c98fbf2fac00198db4b3c803f6a959fc9e3dac9b470f67ffe58ffa29f75f5f","type":"Normal"}]},"resources":{"requests":{"memoryInGB":1.0,"cpu":1.0}},"volumeMounts":[{"name":"empty-volume","mountPath":"/mnt/mydir"}],"livenessProbe":{"exec":{"command":["cat/tmp/healthy"]},"periodSeconds":5}}}],"restartPolicy":"OnFailure","osType":"Linux","volumes":[{"name":"empty-volume","emptyDir":{}}],"instanceView":{"events":[],"state":"Succeeded"},"diagnostics":{"logAnalytics":{"workspaceId":"workspaceId"}}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510","name":"pycontainer26441510","type":"Microsoft.ContainerInstance/containerGroups","location":"westus"}'} + body: {string: '{"properties":{"provisioningState":"Succeeded","containers":[{"name":"pycontainer26441510","properties":{"image":"alpine:latest","ports":[],"environmentVariables":[],"instanceView":{"restartCount":0,"currentState":{"state":"Terminated","startTime":"2018-09-06T18:03:13Z","exitCode":0,"finishTime":"2018-09-06T18:03:13Z","detailStatus":"Completed"},"events":[{"count":1,"firstTimestamp":"2018-09-06T18:03:11Z","lastTimestamp":"2018-09-06T18:03:11Z","name":"Pulling","message":"pulling + image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Pulled","message":"Successfully + pulled image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Created","message":"Created + container with id 41b7e27558992017cd679361313de8157a2b35a3dc76ac79a6d4235dc9835e67","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Started","message":"Started + container with id 41b7e27558992017cd679361313de8157a2b35a3dc76ac79a6d4235dc9835e67","type":"Normal"}]},"resources":{"requests":{"memoryInGB":1.0,"cpu":1.0}},"volumeMounts":[{"name":"empty-volume","mountPath":"/mnt/mydir"}],"livenessProbe":{"exec":{"command":["cat/tmp/healthy"]},"periodSeconds":5}}}],"restartPolicy":"OnFailure","osType":"Linux","volumes":[{"name":"empty-volume","emptyDir":{}}],"instanceView":{"events":[],"state":"Succeeded"},"diagnostics":{"logAnalytics":{"workspaceId":"workspaceId"}}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510","name":"pycontainer26441510","type":"Microsoft.ContainerInstance/containerGroups","location":"westus"}'} headers: cache-control: [no-cache] content-length: ['1875'] content-type: [application/json; charset=utf-8] - date: ['Wed, 20 Jun 2018 17:04:33 GMT'] + date: ['Thu, 06 Sep 2018 18:03:25 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -97,23 +96,22 @@ interactions: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.2 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.5.0 - msrest_azure/0.4.31 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] + User-Agent: [python/3.6.2 (Windows-10-10.0.17134-SP0) requests/2.18.4 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510?api-version=2018-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510?api-version=2018-09-01 response: - body: {string: '{"properties":{"provisioningState":"Succeeded","containers":[{"name":"pycontainer26441510","properties":{"image":"alpine:latest","ports":[],"environmentVariables":[],"instanceView":{"restartCount":0,"currentState":{"state":"Terminated","startTime":"2018-06-20T17:04:09Z","exitCode":0,"finishTime":"2018-06-20T17:04:09Z","detailStatus":"Completed"},"events":[{"count":1,"firstTimestamp":"2018-06-20T17:04:06Z","lastTimestamp":"2018-06-20T17:04:06Z","name":"Pulling","message":"pulling - image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-06-20T17:04:08Z","lastTimestamp":"2018-06-20T17:04:08Z","name":"Pulled","message":"Successfully - pulled image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-06-20T17:04:08Z","lastTimestamp":"2018-06-20T17:04:08Z","name":"Created","message":"Created - container with id d4c98fbf2fac00198db4b3c803f6a959fc9e3dac9b470f67ffe58ffa29f75f5f","type":"Normal"},{"count":1,"firstTimestamp":"2018-06-20T17:04:09Z","lastTimestamp":"2018-06-20T17:04:09Z","name":"Started","message":"Started - container with id d4c98fbf2fac00198db4b3c803f6a959fc9e3dac9b470f67ffe58ffa29f75f5f","type":"Normal"}]},"resources":{"requests":{"memoryInGB":1.0,"cpu":1.0}},"volumeMounts":[{"name":"empty-volume","mountPath":"/mnt/mydir"}],"livenessProbe":{"exec":{"command":["cat/tmp/healthy"]},"periodSeconds":5}}}],"restartPolicy":"OnFailure","osType":"Linux","volumes":[{"name":"empty-volume","emptyDir":{}}],"instanceView":{"events":[],"state":"Succeeded"},"diagnostics":{"logAnalytics":{"workspaceId":"workspaceId"}}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510","name":"pycontainer26441510","type":"Microsoft.ContainerInstance/containerGroups","location":"westus"}'} + body: {string: '{"properties":{"provisioningState":"Succeeded","containers":[{"name":"pycontainer26441510","properties":{"image":"alpine:latest","ports":[],"environmentVariables":[],"instanceView":{"restartCount":0,"currentState":{"state":"Terminated","startTime":"2018-09-06T18:03:13Z","exitCode":0,"finishTime":"2018-09-06T18:03:13Z","detailStatus":"Completed"},"events":[{"count":1,"firstTimestamp":"2018-09-06T18:03:11Z","lastTimestamp":"2018-09-06T18:03:11Z","name":"Pulling","message":"pulling + image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Pulled","message":"Successfully + pulled image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Created","message":"Created + container with id 41b7e27558992017cd679361313de8157a2b35a3dc76ac79a6d4235dc9835e67","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Started","message":"Started + container with id 41b7e27558992017cd679361313de8157a2b35a3dc76ac79a6d4235dc9835e67","type":"Normal"}]},"resources":{"requests":{"memoryInGB":1.0,"cpu":1.0}},"volumeMounts":[{"name":"empty-volume","mountPath":"/mnt/mydir"}],"livenessProbe":{"exec":{"command":["cat/tmp/healthy"]},"periodSeconds":5}}}],"restartPolicy":"OnFailure","osType":"Linux","volumes":[{"name":"empty-volume","emptyDir":{}}],"instanceView":{"events":[],"state":"Succeeded"},"diagnostics":{"logAnalytics":{"workspaceId":"workspaceId"}}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510","name":"pycontainer26441510","type":"Microsoft.ContainerInstance/containerGroups","location":"westus"}'} headers: cache-control: [no-cache] content-length: ['1875'] content-type: [application/json; charset=utf-8] - date: ['Wed, 20 Jun 2018 17:04:34 GMT'] + date: ['Thu, 06 Sep 2018 18:03:33 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -127,19 +125,18 @@ interactions: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.2 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.5.0 - msrest_azure/0.4.31 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] + User-Agent: [python/3.6.2 (Windows-10-10.0.17134-SP0) requests/2.18.4 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups?api-version=2018-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups?api-version=2018-09-01 response: body: {string: '{"value":[{"properties":{"provisioningState":"Succeeded","containers":[{"name":"pycontainer26441510","properties":{"image":"alpine:latest","ports":[],"environmentVariables":[],"resources":{"requests":{"memoryInGB":1.0,"cpu":1.0}},"volumeMounts":[{"name":"empty-volume","mountPath":"/mnt/mydir"}],"livenessProbe":{"exec":{"command":["cat/tmp/healthy"]},"periodSeconds":5}}}],"restartPolicy":"OnFailure","osType":"Linux","volumes":[{"name":"empty-volume","emptyDir":{}}],"diagnostics":{"logAnalytics":{"workspaceId":"workspaceId"}}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510","name":"pycontainer26441510","type":"Microsoft.ContainerInstance/containerGroups","location":"westus"}]}'} headers: cache-control: [no-cache] content-length: ['843'] content-type: [application/json; charset=utf-8] - date: ['Wed, 20 Jun 2018 17:04:34 GMT'] + date: ['Thu, 06 Sep 2018 18:03:34 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -155,18 +152,18 @@ interactions: Connection: [keep-alive] Content-Length: ['66'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.2 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.5.0 - msrest_azure/0.4.31 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] + User-Agent: [python/3.6.2 (Windows-10-10.0.17134-SP0) requests/2.18.4 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] accept-language: [en-US] method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510/containers/pycontainer26441510/exec?api-version=2018-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510/containers/pycontainer26441510/exec?api-version=2018-09-01 response: - body: {string: '{"webSocketUri":"wss://bridge-linux-17.westus.management.azurecontainer.io/exec/caas-b366c4d398d2446186000db440d682dd/bridge-9658fa886f0ac586?rows=24&cols=80&api-version=2018-02-01-preview","password":"ACurGmg7CGUu_utlaXMzgOBUkdalQU_3shgrdGzsV5A[[EOM]]"}'} + body: {string: '{"webSocketUri":"wss://bridge-linux-06.westus.management.azurecontainer.io/exec/caas-1a7f1ac282c843118cc3881a7b0603dd/bridge-9658fa886f0ac586?rows=24&cols=80&api-version=2018-02-01-preview","password":"6eru_Q14EzljWA3MP2ANPkDmQ-JXnAE8LtFPJ03Lxew[[EOM]]"}'} headers: cache-control: [no-cache] content-length: ['254'] content-type: [application/json; charset=utf-8] - date: ['Wed, 20 Jun 2018 17:04:35 GMT'] + date: ['Thu, 06 Sep 2018 18:03:37 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -181,19 +178,74 @@ interactions: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.2 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.5.0 - msrest_azure/0.4.31 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] + User-Agent: [python/3.6.2 (Windows-10-10.0.17134-SP0) requests/2.18.4 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510/containers/pycontainer26441510/logs?api-version=2018-06-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510/containers/pycontainer26441510/logs?api-version=2018-09-01 response: body: {string: '{"content":""}'} headers: cache-control: [no-cache] content-length: ['14'] content-type: [application/json; charset=utf-8] - date: ['Wed, 20 Jun 2018 17:04:35 GMT'] + date: ['Thu, 06 Sep 2018 18:03:38 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + User-Agent: [python/3.6.2 (Windows-10-10.0.17134-SP0) requests/2.18.4 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510/restart?api-version=2018-09-01 + response: + body: {string: ''} + headers: + azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerInstance/locations/westus/operations/efbaa5a1-81a3-460e-b750-26909e01ce03?api-version=2018-06-01'] + cache-control: [no-cache] + date: ['Thu, 06 Sep 2018 18:03:40 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 204, message: No Content} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.2 (Windows-10-10.0.17134-SP0) requests/2.18.4 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-containerinstance/1.0.0 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerInstance/locations/westus/operations/efbaa5a1-81a3-460e-b750-26909e01ce03?api-version=2018-06-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_containerinstance_test_container_instance26441510/providers/Microsoft.ContainerInstance/containerGroups/pycontainer26441510","status":"Succeeded","startTime":"2018-09-06T18:03:41.2568351Z","properties":{"events":[{"count":1,"firstTimestamp":"2018-09-06T18:03:11Z","lastTimestamp":"2018-09-06T18:03:11Z","name":"Pulling","message":"pulling + image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Pulled","message":"Successfully + pulled image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Created","message":"Created + container with id 41b7e27558992017cd679361313de8157a2b35a3dc76ac79a6d4235dc9835e67","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:13Z","lastTimestamp":"2018-09-06T18:03:13Z","name":"Started","message":"Started + container with id 41b7e27558992017cd679361313de8157a2b35a3dc76ac79a6d4235dc9835e67","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:42Z","lastTimestamp":"2018-09-06T18:03:42Z","name":"Pulling","message":"pulling + image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:44Z","lastTimestamp":"2018-09-06T18:03:44Z","name":"Pulled","message":"Successfully + pulled image \"alpine:latest\"","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:44Z","lastTimestamp":"2018-09-06T18:03:44Z","name":"Created","message":"Created + container with id c907e51308f23452c10ecd041e7fcb59fff8d96527ce687315320c125dbfba73","type":"Normal"},{"count":1,"firstTimestamp":"2018-09-06T18:03:44Z","lastTimestamp":"2018-09-06T18:03:44Z","name":"Started","message":"Started + container with id c907e51308f23452c10ecd041e7fcb59fff8d96527ce687315320c125dbfba73","type":"Normal"}]}}'} + headers: + cache-control: [no-cache] + content-length: ['1901'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 06 Sep 2018 18:04:10 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] diff --git a/azure-mgmt-containerinstance/tests/test_mgmt_containerinstance.py b/azure-mgmt-containerinstance/tests/test_mgmt_containerinstance.py index 4b4d56439155..0d2fa0387549 100644 --- a/azure-mgmt-containerinstance/tests/test_mgmt_containerinstance.py +++ b/azure-mgmt-containerinstance/tests/test_mgmt_containerinstance.py @@ -127,6 +127,9 @@ def test_container_instance(self, resource_group, location): # Testing Container_List_Logs containerLogResponse = self.client.container.list_logs(resource_group.name, container_group.name, container_group.containers[0].name) + # Testing Restart Container Group + poller = self.client.container_groups.restart(resource_group.name, container_group_name) + poller.result()