Struct Request

Source
pub struct Request<A: Method, R> { /* private fields */ }
Expand description

A consuming builder which can be used to build up API calls.

In general consumers of the crate should not need to use this type directly. Instead, build up requests from what is found in api::*.

Implementations§

Source§

impl Request<Create, Certificate>

Source

pub fn certificate_chain<S: AsRef<str> + Serialize + Display>( self, val: S, ) -> Self

The full PEM-formatted trust chain between the certificate authority’s certificate and your domain’s SSL certificate.

Digital Ocean Documentation.

Source§

impl Request<Get, Domain>

Source§

impl Request<List, Vec<DomainRecord>>

Source§

impl Request<Create, DomainRecord>

Source

pub fn priority(self, val: Option<usize>) -> Self

The priority for SRV and MX records.

Digital Ocean Documentation.

Source

pub fn port(self, val: Option<usize>) -> Self

The port for SRV records.

Digital Ocean Documentation.

Source

pub fn ttl(self, val: usize) -> Self

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

Digital Ocean Documentation.

Source

pub fn weight(self, val: Option<usize>) -> Self

The weight for SRV records.

Digital Ocean Documentation.

Source§

impl Request<Update, DomainRecord>

Source

pub fn kind<S: AsRef<str> + Display + Serialize>(self, val: S) -> Self

The record type (A, MX, CNAME, etc).

Digital Ocean Documentation.

Source

pub fn name<S: AsRef<str> + Display + Serialize>(self, val: S) -> Self

The host name, alias, or service being defined by the record.

Digital Ocean Documentation.

Source

pub fn data<S: AsRef<str> + Display + Serialize>(self, val: S) -> Self

Variable data depending on record type. See the Domain Records section for more detail on each record type.

Digital Ocean Documentation.

Source

pub fn priority(self, val: Option<usize>) -> Self

The priority for SRV and MX records.

Digital Ocean Documentation.

Source

pub fn port(self, val: Option<usize>) -> Self

The port for SRV records.

Digital Ocean Documentation.

Source

pub fn ttl(self, val: usize) -> Self

This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.

Digital Ocean Documentation.

Source

pub fn weight(self, val: Option<usize>) -> Self

The weight for SRV records.

Digital Ocean Documentation.

Source§

impl Request<Create, Droplet>

Source

pub fn ssh_keys<D>(self, val: Vec<D>) -> Self
where D: Display + Serialize,

An array containing the IDs or fingerprints of the SSH keys that you wish to embed in the Droplet’s root account upon creation.

Digital Ocean Documentation.

Source

pub fn backups(self, val: bool) -> Self

A boolean indicating whether automated backups should be enabled for the Droplet. Automated backups can only be enabled when the Droplet is created.

Digital Ocean Documentation.

Source

pub fn ipv6(self, val: bool) -> Self

A boolean indicating whether IPv6 is enabled on the Droplet.

Digital Ocean Documentation.

Source

pub fn private_networking(self, val: bool) -> Self

A boolean indicating whether private networking is enabled for the Droplet. Private networking is currently only available in certain regions.

Digital Ocean Documentation.

Source

pub fn user_data(self, val: bool) -> Self

A string containing ‘user data’ which may be used to configure the Droplet on first boot, often a ‘cloud-config’ file or Bash script. It must be plain text and may not exceed 64 KiB in size.

Digital Ocean Documentation.

Source

pub fn monitoring(self, val: bool) -> Self

A boolean indicating whether to install the DigitalOcean agent for monitoring.

Digital Ocean Documentation.

Source

pub fn volumes(self, val: Vec<String>) -> Self

A flat array including the unique string identifier for each Block Storage volume to be attached to the Droplet. At the moment a volume can only be attached to a single Droplet.

Digital Ocean Documentation.

Source

pub fn tags(self, val: Vec<String>) -> Self

A flat array of tag names as strings to apply to the Droplet after it is created. Tag names can either be existing or new tags.

Digital Ocean Documentation.

Source§

impl Request<Create, Vec<Droplet>>

Source

pub fn ssh_keys<D>(self, val: Vec<D>) -> Self
where D: Display + Serialize,

An array containing the IDs or fingerprints of the SSH keys that you wish to embed in the Droplet’s root account upon creation.

Digital Ocean Documentation.

Source

pub fn backups(self, val: bool) -> Self

A boolean indicating whether automated backups should be enabled for the Droplet. Automated backups can only be enabled when the Droplet is created.

Digital Ocean Documentation.

Source

pub fn ipv6(self, val: bool) -> Self

A boolean indicating whether IPv6 is enabled on the Droplet.

Digital Ocean Documentation.

Source

pub fn private_networking(self, val: bool) -> Self

