# Cloud Monitoring V3 API - Class Google::Cloud::Monitoring::V3::AlertPolicy::Condition (v1.10.0)

1.10.0 (latest) 1.9.0 1.8.0 1.7.1 1.6.1 1.5.1 1.4.0 1.3.0 1.2.0 1.1.0 1.0.1 0.18.0 0.17.0 0.16.0 0.15.2 0.14.0 0.13.0 0.12.1 0.11.0 0.10.0 0.9.0 0.8.0 0.7.1 Reference documentation and code samples for the Cloud Monitoring V3 API class Google::Cloud::Monitoring::V3::AlertPolicy::Condition.

A condition is a true/false test that determines when an alerting policy
should open an incident. If a condition evaluates to true, it signifies
that something is wrong.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #condition_absent

    def condition_absent() -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence

**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-MetricAbsence)) --- A condition that checks that a time series continues to receive new data points.


  Note: The following fields are mutually exclusive: `condition_absent`, `condition_threshold`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_absent=

    def condition_absent=(value) -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence

**Parameter**

- **value** ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-MetricAbsence)) --- A condition that checks that a time series continues to receive new data points.


  Note: The following fields are mutually exclusive: `condition_absent`, `condition_threshold`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-MetricAbsence)) --- A condition that checks that a time series continues to receive new data points.


  Note: The following fields are mutually exclusive: `condition_absent`, `condition_threshold`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_matched_log

    def condition_matched_log() -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch

**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-LogMatch)) --- A condition that checks for log messages matching given constraints. If set, no other conditions can be present.


  Note: The following fields are mutually exclusive: `condition_matched_log`, `condition_threshold`, `condition_absent`, `condition_monitoring_query_language`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_matched_log=

    def condition_matched_log=(value) -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch

**Parameter**

- **value** ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-LogMatch)) --- A condition that checks for log messages matching given constraints. If set, no other conditions can be present.


  Note: The following fields are mutually exclusive: `condition_matched_log`, `condition_threshold`, `condition_absent`, `condition_monitoring_query_language`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-LogMatch)) --- A condition that checks for log messages matching given constraints. If set, no other conditions can be present.


  Note: The following fields are mutually exclusive: `condition_matched_log`, `condition_threshold`, `condition_absent`, `condition_monitoring_query_language`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_monitoring_query_language

    def condition_monitoring_query_language() -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition

**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-MonitoringQueryLanguageCondition)) --- A condition that uses the Monitoring Query Language to define alerts.


  Note: The following fields are mutually exclusive: `condition_monitoring_query_language`, `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_monitoring_query_language=

    def condition_monitoring_query_language=(value) -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition

**Parameter**

- **value** ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-MonitoringQueryLanguageCondition)) --- A condition that uses the Monitoring Query Language to define alerts.


  Note: The following fields are mutually exclusive: `condition_monitoring_query_language`, `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-MonitoringQueryLanguageCondition)) --- A condition that uses the Monitoring Query Language to define alerts.


  Note: The following fields are mutually exclusive: `condition_monitoring_query_language`, `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_prometheus_query_language

    def condition_prometheus_query_language() -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition

**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-PrometheusQueryLanguageCondition)) --- A condition that uses the Prometheus query language to define alerts.


  Note: The following fields are mutually exclusive: `condition_prometheus_query_language`, `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_prometheus_query_language=

    def condition_prometheus_query_language=(value) -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition

**Parameter**

- **value** ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-PrometheusQueryLanguageCondition)) --- A condition that uses the Prometheus query language to define alerts.


  Note: The following fields are mutually exclusive: `condition_prometheus_query_language`, `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-PrometheusQueryLanguageCondition)) --- A condition that uses the Prometheus query language to define alerts.


  Note: The following fields are mutually exclusive: `condition_prometheus_query_language`, `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_sql

    def condition_sql() -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::SqlCondition

**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::SqlCondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-SqlCondition)) --- A condition that periodically evaluates a SQL query result.


  Note: The following fields are mutually exclusive: `condition_sql`, `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_prometheus_query_language`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_sql=

    def condition_sql=(value) -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::SqlCondition

**Parameter**

- **value** ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::SqlCondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-SqlCondition)) --- A condition that periodically evaluates a SQL query result.


  Note: The following fields are mutually exclusive: `condition_sql`, `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_prometheus_query_language`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::SqlCondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-SqlCondition)) --- A condition that periodically evaluates a SQL query result.


  Note: The following fields are mutually exclusive: `condition_sql`, `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_prometheus_query_language`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_threshold

    def condition_threshold() -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold

