airflow_client.client.ConnectionApi

All URIs are relative to http://localhost

MethodHTTP requestDescription
bulk_connectionsPATCH /api/v2/connectionsBulk Connections
create_default_connectionsPOST /api/v2/connections/defaultsCreate Default Connections
delete_connectionDELETE /api/v2/connections/{connection_id}Delete Connection
get_connectionGET /api/v2/connections/{connection_id}Get Connection
get_connectionsGET /api/v2/connectionsGet Connections
patch_connectionPATCH /api/v2/connections/{connection_id}Patch Connection
post_connectionPOST /api/v2/connectionsPost Connection
test_connectionPOST /api/v2/connections/testTest Connection

bulk_connections

BulkResponse bulk_connections(bulk_body_connection_body)

Bulk Connections

Bulk create, update, and delete connections.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
import airflow_client.client
from airflow_client.client.models.bulk_body_connection_body import BulkBodyConnectionBody
from airflow_client.client.models.bulk_response import BulkResponse
from airflow_client.client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_client.client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = airflow_client.client.ConnectionApi(api_client)
    bulk_body_connection_body = airflow_client.client.BulkBodyConnectionBody() # BulkBodyConnectionBody | 

    try:
        # Bulk Connections
        api_response = api_instance.bulk_connections(bulk_body_connection_body)
        print("The response of ConnectionApi->bulk_connections:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ConnectionApi->bulk_connections: %s\n" % e)

Parameters

NameTypeDescriptionNotes
bulk_body_connection_bodyBulkBodyConnectionBody

Return type

BulkResponse

Authorization

OAuth2PasswordBearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Successful Response-
401Unauthorized-
403Forbidden-
422Validation Error-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_default_connections

create_default_connections()

Create Default Connections