A boolean indicating whether private networking is enabled for the Droplet. Private networking is currently only available in certain regions.

Digital Ocean Documentation.

Source

pub fn user_data(self, val: bool) -> Self

A string containing ‘user data’ which may be used to configure the Droplet on first boot, often a ‘cloud-config’ file or Bash script. It must be plain text and may not exceed 64 KiB in size.

Digital Ocean Documentation.

Source

pub fn monitoring(self, val: bool) -> Self

A boolean indicating whether to install the DigitalOcean agent for monitoring.

Digital Ocean Documentation.

Source

pub fn volumes(self, val: Vec<String>) -> Self

A flat array including the unique string identifier for each Block Storage volume to be attached to the Droplet. At the moment a volume can only be attached to a single Droplet.

Digital Ocean Documentation.

Source

pub fn tags(self, val: Vec<String>) -> Self

A flat array of tag names as strings to apply to the Droplet after it is created. Tag names can either be existing or new tags.

Digital Ocean Documentation.

Source§

impl Request<Get, Droplet>

Source§

impl Request<Get, Droplet>

Source

pub fn actions(self) -> DropletActionRequest<List, Vec<Action>>

Source

pub fn enable_backups(self) -> DropletActionRequest<Create, Action>

Source

pub fn disable_backups(self) -> DropletActionRequest<Create, Action>

Source

pub fn reboot(self) -> DropletActionRequest<Create, Action>

Source

pub fn power_cycle(self) -> DropletActionRequest<Create, Action>

Source

pub fn shutdown(self) -> DropletActionRequest<Create, Action>

Source

pub fn power(self, val: bool) -> DropletActionRequest<Create, Action>

Source

pub fn restore<D: Display>( self, image: D, ) -> DropletActionRequest<Create, Action>

Source

pub fn password_reset(self) -> DropletActionRequest<Create, Action>

Source

pub fn resize<S>( self, size: S, disk: bool, ) -> DropletActionRequest<Create, Action>
where S: AsRef<str> + Serialize + Display,

Source

pub fn rebuild<S>(self, image: S) -> DropletActionRequest<Create, Action>
where S: AsRef<str> + Serialize + Display,

Source

pub fn rename<S>(self, name: S) -> DropletActionRequest<Create, Action>
where S: AsRef<str> + Serialize + Display,

Source

pub fn kernel(self, kernel: usize) -> DropletActionRequest<Create, Action>

Source

pub fn enable_ipv6(self) -> DropletActionRequest<Create, Action>

Source

pub fn enable_private_networking(self) -> DropletActionRequest<Create, Action>

Source

pub fn snapshot<S>(self, name: S) -> DropletActionRequest<Create, Action>
where S: AsRef<str> + Serialize + Display,

Source

pub fn action(self, id: usize) -> DropletActionRequest<Get, Action>

Source§

impl Request<Get, FloatingIp>

Source§

impl Request<Update, Image>

Source

pub fn name<S: Display + Serialize>(self, val: S) -> ImageRequest<Update, Image>

The new name that you would like to use for the image.

Digital Ocean Documentation.

Source§

impl Request<Get, Image>

Source§

impl Request<Create, LoadBalancer>

Source

pub fn algorithm<S>(self, val: S) -> LoadBalancerRequest<Create, LoadBalancer>
where S: Display + Serialize,

The load balancing algorithm used to determine which backend Droplet will be selected by a client. It must be either “round_robin” or “least_connections”. The default value is “round_robin”.

Digital Ocean Documentation.

Source

pub fn forwarding_rule<T>( self, val: T, ) -> LoadBalancerRequest<Create, LoadBalancer>
where T: Into<ForwardingRule>,

An array of objects specifying the forwarding rules for a Load Balancer. At least one forwarding rule is required when creating a new Load Balancer instance.

Digital Ocean Documentation.

Source

pub fn health_check<S: AsRef<str> + Display + Serialize>( self, protocol: S, port: usize, path: Option<S>, check_interval_seconds: Option<usize>, response_timeout_seconds: Option<usize>, unhealthy_threshold: Option<usize>, healthy_threshold: Option<usize>, ) -> LoadBalancerRequest<Create, LoadBalancer>

The (optional) health check settings.

Digital Ocean Documentation.

Source

pub fn sticky_sessions<S: AsRef<str> + Display + Serialize>( self, kind: S, cookie_name: Option<S>, cookie_ttl_seconds: Option<usize>, ) -> LoadBalancerRequest<Create, LoadBalancer>

The (optional) sticky sessions settings. kind must be cookies or none. If kind is cookies then cookie_name and cookie_ttl_seconds should be set as well.

Digital Ocean Documentation.

Source