**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-MetricThreshold)) --- A condition that compares a time series against a threshold.


  Note: The following fields are mutually exclusive: `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #condition_threshold=

    def condition_threshold=(value) -> ::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold

**Parameter**

- **value** ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-MetricThreshold)) --- A condition that compares a time series against a threshold.


  Note: The following fields are mutually exclusive: `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicy-Condition-MetricThreshold)) --- A condition that compares a time series against a threshold.


  Note: The following fields are mutually exclusive: `condition_threshold`, `condition_absent`, `condition_matched_log`, `condition_monitoring_query_language`, `condition_prometheus_query_language`, `condition_sql`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #display_name

    def display_name() -> ::String

**Returns**

- (::String) --- A short name or phrase used to identify the condition in dashboards, notifications, and incidents. To avoid confusion, don't use the same display name for multiple conditions in the same policy.

### #display_name=

    def display_name=(value) -> ::String

**Parameter**

- **value** (::String) --- A short name or phrase used to identify the condition in dashboards, notifications, and incidents. To avoid confusion, don't use the same display name for multiple conditions in the same policy.
**Returns**

- (::String) --- A short name or phrase used to identify the condition in dashboards, notifications, and incidents. To avoid confusion, don't use the same display name for multiple conditions in the same policy.

### #name

    def name() -> ::String

**Returns**

- (::String) --- Required if the condition exists. The unique resource name for this condition. Its format is:

      projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]

  `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  condition is created as part of a new or updated alerting policy.

  When calling the
  [alertPolicies.create](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicyService-Client#Google__Cloud__Monitoring__V3__AlertPolicyService__Client_create_alert_policy_instance_ "Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy (method)")
  method, do not include the `name` field in the conditions of the
  requested alerting policy. Cloud Monitoring creates the
  condition identifiers and includes them in the new policy.

  When calling the
  [alertPolicies.update](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicyService-Client#Google__Cloud__Monitoring__V3__AlertPolicyService__Client_update_alert_policy_instance_ "Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy (method)")
  method to update a policy, including a condition `name` causes the
  existing condition to be updated. Conditions without names are added to
  the updated policy. Existing conditions are deleted if they are not
  updated.

  Best practice is to preserve `[CONDITION_ID]` if you make only small
  changes, such as those to condition thresholds, durations, or trigger
  values. Otherwise, treat the change as a new condition and let the
  existing condition be deleted.

### #name=

    def name=(value) -> ::String

**Parameter**

- **value** (::String) --- Required if the condition exists. The unique resource name for this condition. Its format is:


      projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]

  `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  condition is created as part of a new or updated alerting policy.

  When calling the
  [alertPolicies.create](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicyService-Client#Google__Cloud__Monitoring__V3__AlertPolicyService__Client_create_alert_policy_instance_ "Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy (method)")
  method, do not include the `name` field in the conditions of the
  requested alerting policy. Cloud Monitoring creates the
  condition identifiers and includes them in the new policy.

  When calling the
  [alertPolicies.update](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicyService-Client#Google__Cloud__Monitoring__V3__AlertPolicyService__Client_update_alert_policy_instance_ "Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy (method)")
  method to update a policy, including a condition `name` causes the
  existing condition to be updated. Conditions without names are added to
  the updated policy. Existing conditions are deleted if they are not
  updated.

  Best practice is to preserve `[CONDITION_ID]` if you make only small
  changes, such as those to condition thresholds, durations, or trigger
  values. Otherwise, treat the change as a new condition and let the
  existing condition be deleted.
**Returns**

- (::String) --- Required if the condition exists. The unique resource name for this condition. Its format is:

      projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]

  `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  condition is created as part of a new or updated alerting policy.

  When calling the
  [alertPolicies.create](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicyService-Client#Google__Cloud__Monitoring__V3__AlertPolicyService__Client_create_alert_policy_instance_ "Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy (method)")
  method, do not include the `name` field in the conditions of the
  requested alerting policy. Cloud Monitoring creates the
  condition identifiers and includes them in the new policy.

  When calling the
  [alertPolicies.update](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-AlertPolicyService-Client#Google__Cloud__Monitoring__V3__AlertPolicyService__Client_update_alert_policy_instance_ "Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy (method)")
  method to update a policy, including a condition `name` causes the
  existing condition to be updated. Conditions without names are added to
  the updated policy. Existing conditions are deleted if they are not
  updated.

  Best practice is to preserve `[CONDITION_ID]` if you make only small
  changes, such as those to condition thresholds, durations, or trigger
  values. Otherwise, treat the change as a new condition and let the
  existing condition be deleted.