airflow.providers.google.cloud.hooks.stackdriver
¶
This module contains Google Cloud Stackdriver operators.
Module Contents¶
-
class
airflow.providers.google.cloud.hooks.stackdriver.
StackdriverHook
(gcp_conn_id: str = 'google_cloud_default', delegate_to: Optional[str] = None, impersonation_chain: Optional[Union[str, Sequence[str]]] = None)[source]¶ Bases:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
Stackdriver Hook for connecting with Google Cloud Stackdriver
-
list_alert_policies
(self, project_id: str, format_: Optional[str] = None, filter_: Optional[str] = None, order_by: Optional[str] = None, page_size: Optional[int] = None, retry: Optional[str] = DEFAULT, timeout: Optional[float] = DEFAULT, metadata: Optional[str] = None)[source]¶ Fetches all the Alert Policies identified by the filter passed as filter parameter. The desired return type can be specified by the format parameter, the supported formats are "dict", "json" and None which returns python dictionary, stringified JSON and protobuf respectively.
- Parameters
format (str) -- (Optional) Desired output format of the result. The supported formats are "dict", "json" and None which returns python dictionary, stringified JSON and protobuf respectively.
filter (str) -- If provided, this field specifies the criteria that must be met by alert policies to be included in the response. For more details, see https://cloud.google.com/monitoring/api/v3/sorting-and-filtering.
order_by (str) -- A comma-separated list of fields by which to sort the result. Supports the same set of field references as the
filter
field. Entries can be prefixed with a minus sign to sort by the field in descending order. For more details, see https://cloud.google.com/monitoring/api/v3/sorting-and-filtering.page_size (int) -- 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.
retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
project_id (str) -- The project to fetch alerts from.
-
enable_alert_policies
(self, project_id: str, filter_: Optional[str] = None, retry: Optional[str] = DEFAULT, timeout: Optional[float] = DEFAULT, metadata: Optional[str] = None)[source]¶ Enables one or more disabled alerting policies identified by filter parameter. Inoperative in case the policy is already enabled.
- Parameters
project_id (str) -- The project in which alert needs to be enabled.
filter (str) -- If provided, this field specifies the criteria that must be met by alert policies to be enabled. For more details, see https://cloud.google.com/monitoring/api/v3/sorting-and-filtering.
retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
-
disable_alert_policies
(self, project_id: str, filter_: Optional[str] = None, retry: Optional[str] = DEFAULT, timeout: Optional[float] = DEFAULT, metadata: Optional[str] = None)[source]¶ Disables one or more enabled alerting policies identified by filter parameter. Inoperative in case the policy is already disabled.
- Parameters
project_id (str) -- The project in which alert needs to be disabled.
filter (str) -- If provided, this field specifies the criteria that must be met by alert policies to be disabled. For more details, see https://cloud.google.com/monitoring/api/v3/sorting-and-filtering.
retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
-
upsert_alert
(self, alerts: str, project_id: str, retry: Optional[str] = DEFAULT, timeout: Optional[float] = DEFAULT, metadata: Optional[str] = None)[source]¶ - Creates a new alert or updates an existing policy identified
the name field in the alerts parameter.
- Parameters
project_id (str) -- The project in which alert needs to be created/updated.
alerts (str) -- A JSON string or file that specifies all the alerts that needs to be either created or updated. For more details, see https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.alertPolicies#AlertPolicy. (templated)
retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
-
delete_alert_policy
(self, name: str, retry: Optional[str] = DEFAULT, timeout: Optional[float] = DEFAULT, metadata: Optional[str] = None)[source]¶ Deletes an alerting policy.
- Parameters
name (str) -- The alerting policy to delete. The format is:
projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
.retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
-
list_notification_channels
(self, project_id: str, format_: Optional[str] = None, filter_: Optional[str] = None, order_by: Optional[str] = None, page_size: Optional[int] = None, retry: Optional[str] = DEFAULT, timeout: Optional[str] = DEFAULT, metadata: Optional[str] = None)[source]¶ Fetches all the Notification Channels identified by the filter passed as filter parameter. The desired return type can be specified by the format parameter, the supported formats are "dict", "json" and None which returns python dictionary, stringified JSON and protobuf respectively.
- Parameters
format (str) -- (Optional) Desired output format of the result. The supported formats are "dict", "json" and None which returns python dictionary, stringified JSON and protobuf respectively.
filter (str) -- If provided, this field specifies the criteria that must be met by notification channels to be included in the response. For more details, see https://cloud.google.com/monitoring/api/v3/sorting-and-filtering.
order_by (str) -- A comma-separated list of fields by which to sort the result. Supports the same set of field references as the
filter
field. Entries can be prefixed with a minus sign to sort by the field in descending order. For more details, see https://cloud.google.com/monitoring/api/v3/sorting-and-filtering.page_size (int) -- 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.
retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
project_id (str) -- The project to fetch notification channels from.
-
enable_notification_channels
(self, project_id: str, filter_: Optional[str] = None, retry: Optional[str] = DEFAULT, timeout: Optional[str] = DEFAULT, metadata: Optional[str] = None)[source]¶ Enables one or more disabled alerting policies identified by filter parameter. Inoperative in case the policy is already enabled.
- Parameters
project_id (str) -- The project in which notification channels needs to be enabled.
filter (str) -- If provided, this field specifies the criteria that must be met by notification channels to be enabled. For more details, see https://cloud.google.com/monitoring/api/v3/sorting-and-filtering.
retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
-
disable_notification_channels
(self, project_id: str, filter_: Optional[str] = None, retry: Optional[str] = DEFAULT, timeout: Optional[str] = DEFAULT, metadata: Optional[str] = None)[source]¶ Disables one or more enabled notification channels identified by filter parameter. Inoperative in case the policy is already disabled.
- Parameters
project_id (str) -- The project in which notification channels needs to be enabled.
filter (str) -- If provided, this field specifies the criteria that must be met by alert policies to be disabled. For more details, see https://cloud.google.com/monitoring/api/v3/sorting-and-filtering.
retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
-
upsert_channel
(self, channels: str, project_id: str, retry: Optional[str] = DEFAULT, timeout: Optional[float] = DEFAULT, metadata: Optional[str] = None)[source]¶ Creates a new notification or updates an existing notification channel identified the name field in the alerts parameter.
- Parameters
channels (str) -- A JSON string or file that specifies all the alerts that needs to be either created or updated. For more details, see https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.notificationChannels. (templated)
project_id (str) -- The project in which notification channels needs to be created/updated.
retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
-
delete_notification_channel
(self, name: str, retry: Optional[str] = DEFAULT, timeout: Optional[str] = DEFAULT, metadata: Optional[str] = None)[source]¶ Deletes a notification channel.
- Parameters
name (str) -- The alerting policy to delete. The format is:
projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
.retry (str) -- A retry object used to retry requests. If
None
is specified, requests will be retried using a default configuration.timeout (float) -- 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.metadata (str) -- Additional metadata that is provided to the method.
-