pub fn redirect_http_to_https( self, setting: bool, ) -> LoadBalancerRequest<Create, LoadBalancer>

A boolean value indicating whether HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443. Default value is false.

Digital Ocean Documentation.

Source

pub fn droplets( self, ids: Vec<usize>, ) -> LoadBalancerRequest<Create, LoadBalancer>

The IDs of the Droplets to be assigned to the Load Balancer.

Note: Not intended to be used alongside the tag function.

Digital Ocean Documentation.

Source

pub fn tag<S>(self, tag: S) -> LoadBalancerRequest<Create, LoadBalancer>
where S: AsRef<str> + Display + Serialize,

The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer.

Note: Not intended to be used alongside the droplets function.

Digital Ocean Documentation.

Source§

impl Request<Update, LoadBalancer>

Source

pub fn name<S>(self, val: S) -> LoadBalancerRequest<Update, LoadBalancer>
where S: Display + Serialize,

A human-readable name for a Load Balancer instance.

Digital Ocean Documentation.

Source

pub fn region<S>(self, val: S) -> LoadBalancerRequest<Update, LoadBalancer>
where S: Display + Serialize,

The region where the Load Balancer instance will be located.

Digital Ocean Documentation.

Source

pub fn algorithm<S>(self, val: S) -> LoadBalancerRequest<Update, LoadBalancer>
where S: Display + Serialize,

The load balancing algorithm used to determine which backend Droplet will be selected by a client. It must be either “round_robin” or “least_connections”. The default value is “round_robin”.

Digital Ocean Documentation.

Source

pub fn forwarding_rule<T>( self, val: T, ) -> LoadBalancerRequest<Update, LoadBalancer>
where T: Into<ForwardingRule>,

An array of objects specifying the forwarding rules for a Load Balancer. At least one forwarding rule is required when creating a new Load Balancer instance.

Digital Ocean Documentation.

Source

pub fn health_check<S: AsRef<str> + Display + Serialize>( self, protocol: S, port: usize, path: Option<S>, check_interval_seconds: Option<usize>, response_timeout_seconds: Option<usize>, unhealthy_threshold: Option<usize>, healthy_threshold: Option<usize>, ) -> LoadBalancerRequest<Update, LoadBalancer>

The (optional) health check settings.

Digital Ocean Documentation.

Source

pub fn sticky_sessions<S: AsRef<str> + Display + Serialize>( self, kind: S, cookie_name: Option<S>, cookie_ttl_seconds: Option<usize>, ) -> LoadBalancerRequest<Update, LoadBalancer>

The (optional) sticky sessions settings. kind must be cookies or none. If kind is cookies then cookie_name and cookie_ttl_seconds should be set as well.

Digital Ocean Documentation.

Source

pub fn redirect_http_to_https( self, setting: bool, ) -> LoadBalancerRequest<Update, LoadBalancer>

A boolean value indicating whether HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443. Default value is false.

Digital Ocean Documentation.

Source

pub fn droplets( self, ids: Vec<usize>, ) -> LoadBalancerRequest<Update, LoadBalancer>

The IDs of the Droplets to be assigned to the Load Balancer.

Note: Not intended to be used alongside the tag function.

Digital Ocean Documentation.

Source

pub fn tag<S>(self, tag: S) -> LoadBalancerRequest<Update, LoadBalancer>
where S: AsRef<str> + Display + Serialize,

The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer.

Note: Not intended to be used alongside the droplets function.

Digital Ocean Documentation.

Source§

impl Request<Get, LoadBalancer>

Source

pub fn add_droplets(self, ids: Vec<usize>) -> LoadBalancerRequest<Create, ()>

Add droplets (by id) to the load balancer.

Digital Ocean Documentation.

Source

pub fn remove_droplets(self, ids: Vec<usize>) -> LoadBalancerRequest<Delete, ()>

Remove droplets (by id) from the load balancer.

Digital Ocean Documentation.

Source

pub fn add_forwarding_rules<T>( self, items: Vec<T>, ) -> LoadBalancerRequest<Create, ()>
where T: Into<ForwardingRule>,

Add a forwarding rule to the Load Balancer.

Digital Ocean Documentation.

Source

pub fn remove_forwarding_rules<T>( self, items: Vec<T>, ) -> LoadBalancerRequest<Delete, ()>
where T: Into<ForwardingRule>,

Remove a forwarding rule to the Load Balancer.

Digital Ocean Documentation.

Source§

impl Request<Update, SshKey>

Source

pub fn name<S: AsRef<str> + Display + Serialize>(self, val: S) -> Self

The name to give the new SSH key in your account.

Digital Ocean Documentation.

Source§

impl Request<Get, Tag>

Source

