Stackdriver Monitoring V3 Client - Class HttpCheck (1.12.0)

Reference documentation and code samples for the Stackdriver Monitoring V3 Client class HttpCheck.

Information involved in an HTTP/HTTPS Uptime check request.

Generated from protobuf message google.monitoring.v3.UptimeCheckConfig.HttpCheck

Namespace

Google \ Cloud \ Monitoring \ V3 \ UptimeCheckConfig

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ request_method int

The HTTP request method to use for the check. If set to METHOD_UNSPECIFIED then request_method defaults to GET.

↳ use_ssl bool

If true, use HTTPS instead of HTTP to run the check.

↳ path string

Optional (defaults to "/"). The path to the page against which to run the check. Will be combined with the host (specified within the monitored_resource) and port to construct the full URL. If the provided path does not begin with "/", a "/" will be prepended automatically.

↳ port int

Optional (defaults to 80 when use_ssl is false, and 443 when use_ssl is true). The TCP port on the HTTP server against which to run the check. Will be combined with host (specified within the monitored_resource) and path to construct the full URL.

↳ auth_info HttpCheck\BasicAuthentication

The authentication information. Optional when creating an HTTP check; defaults to empty. Do not set both auth_method and auth_info.

↳ mask_headers bool

Boolean specifying whether to encrypt the header information. Encryption should be specified for any headers related to authentication that you do not wish to be seen when retrieving the configuration. The server will be responsible for encrypting the headers. On Get/List calls, if mask_headers is set to true then the headers will be obscured with ******.

↳ headers array|Google\Protobuf\Internal\MapField

The list of headers to send as part of the Uptime check request. If two headers have the same key and different values, they should be entered as a single header, with the value being a comma-separated list of all the desired values as described at https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). Entering two separate headers with the same key in a Create call will cause the first to be overwritten by the second. The maximum number of headers allowed is 100.

↳ content_type int

The content type header to use for the check. The following configurations result in errors: 1. Content type is specified in both the headers field and the content_type field. 2. Request method is GET and content_type is not TYPE_UNSPECIFIED 3. Request method is POST and content_type is TYPE_UNSPECIFIED. 4. Request method is POST and a "Content-Type" header is provided via headers field. The content_type field should be used instead.

↳ custom_content_type string

A user provided content type header to use for the check. The invalid configurations outlined in the content_type field apply to custom_content_type, as well as the following: 1. content_type is URL_ENCODED and custom_content_type is set. 2. content_type is USER_PROVIDED and custom_content_type is not set.

↳ validate_ssl bool

Boolean specifying whether to include SSL certificate validation as a part of the Uptime check. Only applies to checks where monitored_resource is set to uptime_url. If use_ssl is false, setting validate_ssl to true has no effect.

↳ body string

The request body associated with the HTTP POST request. If content_type is URL_ENCODED, the body passed in must be URL-encoded. Users can provide a Content-Length header via the headers field or the API will do so. If the request_method is GET and body is not empty, the API will return an error. The maximum byte size is 1 megabyte. Note: If client libraries aren't used (which performs the conversion automatically) base64 encode your body data since the field is of bytes type.

↳ accepted_response_status_codes array<HttpCheck\ResponseStatusCode>

If present, the check will only pass if the HTTP response status code is in this set of status codes. If empty, the HTTP status code will only pass if the HTTP status code is 200-299.

↳ ping_config PingConfig

Contains information needed to add pings to an HTTP check.

↳ service_agent_authentication HttpCheck\ServiceAgentAuthentication

If specified, Uptime will generate and attach an OIDC JWT token for the Monitoring service agent service account as an Authorization header in the HTTP request when probing.

getRequestMethod

The HTTP request method to use for the check. If set to METHOD_UNSPECIFIED then request_method defaults to GET.

Returns
Type Description
int

setRequestMethod

The HTTP request method to use for the check. If set to METHOD_UNSPECIFIED then request_method defaults to GET.

Parameter
Name Description
var int
Returns
Type Description
$this

getUseSsl

If true, use HTTPS instead of HTTP to run the check.

Returns
Type Description
bool

setUseSsl

If true, use HTTPS instead of HTTP to run the check.

Parameter
Name Description
var bool
Returns
Type Description
$this

getPath

Optional (defaults to "/"). The path to the page against which to run the check. Will be combined with the host (specified within the monitored_resource) and port to construct the full URL. If the provided path does not begin with "/", a "/" will be prepended automatically.

Returns
Type Description
string

setPath

Optional (defaults to "/"). The path to the page against which to run the check. Will be combined with the host (specified within the monitored_resource) and port to construct the full URL. If the provided path does not begin with "/", a "/" will be prepended automatically.

Parameter
Name Description
var string
Returns
Type Description
$this

getPort

Optional (defaults to 80 when use_ssl is false, and 443 when use_ssl is true). The TCP port on the HTTP server against which to run the check. Will be combined with host (specified within the monitored_resource) and path to construct the full URL.

Returns
Type Description
int

setPort

Optional (defaults to 80 when use_ssl is false, and 443 when use_ssl is true). The TCP port on the HTTP server against which to run the check. Will be combined with host (specified within the monitored_resource) and path to construct the full URL.

Parameter
Name Description
var int
Returns
Type Description
$this

getAuthInfo

The authentication information. Optional when creating an HTTP check; defaults to empty.

Do not set both auth_method and auth_info.

Returns
Type Description
HttpCheck\BasicAuthentication|null

hasAuthInfo

clearAuthInfo

setAuthInfo

The authentication information. Optional when creating an HTTP check; defaults to empty.

Do not set both auth_method and auth_info.

Parameter
Name Description
var HttpCheck\BasicAuthentication
Returns
Type Description
$this

