Bases: 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.
- Parameters
azure_conn_id (str) – Azure connection id of
a service principal which will be used to start the container instance.
-
conn_name_attr = 'azure_conn_id'[source]
-
default_conn_name = 'azure_default'[source]
-
conn_type = 'azure_container_instance'[source]
-
hook_name = 'Azure Container Instance'[source]
-
create_or_update(resource_group, name, container_group)[source]
Create a new container group
- Parameters
resource_group (str) – the name of the resource group
name (str) – the name of the container group
container_group (azure.mgmt.containerinstance.models.ContainerGroup) – the properties of the container group
-
get_state_exitcode_details(resource_group, name)[source]
Get the state and exitcode of a container group
- Parameters
-
- Returns
A tuple with the state, exitcode, and details.
If the exitcode is unknown 0 is returned.
- Return type
tuple
-
get_messages(resource_group, name)[source]
Get the messages of a container group
- Parameters
-
- Returns
A list of the event messages
- Return type
list
-
get_state(resource_group, name)[source]
Get the state of a container group
- Parameters
-
- Returns
ContainerGroup
- Return type
azure.mgmt.containerinstance.models.ContainerGroup
-
get_logs(resource_group, name, tail=1000)[source]
Get the tail from logs of a container group
- Parameters
resource_group (str) – the name of the resource group
name (str) – the name of the container group
tail (int) – the size of the tail
- Returns
A list of log messages
- Return type
list
-
delete(resource_group, name)[source]
Delete a container group
- Parameters
-
-
exists(resource_group, name)[source]
Test if a container group exists
- Parameters
-
-
test_connection()[source]
Test a configured Azure Container Instance connection.