# Google API Common Protos Client - Class AttributeContext (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 AttributeContext.

This message defines the standard attribute vocabulary for Google APIs.

An attribute is a piece of metadata that describes an activity on a network
service. For example, the size of an HTTP request, or the status code of
an HTTP response.
Each attribute has a type and a name, which is logically defined as
a proto message field in `AttributeContext`. The field type becomes the
attribute type, and the field path becomes the attribute name. For example,
the attribute `source.ip` maps to field `AttributeContext.source.ip`.
This message definition is guaranteed not to have any wire breaking change.
So you can use it directly for passing attributes across different systems.
NOTE: Different system may generate different subset of attributes. Please
verify the system specification before relying on an attribute generated
a system.

Generated from protobuf message `google.rpc.context.AttributeContext`

## Namespace

Google \\ Rpc \\ Context

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ origin` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer` The origin of a network activity. In a multi hop network activity, the origin represents the sender of the first hop. For the first hop, the `source` and the `origin` must have the same content. |
| `↳ source` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer` The source of a network activity, such as starting a TCP connection. In a multi hop network activity, the source represents the sender of the last hop. |
| `↳ destination` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer` The destination of a network activity, such as accepting a TCP connection. In a multi hop network activity, the destination represents the receiver of the last hop. |
| `↳ request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Request` Represents a network request, such as an HTTP request. |
| `↳ response` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Response` Represents a network response, such as an HTTP response. |
| `↳ resource` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Resource` Represents a target resource that is involved with a network activity. If multiple resources are involved with an activity, this must be the primary one. |
| `↳ api` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Api` Represents an API operation that is involved to a network activity. |
| `↳ extensions` | `array<https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Any>` Supports extensions for advanced use cases, such as logs and metrics. |

### getOrigin

The origin of a network activity. In a multi hop network activity,
the origin represents the sender of the first hop. For the first hop,
the `source` and the `origin` must have the same content.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer|null` |   |

### hasOrigin

### clearOrigin

### setOrigin

The origin of a network activity. In a multi hop network activity,
the origin represents the sender of the first hop. For the first hop,
the `source` and the `origin` must have the same content.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer` |

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

### getSource

The source of a network activity, such as starting a TCP connection.

In a multi hop network activity, the source represents the sender of the
last hop.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer|null` |   |

### hasSource

### clearSource

### setSource

The source of a network activity, such as starting a TCP connection.

In a multi hop network activity, the source represents the sender of the
last hop.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer` |

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

### getDestination

The destination of a network activity, such as accepting a TCP connection.

In a multi hop network activity, the destination represents the receiver of
the last hop.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer|null` |   |

### hasDestination

### clearDestination

### setDestination

The destination of a network activity, such as accepting a TCP connection.

In a multi hop network activity, the destination represents the receiver of
the last hop.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer` |

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

### getRequest

Represents a network request, such as an HTTP request.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Request|null` |   |

### hasRequest

### clearRequest

### setRequest

Represents a network request, such as an HTTP request.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Request` |

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

### getResponse

Represents a network response, such as an HTTP response.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Response|null` |   |

### hasResponse

### clearResponse

### setResponse

Represents a network response, such as an HTTP response.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Response` |

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

### getResource

Represents a target resource that is involved with a network activity.

If multiple resources are involved with an activity, this must be the
primary one.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Resource|null` |   |

### hasResource

### clearResource

### setResource

Represents a target resource that is involved with a network activity.

If multiple resources are involved with an activity, this must be the
primary one.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Resource` |

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

### getApi

Represents an API operation that is involved to a network activity.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Api|null` |   |

### hasApi

### clearApi

### setApi

Represents an API operation that is involved to a network activity.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Api` |

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

### getExtensions

Supports extensions for advanced use cases, such as logs and metrics.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Any>` |   |

### setExtensions

Supports extensions for advanced use cases, such as logs and metrics.

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

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