openstatus.monitor.v1.HTTPMonitor
*/
class HTTPMonitor extends \Google\Protobuf\Internal\Message
{
/**
* Unique identifier for the monitor (output only for create requests).
*
* Generated from protobuf field string id = 1 [json_name = "id"];
*/
protected $id = '';
/**
* Name of the monitor (required, max 256 characters).
*
* Generated from protobuf field string name = 2 [json_name = "name", (.gnostic.openapi.v3.property) = {
*/
protected $name = '';
/**
* URL to monitor (required, max 2048 characters).
*
* Generated from protobuf field string url = 3 [json_name = "url", (.gnostic.openapi.v3.property) = {
*/
protected $url = '';
/**
* Check periodicity (required).
*
* Generated from protobuf field .openstatus.monitor.v1.Periodicity periodicity = 4 [json_name = "periodicity", (.buf.validate.field) = {
*/
protected $periodicity = 0;
/**
* HTTP method to use (defaults to GET).
*
* Generated from protobuf field .openstatus.monitor.v1.HTTPMethod method = 5 [json_name = "method", (.buf.validate.field) = {
*/
protected $method = 0;
/**
* Request body (optional).
*
* Generated from protobuf field string body = 6 [json_name = "body", (.gnostic.openapi.v3.property) = {
*/
protected $body = '';
/**
* Timeout in milliseconds (0-120000, defaults to 45000).
*
* Generated from protobuf field int64 timeout = 7 [json_name = "timeout", (.buf.validate.field) = {
*/
protected $timeout = 0;
/**
* Latency threshold for degraded status in milliseconds (optional, 0-120000).
*
* Generated from protobuf field optional int64 degraded_at = 8 [json_name = "degradedAt", (.buf.validate.field) = {
*/
protected $degraded_at = null;
/**
* Number of retry attempts (0-10, defaults to 3).
*
* Generated from protobuf field int64 retry = 9 [json_name = "retry", (.buf.validate.field) = {
*/
protected $retry = 0;
/**
* Whether to follow HTTP redirects (defaults to true when not specified).
*
* Generated from protobuf field optional bool follow_redirects = 10 [json_name = "followRedirects"];
*/
protected $follow_redirects = null;
/**
* Custom headers for the request.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.Headers headers = 11 [json_name = "headers", (.buf.validate.field) = {
*/
private $headers;
/**
* Status code assertions for the response.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.StatusCodeAssertion status_code_assertions = 12 [json_name = "statusCodeAssertions", (.buf.validate.field) = {
*/
private $status_code_assertions;
/**
* Body content assertions for the response.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.BodyAssertion body_assertions = 13 [json_name = "bodyAssertions", (.buf.validate.field) = {
*/
private $body_assertions;
/**
* Header assertions for the response.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.HeaderAssertion header_assertions = 14 [json_name = "headerAssertions", (.buf.validate.field) = {
*/
private $header_assertions;
/**
* Description of the monitor (optional).
*
* Generated from protobuf field string description = 15 [json_name = "description", (.buf.validate.field) = {
*/
protected $description = '';
/**
* Whether the monitor is active (defaults to false).
*
* Generated from protobuf field bool active = 16 [json_name = "active"];
*/
protected $active = false;
/**
* Whether the monitor is publicly visible (defaults to false).
*
* Generated from protobuf field bool public = 17 [json_name = "public"];
*/
protected $public = false;
/**
* Geographic regions to run checks from.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.Region regions = 18 [json_name = "regions", (.buf.validate.field) = {
*/
private $regions;
/**
* OpenTelemetry configuration for exporting metrics.
*
* Generated from protobuf field .openstatus.monitor.v1.OpenTelemetryConfig open_telemetry = 19 [json_name = "openTelemetry"];
*/
protected $open_telemetry = null;
/**
* Current operational status of the monitor.
*
* Generated from protobuf field .openstatus.monitor.v1.MonitorStatus status = 20 [json_name = "status"];
*/
protected $status = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $id
* Unique identifier for the monitor (output only for create requests).
* @type string $name
* Name of the monitor (required, max 256 characters).
* @type string $url
* URL to monitor (required, max 2048 characters).
* @type int $periodicity
* Check periodicity (required).
* @type int $method
* HTTP method to use (defaults to GET).
* @type string $body
* Request body (optional).
* @type int|string $timeout
* Timeout in milliseconds (0-120000, defaults to 45000).
* @type int|string $degraded_at
* Latency threshold for degraded status in milliseconds (optional, 0-120000).
* @type int|string $retry
* Number of retry attempts (0-10, defaults to 3).
* @type bool $follow_redirects
* Whether to follow HTTP redirects (defaults to true when not specified).
* @type \Openstatus\Monitor\V1\Headers[] $headers
* Custom headers for the request.
* @type \Openstatus\Monitor\V1\StatusCodeAssertion[] $status_code_assertions
* Status code assertions for the response.
* @type \Openstatus\Monitor\V1\BodyAssertion[] $body_assertions
* Body content assertions for the response.
* @type \Openstatus\Monitor\V1\HeaderAssertion[] $header_assertions
* Header assertions for the response.
* @type string $description
* Description of the monitor (optional).
* @type bool $active
* Whether the monitor is active (defaults to false).
* @type bool $public
* Whether the monitor is publicly visible (defaults to false).
* @type int[] $regions
* Geographic regions to run checks from.
* @type \Openstatus\Monitor\V1\OpenTelemetryConfig $open_telemetry
* OpenTelemetry configuration for exporting metrics.
* @type int $status
* Current operational status of the monitor.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Openstatus\Monitor\V1\HttpMonitor::initOnce();
parent::__construct($data);
}
/**
* Unique identifier for the monitor (output only for create requests).
*
* Generated from protobuf field string id = 1 [json_name = "id"];
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Unique identifier for the monitor (output only for create requests).
*
* Generated from protobuf field string id = 1 [json_name = "id"];
* @param string $var
* @return $this
*/
public function setId(string $var)
{
GPBUtil::checkString($var, true);
$this->id = $var;
return $this;
}
/**
* Name of the monitor (required, max 256 characters).
*
* Generated from protobuf field string name = 2 [json_name = "name", (.gnostic.openapi.v3.property) = {
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Name of the monitor (required, max 256 characters).
*
* Generated from protobuf field string name = 2 [json_name = "name", (.gnostic.openapi.v3.property) = {
* @param string $var
* @return $this
*/
public function setName(string $var)
{
GPBUtil::checkString($var, true);
$this->name = $var;
return $this;
}
/**
* URL to monitor (required, max 2048 characters).
*
* Generated from protobuf field string url = 3 [json_name = "url", (.gnostic.openapi.v3.property) = {
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* URL to monitor (required, max 2048 characters).
*
* Generated from protobuf field string url = 3 [json_name = "url", (.gnostic.openapi.v3.property) = {
* @param string $var
* @return $this
*/
public function setUrl(string $var)
{
GPBUtil::checkString($var, true);
$this->url = $var;
return $this;
}
/**
* Check periodicity (required).
*
* Generated from protobuf field .openstatus.monitor.v1.Periodicity periodicity = 4 [json_name = "periodicity", (.buf.validate.field) = {
* @return int one of the values in {@see \Openstatus\Monitor\V1\Periodicity}
*/
public function getPeriodicity()
{
return $this->periodicity;
}
/**
* Check periodicity (required).
*
* Generated from protobuf field .openstatus.monitor.v1.Periodicity periodicity = 4 [json_name = "periodicity", (.buf.validate.field) = {
* @param int $var one of the values in {@see \Openstatus\Monitor\V1\Periodicity}
* @return $this
*/
public function setPeriodicity(int $var)
{
GPBUtil::checkEnum($var, \Openstatus\Monitor\V1\Periodicity::class);
$this->periodicity = $var;
return $this;
}
/**
* HTTP method to use (defaults to GET).
*
* Generated from protobuf field .openstatus.monitor.v1.HTTPMethod method = 5 [json_name = "method", (.buf.validate.field) = {
* @return int one of the values in {@see \Openstatus\Monitor\V1\HTTPMethod}
*/
public function getMethod()
{
return $this->method;
}
/**
* HTTP method to use (defaults to GET).
*
* Generated from protobuf field .openstatus.monitor.v1.HTTPMethod method = 5 [json_name = "method", (.buf.validate.field) = {
* @param int $var one of the values in {@see \Openstatus\Monitor\V1\HTTPMethod}
* @return $this
*/
public function setMethod(int $var)
{
GPBUtil::checkEnum($var, \Openstatus\Monitor\V1\HTTPMethod::class);
$this->method = $var;
return $this;
}
/**
* Request body (optional).
*
* Generated from protobuf field string body = 6 [json_name = "body", (.gnostic.openapi.v3.property) = {
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* Request body (optional).
*
* Generated from protobuf field string body = 6 [json_name = "body", (.gnostic.openapi.v3.property) = {
* @param string $var
* @return $this
*/
public function setBody(string $var)
{
GPBUtil::checkString($var, true);
$this->body = $var;
return $this;
}
/**
* Timeout in milliseconds (0-120000, defaults to 45000).
*
* Generated from protobuf field int64 timeout = 7 [json_name = "timeout", (.buf.validate.field) = {
* @return int|string
*/
public function getTimeout()
{
return $this->timeout;
}
/**
* Timeout in milliseconds (0-120000, defaults to 45000).
*
* Generated from protobuf field int64 timeout = 7 [json_name = "timeout", (.buf.validate.field) = {
* @param int|string $var
* @return $this
*/
public function setTimeout(int|string $var)
{
GPBUtil::checkInt64($var);
$this->timeout = $var;
return $this;
}
/**
* Latency threshold for degraded status in milliseconds (optional, 0-120000).
*
* Generated from protobuf field optional int64 degraded_at = 8 [json_name = "degradedAt", (.buf.validate.field) = {
* @return int|string
*/
public function getDegradedAt()
{
return isset($this->degraded_at) ? $this->degraded_at : GPBUtil::compatibleInt64(0, '0');
}
public function hasDegradedAt()
{
return isset($this->degraded_at);
}
public function clearDegradedAt()
{
unset($this->degraded_at);
}
/**
* Latency threshold for degraded status in milliseconds (optional, 0-120000).
*
* Generated from protobuf field optional int64 degraded_at = 8 [json_name = "degradedAt", (.buf.validate.field) = {
* @param int|string $var
* @return $this
*/
public function setDegradedAt(int|string $var)
{
GPBUtil::checkInt64($var);
$this->degraded_at = $var;
return $this;
}
/**
* Number of retry attempts (0-10, defaults to 3).
*
* Generated from protobuf field int64 retry = 9 [json_name = "retry", (.buf.validate.field) = {
* @return int|string
*/
public function getRetry()
{
return $this->retry;
}
/**
* Number of retry attempts (0-10, defaults to 3).
*
* Generated from protobuf field int64 retry = 9 [json_name = "retry", (.buf.validate.field) = {
* @param int|string $var
* @return $this
*/
public function setRetry(int|string $var)
{
GPBUtil::checkInt64($var);
$this->retry = $var;
return $this;
}
/**
* Whether to follow HTTP redirects (defaults to true when not specified).
*
* Generated from protobuf field optional bool follow_redirects = 10 [json_name = "followRedirects"];
* @return bool
*/
public function getFollowRedirects()
{
return isset($this->follow_redirects) ? $this->follow_redirects : false;
}
public function hasFollowRedirects()
{
return isset($this->follow_redirects);
}
public function clearFollowRedirects()
{
unset($this->follow_redirects);
}
/**
* Whether to follow HTTP redirects (defaults to true when not specified).
*
* Generated from protobuf field optional bool follow_redirects = 10 [json_name = "followRedirects"];
* @param bool $var
* @return $this
*/
public function setFollowRedirects(bool $var)
{
$this->follow_redirects = $var;
return $this;
}
/**
* Custom headers for the request.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.Headers headers = 11 [json_name = "headers", (.buf.validate.field) = {
* @return RepeatedField<\Openstatus\Monitor\V1\Headers>
*/
public function getHeaders()
{
return $this->headers;
}
/**
* Custom headers for the request.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.Headers headers = 11 [json_name = "headers", (.buf.validate.field) = {
* @param \Openstatus\Monitor\V1\Headers[] $var
* @return $this
*/
public function setHeaders(array|RepeatedField $var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Openstatus\Monitor\V1\Headers::class);
$this->headers = $arr;
return $this;
}
/**
* Status code assertions for the response.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.StatusCodeAssertion status_code_assertions = 12 [json_name = "statusCodeAssertions", (.buf.validate.field) = {
* @return RepeatedField<\Openstatus\Monitor\V1\StatusCodeAssertion>
*/
public function getStatusCodeAssertions()
{
return $this->status_code_assertions;
}
/**
* Status code assertions for the response.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.StatusCodeAssertion status_code_assertions = 12 [json_name = "statusCodeAssertions", (.buf.validate.field) = {
* @param \Openstatus\Monitor\V1\StatusCodeAssertion[] $var
* @return $this
*/
public function setStatusCodeAssertions(array|RepeatedField $var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Openstatus\Monitor\V1\StatusCodeAssertion::class);
$this->status_code_assertions = $arr;
return $this;
}
/**
* Body content assertions for the response.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.BodyAssertion body_assertions = 13 [json_name = "bodyAssertions", (.buf.validate.field) = {
* @return RepeatedField<\Openstatus\Monitor\V1\BodyAssertion>
*/
public function getBodyAssertions()
{
return $this->body_assertions;
}
/**
* Body content assertions for the response.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.BodyAssertion body_assertions = 13 [json_name = "bodyAssertions", (.buf.validate.field) = {
* @param \Openstatus\Monitor\V1\BodyAssertion[] $var
* @return $this
*/
public function setBodyAssertions(array|RepeatedField $var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Openstatus\Monitor\V1\BodyAssertion::class);
$this->body_assertions = $arr;
return $this;
}
/**
* Header assertions for the response.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.HeaderAssertion header_assertions = 14 [json_name = "headerAssertions", (.buf.validate.field) = {
* @return RepeatedField<\Openstatus\Monitor\V1\HeaderAssertion>
*/
public function getHeaderAssertions()
{
return $this->header_assertions;
}
/**
* Header assertions for the response.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.HeaderAssertion header_assertions = 14 [json_name = "headerAssertions", (.buf.validate.field) = {
* @param \Openstatus\Monitor\V1\HeaderAssertion[] $var
* @return $this
*/
public function setHeaderAssertions(array|RepeatedField $var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Openstatus\Monitor\V1\HeaderAssertion::class);
$this->header_assertions = $arr;
return $this;
}
/**
* Description of the monitor (optional).
*
* Generated from protobuf field string description = 15 [json_name = "description", (.buf.validate.field) = {
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Description of the monitor (optional).
*
* Generated from protobuf field string description = 15 [json_name = "description", (.buf.validate.field) = {
* @param string $var
* @return $this
*/
public function setDescription(string $var)
{
GPBUtil::checkString($var, true);
$this->description = $var;
return $this;
}
/**
* Whether the monitor is active (defaults to false).
*
* Generated from protobuf field bool active = 16 [json_name = "active"];
* @return bool
*/
public function getActive()
{
return $this->active;
}
/**
* Whether the monitor is active (defaults to false).
*
* Generated from protobuf field bool active = 16 [json_name = "active"];
* @param bool $var
* @return $this
*/
public function setActive(bool $var)
{
$this->active = $var;
return $this;
}
/**
* Whether the monitor is publicly visible (defaults to false).
*
* Generated from protobuf field bool public = 17 [json_name = "public"];
* @return bool
*/
public function getPublic()
{
return $this->public;
}
/**
* Whether the monitor is publicly visible (defaults to false).
*
* Generated from protobuf field bool public = 17 [json_name = "public"];
* @param bool $var
* @return $this
*/
public function setPublic(bool $var)
{
$this->public = $var;
return $this;
}
/**
* Geographic regions to run checks from.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.Region regions = 18 [json_name = "regions", (.buf.validate.field) = {
* @return RepeatedField one of the values in {@see \Openstatus\Monitor\V1\Region}
*/
public function getRegions()
{
return $this->regions;
}
/**
* Geographic regions to run checks from.
*
* Generated from protobuf field repeated .openstatus.monitor.v1.Region regions = 18 [json_name = "regions", (.buf.validate.field) = {
* @param int[] $var one of the values in {@see \Openstatus\Monitor\V1\Region}
* @return $this
*/
public function setRegions(array|RepeatedField $var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Openstatus\Monitor\V1\Region::class);
$this->regions = $arr;
return $this;
}
/**
* OpenTelemetry configuration for exporting metrics.
*
* Generated from protobuf field .openstatus.monitor.v1.OpenTelemetryConfig open_telemetry = 19 [json_name = "openTelemetry"];
* @return \Openstatus\Monitor\V1\OpenTelemetryConfig|null
*/
public function getOpenTelemetry()
{
return $this->open_telemetry;
}
public function hasOpenTelemetry()
{
return isset($this->open_telemetry);
}
public function clearOpenTelemetry()
{
unset($this->open_telemetry);
}
/**
* OpenTelemetry configuration for exporting metrics.
*
* Generated from protobuf field .openstatus.monitor.v1.OpenTelemetryConfig open_telemetry = 19 [json_name = "openTelemetry"];
* @param \Openstatus\Monitor\V1\OpenTelemetryConfig $var
* @return $this
*/
public function setOpenTelemetry(\Openstatus\Monitor\V1\OpenTelemetryConfig|null $var)
{
$this->open_telemetry = $var;
return $this;
}
/**
* Current operational status of the monitor.
*
* Generated from protobuf field .openstatus.monitor.v1.MonitorStatus status = 20 [json_name = "status"];
* @return int one of the values in {@see \Openstatus\Monitor\V1\MonitorStatus}
*/
public function getStatus()
{
return $this->status;
}
/**
* Current operational status of the monitor.
*
* Generated from protobuf field .openstatus.monitor.v1.MonitorStatus status = 20 [json_name = "status"];
* @param int $var one of the values in {@see \Openstatus\Monitor\V1\MonitorStatus}
* @return $this
*/
public function setStatus(int $var)
{
GPBUtil::checkEnum($var, \Openstatus\Monitor\V1\MonitorStatus::class);
$this->status = $var;
return $this;
}
}