| :py:mod:`airflow.providers.google.cloud.hooks.cloud_memorystore` |
| ================================================================ |
| |
| .. py:module:: airflow.providers.google.cloud.hooks.cloud_memorystore |
| |
| .. autoapi-nested-parse:: |
| |
| Hooks for Cloud Memorystore service. |
| |
| .. spelling:: |
| |
| DataProtectionMode |
| FieldMask |
| pb |
| memcache |
| |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.google.cloud.hooks.cloud_memorystore.CloudMemorystoreHook |
| airflow.providers.google.cloud.hooks.cloud_memorystore.CloudMemorystoreMemcachedHook |
| |
| |
| |
| |
| .. py:class:: CloudMemorystoreHook(gcp_conn_id = 'google_cloud_default', delegate_to = None, impersonation_chain = None) |
| |
| Bases: :py:obj:`airflow.providers.google.common.hooks.base_google.GoogleBaseHook` |
| |
| Hook for Google Cloud Memorystore APIs. |
| |
| All the methods in the hook where project_id is used must be called with |
| keyword arguments rather than positional. |
| |
| :param gcp_conn_id: The connection ID to use when fetching connection info. |
| :param delegate_to: The account to impersonate using domain-wide delegation of authority, |
| if any. For this to work, the service account making the request must have |
| domain-wide delegation enabled. |
| :param impersonation_chain: Optional service account to impersonate using short-term |
| credentials, or chained list of accounts required to get the access_token |
| of the last account in the list, which will be impersonated in the request. |
| If set as a string, the account must grant the originating account |
| the Service Account Token Creator IAM role. |
| If set as a sequence, the identities from the list must grant |
| Service Account Token Creator IAM role to the directly preceding identity, with first |
| account from the list granting this role to the originating account. |
| |
| .. py:method:: get_conn(self) |
| |
| Retrieves client library object that allow access to Cloud Memorystore service. |
| |
| |
| .. py:method:: create_instance(self, location, instance_id, instance, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Creates a Redis instance based on the specified tier and memory size. |
| |
| By default, the instance is accessible from the project's `default network |
| <https://cloud.google.com/compute/docs/networks-and-firewalls#networks>`__. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance_id: Required. The logical name of the Redis instance in the customer project with the |
| following restrictions: |
| |
| - Must contain only lowercase letters, numbers, and hyphens. |
| - Must start with a letter. |
| - Must be between 1-40 characters. |
| - Must end with a number or a letter. |
| - Must be unique within the customer project / location |
| :param instance: Required. A Redis [Instance] resource |
| |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.cloud.redis_v1.types.Instance` |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: delete_instance(self, location, instance, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Deletes a specific Redis instance. Instance stops serving and data is deleted. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance: The logical name of the Redis instance in the customer project. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: export_instance(self, location, instance, output_config, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Export Redis instance data into a Redis RDB format file in Cloud Storage. |
| |
| Redis will continue serving during this operation. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance: The logical name of the Redis instance in the customer project. |
| :param output_config: Required. Specify data to be exported. |
| |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.cloud.redis_v1.types.OutputConfig` |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: failover_instance(self, location, instance, data_protection_mode, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud |
| Memorystore for Redis instance. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance: The logical name of the Redis instance in the customer project. |
| :param data_protection_mode: Optional. Available data protection modes that the user can choose. If |
| it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default. |
| .DataProtectionMode |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: get_instance(self, location, instance, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Gets the details of a specific Redis instance. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance: The logical name of the Redis instance in the customer project. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: import_instance(self, location, instance, input_config, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. |
| |
| Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. |
| When complete, the instance will contain only data from the imported file. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance: The logical name of the Redis instance in the customer project. |
| :param input_config: Required. Specify data to be imported. |
| |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.cloud.redis_v1.types.InputConfig` |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: list_instances(self, location, page_size, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Lists all Redis instances owned by a project in either the specified location (region) or all |
| locations. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| |
| If it is specified as ``-`` (wildcard), then all regions available to the project are |
| queried, and the results are aggregated. |
| :param page_size: The maximum number of resources contained in the underlying API response. If page |
| streaming is performed per- resource, this parameter does not affect the return value. If page |
| streaming is performed per-page, this determines the maximum number of resources in a page. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: update_instance(self, update_mask, instance, project_id = PROVIDE_PROJECT_ID, location = None, instance_id = None, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Updates the metadata and configuration of a specific Redis instance. |
| |
| :param update_mask: Required. Mask of fields to update. At least one path must be supplied in this |
| field. The elements of the repeated paths field may only include these fields from ``Instance``: |
| |
| - ``displayName`` |
| - ``labels`` |
| - ``memorySizeGb`` |
| - ``redisConfig`` |
| |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.protobuf.field_mask_pb2.FieldMask` |
| :param instance: Required. Update description. Only fields specified in ``update_mask`` are updated. |
| |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.cloud.redis_v1.types.Instance` |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance_id: The logical name of the Redis instance in the customer project. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| |
| .. py:class:: CloudMemorystoreMemcachedHook(gcp_conn_id = 'google_cloud_default', delegate_to = None, impersonation_chain = None) |
| |
| Bases: :py:obj:`airflow.providers.google.common.hooks.base_google.GoogleBaseHook` |
| |
| Hook for Google Cloud Memorystore for Memcached service APIs. |
| |
| All the methods in the hook where project_id is used must be called with |
| keyword arguments rather than positional. |
| |
| :param gcp_conn_id: The connection ID to use when fetching connection info. |
| :param delegate_to: The account to impersonate using domain-wide delegation of authority, |
| if any. For this to work, the service account making the request must have |
| domain-wide delegation enabled. |
| :param impersonation_chain: Optional service account to impersonate using short-term |
| credentials, or chained list of accounts required to get the access_token |
| of the last account in the list, which will be impersonated in the request. |
| If set as a string, the account must grant the originating account |
| the Service Account Token Creator IAM role. |
| If set as a sequence, the identities from the list must grant |
| Service Account Token Creator IAM role to the directly preceding identity, with first |
| account from the list granting this role to the originating account. |
| |
| .. py:method:: get_conn(self) |
| |
| Retrieves client library object that allow access to Cloud Memorystore Memcached service. |
| |
| |
| .. py:method:: apply_parameters(self, node_ids, apply_all, project_id, location, instance_id, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Will update current set of Parameters to the set of specified nodes of the Memcached Instance. |
| |
| :param node_ids: Nodes to which we should apply the instance-level parameter group. |
| :param apply_all: Whether to apply instance-level parameter group to all nodes. If set to true, |
| will explicitly restrict users from specifying any nodes, and apply parameter group updates |
| to all nodes within the instance. |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance_id: The logical name of the Memcached instance in the customer project. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: create_instance(self, location, instance_id, instance, project_id, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Creates a Memcached instance based on the specified tier and memory size. |
| |
| By default, the instance is accessible from the project's `default network |
| <https://cloud.google.com/compute/docs/networks-and-firewalls#networks>`__. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance_id: Required. The logical name of the Memcached instance in the customer project |
| with the following restrictions: |
| |
| - Must contain only lowercase letters, numbers, and hyphens. |
| - Must start with a letter. |
| - Must be between 1-40 characters. |
| - Must end with a number or a letter. |
| - Must be unique within the customer project / location |
| :param instance: Required. A Memcached [Instance] resource |
| |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.cloud.memcache_v1beta2.types.cloud_memcache.Instance` |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the GCP connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: delete_instance(self, location, instance, project_id, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Deletes a specific Memcached instance. Instance stops serving and data is deleted. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance: The logical name of the Memcached instance in the customer project. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the GCP connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: get_instance(self, location, instance, project_id, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Gets the details of a specific Memcached instance. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance: The logical name of the Memcached instance in the customer project. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the GCP connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: list_instances(self, location, project_id, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Lists all Memcached instances owned by a project in either the specified location (region) or all |
| locations. |
| |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| |
| If it is specified as ``-`` (wildcard), then all regions available to the project are |
| queried, and the results are aggregated. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the GCP connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: update_instance(self, update_mask, instance, project_id, location = None, instance_id = None, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Updates the metadata and configuration of a specific Memcached instance. |
| |
| :param update_mask: Required. Mask of fields to update. At least one path must be supplied in this |
| field. The elements of the repeated paths field may only include these fields from ``Instance``: |
| |
| - ``displayName`` |
| |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.protobuf.field_mask_pb2.FieldMask`) |
| Union[Dict, google.protobuf.field_mask_pb2.FieldMask] |
| :param instance: Required. Update description. Only fields specified in ``update_mask`` are updated. |
| |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.cloud.memcache_v1beta2.types.cloud_memcache.Instance` |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance_id: The logical name of the Memcached instance in the customer project. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| .. py:method:: update_parameters(self, update_mask, parameters, project_id, location, instance_id, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Updates the defined Memcached Parameters for an existing Instance. This method only stages the |
| parameters, it must be followed by apply_parameters to apply the parameters to nodes of |
| the Memcached Instance. |
| |
| :param update_mask: Required. Mask of fields to update. |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.protobuf.field_mask_pb2.FieldMask` |
| Union[Dict, google.protobuf.field_mask_pb2.FieldMask] |
| :param parameters: The parameters to apply to the instance. |
| If a dict is provided, it must be of the same form as the protobuf message |
| :class:`~google.cloud.memcache_v1beta2.types.cloud_memcache.MemcacheParameters` |
| :param location: The location of the Cloud Memorystore instance (for example europe-west1) |
| :param instance_id: The logical name of the Memcached instance in the customer project. |
| :param project_id: Project ID of the project that contains the instance. If set |
| to None or missing, the default project_id from the Google Cloud connection is used. |
| :param retry: A retry object used to retry requests. If ``None`` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| ``retry`` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| |
| |