Create default connections.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
import airflow_client.client
from airflow_client.client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_client.client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = airflow_client.client.ConnectionApi(api_client)

    try:
        # Create Default Connections
        api_instance.create_default_connections()
    except Exception as e:
        print("Exception when calling ConnectionApi->create_default_connections: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

void (empty response body)

Authorization

OAuth2PasswordBearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
204Successful Response-
401Unauthorized-
403Forbidden-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_connection

delete_connection(connection_id)

Delete Connection

Delete a connection entry.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
import airflow_client.client
from airflow_client.client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_client.client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = airflow_client.client.ConnectionApi(api_client)
    connection_id = 'connection_id_example' # str | 

    try:
        # Delete Connection
        api_instance.delete_connection(connection_id)
    except Exception as e:
        print("Exception when calling ConnectionApi->delete_connection: %s\n" % e)

Parameters

NameTypeDescriptionNotes
connection_idstr

Return type

void (empty response body)

Authorization

OAuth2PasswordBearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
204Successful Response-
401Unauthorized-
403Forbidden-
404Not Found-
422Validation Error-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_connection

ConnectionResponse get_connection(connection_id)

Get Connection

Get a connection entry.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
import airflow_client.client
from airflow_client.client.models.connection_response import ConnectionResponse
from airflow_client.client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_client.client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = airflow_client.client.ConnectionApi(api_client)
    connection_id = 'connection_id_example' # str | 

    try:
        # Get Connection
        api_response = api_instance.get_connection(connection_id)
        print("The response of ConnectionApi->get_connection:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ConnectionApi->get_connection: %s\n" % e)

Parameters

NameTypeDescriptionNotes
connection_idstr

Return type

ConnectionResponse

Authorization

OAuth2PasswordBearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Successful Response-
401Unauthorized-
403Forbidden-
404Not Found-
422Validation Error-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_connections

ConnectionCollectionResponse get_connections(limit=limit, offset=offset, order_by=order_by, connection_id_pattern=connection_id_pattern)

Get Connections

Get all connection entries.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
import airflow_client.client
from airflow_client.client.models.connection_collection_response import ConnectionCollectionResponse
from airflow_client.client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_client.client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = airflow_client.client.ConnectionApi(api_client)
    limit = 50 # int |  (optional) (default to 50)
    offset = 0 # int |  (optional) (default to 0)
    order_by = 'id' # str |  (optional) (default to 'id')
    connection_id_pattern = 'connection_id_pattern_example' # str |  (optional)

    try:
        # Get Connections
        api_response = api_instance.get_connections(limit=limit, offset=offset, order_by=order_by, connection_id_pattern=connection_id_pattern)
        print("The response of ConnectionApi->get_connections:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ConnectionApi->get_connections: %s\n" % e)

Parameters

NameTypeDescriptionNotes
limitint[optional] [default to 50]
offsetint[optional] [default to 0]
order_bystr[optional] [default to 'id']
connection_id_patternstr[optional]

Return type

ConnectionCollectionResponse

Authorization

OAuth2PasswordBearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Successful Response-
401Unauthorized-
403Forbidden-
404Not Found-
422Validation Error-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

patch_connection

ConnectionResponse patch_connection(connection_id, connection_body, update_mask=update_mask)

Patch Connection

Update a connection entry.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
import airflow_client.client
from airflow_client.client.models.connection_body import ConnectionBody
from airflow_client.client.models.connection_response import ConnectionResponse
from airflow_client.client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_client.client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = airflow_client.client.ConnectionApi(api_client)
    connection_id = 'connection_id_example' # str | 
    connection_body = airflow_client.client.ConnectionBody() # ConnectionBody | 
    update_mask = ['update_mask_example'] # List[str] |  (optional)

    try:
        # Patch Connection
        api_response = api_instance.patch_connection(connection_id, connection_body, update_mask=update_mask)
        print("The response of ConnectionApi->patch_connection:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ConnectionApi->patch_connection: %s\n" % e)

Parameters

NameTypeDescriptionNotes
connection_idstr
connection_bodyConnectionBody
update_maskList[str][optional]

Return type

ConnectionResponse

Authorization

OAuth2PasswordBearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Successful Response-
400Bad Request-
401Unauthorized-
403Forbidden-
404Not Found-
422Validation Error-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

post_connection

ConnectionResponse post_connection(connection_body)

Post Connection

Create connection entry.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
import airflow_client.client
from airflow_client.client.models.connection_body import ConnectionBody
from airflow_client.client.models.connection_response import ConnectionResponse
from airflow_client.client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_client.client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = airflow_client.client.ConnectionApi(api_client)
    connection_body = airflow_client.client.ConnectionBody() # ConnectionBody | 

    try:
        # Post Connection
        api_response = api_instance.post_connection(connection_body)
        print("The response of ConnectionApi->post_connection:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ConnectionApi->post_connection: %s\n" % e)

Parameters

NameTypeDescriptionNotes
connection_bodyConnectionBody

Return type

ConnectionResponse

Authorization

OAuth2PasswordBearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
201Successful Response-
401Unauthorized-
403Forbidden-
409Conflict-
422Validation Error-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

test_connection

ConnectionTestResponse test_connection(connection_body)

Test Connection

Test an API connection.

This method first creates an in-memory transient conn_id & exports that to an env var, as some hook classes tries to find out the conn from their init method & errors out if not found. It also deletes the conn id env connection after the test.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
import airflow_client.client
from airflow_client.client.models.connection_body import ConnectionBody
from airflow_client.client.models.connection_test_response import ConnectionTestResponse
from airflow_client.client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_client.client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = airflow_client.client.ConnectionApi(api_client)
    connection_body = airflow_client.client.ConnectionBody() # ConnectionBody | 

    try:
        # Test Connection
        api_response = api_instance.test_connection(connection_body)
        print("The response of ConnectionApi->test_connection:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ConnectionApi->test_connection: %s\n" % e)

Parameters

NameTypeDescriptionNotes
connection_bodyConnectionBody

Return type

ConnectionTestResponse

Authorization

OAuth2PasswordBearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Successful Response-
401Unauthorized-
403Forbidden-
422Validation Error-

[Back to top] [Back to API list] [Back to Model list] [Back to README]