File: container_py3.py

package info (click to toggle)
python-azure 20181112%2Bgit-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 407,300 kB
  • sloc: python: 717,190; makefile: 201; sh: 76
file content (85 lines) | stat: -rw-r--r-- 3,864 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# 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 Container(Model):
    """A container instance.

    Variables are only populated by the server, and will be ignored when
    sending a request.

    All required parameters must be populated in order to send to Azure.

    :param name: Required. The user-provided name of the container instance.
    :type name: str
    :param image: Required. The name of the image used to create the container
     instance.
    :type image: str
    :param command: The commands to execute within the container instance in
     exec form.
    :type command: list[str]
    :param ports: The exposed ports on the container instance.
    :type ports: list[~azure.mgmt.containerinstance.models.ContainerPort]
    :param environment_variables: The environment variables to set in the
     container instance.
    :type environment_variables:
     list[~azure.mgmt.containerinstance.models.EnvironmentVariable]
    :ivar instance_view: The instance view of the container instance. Only
     valid in response.
    :vartype instance_view:
     ~azure.mgmt.containerinstance.models.ContainerPropertiesInstanceView
    :param resources: Required. The resource requirements of the container
     instance.
    :type resources: ~azure.mgmt.containerinstance.models.ResourceRequirements
    :param volume_mounts: The volume mounts available to the container
     instance.
    :type volume_mounts:
     list[~azure.mgmt.containerinstance.models.VolumeMount]
    :param liveness_probe: The liveness probe.
    :type liveness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe
    :param readiness_probe: The readiness probe.
    :type readiness_probe: ~azure.mgmt.containerinstance.models.ContainerProbe
    """

    _validation = {
        'name': {'required': True},
        'image': {'required': True},
        'instance_view': {'readonly': True},
        'resources': {'required': True},
    }

    _attribute_map = {
        'name': {'key': 'name', 'type': 'str'},
        'image': {'key': 'properties.image', 'type': 'str'},
        'command': {'key': 'properties.command', 'type': '[str]'},
        'ports': {'key': 'properties.ports', 'type': '[ContainerPort]'},
        'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'},
        'instance_view': {'key': 'properties.instanceView', 'type': 'ContainerPropertiesInstanceView'},
        'resources': {'key': 'properties.resources', 'type': 'ResourceRequirements'},
        'volume_mounts': {'key': 'properties.volumeMounts', 'type': '[VolumeMount]'},
        'liveness_probe': {'key': 'properties.livenessProbe', 'type': 'ContainerProbe'},
        'readiness_probe': {'key': 'properties.readinessProbe', 'type': 'ContainerProbe'},
    }

    def __init__(self, *, name: str, image: str, resources, command=None, ports=None, environment_variables=None, volume_mounts=None, liveness_probe=None, readiness_probe=None, **kwargs) -> None:
        super(Container, self).__init__(**kwargs)
        self.name = name
        self.image = image
        self.command = command
        self.ports = ports
        self.environment_variables = environment_variables
        self.instance_view = None
        self.resources = resources
        self.volume_mounts = volume_mounts
        self.liveness_probe = liveness_probe
        self.readiness_probe = readiness_probe