# Google Cloud Service Control V1 Client - Class HttpRequest (2.2.0)

2.2.0 (latest) 2.1.1 2.0.4 1.4.4 1.3.0 1.2.1 1.1.1 1.0.6 Reference documentation and code samples for the Google Cloud Service Control V1 Client class HttpRequest.

A common proto for logging HTTP requests. Only contains semantics
defined by the HTTP specification. Product-specific logging
information MUST be defined in a separate message.

Generated from protobuf message `google.api.servicecontrol.v1.HttpRequest`

## Namespace

Google \\ Cloud \\ ServiceControl \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ request_method` | `string` The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. |
| `↳ request_url` | `string` The scheme (http, https), the host name, the path, and the query portion of the URL that was requested. Example: `"http://example.com/some/info?color=red"`. |
| `↳ request_size` | `int|string` The size of the HTTP request message in bytes, including the request headers and the request body. |
| `↳ status` | `int` The response code indicating the status of the response. Examples: 200, 404. |
| `↳ response_size` | `int|string` The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body. |
| `↳ user_agent` | `string` The user agent sent by the client. Example: `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. |
| `↳ remote_ip` | `string` The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. |
| `↳ server_ip` | `string` The IP address (IPv4 or IPv6) of the origin server that the request was sent to. |
| `↳ referer` | `string` The referer URL of the request, as defined in [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). |
| `↳ latency` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` The request processing latency on the server, from the time the request was received until the response was sent. |
| `↳ cache_lookup` | `bool` Whether or not a cache lookup was attempted. |
| `↳ cache_hit` | `bool` Whether or not an entity was served from cache (with or without validation). |
| `↳ cache_validated_with_origin_server` | `bool` Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if `cache_hit` is True. |
| `↳ cache_fill_bytes` | `int|string` The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted. |
| `↳ protocol` | `string` Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" |

### getRequestMethod

The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.

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

### setRequestMethod

The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.

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

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

### getRequestUrl

The scheme (http, https), the host name, the path, and the query
portion of the URL that was requested.

Example: `"http://example.com/some/info?color=red"`.

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

### setRequestUrl

The scheme (http, https), the host name, the path, and the query
portion of the URL that was requested.

Example: `"http://example.com/some/info?color=red"`.

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

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

### getRequestSize

The size of the HTTP request message in bytes, including the request
headers and the request body.

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

### setRequestSize

The size of the HTTP request message in bytes, including the request
headers and the request body.

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

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

### getStatus

The response code indicating the status of the response.

Examples: 200, 404.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setStatus

The response code indicating the status of the response.

Examples: 200, 404.

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

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

### getResponseSize

The size of the HTTP response message sent back to the client, in bytes,
including the response headers and the response body.

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

### setResponseSize

The size of the HTTP response message sent back to the client, in bytes,
including the response headers and the response body.

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

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

### getUserAgent

The user agent sent by the client. Example:
`"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
CLR 1.0.3705)"`.

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

### setUserAgent

The user agent sent by the client. Example:
`"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
CLR 1.0.3705)"`.

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

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

### getRemoteIp

The IP address (IPv4 or IPv6) of the client that issued the HTTP
request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`.

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

### setRemoteIp

The IP address (IPv4 or IPv6) of the client that issued the HTTP
request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`.

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

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

### getServerIp

The IP address (IPv4 or IPv6) of the origin server that the request was
sent to.

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

### setServerIp

The IP address (IPv4 or IPv6) of the origin server that the request was
sent to.

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

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

### getReferer

The referer URL of the request, as defined in
[HTTP/1.1 Header Field
Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).

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

### setReferer

The referer URL of the request, as defined in
[HTTP/1.1 Header Field
Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).

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

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

### getLatency

The request processing latency on the server, from the time the request was
received until the response was sent.

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

### hasLatency

### clearLatency

### setLatency

The request processing latency on the server, from the time the request was
received until the response was sent.

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

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

### getCacheLookup

Whether or not a cache lookup was attempted.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setCacheLookup

Whether or not a cache lookup was attempted.

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

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

### getCacheHit

Whether or not an entity was served from cache
(with or without validation).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setCacheHit

Whether or not an entity was served from cache
(with or without validation).

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

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

### getCacheValidatedWithOriginServer

Whether or not the response was validated with the origin server before
being served from cache. This field is only meaningful if `cache_hit` is
True.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setCacheValidatedWithOriginServer

Whether or not the response was validated with the origin server before
being served from cache. This field is only meaningful if `cache_hit` is
True.

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

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

### getCacheFillBytes

The number of HTTP response bytes inserted into cache. Set only when a
cache fill was attempted.

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

### setCacheFillBytes

The number of HTTP response bytes inserted into cache. Set only when a
cache fill was attempted.

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

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

### getProtocol

Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"

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

### setProtocol

Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"

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

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