swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  title: ContainerInstanceManagementClient
  version: 2017-08-01-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2017-08-01-preview/containerInstance.json
      version: "2.0"
  x-preferred: false
  x-providerName: azure.com
  x-serviceName: containerinstance-containerInstance
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: Impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters:
  ApiVersionParameter:
    description: Client API version
    in: query
    name: api-version
    required: true
    type: string
  SubscriptionIdParameter:
    description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
    in: path
    name: subscriptionId
    required: true
    type: string
paths:
  "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups":
    get:
      description: Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
      operationId: ContainerGroups_List
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ContainerGroupListResult"
      summary: Get a list of container groups in the specified subscription.
      x-ms-examples:
        ContainerGroupsList:
          parameters:
            api-version: 2017-08-01-preview
            subscriptionId: subid
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1
                    location: WestUs
                    name: demo1
                    properties:
                      containers:
                        - name: demo1
                          properties:
                            command: null
                            environmentVariables: []
                            image: nginx
                            instanceView: null
                            ports:
                              - port: 80
                            resources:
                              limits: null
                              requests:
                                cpu: 1
                                memoryInGb: 1.5
                            volumeMounts:
                              - mountPath: /mnt/volume1
                                name: volume1
                                readOnly: false
                      imageRegistryCredentials:
                        - password: null
                          server: azcloudconsoleregistry.azurecr.io
                          username: azcloudconsoleregistry
                      ipAddress:
                        ip: 10.0.0.1
                        ports:
                          - port: 80
                            protocol: TCP
                      osType: Linux
                      provisioningState: Succeeded
                      restartPolicy: null
                      state: null
                      volumes:
                        - azureFile:
                            readOnly: null
                            shareName: share1
                            storageAccountKey: null
                            storageAccountName: stroage1
                          name: volume1
                    resourceGroup: demo
                    tags: null
                    type: Microsoft.ContainerInstance/containerGroups
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups":
    get:
      description: Get a list of container groups in a specified subscription and resource group. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
      operationId: ContainerGroups_ListByResourceGroup
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: The name of the resource group that contains the container group.
          in: path
          name: resourceGroupName
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ContainerGroupListResult"
      summary: Get a list of container groups in the specified subscription and resource group.
      x-ms-examples:
        ContainerGroupsListByResourceGroup:
          parameters:
            api-version: 2017-08-01-preview
            resourceGroupName: demo
            subscriptionId: subid
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1
                    location: WestUs
                    name: demo1
                    properties:
                      containers:
                        - name: demo1
                          properties:
                            command: null
                            environmentVariables: []
                            image: nginx
                            instanceView: null
                            ports:
                              - port: 80
                            resources:
                              limits: null
                              requests:
                                cpu: 1
                                memoryInGb: 1.5
                            volumeMounts:
                              - mountPath: /mnt/volume1
                                name: volume1
                                readOnly: false
                      imageRegistryCredentials:
                        - password: null
                          server: azcloudconsoleregistry.azurecr.io
                          username: azcloudconsoleregistry
                      ipAddress:
                        ip: 10.0.0.1
                        ports:
                          - port: 80
                            protocol: TCP
                      osType: Linux
                      provisioningState: Succeeded
                      restartPolicy: null
                      state: null
                      volumes:
                        - azureFile:
                            readOnly: null
                            shareName: share1
                            storageAccountKey: null
                            storageAccountName: stroage1
                          name: volume1
                    resourceGroup: demo
                    tags: null
                    type: Microsoft.ContainerInstance/containerGroups
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}":
    delete:
      description: Delete the specified container group in the specified subscription and resource group. The operation does not delete other resources provided by the user, such as volumes.
      operationId: ContainerGroups_Delete
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: The name of the resource group that contains the container group.
          in: path
          name: resourceGroupName
          required: true
          type: string
        - description: The name of the container group to be deleted.
          in: path
          name: containerGroupName
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ContainerGroup"
        "204":
          description: No Content - the specified container group was not found.
      summary: Delete the specified container group.
      x-ms-examples:
        ContainerGroupsDelete:
          parameters:
            api-version: 2017-08-01-preview
            containerGroupName: demo1
            resourceGroupName: demo
            subscriptionId: subid
          responses:
            "200": {}
            "204": {}
    get:
      description: Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.
      operationId: ContainerGroups_Get
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: The name of the resource group that contains the container group.
          in: path
          name: resourceGroupName
          required: true
          type: string
        - description: The name of the container group.
          in: path
          name: containerGroupName
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ContainerGroup"
      summary: Get the properties of the specified container group.
      x-ms-examples:
        ContainerGroupsGet:
          parameters:
            api-version: 2017-08-01-preview
            resourceGroupName: demo
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1
                location: WestUs
                name: demo1
                properties:
                  containers:
                    - name: demo1
                      properties:
                        command: null
                        environmentVariables: []
                        image: nginx
                        instanceView: null
                        ports:
                          - port: 80
                        resources:
                          limits: null
                          requests:
                            cpu: 1
                            memoryInGb: 1.5
                        volumeMounts:
                          - mountPath: /mnt/volume1
                            name: volume1
                            readOnly: false
                  imageRegistryCredentials:
                    - password: null
                      server: azcloudconsoleregistry.azurecr.io
                      username: azcloudconsoleregistry
                  ipAddress:
                    ip: 10.0.0.1
                    ports:
                      - port: 80
                        protocol: TCP
                  osType: Linux
                  provisioningState: Succeeded
                  restartPolicy: null
                  state: null
                  volumes:
                    - azureFile:
                        readOnly: null
                        shareName: share1
                        storageAccountKey: null
                        storageAccountName: stroage1
                      name: volume1
                resourceGroup: demo
                tags: null
                type: Microsoft.ContainerInstance/containerGroups
    put:
      description: Create or update container groups with specified configurations.
      operationId: ContainerGroups_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: The name of the resource group to contain the container group to be created or updated.
          in: path
          name: resourceGroupName
          required: true
          type: string
        - description: The name of the container group to be created or updated.
          in: path
          name: containerGroupName
          required: true
          type: string
        - description: The properties of the container group to be created or updated.
          in: body
          name: containerGroup
          required: true
          schema:
            $ref: "#/definitions/ContainerGroup"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ContainerGroup"
        "201":
          description: Created - the container group is created.
          schema:
            $ref: "#/definitions/ContainerGroup"
      summary: Create or update container groups.
      x-ms-examples:
        ContainerGroupsCreateOrUpdate:
          parameters:
            api-version: 2017-08-01-preview
            containerGroup:
              id: /subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1
              location: west us
              name: demo1
              properties:
                containers:
                  - name: demo1
                    properties:
                      command: null
                      environmentVariables: []
                      image: nginx
                      instanceView: {}
                      ports:
                        - port: 80
                      resources:
                        limits: null
                        requests:
                          cpu: 1
                          memoryInGb: 1.5
                      volumeMounts: null
                imageRegistryCredentials: null
                ipAddress:
                  type: Public
                osType: Linux
                provisioningState: null
                restartPolicy: null
                state: null
              resourceGroup: demo
              tags: null
              type: Microsoft.ContainerInstance/containerGroups
            containerGroupName: demo1
            resourceGroupName: demo
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1
                location: WestUs
                name: demo1
                properties:
                  containers:
                    - name: demo1
                      properties:
                        command: null
                        environmentVariables: []
                        image: nginx
                        instanceView: null
                        ports:
                          - port: 80
                        resources:
                          limits: null
                          requests:
                            cpu: 1
                            memoryInGb: 1.5
                        volumeMounts: null
                  imageRegistryCredentials: null
                  ipAddress:
                    ip: 10.0.0.1
                    ports:
                      - port: 80
                        protocol: TCP
                  osType: Linux
                  provisioningState: Succeeded
                  restartPolicy: null
                  state: null
                  volumes: null
                resourceGroup: demo
                tags: null
                type: Microsoft.ContainerInstance/containerGroups
            "201":
              body:
                id: /subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1
                location: WestUs
                name: demo1
                properties:
                  containers:
                    - name: demo1
                      properties:
                        command: null
                        environmentVariables: []
                        image: nginx
                        instanceView: null
                        ports:
                          - port: 80
                        resources:
                          limits: null
                          requests:
                            cpu: 1
                            memoryInGb: 1.5
                        volumeMounts: null
                  imageRegistryCredentials: null
                  ipAddress:
                    ip: 10.0.0.1
                    ports:
                      - port: 80
                        protocol: TCP
                  osType: Linux
                  provisioningState: Succeeded
                  restartPolicy: null
                  state: null
                  volumes: null
                resourceGroup: demo
                tags: null
                type: Microsoft.ContainerInstance/containerGroups
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs":
    get:
      description: Get the logs for a specified container instance in a specified resource group and container group.
      operationId: ContainerLogs_List
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: The name of the resource group that contains the container instance.
          in: path
          name: resourceGroupName
          required: true
          type: string
        - description: The name of the container instance.
          in: path
          name: containerName
          required: true
          type: string
        - description: The name of the container group the container instance belongs to.
          in: path
          name: containerGroupName
          required: true
          type: string
        - description: 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.
          in: query
          name: tail
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Logs"
      summary: Get the logs for a specified container instance.
      x-ms-examples:
        ContainerLogsList:
          parameters:
            api-version: 2017-08-01-preview
            containerGroupName: demo1
            containerName: container1
            resourceGroupName: demo
            subscriptionId: subid
            tail: 10
          responses:
            "200":
              body:
                content: log content
