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_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
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for AwsUserAgent
impl Debug for AwsUserAgent
source§impl Storable for AwsUserAgent
impl Storable for AwsUserAgent
§type Storer = StoreReplace<AwsUserAgent>
type Storer = StoreReplace<AwsUserAgent>
Specify how an item is stored in the config bag, e.g.
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
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>
Creates a shared type from an unshared type.