Struct aws_sdk_oam::client::Client
source · pub struct Client { /* private fields */ }
Expand description
Client for CloudWatch Observability Access Manager
Client for invoking operations on CloudWatch Observability Access Manager. Each operation on CloudWatch Observability Access Manager is a method on this
this struct. .send()
MUST be invoked on the generated operations to dispatch the request to the service.
§Constructing a Client
A Config
is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env()
, since this will resolve an SdkConfig
which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env()
instead, which returns a ConfigLoader
that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_oam::Client::new(&config);
Occasionally, SDKs may have additional service-specific values that can be set on the Config
that
is absent from SdkConfig
, or slightly different settings for a specific client may be desired.
The Config
struct implements From<&SdkConfig>
, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_oam::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();
See the aws-config
docs and Config
for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
§Using the Client
A client has a function for every operation that can be performed by the service.
For example, the CreateLink
operation has
a Client::create_link
, function which returns a builder for that operation.
The fluent builder ultimately has a send()
function that returns an async future that
returns a result, as illustrated below:
let result = client.create_link()
.label_template("example")
.send()
.await;
The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize
module for more
information.
Implementations§
source§impl Client
impl Client
sourcepub fn create_link(&self) -> CreateLinkFluentBuilder
pub fn create_link(&self) -> CreateLinkFluentBuilder
Constructs a fluent builder for the CreateLink
operation.
- The fluent builder is configurable:
label_template(impl Into<String>)
/set_label_template(Option<String>)
:
required: trueSpecify a friendly human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.
You can use a custom label or use the following variables:
-
$AccountName
is the name of the account -
$AccountEmail
is the globally unique email address of the account -
$AccountEmailNoDomain
is the email address of the account without the domain name
-
resource_types(ResourceType)
/set_resource_types(Option<Vec::<ResourceType>>)
:
required: trueAn array of strings that define which types of data that the source account shares with the monitoring account.
sink_identifier(impl Into<String>)
/set_sink_identifier(Option<String>)
:
required: trueThe ARN of the sink to use to create this link. You can use ListSinks to find the ARNs of sinks.
For more information about sinks, see CreateSink.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: falseAssigns one or more tags (key-value pairs) to the link.
Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.
For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags.
link_configuration(LinkConfiguration)
/set_link_configuration(Option<LinkConfiguration>)
:
required: falseUse this structure to optionally create filters that specify that only some metric namespaces or log groups are to be shared from the source account to the monitoring account.
- On success, responds with
CreateLinkOutput
with field(s):arn(Option<String>)
:The ARN of the link that is newly created.
id(Option<String>)
:The random ID string that Amazon Web Services generated as part of the link ARN.
label(Option<String>)
:The label that you assigned to this link. If the
labelTemplate
includes variables, this field displays the variables resolved to their actual values.label_template(Option<String>)
:The exact label template that you specified, with the variables not resolved.
resource_types(Option<Vec::<String>>)
:The resource types supported by this link.
sink_arn(Option<String>)
:The ARN of the sink that is used for this link.
tags(Option<HashMap::<String, String>>)
:The tags assigned to the link.
link_configuration(Option<LinkConfiguration>)
:This structure includes filters that specify which metric namespaces and which log groups are shared from the source account to the monitoring account.
- On failure, responds with
SdkError<CreateLinkError>
source§impl Client
impl Client
sourcepub fn create_sink(&self) -> CreateSinkFluentBuilder
pub fn create_sink(&self) -> CreateSinkFluentBuilder
Constructs a fluent builder for the CreateSink
operation.
- The fluent builder is configurable:
name(impl Into<String>)
/set_name(Option<String>)
:
required: trueA name for the sink.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: falseAssigns one or more tags (key-value pairs) to the link.
Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.
For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags.
- On success, responds with
CreateSinkOutput
with field(s):arn(Option<String>)
:The ARN of the sink that is newly created.
id(Option<String>)
:The random ID string that Amazon Web Services generated as part of the sink ARN.
name(Option<String>)
:The name of the sink.
tags(Option<HashMap::<String, String>>)
:The tags assigned to the sink.
- On failure, responds with
SdkError<CreateSinkError>
source§impl Client
impl Client
sourcepub fn delete_link(&self) -> DeleteLinkFluentBuilder
pub fn delete_link(&self) -> DeleteLinkFluentBuilder
Constructs a fluent builder for the DeleteLink
operation.
- The fluent builder is configurable:
identifier(impl Into<String>)
/set_identifier(Option<String>)
:
required: trueThe ARN of the link to delete.
- On success, responds with
DeleteLinkOutput
- On failure, responds with
SdkError<DeleteLinkError>
source§impl Client
impl Client
sourcepub fn delete_sink(&self) -> DeleteSinkFluentBuilder
pub fn delete_sink(&self) -> DeleteSinkFluentBuilder
Constructs a fluent builder for the DeleteSink
operation.
- The fluent builder is configurable:
identifier(impl Into<String>)
/set_identifier(Option<String>)
:
required: trueThe ARN of the sink to delete.
- On success, responds with
DeleteSinkOutput
- On failure, responds with
SdkError<DeleteSinkError>
source§impl Client
impl Client
sourcepub fn get_link(&self) -> GetLinkFluentBuilder
pub fn get_link(&self) -> GetLinkFluentBuilder
Constructs a fluent builder for the GetLink
operation.
- The fluent builder is configurable:
identifier(impl Into<String>)
/set_identifier(Option<String>)
:
required: trueThe ARN of the link to retrieve information for.
- On success, responds with
GetLinkOutput
with field(s):arn(Option<String>)
:The ARN of the link.
id(Option<String>)
:The random ID string that Amazon Web Services generated as part of the link ARN.
label(Option<String>)
:The label that you assigned to this link, with the variables resolved to their actual values.
label_template(Option<String>)
:The exact label template that was specified when the link was created, with the template variables not resolved.
resource_types(Option<Vec::<String>>)
:The resource types supported by this link.
sink_arn(Option<String>)
:The ARN of the sink that is used for this link.
tags(Option<HashMap::<String, String>>)
:The tags assigned to the link.
link_configuration(Option<LinkConfiguration>)
:This structure includes filters that specify which metric namespaces and which log groups are shared from the source account to the monitoring account.
- On failure, responds with
SdkError<GetLinkError>
source§impl Client
impl Client
sourcepub fn get_sink(&self) -> GetSinkFluentBuilder
pub fn get_sink(&self) -> GetSinkFluentBuilder
Constructs a fluent builder for the GetSink
operation.
- The fluent builder is configurable:
identifier(impl Into<String>)
/set_identifier(Option<String>)
:
required: trueThe ARN of the sink to retrieve information for.
- On success, responds with
GetSinkOutput
with field(s):arn(Option<String>)
:The ARN of the sink.
id(Option<String>)
:The random ID string that Amazon Web Services generated as part of the sink ARN.
name(Option<String>)
:The name of the sink.
tags(Option<HashMap::<String, String>>)
:The tags assigned to the sink.
- On failure, responds with
SdkError<GetSinkError>
source§impl Client
impl Client
sourcepub fn get_sink_policy(&self) -> GetSinkPolicyFluentBuilder
pub fn get_sink_policy(&self) -> GetSinkPolicyFluentBuilder
Constructs a fluent builder for the GetSinkPolicy
operation.
- The fluent builder is configurable:
sink_identifier(impl Into<String>)
/set_sink_identifier(Option<String>)
:
required: trueThe ARN of the sink to retrieve the policy of.
- On success, responds with
GetSinkPolicyOutput
with field(s):sink_arn(Option<String>)
:The ARN of the sink.
sink_id(Option<String>)
:The random ID string that Amazon Web Services generated as part of the sink ARN.
policy(Option<String>)
:The policy that you specified, in JSON format.
- On failure, responds with
SdkError<GetSinkPolicyError>
source§impl Client
impl Client
sourcepub fn list_attached_links(&self) -> ListAttachedLinksFluentBuilder
pub fn list_attached_links(&self) -> ListAttachedLinksFluentBuilder
Constructs a fluent builder for the ListAttachedLinks
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseLimits the number of returned links to the specified number.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token for the next set of items to return. You received this token from a previous call.
sink_identifier(impl Into<String>)
/set_sink_identifier(Option<String>)
:
required: trueThe ARN of the sink that you want to retrieve links for.
- On success, responds with
ListAttachedLinksOutput
with field(s):items(Vec::<ListAttachedLinksItem>)
:An array of structures that contain the information about the attached links.
next_token(Option<String>)
:The token to use when requesting the next set of links.
- On failure, responds with
SdkError<ListAttachedLinksError>
source§impl Client
impl Client
sourcepub fn list_links(&self) -> ListLinksFluentBuilder
pub fn list_links(&self) -> ListLinksFluentBuilder
Constructs a fluent builder for the ListLinks
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseLimits the number of returned links to the specified number.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token for the next set of items to return. You received this token from a previous call.
- On success, responds with
ListLinksOutput
with field(s):items(Vec::<ListLinksItem>)
:An array of structures that contain the information about the returned links.
next_token(Option<String>)
:The token to use when requesting the next set of links.
- On failure, responds with
SdkError<ListLinksError>
source§impl Client
impl Client
sourcepub fn list_sinks(&self) -> ListSinksFluentBuilder
pub fn list_sinks(&self) -> ListSinksFluentBuilder
Constructs a fluent builder for the ListSinks
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseLimits the number of returned links to the specified number.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token for the next set of items to return. You received this token from a previous call.
- On success, responds with
ListSinksOutput
with field(s):items(Vec::<ListSinksItem>)
:An array of structures that contain the information about the returned sinks.
next_token(Option<String>)
:The token to use when requesting the next set of sinks.
- On failure, responds with
SdkError<ListSinksError>
source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe ARN of the resource that you want to view tags for.
The ARN format of a sink is
arn:aws:oam:Region:account-id:sink/sink-id
The ARN format of a link is
arn:aws:oam:Region:account-id:link/link-id
For more information about ARN format, see CloudWatch Logs resources and operations.
Unlike tagging permissions in other Amazon Web Services services, to retrieve the list of tags for links or sinks you must have the
oam:RequestTag
permission. Theaws:ReguestTag
permission does not allow you to tag and untag links and sinks.
- On success, responds with
ListTagsForResourceOutput
with field(s):tags(Option<HashMap::<String, String>>)
:The list of tags associated with the requested resource.>
- On failure, responds with
SdkError<ListTagsForResourceError>
source§impl Client
impl Client
sourcepub fn put_sink_policy(&self) -> PutSinkPolicyFluentBuilder
pub fn put_sink_policy(&self) -> PutSinkPolicyFluentBuilder
Constructs a fluent builder for the PutSinkPolicy
operation.
- The fluent builder is configurable:
sink_identifier(impl Into<String>)
/set_sink_identifier(Option<String>)
:
required: trueThe ARN of the sink to attach this policy to.
policy(impl Into<String>)
/set_policy(Option<String>)
:
required: trueThe JSON policy to use. If you are updating an existing policy, the entire existing policy is replaced by what you specify here.
The policy must be in JSON string format with quotation marks escaped and no newlines.
For examples of different types of policies, see the Examples section on this page.
- On success, responds with
PutSinkPolicyOutput
with field(s):sink_arn(Option<String>)
:The ARN of the sink.
sink_id(Option<String>)
:The random ID string that Amazon Web Services generated as part of the sink ARN.
policy(Option<String>)
:The policy that you specified.
- On failure, responds with
SdkError<PutSinkPolicyError>
source§impl Client
impl Client
sourcepub fn tag_resource(&self) -> TagResourceFluentBuilder
pub fn tag_resource(&self) -> TagResourceFluentBuilder
Constructs a fluent builder for the TagResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe ARN of the resource that you’re adding tags to.
The ARN format of a sink is
arn:aws:oam:Region:account-id:sink/sink-id
The ARN format of a link is
arn:aws:oam:Region:account-id:link/link-id
For more information about ARN format, see CloudWatch Logs resources and operations.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: trueThe list of key-value pairs to associate with the resource.
- On success, responds with
TagResourceOutput
- On failure, responds with
SdkError<TagResourceError>
source§impl Client
impl Client
sourcepub fn untag_resource(&self) -> UntagResourceFluentBuilder
pub fn untag_resource(&self) -> UntagResourceFluentBuilder
Constructs a fluent builder for the UntagResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe ARN of the resource that you’re removing tags from.
The ARN format of a sink is
arn:aws:oam:Region:account-id:sink/sink-id
The ARN format of a link is
arn:aws:oam:Region:account-id:link/link-id
For more information about ARN format, see CloudWatch Logs resources and operations.
tag_keys(impl Into<String>)
/set_tag_keys(Option<Vec::<String>>)
:
required: trueThe list of tag keys to remove from the resource.
- On success, responds with
UntagResourceOutput
- On failure, responds with
SdkError<UntagResourceError>
source§impl Client
impl Client
sourcepub fn update_link(&self) -> UpdateLinkFluentBuilder
pub fn update_link(&self) -> UpdateLinkFluentBuilder
Constructs a fluent builder for the UpdateLink
operation.
- The fluent builder is configurable:
identifier(impl Into<String>)
/set_identifier(Option<String>)
:
required: trueThe ARN of the link that you want to update.
resource_types(ResourceType)
/set_resource_types(Option<Vec::<ResourceType>>)
:
required: trueAn array of strings that define which types of data that the source account will send to the monitoring account.
Your input here replaces the current set of data types that are shared.
link_configuration(LinkConfiguration)
/set_link_configuration(Option<LinkConfiguration>)
:
required: falseUse this structure to filter which metric namespaces and which log groups are to be shared from the source account to the monitoring account.
- On success, responds with
UpdateLinkOutput
with field(s):arn(Option<String>)
:The ARN of the link that you have updated.
id(Option<String>)
:The random ID string that Amazon Web Services generated as part of the sink ARN.
label(Option<String>)
:The label assigned to this link, with the variables resolved to their actual values.
label_template(Option<String>)
:The exact label template that was specified when the link was created, with the template variables not resolved.
resource_types(Option<Vec::<String>>)
:The resource types now supported by this link.
sink_arn(Option<String>)
:The ARN of the sink that is used for this link.
tags(Option<HashMap::<String, String>>)
:The tags assigned to the link.
link_configuration(Option<LinkConfiguration>)
:This structure includes filters that specify which metric namespaces and which log groups are shared from the source account to the monitoring account.
- On failure, responds with
SdkError<UpdateLinkError>
source§impl Client
impl Client
sourcepub fn from_conf(conf: Config) -> Self
pub fn from_conf(conf: Config) -> Self
Creates a new client from the service Config
.
§Panics
This method will panic in the following cases:
- Retries or timeouts are enabled without a
sleep_impl
configured. - Identity caching is enabled without a
sleep_impl
andtime_source
configured. - No
behavior_version
is provided.
The panic message for each of these will have instructions on how to resolve them.
source§impl Client
impl Client
sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
§Panics
- This method will panic if the
sdk_config
is missing an async sleep implementation. If you experience this panic, set thesleep_impl
on the Config passed into this function to fix it. - This method will panic if the
sdk_config
is missing an HTTP connector. If you experience this panic, set thehttp_connector
on the Config passed into this function to fix it. - This method will panic if no
BehaviorVersion
is provided. If you experience this panic, setbehavior_version
on the Config or enable thebehavior-version-latest
Cargo feature.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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> 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