Struct aws_runtime::user_agent::AwsUserAgent
source · pub struct AwsUserAgent { /* private fields */ }
Expand description
AWS User Agent
Ths struct should be inserted into the ConfigBag
during operation construction. The UserAgentInterceptor
reads AwsUserAgent
from the config bag and sets the User-Agent
and x-amz-user-agent
headers.
Implementations§
source§impl AwsUserAgent
impl AwsUserAgent
sourcepub fn new_from_environment(env: Env, api_metadata: ApiMetadata) -> Self
pub fn new_from_environment(env: Env, api_metadata: ApiMetadata) -> Self
Load a User Agent configuration from the environment
This utilizes BUILD_METADATA
from aws_types
to capture the Rust version & target platform. ApiMetadata
provides
the version & name of the specific service.
sourcepub fn for_tests() -> Self
pub fn for_tests() -> Self
For test purposes, construct an environment-independent User Agent
Without this, running CI on a different platform would produce different user agent strings
sourcepub fn with_additional_metadata(self, metadata: AdditionalMetadata) -> Self
pub fn with_additional_metadata(self, metadata: AdditionalMetadata) -> Self
Adds additional metadata to the user agent.
sourcepub fn add_additional_metadata(
&mut self,
metadata: AdditionalMetadata,
) -> &mut Self
pub fn add_additional_metadata( &mut self, metadata: AdditionalMetadata, ) -> &mut Self
Adds additional metadata to the user agent.
sourcepub fn with_app_name(self, app_name: AppName) -> Self
pub fn with_app_name(self, app_name: AppName) -> Self
Sets the app name for the user agent.
sourcepub fn set_app_name(&mut self, app_name: AppName) -> &mut Self
pub fn set_app_name(&mut self, app_name: AppName) -> &mut Self
Sets the app name for the user agent.
sourcepub fn aws_ua_header(&self) -> String
pub fn aws_ua_header(&self) -> String
Generate a new-style user agent style header
This header should be set at x-amz-user-agent
Trait Implementations§
source§impl Clone for AwsUserAgent
impl Clone for AwsUserAgent
source§fn clone(&self) -> AwsUserAgent
fn clone(&self) -> AwsUserAgent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AwsUserAgent
impl Debug for AwsUserAgent
source§impl Storable for AwsUserAgent
impl Storable for AwsUserAgent
source§type Storer = StoreReplace<AwsUserAgent>
type Storer = StoreReplace<AwsUserAgent>
StoreReplace
and StoreAppend
Auto Trait Implementations§
impl Freeze for AwsUserAgent
impl RefUnwindSafe for AwsUserAgent
impl Send for AwsUserAgent
impl Sync for AwsUserAgent
impl Unpin for AwsUserAgent
impl UnwindSafe for AwsUserAgent
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more