getMaskHeaders

Boolean specifying whether to encrypt the header information.

Encryption should be specified for any headers related to authentication that you do not wish to be seen when retrieving the configuration. The server will be responsible for encrypting the headers. On Get/List calls, if mask_headers is set to true then the headers will be obscured with ******.

Returns
Type Description
bool

setMaskHeaders

Boolean specifying whether to encrypt the header information.

Encryption should be specified for any headers related to authentication that you do not wish to be seen when retrieving the configuration. The server will be responsible for encrypting the headers. On Get/List calls, if mask_headers is set to true then the headers will be obscured with ******.

Parameter
Name Description
var bool
Returns
Type Description
$this

getHeaders

The list of headers to send as part of the Uptime check request.

If two headers have the same key and different values, they should be entered as a single header, with the value being a comma-separated list of all the desired values as described at https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). Entering two separate headers with the same key in a Create call will cause the first to be overwritten by the second. The maximum number of headers allowed is 100.

Returns
Type Description
Google\Protobuf\Internal\MapField

setHeaders

The list of headers to send as part of the Uptime check request.

If two headers have the same key and different values, they should be entered as a single header, with the value being a comma-separated list of all the desired values as described at https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). Entering two separate headers with the same key in a Create call will cause the first to be overwritten by the second. The maximum number of headers allowed is 100.

Parameter
Name Description
var array|Google\Protobuf\Internal\MapField
Returns
Type Description
$this

getContentType

The content type header to use for the check. The following configurations result in errors:

  1. Content type is specified in both the headers field and the content_type field.

  2. Request method is GET and content_type is not TYPE_UNSPECIFIED

  3. Request method is POST and content_type is TYPE_UNSPECIFIED.
  4. Request method is POST and a "Content-Type" header is provided via headers field. The content_type field should be used instead.
Returns
Type Description
int

setContentType

The content type header to use for the check. The following configurations result in errors:

  1. Content type is specified in both the headers field and the content_type field.

  2. Request method is GET and content_type is not TYPE_UNSPECIFIED

  3. Request method is POST and content_type is TYPE_UNSPECIFIED.
  4. Request method is POST and a "Content-Type" header is provided via headers field. The content_type field should be used instead.
Parameter
Name Description
var int
Returns
Type Description
$this

getCustomContentType

A user provided content type header to use for the check. The invalid configurations outlined in the content_type field apply to custom_content_type, as well as the following:

  1. content_type is URL_ENCODED and custom_content_type is set.

  2. content_type is USER_PROVIDED and custom_content_type is not set.

Returns
Type Description
string

setCustomContentType

A user provided content type header to use for the check. The invalid configurations outlined in the content_type field apply to custom_content_type, as well as the following:

  1. content_type is URL_ENCODED and custom_content_type is set.

  2. content_type is USER_PROVIDED and custom_content_type is not set.

Parameter
Name Description
var string
Returns
Type Description
$this

getValidateSsl

Boolean specifying whether to include SSL certificate validation as a part of the Uptime check. Only applies to checks where monitored_resource is set to uptime_url. If use_ssl is false, setting validate_ssl to true has no effect.

Returns
Type Description
bool

setValidateSsl

Boolean specifying whether to include SSL certificate validation as a part of the Uptime check. Only applies to checks where monitored_resource is set to uptime_url. If use_ssl is false, setting validate_ssl to true has no effect.

Parameter
Name Description
var bool
Returns
Type Description
$this

getBody

The request body associated with the HTTP POST request. If content_type is URL_ENCODED, the body passed in must be URL-encoded. Users can provide a Content-Length header via the headers field or the API will do so. If the request_method is GET and body is not empty, the API will return an error. The maximum byte size is 1 megabyte.

Note: If client libraries aren't used (which performs the conversion automatically) base64 encode your body data since the field is of bytes type.

Returns
Type Description
string

setBody

The request body associated with the HTTP POST request. If content_type is URL_ENCODED, the body passed in must be URL-encoded. Users can provide a Content-Length header via the headers field or the API will do so. If the request_method is GET and body is not empty, the API will return an error. The maximum byte size is 1 megabyte.

Note: If client libraries aren't used (which performs the conversion automatically) base64 encode your body data since the field is of bytes type.

Parameter
Name Description
var string
Returns
Type Description
$this

getAcceptedResponseStatusCodes

If present, the check will only pass if the HTTP response status code is in this set of status codes. If empty, the HTTP status code will only pass if the HTTP status code is 200-299.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAcceptedResponseStatusCodes

If present, the check will only pass if the HTTP response status code is in this set of status codes. If empty, the HTTP status code will only pass if the HTTP status code is 200-299.

Parameter
Name Description
var array<HttpCheck\ResponseStatusCode>
Returns
Type Description
$this

getPingConfig

Contains information needed to add pings to an HTTP check.

Returns
Type Description
PingConfig|null

hasPingConfig

clearPingConfig

setPingConfig

Contains information needed to add pings to an HTTP check.

Parameter
Name Description
var PingConfig
Returns
Type Description
$this

getServiceAgentAuthentication

If specified, Uptime will generate and attach an OIDC JWT token for the Monitoring service agent service account as an Authorization header in the HTTP request when probing.

Returns
Type Description
HttpCheck\ServiceAgentAuthentication|null

hasServiceAgentAuthentication

setServiceAgentAuthentication

If specified, Uptime will generate and attach an OIDC JWT token for the Monitoring service agent service account as an Authorization header in the HTTP request when probing.

Parameter
Name Description
var HttpCheck\ServiceAgentAuthentication
Returns
Type Description
$this

getAuthMethod

Returns
Type Description
string