Struct aws_sdk_sqs::config::Builder

source ·
pub struct Builder { /* private fields */ }
Expand description

Builder for creating a Config.

Implementations§

Constructs a config builder.

When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.

When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.

When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.

When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.

Sets the endpoint resolver to use when making requests.

When unset, the client will used a generated endpoint resolver based on the endpoint resolution rules for aws_sdk_sqs.

Examples
use aws_smithy_http::endpoint;
use aws_sdk_sqs::endpoint::{Params as EndpointParams, DefaultResolver};
/// Endpoint resolver which adds a prefix to the generated endpoint
struct PrefixResolver {
    base_resolver: DefaultResolver,
    prefix: String
}
impl endpoint::ResolveEndpoint<EndpointParams> for PrefixResolver {
  fn resolve_endpoint(&self, params: &EndpointParams) -> endpoint::Result {
       self.base_resolver
             .resolve_endpoint(params)
             .map(|ep|{
                  let url = ep.url().to_string();
                  ep.into_builder().url(format!("{}.{}", &self.prefix, url)).build()
              })
  }
}
let prefix_resolver = PrefixResolver {
    base_resolver: DefaultResolver::new(),
    prefix: "subdomain".to_string()
};
let config = aws_sdk_sqs::Config::builder().endpoint_resolver(prefix_resolver);

Sets the endpoint resolver to use when making requests.

When unset, the client will used a generated endpoint resolver based on the endpoint resolution rules for aws_sdk_sqs.

Set the retry_config for the builder

Examples
use aws_sdk_sqs::config::Config;
use aws_sdk_sqs::config::retry::RetryConfig;

let retry_config = RetryConfig::standard().with_max_attempts(5);
let config = Config::builder().retry_config(retry_config).build();

Set the retry_config for the builder

Examples
use aws_sdk_sqs::config::{Builder, Config};
use aws_sdk_sqs::config::retry::RetryConfig;

fn disable_retries(builder: &mut Builder) {
    let retry_config = RetryConfig::standard().with_max_attempts(1);
    builder.set_retry_config(Some(retry_config));
}

let mut builder = Config::builder();
disable_retries(&mut builder);
let config = builder.build();

Set the sleep_impl for the builder

Examples
use aws_sdk_sqs::config::{AsyncSleep, Sleep, Config};

#[derive(Debug)]
pub struct ForeverSleep;

impl AsyncSleep for ForeverSleep {
    fn sleep(&self, duration: std::time::Duration) -> Sleep {
        Sleep::new(std::future::pending())
    }
}

let sleep_impl = std::sync::Arc::new(ForeverSleep);
let config = Config::builder().sleep_impl(sleep_impl).build();

Set the sleep_impl for the builder

Examples
use aws_sdk_sqs::config::{AsyncSleep, Sleep, Builder, Config};

#[derive(Debug)]
pub struct ForeverSleep;

impl AsyncSleep for ForeverSleep {
    fn sleep(&self, duration: std::time::Duration) -> Sleep {
        Sleep::new(std::future::pending())
    }
}

fn set_never_ending_sleep_impl(builder: &mut Builder) {
    let sleep_impl = std::sync::Arc::new(ForeverSleep);
    builder.set_sleep_impl(Some(sleep_impl));
}

let mut builder = Config::builder();
set_never_ending_sleep_impl(&mut builder);
let config = builder.build();

Set the timeout_config for the builder

Examples
use aws_sdk_sqs::config::Config;
use aws_sdk_sqs::config::timeout::TimeoutConfig;

let timeout_config = TimeoutConfig::builder()
    .operation_attempt_timeout(Duration::from_secs(1))
    .build();
let config = Config::builder().timeout_config(timeout_config).build();

Set the timeout_config for the builder

Examples
use aws_sdk_sqs::config::{Builder, Config};
use aws_sdk_sqs::config::timeout::TimeoutConfig;

fn set_request_timeout(builder: &mut Builder) {
    let timeout_config = TimeoutConfig::builder()
        .operation_attempt_timeout(Duration::from_secs(1))
        .build();
    builder.set_timeout_config(Some(timeout_config));
}

let mut builder = Config::builder();
set_request_timeout(&mut builder);
let config = builder.build();
👎Deprecated: use endpoint_url or set the endpoint resolver directly

Overrides the endpoint resolver to use when making requests.

This method is deprecated, use Builder::endpoint_url or Builder::endpoint_resolver instead.

When unset, the client will used a generated endpoint resolver based on the endpoint metadata for aws_sdk_sqs.

Examples
use aws_types::region::Region;
use aws_sdk_sqs::config::{Builder, Config};
use aws_sdk_sqs::Endpoint;

let config = aws_sdk_sqs::Config::builder()
    .endpoint_resolver(Endpoint::immutable("http://localhost:8080")?)
    .build();
👎Deprecated: use endpoint_url or set the endpoint resolver directly

Sets the endpoint resolver to use when making requests.

This method is deprecated, use Builder::endpoint_url or Builder::endpoint_resolver instead.

Sets the endpoint url used to communicate with this service

Note: this is used in combination with other endpoint rules, e.g. an API that applies a host-label prefix will be prefixed onto this URL. To fully override the endpoint resolver, use Builder::endpoint_resolver.

Sets the endpoint url used to communicate with this service

Note: this is used in combination with other endpoint rules, e.g. an API that applies a host-label prefix will be prefixed onto this URL. To fully override the endpoint resolver, use Builder::endpoint_resolver.

Sets the name of the app that is using the client.

This optional name is used to identify the application in the user agent that gets sent along with requests.

Sets the name of the app that is using the client.

This optional name is used to identify the application in the user agent that gets sent along with requests.

Sets the HTTP connector to use when making requests.

Examples
use std::time::Duration;
use aws_smithy_client::{Client, hyper_ext};
use aws_smithy_client::erase::DynConnector;
use aws_smithy_client::http_connector::ConnectorSettings;
use aws_sdk_sqs::config::Config;

let https_connector = hyper_rustls::HttpsConnectorBuilder::new()
    .with_webpki_roots()
    .https_only()
    .enable_http1()
    .enable_http2()
    .build();
let smithy_connector = hyper_ext::Adapter::builder()
    // Optionally set things like timeouts as well
    .connector_settings(
        ConnectorSettings::builder()
            .connect_timeout(Duration::from_secs(5))
            .build()
    )
    .build(https_connector);

Sets the HTTP connector to use when making requests.

Examples
use std::time::Duration;
use aws_smithy_client::hyper_ext;
use aws_smithy_client::http_connector::ConnectorSettings;
use crate::sdk_config::{SdkConfig, Builder};
use aws_sdk_sqs::config::{Builder, Config};

fn override_http_connector(builder: &mut Builder) {
    let https_connector = hyper_rustls::HttpsConnectorBuilder::new()
        .with_webpki_roots()
        .https_only()
        .enable_http1()
        .enable_http2()
        .build();
    let smithy_connector = hyper_ext::Adapter::builder()
        // Optionally set things like timeouts as well
        .connector_settings(
            ConnectorSettings::builder()
                .connect_timeout(Duration::from_secs(5))
                .build()
        )
        .build(https_connector);
    builder.set_http_connector(Some(smithy_connector));
}

let mut builder = aws_sdk_sqs::Config::builder();
override_http_connector(&mut builder);
let config = builder.build();

Sets the AWS region to use when making requests.

Examples
use aws_types::region::Region;
use aws_sdk_sqs::config::{Builder, Config};

let config = aws_sdk_sqs::Config::builder()
    .region(Region::new("us-east-1"))
    .build();

Sets the credentials provider for this service

Sets the credentials provider for this service

Builds a Config.

Trait Implementations§

Returns the “default value” for a type. Read more
Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more