---
title: HealthcheckBuilder
summary: A builder structure for generating healthchecks for a dynamic backend
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/experimental/dynamic_backend_healthchecks/struct.HealthcheckBuilder/
---

**Kind:** Struct  
**Module:** [dynamic_backend_healthchecks](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/experimental/dynamic_backend_healthchecks/)  
**Package:** fastly 0.13.1  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#21

```rust
pub struct HealthcheckBuilder { /* private fields */ }
```

A builder structure for generating healthchecks for a dynamic backend

This structure can be constructed using either [`Backend::healthcheck_builder()`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/backend/struct.Backend/#method-healthcheck_builder) or its
own [`new()`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/experimental/dynamic_backend_healthchecks/struct.HealthcheckBuilder/#method-new) method, and will generate a new healthcheck for use by the `DynamicBackendBuilder` after
consuming the `BackendBuilder` with `finish()`.

## Methods

### expected_status

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#205

```rust
fn expected_status(self, value: u16) -> Self
```

Sets the HTTP status code that signifies a healthy state.  

Defaults to 200.

**Parameters**

- `self`: `Self`
- `value`: `u16`

**Returns**

`Self`

### get_expected_status

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#148

```rust
fn get_expected_status(&self) -> u16
```

Returns the expected_status from the HealthcheckBuilder

**Parameters**

- `self`: `&Self`

**Returns**

`u16`

### get_host

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#133

```rust
fn get_host(&self) -> &str
```

Returns the host from the HealthcheckBuilder

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

### get_initial

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#163

```rust
fn get_initial(&self) -> u32
```

Returns the initial from the HealthcheckBuilder

**Parameters**

- `self`: `&Self`

**Returns**

`u32`

### get_interval_ms

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#168

```rust
fn get_interval_ms(&self) -> Duration
```

Returns the interval_ms from the HealthcheckBuilder

**Parameters**

- `self`: `&Self`

**Returns**

`Duration`

### get_method

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#138

```rust
fn get_method(&self) -> &str
```

Returns the method from the HealthcheckBuilder

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

### get_path

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#143

```rust
fn get_path(&self) -> &PathAndQuery
```

Returns the path from the HealthcheckBuilder

**Parameters**

- `self`: `&Self`

**Returns**

`&PathAndQuery`

### get_threshold

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#158

```rust
fn get_threshold(&self) -> u32
```

Returns the threshold from the HealthcheckBuilder

**Parameters**

- `self`: `&Self`

**Returns**

`u32`

### get_timeout_ms

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#173

```rust
fn get_timeout_ms(&self) -> Duration
```

Returns the timeout_ms from the HealthcheckBuilder

**Parameters**

- `self`: `&Self`

**Returns**

`Duration`

### get_window

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#153

```rust
fn get_window(&self) -> u32
```

Returns the window from the HealthcheckBuilder

**Parameters**

- `self`: `&Self`

**Returns**

`u32`

### host

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#180

```rust
fn host(self, name: impl ToString) -> Self
```

Set the Host header to set when making the request (e.g. example.com).

A common mistake is setting the wrong host header, which causes the health check to fail.

**Parameters**

- `self`: `Self`
- `name`: `impl ToString`

**Returns**

`Self`

### initial

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#232

```rust
fn initial(self, value: u32) -> Self
```

Set the number of successes to assume are successful when beginning a health check.
Must not be greater than the current window.

Defaults to 4.

**Parameters**

- `self`: `Self`
- `value`: `u32`

**Returns**

`Self`

### interval_ms

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#242

```rust
fn interval_ms(self, value: Duration) -> Self
```

Set the interval in milliseconds where a health check should be performed.
Times must be 1 second to 1 hour inclusive. Must be less
than the current timeout_ms.

Defaults to 15000ms.

**Parameters**

- `self`: `Self`
- `value`: `Duration`

**Returns**

`Self`

### method

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#188

```rust
fn method(self, value: impl ToString) -> Self
```

Set an HTTP verb (i.e., HEAD, GET, or POST) to use when performing the health check.

Defaults to "GET".

**Parameters**

- `self`: `Self`
- `value`: `impl ToString`

**Returns**

`Self`

### new

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#50

```rust
fn new(host: impl ToString) -> Self
```

Create a new health check builder for a dynamic backend.

The argument is a string describing the backend host on which to check health
checks on. This can be of the form:

   * `"<ip address>"`
   * `"<hostname>"`
   * `"<ip address>:<port>"`
   * `"<hostname>:<port>"`

The builder will start with default values for all other possible fields for the
health check, which can be overridden using the other methods provided. Use 
`BackendBuilder::healthcheck` to add the health check to a specific Dynamic Backend
and call `BackendBuilder::finish()` to complete the construction of the dynamic backend.

Values for health checks have strict limits to prevent ill-use. If you create a health
check with a value that breaks these limits, `finish()` will error with a 
`BackendCreationError:InvalidHealthcheckValues`

**Parameters**

- `host`: `impl ToString`

**Returns**

`Self`

### path

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#197

```rust
fn path(self, value: impl ToString) -> Self
```

Set a path to visit on your origins when performing the check. Use a unique path.
For example, use /website-healthcheck.txt, not / or /healthcheck.

Defaults to "/".

**Parameters**

- `self`: `Self`
- `value`: `impl ToString`

**Returns**

`Self`

### threshold

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#223

```rust
fn threshold(self, value: u32) -> Self
```

Set the number of health checks that must be successful within the window
to be considered healthy. Must not be greater than the current window.

Defaults to 3.

**Parameters**

- `self`: `Self`
- `value`: `u32`

**Returns**

`Self`

### timeout_ms

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#252

```rust
fn timeout_ms(self, value: Duration) -> Self
```

Set the time in milliseconds in which to perform the health check.
Note that querying the health check renews the timer. Must not be less
than the current interval_ms.

Defaults to 5000ms.

**Parameters**

- `self`: `Self`
- `value`: `Duration`

**Returns**

`Self`

### validate

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#66

```rust
fn validate(&self) -> Result<(), BackendCreationError>
```

Validate that the current health check has acceptable values

**Parameters**

- `self`: `&Self`

**Returns**

`Result<(), BackendCreationError>`

### window

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#214

```rust
fn window(self, value: u32) -> Self
```

Set the number of most recent health check queries to keep.
Must not be greater than 15.

Defaults to 5.

**Parameters**

- `self`: `Self`
- `value`: `u32`

**Returns**

`Self`

## Trait implementations

### impl Clone for HealthcheckBuilder

#### clone

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/experimental/dynamic_backend_healthchecks.rs#20

```rust
fn clone(&self) -> Self
```

**Parameters**

- `self`: `&Self`

**Returns**

`Self`

## Auto trait implementations

- `Freeze`
- `RefUnwindSafe`
- `Send`
- `Sync`
- `Unpin`
- `UnsafeUnpin`
- `UnwindSafe`

## Blanket implementations

- `Any`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Downcast`
- `DowncastSync`
- `ErasedDestructor`
- `From<T>`
- `Into<U>`
- `IntoEither`
- `Same`
- `ToOwned`
- `TryFrom<U>`
- `TryInto<U>`
