blob: aa0be856ac77c3530ca930b8dbe9250e18b759c5 [file] [log] [blame]
:py:mod:`airflow.providers.microsoft.azure.hooks.container_instance`
====================================================================
.. py:module:: airflow.providers.microsoft.azure.hooks.container_instance
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.microsoft.azure.hooks.container_instance.AzureContainerInstanceHook
.. py:class:: AzureContainerInstanceHook(conn_id = default_conn_name)
Bases: :py:obj:`airflow.providers.microsoft.azure.hooks.base_azure.AzureBaseHook`
A hook to communicate with Azure Container Instances.
This hook requires a service principal in order to work.
After creating this service principal
(Azure Active Directory/App Registrations), you need to fill in the
client_id (Application ID) as login, the generated password as password,
and tenantId and subscriptionId in the extra's field as a json.
:param conn_id: :ref:`Azure connection id<howto/connection:azure>` of
a service principal which will be used to start the container instance.
.. py:attribute:: conn_name_attr
:annotation: = azure_conn_id
.. py:attribute:: default_conn_name
:annotation: = azure_default
.. py:attribute:: conn_type
:annotation: = azure_container_instance
.. py:attribute:: hook_name
:annotation: = Azure Container Instance
.. py:method:: create_or_update(self, resource_group, name, container_group)
Create a new container group
:param resource_group: the name of the resource group
:param name: the name of the container group
:param container_group: the properties of the container group
.. py:method:: get_state_exitcode_details(self, resource_group, name)
Get the state and exitcode of a container group
:param resource_group: the name of the resource group
:param name: the name of the container group
:return: A tuple with the state, exitcode, and details.
If the exitcode is unknown 0 is returned.
:rtype: tuple(state,exitcode,details)
.. py:method:: get_messages(self, resource_group, name)
Get the messages of a container group
:param resource_group: the name of the resource group
:param name: the name of the container group
:return: A list of the event messages
:rtype: list[str]
.. py:method:: get_state(self, resource_group, name)
Get the state of a container group
:param resource_group: the name of the resource group
:param name: the name of the container group
:return: ContainerGroup
:rtype: ~azure.mgmt.containerinstance.models.ContainerGroup
.. py:method:: get_logs(self, resource_group, name, tail = 1000)
Get the tail from logs of a container group
:param resource_group: the name of the resource group
:param name: the name of the container group
:param tail: the size of the tail
:return: A list of log messages
:rtype: list[str]
.. py:method:: delete(self, resource_group, name)
Delete a container group
:param resource_group: the name of the resource group
:param name: the name of the container group
.. py:method:: exists(self, resource_group, name)
Test if a container group exists
:param resource_group: the name of the resource group
:param name: the name of the container group