Struct aws_sdk_dlm::Client
source · pub struct Client { /* private fields */ }
Expand description
Client for Amazon Data Lifecycle Manager
Client for invoking operations on Amazon Data Lifecycle Manager. Each operation on Amazon Data Lifecycle 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_dlm::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 Builder
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_dlm::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 CreateLifecyclePolicy
operation has
a Client::create_lifecycle_policy
, 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_lifecycle_policy()
.execution_role_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_lifecycle_policy(&self) -> CreateLifecyclePolicyFluentBuilder
pub fn create_lifecycle_policy(&self) -> CreateLifecyclePolicyFluentBuilder
Constructs a fluent builder for the CreateLifecyclePolicy
operation.
- The fluent builder is configurable:
execution_role_arn(impl Into<String>)
/set_execution_role_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
description(impl Into<String>)
/set_description(Option<String>)
:
required: trueA description of the lifecycle policy. The characters ^[0-9A-Za-z _-]+$ are supported.
state(SettablePolicyStateValues)
/set_state(Option<SettablePolicyStateValues>)
:
required: trueThe activation state of the lifecycle policy after creation.
policy_details(PolicyDetails)
/set_policy_details(Option<PolicyDetails>)
:
required: falseThe configuration details of the lifecycle policy.
If you create a default policy, you can specify the request parameters either in the request body, or in the PolicyDetails request structure, but not both.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: falseThe tags to apply to the lifecycle policy during creation.
default_policy(DefaultPolicyTypeValues)
/set_default_policy(Option<DefaultPolicyTypeValues>)
:
required: false[Default policies only] Specify the type of default policy to create.
-
To create a default policy for EBS snapshots, that creates snapshots of all volumes in the Region that do not have recent backups, specify
VOLUME
. -
To create a default policy for EBS-backed AMIs, that creates EBS-backed AMIs from all instances in the Region that do not have recent backups, specify
INSTANCE
.
-
create_interval(i32)
/set_create_interval(Option<i32>)
:
required: false[Default policies only] Specifies how often the policy should run and create snapshots or AMIs. The creation frequency can range from 1 to 7 days. If you do not specify a value, the default is 1.
Default: 1
retain_interval(i32)
/set_retain_interval(Option<i32>)
:
required: false[Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them. The retention period can range from 2 to 14 days, but it must be greater than the creation frequency to ensure that the policy retains at least 1 snapshot or AMI at any given time. If you do not specify a value, the default is 7.
Default: 7
copy_tags(bool)
/set_copy_tags(Option<bool>)
:
required: false[Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI. If you do not specify a value, the default is
false
.Default: false
extend_deletion(bool)
/set_extend_deletion(Option<bool>)
:
required: false[Default policies only] Defines the snapshot or AMI retention behavior for the policy if the source volume or instance is deleted, or if the policy enters the error, disabled, or deleted state.
By default (ExtendDeletion=false):
-
If a source resource is deleted, Amazon Data Lifecycle Manager will continue to delete previously created snapshots or AMIs, up to but not including the last one, based on the specified retention period. If you want Amazon Data Lifecycle Manager to delete all snapshots or AMIs, including the last one, specify
true
. -
If a policy enters the error, disabled, or deleted state, Amazon Data Lifecycle Manager stops deleting snapshots and AMIs. If you want Amazon Data Lifecycle Manager to continue deleting snapshots or AMIs, including the last one, if the policy enters one of these states, specify
true
.
If you enable extended deletion (ExtendDeletion=true), you override both default behaviors simultaneously.
If you do not specify a value, the default is
false
.Default: false
-
cross_region_copy_targets(CrossRegionCopyTarget)
/set_cross_region_copy_targets(Option<Vec::<CrossRegionCopyTarget>>)
:
required: false[Default policies only] Specifies destination Regions for snapshot or AMI copies. You can specify up to 3 destination Regions. If you do not want to create cross-Region copies, omit this parameter.
exclusions(Exclusions)
/set_exclusions(Option<Exclusions>)
:
required: false[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs. The policy will not create snapshots or AMIs for target resources that match any of the specified exclusion parameters.
- On success, responds with
CreateLifecyclePolicyOutput
with field(s):policy_id(Option<String>)
:The identifier of the lifecycle policy.
- On failure, responds with
SdkError<CreateLifecyclePolicyError>
source§impl Client
impl Client
sourcepub fn delete_lifecycle_policy(&self) -> DeleteLifecyclePolicyFluentBuilder
pub fn delete_lifecycle_policy(&self) -> DeleteLifecyclePolicyFluentBuilder
Constructs a fluent builder for the DeleteLifecyclePolicy
operation.
- The fluent builder is configurable:
policy_id(impl Into<String>)
/set_policy_id(Option<String>)
:
required: trueThe identifier of the lifecycle policy.
- On success, responds with
DeleteLifecyclePolicyOutput
- On failure, responds with
SdkError<DeleteLifecyclePolicyError>
source§impl Client
impl Client
sourcepub fn get_lifecycle_policies(&self) -> GetLifecyclePoliciesFluentBuilder
pub fn get_lifecycle_policies(&self) -> GetLifecyclePoliciesFluentBuilder
Constructs a fluent builder for the GetLifecyclePolicies
operation.
- The fluent builder is configurable:
policy_ids(impl Into<String>)
/set_policy_ids(Option<Vec::<String>>)
:
required: falseThe identifiers of the data lifecycle policies.
state(GettablePolicyStateValues)
/set_state(Option<GettablePolicyStateValues>)
:
required: falseThe activation state.
resource_types(ResourceTypeValues)
/set_resource_types(Option<Vec::<ResourceTypeValues>>)
:
required: falseThe resource type.
target_tags(impl Into<String>)
/set_target_tags(Option<Vec::<String>>)
:
required: falseThe target tag for a policy.
Tags are strings in the format
key=value
.tags_to_add(impl Into<String>)
/set_tags_to_add(Option<Vec::<String>>)
:
required: falseThe tags to add to objects created by the policy.
Tags are strings in the format
key=value
.These user-defined tags are added in addition to the Amazon Web Services-added lifecycle tags.
default_policy_type(DefaultPoliciesTypeValues)
/set_default_policy_type(Option<DefaultPoliciesTypeValues>)
:
required: false[Default policies only] Specifies the type of default policy to get. Specify one of the following:
-
VOLUME
- To get only the default policy for EBS snapshots -
INSTANCE
- To get only the default policy for EBS-backed AMIs -
ALL
- To get all default policies
-
- On success, responds with
GetLifecyclePoliciesOutput
with field(s):policies(Option<Vec::<LifecyclePolicySummary>>)
:Summary information about the lifecycle policies.
- On failure, responds with
SdkError<GetLifecyclePoliciesError>
source§impl Client
impl Client
sourcepub fn get_lifecycle_policy(&self) -> GetLifecyclePolicyFluentBuilder
pub fn get_lifecycle_policy(&self) -> GetLifecyclePolicyFluentBuilder
Constructs a fluent builder for the GetLifecyclePolicy
operation.
- The fluent builder is configurable:
policy_id(impl Into<String>)
/set_policy_id(Option<String>)
:
required: trueThe identifier of the lifecycle policy.
- On success, responds with
GetLifecyclePolicyOutput
with field(s):policy(Option<LifecyclePolicy>)
:Detailed information about the lifecycle policy.
- On failure, responds with
SdkError<GetLifecyclePolicyError>
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 Amazon Resource Name (ARN) of the resource.
- On success, responds with
ListTagsForResourceOutput
with field(s):tags(Option<HashMap::<String, String>>)
:Information about the tags.
- 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 Amazon Resource Name (ARN) of the resource.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: trueOne or more tags.
- 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 Amazon Resource Name (ARN) of the resource.
tag_keys(impl Into<String>)
/set_tag_keys(Option<Vec::<String>>)
:
required: trueThe tag keys.
- On success, responds with
UntagResourceOutput
- On failure, responds with
SdkError<UntagResourceError>
source§impl Client
impl Client
sourcepub fn update_lifecycle_policy(&self) -> UpdateLifecyclePolicyFluentBuilder
pub fn update_lifecycle_policy(&self) -> UpdateLifecyclePolicyFluentBuilder
Constructs a fluent builder for the UpdateLifecyclePolicy
operation.
- The fluent builder is configurable:
policy_id(impl Into<String>)
/set_policy_id(Option<String>)
:
required: trueThe identifier of the lifecycle policy.
execution_role_arn(impl Into<String>)
/set_execution_role_arn(Option<String>)
:
required: falseThe Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
state(SettablePolicyStateValues)
/set_state(Option<SettablePolicyStateValues>)
:
required: falseThe desired activation state of the lifecycle policy after creation.
description(impl Into<String>)
/set_description(Option<String>)
:
required: falseA description of the lifecycle policy.
policy_details(PolicyDetails)
/set_policy_details(Option<PolicyDetails>)
:
required: falseThe configuration of the lifecycle policy. You cannot update the policy type or the resource type.
create_interval(i32)
/set_create_interval(Option<i32>)
:
required: false[Default policies only] Specifies how often the policy should run and create snapshots or AMIs. The creation frequency can range from 1 to 7 days.
retain_interval(i32)
/set_retain_interval(Option<i32>)
:
required: false[Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them. The retention period can range from 2 to 14 days, but it must be greater than the creation frequency to ensure that the policy retains at least 1 snapshot or AMI at any given time.
copy_tags(bool)
/set_copy_tags(Option<bool>)
:
required: false[Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.
extend_deletion(bool)
/set_extend_deletion(Option<bool>)
:
required: false[Default policies only] Defines the snapshot or AMI retention behavior for the policy if the source volume or instance is deleted, or if the policy enters the error, disabled, or deleted state.
By default (ExtendDeletion=false):
-
If a source resource is deleted, Amazon Data Lifecycle Manager will continue to delete previously created snapshots or AMIs, up to but not including the last one, based on the specified retention period. If you want Amazon Data Lifecycle Manager to delete all snapshots or AMIs, including the last one, specify
true
. -
If a policy enters the error, disabled, or deleted state, Amazon Data Lifecycle Manager stops deleting snapshots and AMIs. If you want Amazon Data Lifecycle Manager to continue deleting snapshots or AMIs, including the last one, if the policy enters one of these states, specify
true
.
If you enable extended deletion (ExtendDeletion=true), you override both default behaviors simultaneously.
Default: false
-
cross_region_copy_targets(CrossRegionCopyTarget)
/set_cross_region_copy_targets(Option<Vec::<CrossRegionCopyTarget>>)
:
required: false[Default policies only] Specifies destination Regions for snapshot or AMI copies. You can specify up to 3 destination Regions. If you do not want to create cross-Region copies, omit this parameter.
exclusions(Exclusions)
/set_exclusions(Option<Exclusions>)
:
required: false[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs. The policy will not create snapshots or AMIs for target resources that match any of the specified exclusion parameters.
- On success, responds with
UpdateLifecyclePolicyOutput
- On failure, responds with
SdkError<UpdateLifecyclePolicyError>
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> 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 moresource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightBlack
.
§Example
println!("{}", value.bright_black());
source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightGreen
.
§Example
println!("{}", value.bright_green());
source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightYellow
.
§Example
println!("{}", value.bright_yellow());
source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightMagenta
.
§Example
println!("{}", value.bright_magenta());
source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Returns self
with the
fg()
set to
Color::BrightWhite
.
§Example
println!("{}", value.bright_white());
source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightBlack
.
§Example
println!("{}", value.on_bright_black());
source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightGreen
.
§Example
println!("{}", value.on_bright_green());
source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightYellow
.
§Example
println!("{}", value.on_bright_yellow());
source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightBlue
.
§Example
println!("{}", value.on_bright_blue());
source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightMagenta
.
§Example
println!("{}", value.on_bright_magenta());
source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightCyan
.
§Example
println!("{}", value.on_bright_cyan());
source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Returns self
with the
bg()
set to
Color::BrightWhite
.
§Example
println!("{}", value.on_bright_white());
source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
source§fn underline(&self) -> Painted<&T>
fn underline(&self) -> Painted<&T>
Returns self
with the
attr()
set to
Attribute::Underline
.
§Example
println!("{}", value.underline());
source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Returns self
with the
attr()
set to
Attribute::RapidBlink
.
§Example
println!("{}", value.rapid_blink());
source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);