Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
from .operations.container_groups_operations import ContainerGroupsOperations
from .operations.operations import Operations
from .operations.container_group_usage_operations import ContainerGroupUsageOperations
from .operations.container_logs_operations import ContainerLogsOperations
from .operations.start_container_operations import StartContainerOperations
from .operations.container_operations import ContainerOperations
from . import models


Expand Down Expand Up @@ -67,10 +66,8 @@ class ContainerInstanceManagementClient(SDKClient):
:vartype operations: azure.mgmt.containerinstance.operations.Operations
:ivar container_group_usage: ContainerGroupUsage operations
:vartype container_group_usage: azure.mgmt.containerinstance.operations.ContainerGroupUsageOperations
:ivar container_logs: ContainerLogs operations
:vartype container_logs: azure.mgmt.containerinstance.operations.ContainerLogsOperations
:ivar start_container: StartContainer operations
:vartype start_container: azure.mgmt.containerinstance.operations.StartContainerOperations
:ivar container: Container operations
:vartype container: azure.mgmt.containerinstance.operations.ContainerOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand Down Expand Up @@ -99,7 +96,5 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.container_group_usage = ContainerGroupUsageOperations(
self._client, self.config, self._serialize, self._deserialize)
self.container_logs = ContainerLogsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.start_container = StartContainerOperations(
self.container = ContainerOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class ContainerExecRequest(Model):
"""The start container exec request.
"""The container exec request.

:param command: The command to be executed.
:type command: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class ContainerExecRequest(Model):
"""The start container exec request.
"""The container exec request.

:param command: The command to be executed.
:type command: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
from .container_groups_operations import ContainerGroupsOperations
from .operations import Operations
from .container_group_usage_operations import ContainerGroupUsageOperations
from .container_logs_operations import ContainerLogsOperations
from .start_container_operations import StartContainerOperations
from .container_operations import ContainerOperations

__all__ = [
'ContainerGroupsOperations',
'Operations',
'ContainerGroupUsageOperations',
'ContainerLogsOperations',
'StartContainerOperations',
'ContainerOperations',
]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from .. import models


class StartContainerOperations(object):
"""StartContainerOperations operations.
class ContainerOperations(object):
"""ContainerOperations operations.

:param client: Client for service requests.
:param config: Configuration of service client.
Expand All @@ -37,12 +37,86 @@ def __init__(self, client, config, serializer, deserializer):

self.config = config

def launch_exec(
def list_logs(
self, resource_group_name, container_group_name, container_name, tail=None, custom_headers=None, raw=False, **operation_config):
"""Get the logs for a specified container instance.

Get the logs for a specified container instance in a specified resource
group and container group.

:param resource_group_name: The name of the resource group.
: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
: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 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<msrest:optionsforoperations>`.
:return: Logs or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.containerinstance.models.Logs or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.list_logs.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'),
'containerName': self._serialize.url("container_name", container_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')
if tail is not None:
query_parameters['tail'] = self._serialize.query("tail", tail, 'int')

# Construct headers
header_parameters = {}
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())
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.get(url, query_parameters)
response = self._client.send(request, header_parameters, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('Logs', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
list_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs'}

def execute_command(
self, resource_group_name, container_group_name, container_name, command=None, terminal_size=None, custom_headers=None, raw=False, **operation_config):
"""Starts the exec command for a specific container instance.
"""Executes a command in a specific container instance.

Starts the exec command for a specified container instance in a
specified resource group and container group.
Executes a command for a specific container instance in a specified
resource group and container group.

:param resource_group_name: The name of the resource group.
:type resource_group_name: str
Expand All @@ -68,7 +142,7 @@ def launch_exec(
container_exec_request = models.ContainerExecRequest(command=command, terminal_size=terminal_size)

# Construct URL
url = self.launch_exec.metadata['url']
url = self.execute_command.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'),
Expand Down Expand Up @@ -114,4 +188,4 @@ def launch_exec(
return client_raw_response

return deserialized
launch_exec.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'}
execute_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec'}