# Stackdriver Monitoring V3 Client - Class ServiceLevelObjective (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 ServiceLevelObjective.

A Service-Level Objective (SLO) describes a level of desired good service. It
consists of a service-level indicator (SLI), a performance goal, and a period
over which the objective is to be evaluated against that goal. The SLO can
use SLIs defined in a number of different manners. Typical SLOs might include
"99% of requests in each rolling week have latency below 200 milliseconds" or
"99.5% of requests in each calendar month return successfully."

Generated from protobuf message `google.monitoring.v3.ServiceLevelObjective`

## Namespace

Google \\ Cloud \\ Monitoring \\ V3

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Identifier. Resource name for this `ServiceLevelObjective`. The format is: projects/\[PROJECT_ID_OR_NUMBER\]/services/\[SERVICE_ID\]/serviceLevelObjectives/\[SLO_NAME\] |
| `↳ display_name` | `string` Name used for UI elements listing this SLO. |
| `↳ service_level_indicator` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.ServiceLevelIndicator` The definition of good service, used to measure and calculate the quality of the `Service`'s performance with respect to a single aspect of service quality. |
| `↳ goal` | `float` The fraction of service that must be good in order for this objective to be met. `0 < goal <= 0.9999`. |
| `↳ rolling_period` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` A rolling time period, semantically "in the past `<rolling_period>`". Must be an integer multiple of 1 day no larger than 30 days. |
| `↳ calendar_period` | `int` A calendar period, semantically "since the start of the current `<calendar_period>`". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and `MONTH` are supported. |
| `↳ user_labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Labels which have been used to annotate the service-level objective. Label keys must start with a letter. Label keys and values may contain lowercase letters, numbers, underscores, and dashes. Label keys and values have a maximum length of 63 characters, and must be less than 128 bytes in size. Up to 64 label entries may be stored. For labels which do not have a semantic value, the empty string may be supplied for the label value. |

### getName

Identifier. Resource name for this `ServiceLevelObjective`. The format is:
projects/\[PROJECT_ID_OR_NUMBER\]/services/\[SERVICE_ID\]/serviceLevelObjectives/\[SLO_NAME\]

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

### setName

Identifier. Resource name for this `ServiceLevelObjective`. The format is:
projects/\[PROJECT_ID_OR_NUMBER\]/services/\[SERVICE_ID\]/serviceLevelObjectives/\[SLO_NAME\]

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

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

### getDisplayName

Name used for UI elements listing this SLO.

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

### setDisplayName

Name used for UI elements listing this SLO.

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

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

### getServiceLevelIndicator

The definition of good service, used to measure and calculate the quality
of the `Service`'s performance with respect to a single aspect of service
quality.

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

### hasServiceLevelIndicator

### clearServiceLevelIndicator

### setServiceLevelIndicator

The definition of good service, used to measure and calculate the quality
of the `Service`'s performance with respect to a single aspect of service
quality.

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

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

### getGoal

The fraction of service that must be good in order for this objective to be
met. `0 < goal <= 0.9999`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### setGoal

The fraction of service that must be good in order for this objective to be
met. `0 < goal <= 0.9999`.

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

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

### getRollingPeriod

A rolling time period, semantically "in the past `<rolling_period>`".

Must be an integer multiple of 1 day no larger than 30 days.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasRollingPeriod

### setRollingPeriod

A rolling time period, semantically "in the past `<rolling_period>`".

Must be an integer multiple of 1 day no larger than 30 days.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

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

### getCalendarPeriod

A calendar period, semantically "since the start of the current
`<calendar_period>`". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and
`MONTH` are supported.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [CalendarPeriod](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Type.CalendarPeriod.html). |

### hasCalendarPeriod

### setCalendarPeriod

A calendar period, semantically "since the start of the current
`<calendar_period>`". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and
`MONTH` are supported.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [CalendarPeriod](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Type.CalendarPeriod.html). |

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

### getUserLabels

Labels which have been used to annotate the service-level objective. Label
keys must start with a letter. Label keys and values may contain lowercase
letters, numbers, underscores, and dashes. Label keys and values have a
maximum length of 63 characters, and must be less than 128 bytes in size.

Up to 64 label entries may be stored. For labels which do not have a
semantic value, the empty string may be supplied for the label value.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setUserLabels

Labels which have been used to annotate the service-level objective. Label
keys must start with a letter. Label keys and values may contain lowercase
letters, numbers, underscores, and dashes. Label keys and values have a
maximum length of 63 characters, and must be less than 128 bytes in size.

Up to 64 label entries may be stored. For labels which do not have a
semantic value, the empty string may be supplied for the label value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

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

### getPeriod

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