#[derive(Debug)]
pub(crate) struct Handle {
pub(crate) client: ::aws_smithy_client::Client<
::aws_smithy_client::erase::DynConnector,
::aws_smithy_client::erase::DynMiddleware<::aws_smithy_client::erase::DynConnector>,
>,
pub(crate) conf: crate::Config,
}
#[derive(::std::fmt::Debug)]
pub struct Client {
handle: ::std::sync::Arc<Handle>,
}
impl ::std::clone::Clone for Client {
fn clone(&self) -> Self {
Self {
handle: self.handle.clone(),
}
}
}
impl
From<
::aws_smithy_client::Client<
::aws_smithy_client::erase::DynConnector,
::aws_smithy_client::erase::DynMiddleware<::aws_smithy_client::erase::DynConnector>,
>,
> for Client
{
fn from(
client: ::aws_smithy_client::Client<
::aws_smithy_client::erase::DynConnector,
::aws_smithy_client::erase::DynMiddleware<::aws_smithy_client::erase::DynConnector>,
>,
) -> Self {
Self::with_config(client, crate::Config::builder().build())
}
}
impl Client {
pub fn with_config(
client: ::aws_smithy_client::Client<
::aws_smithy_client::erase::DynConnector,
::aws_smithy_client::erase::DynMiddleware<::aws_smithy_client::erase::DynConnector>,
>,
conf: crate::Config,
) -> Self {
Self {
handle: ::std::sync::Arc::new(Handle { client, conf }),
}
}
pub fn conf(&self) -> &crate::Config {
&self.handle.conf
}
}
impl Client {
pub fn new(sdk_config: &::aws_types::sdk_config::SdkConfig) -> Self {
Self::from_conf(sdk_config.into())
}
pub fn from_conf(conf: crate::Config) -> Self {
let retry_config = conf
.retry_config()
.cloned()
.unwrap_or_else(::aws_smithy_types::retry::RetryConfig::disabled);
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(::aws_smithy_types::timeout::TimeoutConfig::disabled);
let sleep_impl = conf.sleep_impl();
if (retry_config.has_retry() || timeout_config.has_timeouts()) && sleep_impl.is_none() {
panic!("An async sleep implementation is required for retries or timeouts to work. \
Set the `sleep_impl` on the Config passed into this function to fix this panic.");
}
let connector = conf.http_connector().and_then(|c| {
let timeout_config = conf
.timeout_config()
.cloned()
.unwrap_or_else(::aws_smithy_types::timeout::TimeoutConfig::disabled);
let connector_settings =
::aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
);
c.connector(&connector_settings, conf.sleep_impl())
});
let builder = ::aws_smithy_client::Builder::new();
let builder = match connector {
Some(c) => builder.connector(c),
None => {
#[cfg(any(feature = "rustls", feature = "native-tls"))]
{
builder.dyn_https_connector(
::aws_smithy_client::http_connector::ConnectorSettings::from_timeout_config(
&timeout_config,
),
)
}
#[cfg(not(any(feature = "rustls", feature = "native-tls")))]
{
panic!("No HTTP connector was available. Enable the `rustls` or `native-tls` crate feature or set a connector to fix this.");
}
}
};
let mut builder = builder
.middleware(::aws_smithy_client::erase::DynMiddleware::new(
crate::middleware::DefaultMiddleware::new(),
))
.reconnect_mode(retry_config.reconnect_mode())
.retry_config(retry_config.into())
.operation_timeout_config(timeout_config.into());
builder.set_sleep_impl(sleep_impl);
let client = builder.build();
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
}
mod create_app;
mod create_campaign;
mod create_email_template;
mod create_export_job;
mod create_import_job;
mod create_in_app_template;
mod create_journey;
mod create_push_template;
mod create_recommender_configuration;
mod create_segment;
mod create_sms_template;
mod create_voice_template;
pub mod customize;
mod delete_adm_channel;
mod delete_apns_channel;
mod delete_apns_sandbox_channel;
mod delete_apns_voip_channel;
mod delete_apns_voip_sandbox_channel;
mod delete_app;
mod delete_baidu_channel;
mod delete_campaign;
mod delete_email_channel;
mod delete_email_template;
mod delete_endpoint;
mod delete_event_stream;
mod delete_gcm_channel;
mod delete_in_app_template;
mod delete_journey;
mod delete_push_template;
mod delete_recommender_configuration;
mod delete_segment;
mod delete_sms_channel;
mod delete_sms_template;
mod delete_user_endpoints;
mod delete_voice_channel;
mod delete_voice_template;
mod get_adm_channel;
mod get_apns_channel;
mod get_apns_sandbox_channel;
mod get_apns_voip_channel;
mod get_apns_voip_sandbox_channel;
mod get_app;
mod get_application_date_range_kpi;
mod get_application_settings;
mod get_apps;
mod get_baidu_channel;
mod get_campaign;
mod get_campaign_activities;
mod get_campaign_date_range_kpi;
mod get_campaign_version;
mod get_campaign_versions;
mod get_campaigns;
mod get_channels;
mod get_email_channel;
mod get_email_template;
mod get_endpoint;
mod get_event_stream;
mod get_export_job;
mod get_export_jobs;
mod get_gcm_channel;
mod get_import_job;
mod get_import_jobs;
mod get_in_app_messages;
mod get_in_app_template;
mod get_journey;
mod get_journey_date_range_kpi;
mod get_journey_execution_activity_metrics;
mod get_journey_execution_metrics;
mod get_journey_run_execution_activity_metrics;
mod get_journey_run_execution_metrics;
mod get_journey_runs;
mod get_push_template;
mod get_recommender_configuration;
mod get_recommender_configurations;
mod get_segment;
mod get_segment_export_jobs;
mod get_segment_import_jobs;
mod get_segment_version;
mod get_segment_versions;
mod get_segments;
mod get_sms_channel;
mod get_sms_template;
mod get_user_endpoints;
mod get_voice_channel;
mod get_voice_template;
mod list_journeys;
mod list_tags_for_resource;
mod list_template_versions;
mod list_templates;
mod phone_number_validate;
mod put_event_stream;
mod put_events;
mod remove_attributes;
mod send_messages;
mod send_otp_message;
mod send_users_messages;
mod tag_resource;
mod untag_resource;
mod update_adm_channel;
mod update_apns_channel;
mod update_apns_sandbox_channel;
mod update_apns_voip_channel;
mod update_apns_voip_sandbox_channel;
mod update_application_settings;
mod update_baidu_channel;
mod update_campaign;
mod update_email_channel;
mod update_email_template;
mod update_endpoint;
mod update_endpoints_batch;
mod update_gcm_channel;
mod update_in_app_template;
mod update_journey;
mod update_journey_state;
mod update_push_template;
mod update_recommender_configuration;
mod update_segment;
mod update_sms_channel;
mod update_sms_template;
mod update_template_active_version;
mod update_voice_channel;
mod update_voice_template;
mod verify_otp_message;