# Stackdriver Monitoring V3 Client - Class SqlCondition (2.2.2)

2.2.2 (latest) 2.2.1 2.1.2 2.0.1 1.12.1 1.11.1 1.10.3 1.9.0 1.8.0 1.7.1 1.6.0 1.5.1 1.4.0 1.3.2 1.2.2 Reference documentation and code samples for the Stackdriver Monitoring V3 Client class SqlCondition.

A condition that allows alerting policies to be defined using GoogleSQL.

SQL conditions examine a sliding window of logs using GoogleSQL.
Alert policies with SQL conditions may incur additional billing.

Generated from protobuf message `google.monitoring.v3.AlertPolicy.Condition.SqlCondition`

## Namespace

Google \\ Cloud \\ Monitoring \\ V3 \\ AlertPolicy \\ Condition

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ query` | `string` Required. The Log Analytics SQL query to run, as a string. The query must conform to the required shape. Specifically, the query must not try to filter the input by time. A filter will automatically be applied to filter the input so that the query receives all rows received since the last time the query was run. For example, the following query extracts all log entries containing an HTTP request: SELECT timestamp, log_name, severity, http_request, resource, labels FROM my-project.global._Default._AllLogs WHERE http_request IS NOT NULL |
| `↳ minutes` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.Minutes` Schedule the query to execute every so many minutes. |
| `↳ hourly` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.Hourly` Schedule the query to execute every so many hours. |
| `↳ daily` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.Daily` Schedule the query to execute every so many days. |
| `↳ row_count_test` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.RowCountTest` Test the row count against a threshold. |
| `↳ boolean_test` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.BooleanTest` Test the boolean value in the indicated column. |

### getQuery

Required. The Log Analytics SQL query to run, as a string. The query
must conform to the required shape. Specifically, the query must not
try to filter the input by time. A filter will automatically be
applied to filter the input so that the query receives all rows
received since the last time the query was run.

For example, the following query extracts all log entries containing an
HTTP request:
SELECT
timestamp, log_name, severity, http_request, resource, labels
FROM
my-project.global._Default._AllLogs
WHERE
http_request IS NOT NULL

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setQuery

Required. The Log Analytics SQL query to run, as a string. The query
must conform to the required shape. Specifically, the query must not
try to filter the input by time. A filter will automatically be
applied to filter the input so that the query receives all rows
received since the last time the query was run.

For example, the following query extracts all log entries containing an
HTTP request:
SELECT
timestamp, log_name, severity, http_request, resource, labels
FROM
my-project.global._Default._AllLogs
WHERE
http_request IS NOT NULL

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMinutes

Schedule the query to execute every so many minutes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.Minutes|null` |   |

### hasMinutes

### setMinutes

Schedule the query to execute every so many minutes.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.Minutes` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getHourly

Schedule the query to execute every so many hours.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.Hourly|null` |   |

### hasHourly

### setHourly

Schedule the query to execute every so many hours.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.Hourly` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDaily

Schedule the query to execute every so many days.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.Daily|null` |   |

### hasDaily

### setDaily

Schedule the query to execute every so many days.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.Daily` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRowCountTest

Test the row count against a threshold.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.RowCountTest|null` |   |

### hasRowCountTest

### setRowCountTest

Test the row count against a threshold.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.RowCountTest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBooleanTest

Test the boolean value in the indicated column.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.BooleanTest|null` |   |

### hasBooleanTest

### setBooleanTest

Test the boolean value in the indicated column.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition.SqlCondition.BooleanTest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSchedule

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### getEvaluate

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |