HttpCheck

#[non_exhaustive]
pub struct HttpCheck {
Show 14 fields pub request_method: RequestMethod, pub use_ssl: bool, pub path: String, pub port: i32, pub auth_info: Option<BasicAuthentication>, pub mask_headers: bool, pub headers: HashMap<String, String>, pub content_type: ContentType, pub custom_content_type: String, pub validate_ssl: bool, pub body: Bytes, pub accepted_response_status_codes: Vec<ResponseStatusCode>, pub ping_config: Option<PingConfig>, pub auth_method: Option<AuthMethod>, /* private fields */
}
Expand description

Information involved in an HTTP/HTTPS Uptime check request.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§request_method: RequestMethod

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: i32

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: Option<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: HashMap<String, String>

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: ContentType

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: Bytes

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: Vec<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: Option<PingConfig>

Contains information needed to add pings to an HTTP check.

§auth_method: Option<AuthMethod>

This field is optional and should be set only by users interested in an authenticated uptime check. Do not set both auth_method and auth_info.

Implementations§

Source§

impl HttpCheck

Source

pub fn new() -> Self

Source

pub fn set_request_method<T: Into<RequestMethod>>(self, v: T) -> Self

Sets the value of request_method.

Source

pub fn set_use_ssl<T: Into<bool>>(self, v: T) -> Self

Sets the value of use_ssl.

Source

pub fn set_path<T: Into<String>>(self, v: T) -> Self

Sets the value of path.

Source

pub fn set_port<T: Into<i32>>(self, v: T) -> Self

Sets the value of port.

Source

pub fn set_auth_info<T>(self, v: T) -> Self

Sets the value of auth_info.

Source

pub fn set_or_clear_auth_info<T>(self, v: Option<T>) -> Self

Sets or clears the value of auth_info.

Source

pub fn set_mask_headers<T: Into<bool>>(self, v: T) -> Self

Sets the value of mask_headers.

Source

pub fn set_headers<T, K, V>(self, v: T) -> Self
where T: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<String>,

Sets the value of headers.

Source

pub fn set_content_type<T: Into<ContentType>>(self, v: T) -> Self

Sets the value of content_type.

Source

pub fn set_custom_content_type<T: Into<String>>(self, v: T) -> Self

Sets the value of custom_content_type.

Source

pub fn set_validate_ssl<T: Into<bool>>(self, v: T) -> Self

Sets the value of validate_ssl.

Source

pub fn set_body<T: Into<Bytes>>(self, v: T) -> Self

Sets the value of body.

Source

pub fn set_accepted_response_status_codes<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<ResponseStatusCode>,

Sets the value of accepted_response_status_codes.

Source

pub fn set_ping_config<T>(self, v: T) -> Self
where T: Into<PingConfig>,

Sets the value of ping_config.

Source

pub fn set_or_clear_ping_config<T>(self, v: Option<T>) -> Self
where T: Into<PingConfig>,

Sets or clears the value of ping_config.

Source

pub fn set_auth_method<T: Into<Option<AuthMethod>>>(self, v: T) -> Self

Sets the value of auth_method.

Note that all the setters affecting auth_method are mutually exclusive.

Source

pub fn service_agent_authentication( &self, ) -> Option<&Box<ServiceAgentAuthentication>>

The value of auth_method if it holds a ServiceAgentAuthentication, None if the field is not set or holds a different branch.

Source

pub fn set_service_agent_authentication<T: Into<Box<ServiceAgentAuthentication>>>( self, v: T, ) -> Self

Sets the value of auth_method to hold a ServiceAgentAuthentication.

Note that all the setters affecting auth_method are mutually exclusive.

Trait Implementations§

Source§

impl Clone for HttpCheck

Source§

fn clone(&self) -> HttpCheck

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpCheck

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HttpCheck

Source§

fn default() -> HttpCheck

Returns the “default value” for a type. Read more
Source§

impl Message for HttpCheck

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for HttpCheck

Source§

fn eq(&self, other: &HttpCheck) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for HttpCheck

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,