pub fn add_resources<S>(self, resources: Vec<(S, S)>) -> TagRequest<Create, ()>
where S: AsRef<str> + Serialize + Display,

Accepts tuples matching (id, type). Currently the only type is "droplet".

Digital Ocean Documentation.

Source

pub fn remove_resources<S>( self, resources: Vec<(S, S)>, ) -> TagRequest<Delete, ()>
where S: AsRef<str> + Serialize + Display,

Accepts tuples matching (id, type). Currently the only type is "droplet".

Digital Ocean Documentation.

Source§

impl Request<List, Vec<Volume>>

Source

pub fn region<S: AsRef<str> + Serialize + Display>(self, region: S) -> Self

Source§

impl Request<Get, Volume>

Source§

impl Request<Create, Volume>

Source

pub fn description<S: AsRef<str> + Serialize + Display>(self, val: S) -> Self

An optional free-form text field to describe a Block Storage volume.

Digital Ocean Documentation.

Source

pub fn region<S: AsRef<str> + Serialize + Display>(self, val: S) -> Self

The region where the Block Storage volume will be created. When setting a region, the value should be the slug identifier for the region. When you query a Block Storage volume, the entire region object will be returned.

Note: Should not be specified with a snapshot_id.

Digital Ocean Documentation.

Source

pub fn snapshot_id<S: AsRef<str> + Serialize + Display>(self, val: S) -> Self

The unique identifier for the volume snapshot from which to create the volume.

Note: Should not be specified with a region_id.

Digital Ocean Documentation.

Source§

impl Request<Get, Volume>

Source§

impl<A: Method, R> Request<A, R>

Source

pub fn url_mut(&mut self) -> &mut Url

Source

pub fn body_mut(&mut self) -> &mut Value

The JSON body of the request.

Source§

impl<A: Method, R> Request<A, R>

Source

pub fn url(&self) -> &Url

Source

pub fn body(&self) -> &Value

The JSON body of the request.

Source

pub fn method(&self) -> &A

Source§

impl<A: Method, R> Request<A, R>

Source

pub fn set_url(&mut self, val: Url) -> &mut Self

Source

pub fn set_body(&mut self, val: Value) -> &mut Self

The JSON body of the request.

Source§

impl<A: Method, V> Request<A, V>

Source

pub fn new(url: Url) -> Self

Create a request pointing at the given url. V is the value ultimately returned when the call is executed.

Source§

impl<V> Request<List, V>

Source

pub fn limit(self, limit: Option<usize>) -> Self

Impose a limit on the number of values which may be retrieved from a request.

Trait Implementations§

Source§

impl<A: Clone + Method, R: Clone> Clone for Request<A, R>

Source§

fn clone(&self) -> Request<A, R>

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<A: Debug + Method, R: Debug> Debug for Request<A, R>

Source§

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

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

impl<'de, A, R> Deserialize<'de> for Request<A, R>
where A: Deserialize<'de> + Method,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Executable<()> for Request<Delete, ()>

Source§

fn execute<'life0, 'async_trait>( self, instance: &'life0 DigitalOcean, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the corresponding call.
Source§

impl<V: HasResponse + Send> Executable<V> for Request<Create, V>

Source§

fn execute<'life0, 'async_trait>( self, instance: &'life0 DigitalOcean, ) -> Pin<Box<dyn Future<Output = Result<V, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the corresponding call.
Source§

impl<V: HasResponse + Send> Executable<V> for Request<Get, V>

Source§

fn execute<'life0, 'async_trait>( self, instance: &'life0 DigitalOcean, ) -> Pin<Box<dyn Future<Output = Result<V, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the corresponding call.
Source§

impl<V: HasResponse + Send> Executable<V> for Request<Update, V>

Source§

fn execute<'life0, 'async_trait>( self, instance: &'life0 DigitalOcean, ) -> Pin<Box<dyn Future<Output = Result<V, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the corresponding call.
Source§

impl<V> Executable<Vec<V>> for Request<List, Vec<V>>

Source§

fn execute<'life0, 'async_trait>( self, instance: &'life0 DigitalOcean, ) -> Pin<Box<dyn Future<Output = Result<Vec<V>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the corresponding call.

Auto Trait Implementations§

§

impl<A, R> Freeze for Request<A, R>
where A: Freeze,

§

impl<A, R> RefUnwindSafe for Request<A, R>

§

impl<A, R> Send for Request<A, R>
where A: Send, R: Send,

§

impl<A, R> Sync for Request<A, R>
where A: Sync, R: Sync,

§

impl<A, R> Unpin for Request<A, R>
where A: Unpin, R: Unpin,

§

impl<A, R> UnwindSafe for Request<A, R>
where A: UnwindSafe, R: UnwindSafe,

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<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,