# Google API Common Protos Client - Class Violation (4.14.0)

4.14.0 (latest) 4.13.0 4.12.5 4.11.0 4.10.0 4.9.0 4.8.3 Reference documentation and code samples for the Google API Common Protos Client class Violation.

A message type used to describe a single precondition failure.

Generated from protobuf message `google.rpc.PreconditionFailure.Violation`

## Namespace

Google \\ Rpc \\ PreconditionFailure

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ type` | `string` The type of PreconditionFailure. We recommend using a service-specific enum type to define the supported precondition violation subjects. For example, "TOS" for "Terms of Service violation". |
| `↳ subject` | `string` The subject, relative to the type, that failed. For example, "google.com/cloud" relative to the "TOS" type would indicate which terms of service is being referenced. |
| `↳ description` | `string` A description of how the precondition failed. Developers can use this description to understand how to fix the failure. For example: "Terms of service not accepted". |

### getType

The type of PreconditionFailure. We recommend using a service-specific
enum type to define the supported precondition violation subjects. For
example, "TOS" for "Terms of Service violation".

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

### setType

The type of PreconditionFailure. We recommend using a service-specific
enum type to define the supported precondition violation subjects. For
example, "TOS" for "Terms of Service violation".

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

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

### getSubject

The subject, relative to the type, that failed.

For example, "google.com/cloud" relative to the "TOS" type would indicate
which terms of service is being referenced.

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

### setSubject

The subject, relative to the type, that failed.

For example, "google.com/cloud" relative to the "TOS" type would indicate
which terms of service is being referenced.

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

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

### getDescription

A description of how the precondition failed. Developers can use this
description to understand how to fix the failure.

For example: "Terms of service not accepted".

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

### setDescription

A description of how the precondition failed. Developers can use this
description to understand how to fix the failure.

For example: "Terms of service not accepted".

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

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