definitions:
  AzureFileVolume:
    description: The properties of the Azure File volume. Azure File shares are mounted as volumes.
    properties:
      readOnly:
        description: The flag indicating whether the Azure File shared mounted as a volume is read-only.
        type: boolean
      shareName:
        description: The name of the Azure File share to be mounted as a volume.
        type: string
      storageAccountKey:
        description: The storage account access key used to access the Azure File share.
        type: string
      storageAccountName:
        description: The name of the storage account that contains the Azure File share.
        type: string
    required:
      - shareName
      - storageAccountName
    type: object
  Container:
    description: A container instance.
    properties:
      name:
        description: The user-provided name of the container instance.
        type: string
      properties:
        $ref: "#/definitions/ContainerProperties"
        description: The properties of the container instance.
        x-ms-client-flatten: true
    required:
      - properties
      - name
    type: object
  ContainerEvent:
    description: A container instance event.
    properties:
      count:
        description: The count of the event.
        type: integer
      firstTimestamp:
        description: The date-time of the earliest logged event.
        format: date-time
        type: string
      lastTimestamp:
        description: The date-time of the latest logged event.
        format: date-time
        type: string
      message:
        description: The event message.
        type: string
      type:
        description: The event type.
        type: string
    type: object
  ContainerGroup:
    allOf:
      - $ref: "#/definitions/Resource"
      - properties:
          properties:
            properties:
              containers:
                description: The containers within the container group.
                items:
                  $ref: "#/definitions/Container"
                type: array
              imageRegistryCredentials:
                description: The image registry credentials by which the container group is created from.
                items:
                  $ref: "#/definitions/ImageRegistryCredential"
                type: array
              ipAddress:
                $ref: "#/definitions/IpAddress"
                description: The IP address type of the container group.
              osType:
                description: The operating system type required by the containers in the container group.
                enum:
                  - Windows
                  - Linux
                type: string
                x-ms-enum:
                  modelAsString: true
                  name: OperatingSystemTypes
              provisioningState:
                description: The provisioning state of the container group. This only appears in the response.
                readOnly: true
                type: string
              restartPolicy:
                description: Restart policy for all containers within the container group. Currently the only available option is `always`.
                enum:
                  - always
                type: string
                x-ms-enum:
                  modelAsString: true
                  name: ContainerRestartPolicy
              state:
                description: The current state of the container group. This is only valid for the response.
                readOnly: true
                type: string
              volumes:
                description: The list of volumes that can be mounted by containers in this container group.
                items:
                  $ref: "#/definitions/Volume"
                type: array
            required:
              - containers
              - osType
            type: object
            x-ms-client-flatten: true
        required:
          - properties
        type: object
    description: A container group.
  ContainerGroupListResult:
    description: The container group list response that contains the container group properties.
    properties:
      nextLink:
        description: The URI to fetch the next page of container groups.
        type: string
      value:
        description: The list of container groups.
        items:
          $ref: "#/definitions/ContainerGroup"
        type: array
    type: object
  ContainerPort:
    description: The port exposed on the container instance.
    properties:
      port:
        description: The port number exposed within the container group.
        format: int32
        type: integer
    required:
      - port
    type: object
  ContainerProperties:
    description: The container instance properties.
    properties:
      command:
        description: The commands to execute within the container instance in exec form.
        items:
          type: string
        type: array
      environmentVariables:
        description: The environment variables to set in the container instance.
        items:
          $ref: "#/definitions/EnvironmentVariable"
        type: array
      image:
        description: The name of the image used to create the container instance.
        type: string
      instanceView:
        description: The instance view of the container instance. Only valid in response.
        properties:
          currentState:
            $ref: "#/definitions/ContainerState"
            description: Current container instance state.
          events:
            description: The events of the container instance.
            items:
              $ref: "#/definitions/ContainerEvent"
            type: array
          previousState:
            $ref: "#/definitions/ContainerState"
            description: Previous container instance state.
          restartCount:
            description: The number of times that the container instance has been restarted.
            type: integer
        readOnly: true
        type: object
      ports:
        description: The exposed ports on the container instance.
        items:
          $ref: "#/definitions/ContainerPort"
        type: array
      resources:
        $ref: "#/definitions/ResourceRequirements"
        description: The resource requirements of the container instance.
      volumeMounts:
        description: The volume mounts available to the container instance.
        items:
          $ref: "#/definitions/VolumeMount"
        type: array
    required:
      - image
      - resources
    type: object
  ContainerState:
    description: The container instance state.
    properties:
      detailStatus:
        description: The human-readable status of the container instance state.
        type: string
      exitCode:
        description: The container instance exit codes correspond to those from the `docker run` command.
        type: integer
      finishTime:
        description: The date-time when the container instance state finished.
        format: date-time
        type: string
      startTime:
        description: The date-time when the container instance state started.
        format: date-time
        type: string
      state:
        description: The state of the container instance.
        type: string
    type: object
  EnvironmentVariable:
    description: The environment variable to set within the container instance.
    properties:
      name:
        description: The name of the environment variable.
        type: string
      value:
        description: The value of the environment variable.
        type: string
    required:
      - name
      - value
    type: object
  ImageRegistryCredential:
    description: Image registry credential.
    properties:
      password:
        description: The password for the private registry.
        type: string
      server:
        description: The Docker image registry server without a protocol such as "http" and "https".
        type: string
      username:
        description: The username for the private registry.
        type: string
    required:
      - server
      - username
    type: object
  IpAddress:
    description: IP address for the container group.
    properties:
      ip:
        description: The IP exposed to the public internet.
        type: string
      ports:
        description: The list of ports exposed on the container group.
        items:
          $ref: "#/definitions/Port"
        type: array
      type:
        description: Specifies if the IP is exposed to the public internet.
        enum:
          - Public
        type: string
        x-ms-enum:
          modelAsString: true
          name: ContainerGroupIpAddressType
    required:
      - ports
      - type
    type: object
  Logs:
    description: The logs.
    properties:
      content:
        description: The content of the log.
        type: string
    type: object
  Port:
    description: The port exposed on the container group.
    properties:
      port:
        description: The port number.
        format: int32
        type: integer
      protocol:
        description: The protocol associated with the port.
        enum:
          - TCP
          - UDP
        type: string
        x-ms-enum:
          modelAsString: true
          name: ContainerGroupNetworkProtocol
    required:
      - port
    type: object
  Resource:
    description: The Resource model definition.
    properties:
      id:
        description: The resource id.
        readOnly: true
        type: string
      location:
        description: The resource location.
        type: string
      name:
        description: The resource name.
        readOnly: true
        type: string
      tags:
        additionalProperties:
          type: string
        description: The resource tags.
        type: object
      type:
        description: The resource type.
        readOnly: true
        type: string
    required:
      - location
    type: object
    x-ms-azure-resource: true
  ResourceLimits:
    description: The resource limits.
    properties:
      cpu:
        description: The CPU limit of this container instance.
        format: double
        type: number
      memoryInGB:
        description: The memory limit in GB of this container instance.
        format: double
        type: number
    type: object
  ResourceRequests:
    description: The resource requests.
    properties:
      cpu:
        description: The CPU request of this container instance.
        format: double
        type: number
      memoryInGB:
        description: The memory request in GB of this container instance.
        format: double
        type: number
    required:
      - memoryInGB
      - cpu
    type: object
  ResourceRequirements:
    description: The resource requirements.
    properties:
      limits:
        $ref: "#/definitions/ResourceLimits"
        description: The resource limits of this container instance.
      requests:
        $ref: "#/definitions/ResourceRequests"
        description: The resource requests of this container instance.
    required:
      - requests
    type: object
  Volume:
    description: The properties of the volume.
    properties:
      azureFile:
        $ref: "#/definitions/AzureFileVolume"
        description: The name of the Azure File volume.
      name:
        description: The name of the volume.
        type: string
    required:
      - name
      - azureFile
    type: object
  VolumeMount:
    description: The properties of the volume mount.
    properties:
      mountPath:
        description: The path within the container where the volume should be mounted. Must not contain colon (:).
        type: string
      name:
        description: The name of the volume mount.
        type: string
      readOnly:
        description: The flag indicating whether the volume mount is read-only.
        type: boolean
    required:
      - name
      - mountPath
    type: object
