airflow.providers.amazon.aws.hooks.elasticache_replication_group

Module Contents

class airflow.providers.amazon.aws.hooks.elasticache_replication_group.ElastiCacheReplicationGroupHook(max_retries: int = 10, exponential_back_off_factor: float = 1, initial_poke_interval: float = 60, *args, **kwargs)[source]

Bases: airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook

Interact with AWS ElastiCache

Parameters
  • max_retries (int) -- Max retries for checking availability of and deleting replication group If this is not supplied then this is defaulted to 10

  • exponential_back_off_factor (float) -- Multiplication factor for deciding next sleep time If this is not supplied then this is defaulted to 1

  • initial_poke_interval (float) -- Initial sleep time in seconds If this is not supplied then this is defaulted to 60 seconds

TERMINAL_STATES[source]
create_replication_group(self, config: dict)[source]

Call ElastiCache API for creating a replication group

Parameters

config (dict) -- Configuration for creating the replication group

Returns

Response from ElastiCache create replication group API

Return type

dict

delete_replication_group(self, replication_group_id: str)[source]

Call ElastiCache API for deleting a replication group

Parameters

replication_group_id (str) -- ID of replication group to delete

Returns

Response from ElastiCache delete replication group API

Return type

dict

describe_replication_group(self, replication_group_id: str)[source]

Call ElastiCache API for describing a replication group

Parameters

replication_group_id (str) -- ID of replication group to describe

Returns

Response from ElastiCache describe replication group API

Return type

dict

get_replication_group_status(self, replication_group_id: str)[source]

Get current status of replication group

Parameters

replication_group_id (str) -- ID of replication group to check for status

Returns

Current status of replication group

Return type

str

is_replication_group_available(self, replication_group_id: str)[source]

Helper for checking if replication group is available or not

Parameters

replication_group_id (str) -- ID of replication group to check for availability

Returns

True if available else False

Return type

bool

wait_for_availability(self, replication_group_id: str, initial_sleep_time: Optional[float] = None, exponential_back_off_factor: Optional[float] = None, max_retries: Optional[int] = None)[source]

Check if replication group is available or not by performing a describe over it

Parameters
  • replication_group_id (str) -- ID of replication group to check for availability

  • initial_sleep_time (float) -- Initial sleep time in seconds If this is not supplied then this is defaulted to class level value

  • exponential_back_off_factor (float) -- Multiplication factor for deciding next sleep time If this is not supplied then this is defaulted to class level value

  • max_retries (int) -- Max retries for checking availability of replication group If this is not supplied then this is defaulted to class level value

Returns

True if replication is available else False

Return type

bool

wait_for_deletion(self, replication_group_id: str, initial_sleep_time: Optional[float] = None, exponential_back_off_factor: Optional[float] = None, max_retries: Optional[int] = None)[source]

Helper for deleting a replication group ensuring it is either deleted or can't be deleted

Parameters
  • replication_group_id (str) -- ID of replication to delete

  • initial_sleep_time (float) -- Initial sleep time in second If this is not supplied then this is defaulted to class level value

  • exponential_back_off_factor (float) -- Multiplication factor for deciding next sleep time If this is not supplied then this is defaulted to class level value

  • max_retries (int) -- Max retries for checking availability of replication group If this is not supplied then this is defaulted to class level value

Returns

Response from ElastiCache delete replication group API and flag to identify if deleted or not

Return type

(dict, bool)

ensure_delete_replication_group(self, replication_group_id: str, initial_sleep_time: Optional[float] = None, exponential_back_off_factor: Optional[float] = None, max_retries: Optional[int] = None)[source]

Delete a replication group ensuring it is either deleted or can't be deleted

Parameters
  • replication_group_id (str) -- ID of replication to delete

  • initial_sleep_time (float) -- Initial sleep time in second If this is not supplied then this is defaulted to class level value

  • exponential_back_off_factor (float) -- Multiplication factor for deciding next sleep time If this is not supplied then this is defaulted to class level value

  • max_retries (int) -- Max retries for checking availability of replication group If this is not supplied then this is defaulted to class level value

Returns

Response from ElastiCache delete replication group API

Return type

dict

Raises

AirflowException -- If replication group is not deleted

Was this entry helpful?