From ce022a3f72b7735087d4c3bbe81d293a0ab75327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Bregu=C5=82a?= Date: Thu, 19 Mar 2020 06:46:17 +0100 Subject: [PATCH] [AIRFLOW-XXXX] Add cross-references for operators guide (#7760) --- .../cloud/operators/natural_language.py | 1 - .../google/cloud/operators/stackdriver.py | 40 +++++++++++++++++++ docs/howto/operator/gcp/stackdriver.rst | 22 +++++----- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/airflow/providers/google/cloud/operators/natural_language.py b/airflow/providers/google/cloud/operators/natural_language.py index 3ae9f03c28a7..fae7b04d4657 100644 --- a/airflow/providers/google/cloud/operators/natural_language.py +++ b/airflow/providers/google/cloud/operators/natural_language.py @@ -40,7 +40,6 @@ class CloudNaturalLanguageAnalyzeEntitiesOperator(BaseOperator): For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudNaturalLanguageAnalyzeEntitiesOperator` - :param document: Input document. If a dict is provided, it must be of the same form as the protobuf message Document :type document: dict or google.cloud.language_v1.types.Document diff --git a/airflow/providers/google/cloud/operators/stackdriver.py b/airflow/providers/google/cloud/operators/stackdriver.py index f12677ad2b2c..3881acc384f0 100644 --- a/airflow/providers/google/cloud/operators/stackdriver.py +++ b/airflow/providers/google/cloud/operators/stackdriver.py @@ -33,6 +33,10 @@ class StackdriverListAlertPoliciesOperator(BaseOperator): which returns python dictionary, stringified JSON and protobuf respectively. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverListAlertPoliciesOperator` + :param format_: (Optional) Desired output format of the result. The supported formats are "dict", "json" and None which returns python dictionary, stringified JSON and protobuf respectively. @@ -127,6 +131,10 @@ class StackdriverEnableAlertPoliciesOperator(BaseOperator): Enables one or more disabled alerting policies identified by filter parameter. Inoperative in case the policy is already enabled. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverEnableAlertPoliciesOperator` + :param filter_: 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. @@ -194,6 +202,10 @@ class StackdriverDisableAlertPoliciesOperator(BaseOperator): Disables one or more enabled alerting policies identified by filter parameter. Inoperative in case the policy is already disabled. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverDisableAlertPoliciesOperator` + :param filter_: 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. @@ -261,6 +273,10 @@ class StackdriverUpsertAlertOperator(BaseOperator): Creates a new alert or updates an existing policy identified the name field in the alerts parameter. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverUpsertAlertOperator` + :param alerts: 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. @@ -330,6 +346,10 @@ class StackdriverDeleteAlertOperator(BaseOperator): """ Deletes an alerting policy. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverDeleteAlertOperator` + :param name: The alerting policy to delete. The format is: ``projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]``. :type name: str @@ -399,6 +419,10 @@ class StackdriverListNotificationChannelsOperator(BaseOperator): which returns python dictionary, stringified JSON and protobuf respectively. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverListNotificationChannelsOperator` + :param format_: (Optional) Desired output format of the result. The supported formats are "dict", "json" and None which returns python dictionary, stringified JSON and protobuf respectively. @@ -495,6 +519,10 @@ class StackdriverEnableNotificationChannelsOperator(BaseOperator): Enables one or more disabled alerting policies identified by filter parameter. Inoperative in case the policy is already enabled. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverEnableNotificationChannelsOperator` + :param filter_: 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. @@ -564,6 +592,10 @@ class StackdriverDisableNotificationChannelsOperator(BaseOperator): Disables one or more enabled notification channels identified by filter parameter. Inoperative in case the policy is already disabled. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverDisableNotificationChannelsOperator` + :param filter_: 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. @@ -633,6 +665,10 @@ class StackdriverUpsertNotificationChannelOperator(BaseOperator): Creates a new notification or updates an existing notification channel identified the name field in the alerts parameter. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverUpsertNotificationChannelOperator` + :param channels: 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. @@ -703,6 +739,10 @@ class StackdriverDeleteNotificationChannelOperator(BaseOperator): """ Deletes a notification channel. + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:StackdriverDeleteNotificationChannelOperator` + :param name: The alerting policy to delete. The format is: ``projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]``. :type name: str diff --git a/docs/howto/operator/gcp/stackdriver.rst b/docs/howto/operator/gcp/stackdriver.rst index 98af940cc1b2..89005ba23db7 100644 --- a/docs/howto/operator/gcp/stackdriver.rst +++ b/docs/howto/operator/gcp/stackdriver.rst @@ -30,6 +30,8 @@ Prerequisite Tasks .. include:: _partials/prerequisite_tasks.rst +.. _howto/operator:StackdriverListAlertPoliciesOperator: + StackdriverListAlertPoliciesOperator ------------------------------------ @@ -48,7 +50,7 @@ If project is is missing it wil be retrieved from GCP connection used. :start-after: [START howto_operator_gcp_stackdriver_list_alert_policy] :end-before: [END howto_operator_gcp_stackdriver_list_alert_policy] -.. _howto/operator:StackdriverListAlertPoliciesOperator: +.. _howto/operator:StackdriverEnableAlertPoliciesOperator: StackdriverEnableAlertPoliciesOperator -------------------------------------- @@ -68,7 +70,7 @@ If project is is missing it wil be retrieved from GCP connection used. :start-after: [START howto_operator_gcp_stackdriver_enable_alert_policy] :end-before: [END howto_operator_gcp_stackdriver_enable_alert_policy] -.. _howto/operator:StackdriverEnableAlertPoliciesOperator: +.. _howto/operator:StackdriverDisableAlertPoliciesOperator: StackdriverDisableAlertPoliciesOperator --------------------------------------- @@ -88,7 +90,7 @@ If project is is missing it wil be retrieved from GCP connection used. :start-after: [START howto_operator_gcp_stackdriver_disable_alert_policy] :end-before: [END howto_operator_gcp_stackdriver_disable_alert_policy] -.. _howto/operator:StackdriverDisableAlertPoliciesOperator: +.. _howto/operator:StackdriverUpsertAlertOperator: StackdriverUpsertAlertOperator ------------------------------ @@ -109,7 +111,7 @@ If project is is missing it wil be retrieved from GCP connection used. :start-after: [START howto_operator_gcp_stackdriver_upsert_alert_policy] :end-before: [END howto_operator_gcp_stackdriver_upsert_alert_policy] -.. _howto/operator:StackdriverUpsertAlertOperator: +.. _howto/operator:StackdriverDeleteAlertOperator: StackdriverDeleteAlertOperator ------------------------------ @@ -128,7 +130,7 @@ The name of the alert to be deleted should be given in the format projects/