Struct aws_sdk_networkmonitor::client::Client
source · pub struct Client { /* private fields */ }Expand description
Client for Amazon CloudWatch Network Monitor
Client for invoking operations on Amazon CloudWatch Network Monitor. Each operation on Amazon CloudWatch Network Monitor 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_networkmonitor::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_networkmonitor::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 ListTagsForResource operation has
a Client::list_tags_for_resource, 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.list_tags_for_resource()
.resource_arn("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_monitor(&self) -> CreateMonitorFluentBuilder
pub fn create_monitor(&self) -> CreateMonitorFluentBuilder
Constructs a fluent builder for the CreateMonitor operation.
- The fluent builder is configurable:
monitor_name(impl Into<String>)/set_monitor_name(Option<String>):
required: trueThe name identifying the monitor. It can contain only letters, underscores (_), or dashes (-), and can be up to 200 characters.
probes(CreateMonitorProbeInput)/set_probes(Option<Vec::<CreateMonitorProbeInput>>):
required: falseDisplays a list of all of the probes created for a monitor.
aggregation_period(i64)/set_aggregation_period(Option<i64>):
required: falseThe time, in seconds, that metrics are aggregated and sent to Amazon CloudWatch. Valid values are either
30or60.60is the default if no period is chosen.client_token(impl Into<String>)/set_client_token(Option<String>):
required: falseUnique, case-sensitive identifier to ensure the idempotency of the request. Only returned if a client token was provided in the request.
tags(impl Into<String>, impl Into<String>)/set_tags(Option<HashMap::<String, String>>):
required: falseThe list of key-value pairs created and assigned to the monitor.
- On success, responds with
CreateMonitorOutputwith field(s):monitor_arn(String):The ARN of the monitor.
monitor_name(String):The name of the monitor.
state(MonitorState):The state of the monitor.
aggregation_period(Option<i64>):The number of seconds that metrics are aggregated by and sent to Amazon CloudWatch. This will be either
30or60.tags(Option<HashMap::<String, String>>):The list of key-value pairs assigned to the monitor.
- On failure, responds with
SdkError<CreateMonitorError>
source§impl Client
impl Client
sourcepub fn create_probe(&self) -> CreateProbeFluentBuilder
pub fn create_probe(&self) -> CreateProbeFluentBuilder
Constructs a fluent builder for the CreateProbe operation.
- The fluent builder is configurable:
monitor_name(impl Into<String>)/set_monitor_name(Option<String>):
required: trueThe name of the monitor to associated with the probe.
probe(ProbeInput)/set_probe(Option<ProbeInput>):
required: trueDescribes the details of an individual probe for a monitor.
client_token(impl Into<String>)/set_client_token(Option<String>):
required: falseUnique, case-sensitive identifier to ensure the idempotency of the request. Only returned if a client token was provided in the request.
tags(impl Into<String>, impl Into<String>)/set_tags(Option<HashMap::<String, String>>):
required: falseThe list of key-value pairs created and assigned to the probe.
- On success, responds with
CreateProbeOutputwith field(s):probe_id(Option<String>):The ID of the probe for which details are returned.
probe_arn(Option<String>):The ARN of the probe.
source_arn(String):The ARN of the probe.
destination(String):The destination IP address for the monitor. This must be either an IPv4 or IPv6 address.
destination_port(Option<i32>):The port associated with the
destination. This is required only if theprotocolisTCPand must be a number between1and65536.protocol(Protocol):The protocol used for the network traffic between the
sourceanddestination. This must be eitherTCPorICMP.packet_size(Option<i32>):The size of the packets sent between the source and destination. This must be a number between
56and8500.address_family(Option<AddressFamily>):Indicates whether the IP address is
IPV4orIPV6.vpc_id(Option<String>):The ID of the source VPC or subnet.
state(Option<ProbeState>):The state of the probe.
created_at(Option<DateTime>):The time and date that the probe was created.
modified_at(Option<DateTime>):The time and date when the probe was last modified.
tags(Option<HashMap::<String, String>>):The list of key-value pairs assigned to the probe.
- On failure, responds with
SdkError<CreateProbeError>
source§impl Client
impl Client
sourcepub fn delete_monitor(&self) -> DeleteMonitorFluentBuilder
pub fn delete_monitor(&self) -> DeleteMonitorFluentBuilder
Constructs a fluent builder for the DeleteMonitor operation.
- The fluent builder is configurable:
monitor_name(impl Into<String>)/set_monitor_name(Option<String>):
required: trueThe name of the monitor to delete.
- On success, responds with
DeleteMonitorOutput - On failure, responds with
SdkError<DeleteMonitorError>
source§impl Client
impl Client
sourcepub fn delete_probe(&self) -> DeleteProbeFluentBuilder
pub fn delete_probe(&self) -> DeleteProbeFluentBuilder
Constructs a fluent builder for the DeleteProbe operation.
- The fluent builder is configurable:
monitor_name(impl Into<String>)/set_monitor_name(Option<String>):
required: trueThe name of the monitor to delete.
probe_id(impl Into<String>)/set_probe_id(Option<String>):
required: trueThe ID of the probe to delete.
- On success, responds with
DeleteProbeOutput - On failure, responds with
SdkError<DeleteProbeError>
source§impl Client
impl Client
sourcepub fn get_monitor(&self) -> GetMonitorFluentBuilder
pub fn get_monitor(&self) -> GetMonitorFluentBuilder
Constructs a fluent builder for the GetMonitor operation.
- The fluent builder is configurable:
monitor_name(impl Into<String>)/set_monitor_name(Option<String>):
required: trueThe name of the monitor that details are returned for.
- On success, responds with
GetMonitorOutputwith field(s):monitor_arn(String):The ARN of the selected monitor.
monitor_name(String):The name of the monitor.
state(MonitorState):Lists the status of the
stateof each monitor.aggregation_period(i64):The aggregation period for the specified monitor.
tags(Option<HashMap::<String, String>>):The list of key-value pairs assigned to the monitor.
probes(Option<Vec::<Probe>>):The details about each probe associated with that monitor.
created_at(DateTime):The time and date when the monitor was created.
modified_at(DateTime):The time and date when the monitor was last modified.
- On failure, responds with
SdkError<GetMonitorError>
source§impl Client
impl Client
sourcepub fn get_probe(&self) -> GetProbeFluentBuilder
pub fn get_probe(&self) -> GetProbeFluentBuilder
Constructs a fluent builder for the GetProbe operation.
- The fluent builder is configurable:
monitor_name(impl Into<String>)/set_monitor_name(Option<String>):
required: trueThe name of the monitor associated with the probe. Run
ListMonitorsto get a list of monitor names.probe_id(impl Into<String>)/set_probe_id(Option<String>):
required: trueThe ID of the probe to get information about. Run
GetMonitoraction to get a list of probes and probe IDs for the monitor.
- On success, responds with
GetProbeOutputwith field(s):probe_id(Option<String>):The ID of the probe for which details are returned.
probe_arn(Option<String>):The ARN of the probe.
source_arn(String):The ARN of the probe.
destination(String):The destination IP address for the monitor. This must be either an IPv4 or IPv6 address.
destination_port(Option<i32>):The port associated with the
destination. This is required only if theprotocolisTCPand must be a number between1and65536.protocol(Protocol):The protocol used for the network traffic between the
sourceanddestination. This must be eitherTCPorICMP.packet_size(Option<i32>):The size of the packets sent between the source and destination. This must be a number between
56and8500.address_family(Option<AddressFamily>):Indicates whether the IP address is
IPV4orIPV6.vpc_id(Option<String>):The ID of the source VPC or subnet.
state(Option<ProbeState>):The state of the probe.
created_at(Option<DateTime>):The time and date that the probe was created.
modified_at(Option<DateTime>):The time and date that the probe was last modified.
tags(Option<HashMap::<String, String>>):The list of key-value pairs assigned to the probe.
- On failure, responds with
SdkError<GetProbeError>
source§impl Client
impl Client
sourcepub fn list_monitors(&self) -> ListMonitorsFluentBuilder
pub fn list_monitors(&self) -> ListMonitorsFluentBuilder
Constructs a fluent builder for the ListMonitors operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseThe token for the next page of results.
max_results(i32)/set_max_results(Option<i32>):
required: falseThe maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned
nextTokenvalue.If
MaxResultsis given a value larger than 100, only 100 results are returned.state(impl Into<String>)/set_state(Option<String>):
required: falseThe list of all monitors and their states.
- On success, responds with
ListMonitorsOutputwith field(s):monitors(Vec::<MonitorSummary>):Lists individual details about each of your monitors.
next_token(Option<String>):The token for the next page of results.
- On failure, responds with
SdkError<ListMonitorsError>
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
- On success, responds with
ListTagsForResourceOutputwith field(s):tags(Option<HashMap::<String, String>>):Lists the tags assigned to the resource.
- On failure, responds with
SdkError<ListTagsForResourceError>
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 monitor or probe to tag.
tags(impl Into<String>, impl Into<String>)/set_tags(Option<HashMap::<String, String>>):
required: trueThe list of key-value pairs assigned to the monitor or probe.
- 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 monitor or probe that the tag should be removed from.
tag_keys(impl Into<String>)/set_tag_keys(Option<Vec::<String>>):
required: trueThe key-value pa
- On success, responds with
UntagResourceOutput - On failure, responds with
SdkError<UntagResourceError>
source§impl Client
impl Client
sourcepub fn update_monitor(&self) -> UpdateMonitorFluentBuilder
pub fn update_monitor(&self) -> UpdateMonitorFluentBuilder
Constructs a fluent builder for the UpdateMonitor operation.
- The fluent builder is configurable:
monitor_name(impl Into<String>)/set_monitor_name(Option<String>):
required: trueThe name of the monitor to update.
aggregation_period(i64)/set_aggregation_period(Option<i64>):
required: trueThe aggregation time, in seconds, to change to. This must be either
30or60.
- On success, responds with
UpdateMonitorOutputwith field(s):monitor_arn(String):The ARN of the monitor that was updated.
monitor_name(String):The name of the monitor that was updated.
state(MonitorState):The state of the updated monitor.
aggregation_period(Option<i64>):The changed aggregation period.
tags(Option<HashMap::<String, String>>):The list of key-value pairs associated with the monitor.
- On failure, responds with
SdkError<UpdateMonitorError>
source§impl Client
impl Client
sourcepub fn update_probe(&self) -> UpdateProbeFluentBuilder
pub fn update_probe(&self) -> UpdateProbeFluentBuilder
Constructs a fluent builder for the UpdateProbe operation.
- The fluent builder is configurable:
monitor_name(impl Into<String>)/set_monitor_name(Option<String>):
required: trueThe name of the monitor that the probe was updated for.
probe_id(impl Into<String>)/set_probe_id(Option<String>):
required: trueThe ID of the probe to update.
state(ProbeState)/set_state(Option<ProbeState>):
required: falseThe state of the probe update.
destination(impl Into<String>)/set_destination(Option<String>):
required: falseThe updated IP address for the probe destination. This must be either an IPv4 or IPv6 address.
destination_port(i32)/set_destination_port(Option<i32>):
required: falseThe updated port for the probe destination. This is required only if the
protocolisTCPand must be a number between1and65536.protocol(Protocol)/set_protocol(Option<Protocol>):
required: falseThe updated network protocol for the destination. This can be either
TCPorICMP. If the protocol isTCP, thenportis also required.packet_size(i32)/set_packet_size(Option<i32>):
required: falsehe updated packets size for network traffic between the source and destination. This must be a number between
56and8500.
- On success, responds with
UpdateProbeOutputwith field(s):probe_id(Option<String>):The updated ID of the probe.
probe_arn(Option<String>):The updated ARN of the probe.
source_arn(String):The updated ARN of the source subnet.
destination(String):The updated destination IP address for the probe.
destination_port(Option<i32>):The updated destination port. This must be a number between
1and65536.protocol(Protocol):The updated protocol for the probe.
packet_size(Option<i32>):The updated packet size for the probe.
address_family(Option<AddressFamily>):The updated IP address family. This must be either
IPV4orIPV6.vpc_id(Option<String>):The updated ID of the source VPC subnet ID.
state(Option<ProbeState>):The state of the updated probe.
created_at(Option<DateTime>):The time and date that the probe was created.
modified_at(Option<DateTime>):The time and date that the probe was last updated.
tags(Option<HashMap::<String, String>>):Update tags for a probe.
- On failure, responds with
SdkError<UpdateProbeError>
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_implconfigured. - Identity caching is enabled without a
sleep_implandtime_sourceconfigured. - No
behavior_versionis 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_configis missing an async sleep implementation. If you experience this panic, set thesleep_implon the Config passed into this function to fix it. - This method will panic if the
sdk_configis missing an HTTP connector. If you experience this panic, set thehttp_connectoron the Config passed into this function to fix it. - This method will panic if no
BehaviorVersionis provided. If you experience this panic, setbehavior_versionon the Config or enable thebehavior-version-latestCargo 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