Struct aws_sdk_cloudhsmv2::Client
source · pub struct Client { /* private fields */ }Expand description
Client for AWS CloudHSM V2
Client for invoking operations on AWS CloudHSM V2. Each operation on AWS CloudHSM V2 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_cloudhsmv2::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_cloudhsmv2::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 CopyBackupToRegion operation has
a Client::copy_backup_to_region, 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.copy_backup_to_region()
.destination_region("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 copy_backup_to_region(&self) -> CopyBackupToRegionFluentBuilder
pub fn copy_backup_to_region(&self) -> CopyBackupToRegionFluentBuilder
Constructs a fluent builder for the CopyBackupToRegion operation.
- The fluent builder is configurable:
destination_region(impl Into<String>)/set_destination_region(Option<String>):
required: trueThe AWS region that will contain your copied CloudHSM cluster backup.
backup_id(impl Into<String>)/set_backup_id(Option<String>):
required: trueThe ID of the backup that will be copied to the destination region.
tag_list(Tag)/set_tag_list(Option<Vec::<Tag>>):
required: falseTags to apply to the destination backup during creation. If you specify tags, only these tags will be applied to the destination backup. If you do not specify tags, the service copies tags from the source backup to the destination backup.
- On success, responds with
CopyBackupToRegionOutputwith field(s):destination_backup(Option<DestinationBackup>):Information on the backup that will be copied to the destination region, including CreateTimestamp, SourceBackup, SourceCluster, and Source Region. CreateTimestamp of the destination backup will be the same as that of the source backup.
You will need to use the
sourceBackupIDreturned in this operation to use theDescribeBackupsoperation on the backup that will be copied to the destination region.
- On failure, responds with
SdkError<CopyBackupToRegionError>
source§impl Client
impl Client
sourcepub fn create_cluster(&self) -> CreateClusterFluentBuilder
pub fn create_cluster(&self) -> CreateClusterFluentBuilder
Constructs a fluent builder for the CreateCluster operation.
- The fluent builder is configurable:
backup_retention_policy(BackupRetentionPolicy)/set_backup_retention_policy(Option<BackupRetentionPolicy>):
required: falseA policy that defines how the service retains backups.
hsm_type(impl Into<String>)/set_hsm_type(Option<String>):
required: trueThe type of HSM to use in the cluster. The allowed values are
hsm1.mediumandhsm2m.medium.source_backup_id(impl Into<String>)/set_source_backup_id(Option<String>):
required: falseThe identifier (ID) or the Amazon Resource Name (ARN) of the cluster backup to restore. Use this value to restore the cluster from a backup instead of creating a new cluster. To find the backup ID or ARN, use
DescribeBackups. If using a backup in another account, the full ARN must be supplied.subnet_ids(impl Into<String>)/set_subnet_ids(Option<Vec::<String>>):
required: trueThe identifiers (IDs) of the subnets where you are creating the cluster. You must specify at least one subnet. If you specify multiple subnets, they must meet the following criteria:
-
All subnets must be in the same virtual private cloud (VPC).
-
You can specify only one subnet per Availability Zone.
-
tag_list(Tag)/set_tag_list(Option<Vec::<Tag>>):
required: falseTags to apply to the CloudHSM cluster during creation.
mode(ClusterMode)/set_mode(Option<ClusterMode>):
required: falseThe mode to use in the cluster. The allowed values are
FIPSandNON_FIPS.
- On success, responds with
CreateClusterOutputwith field(s):cluster(Option<Cluster>):Information about the cluster that was created.
- On failure, responds with
SdkError<CreateClusterError>
source§impl Client
impl Client
sourcepub fn create_hsm(&self) -> CreateHsmFluentBuilder
pub fn create_hsm(&self) -> CreateHsmFluentBuilder
Constructs a fluent builder for the CreateHsm operation.
- The fluent builder is configurable:
cluster_id(impl Into<String>)/set_cluster_id(Option<String>):
required: trueThe identifier (ID) of the HSM’s cluster. To find the cluster ID, use
DescribeClusters.availability_zone(impl Into<String>)/set_availability_zone(Option<String>):
required: trueThe Availability Zone where you are creating the HSM. To find the cluster’s Availability Zones, use
DescribeClusters.ip_address(impl Into<String>)/set_ip_address(Option<String>):
required: falseThe HSM’s IP address. If you specify an IP address, use an available address from the subnet that maps to the Availability Zone where you are creating the HSM. If you don’t specify an IP address, one is chosen for you from that subnet.
- On success, responds with
CreateHsmOutputwith field(s):hsm(Option<Hsm>):Information about the HSM that was created.
- On failure, responds with
SdkError<CreateHsmError>
source§impl Client
impl Client
sourcepub fn delete_backup(&self) -> DeleteBackupFluentBuilder
pub fn delete_backup(&self) -> DeleteBackupFluentBuilder
Constructs a fluent builder for the DeleteBackup operation.
- The fluent builder is configurable:
backup_id(impl Into<String>)/set_backup_id(Option<String>):
required: trueThe ID of the backup to be deleted. To find the ID of a backup, use the
DescribeBackupsoperation.
- On success, responds with
DeleteBackupOutputwith field(s):backup(Option<Backup>):Information on the
Backupobject deleted.
- On failure, responds with
SdkError<DeleteBackupError>
source§impl Client
impl Client
sourcepub fn delete_cluster(&self) -> DeleteClusterFluentBuilder
pub fn delete_cluster(&self) -> DeleteClusterFluentBuilder
Constructs a fluent builder for the DeleteCluster operation.
- The fluent builder is configurable:
cluster_id(impl Into<String>)/set_cluster_id(Option<String>):
required: trueThe identifier (ID) of the cluster that you are deleting. To find the cluster ID, use
DescribeClusters.
- On success, responds with
DeleteClusterOutputwith field(s):cluster(Option<Cluster>):Information about the cluster that was deleted.
- On failure, responds with
SdkError<DeleteClusterError>
source§impl Client
impl Client
sourcepub fn delete_hsm(&self) -> DeleteHsmFluentBuilder
pub fn delete_hsm(&self) -> DeleteHsmFluentBuilder
Constructs a fluent builder for the DeleteHsm operation.
- The fluent builder is configurable:
cluster_id(impl Into<String>)/set_cluster_id(Option<String>):
required: trueThe identifier (ID) of the cluster that contains the HSM that you are deleting.
hsm_id(impl Into<String>)/set_hsm_id(Option<String>):
required: falseThe identifier (ID) of the HSM that you are deleting.
eni_id(impl Into<String>)/set_eni_id(Option<String>):
required: falseThe identifier (ID) of the elastic network interface (ENI) of the HSM that you are deleting.
eni_ip(impl Into<String>)/set_eni_ip(Option<String>):
required: falseThe IP address of the elastic network interface (ENI) of the HSM that you are deleting.
- On success, responds with
DeleteHsmOutputwith field(s):hsm_id(Option<String>):The identifier (ID) of the HSM that was deleted.
- On failure, responds with
SdkError<DeleteHsmError>
source§impl Client
impl Client
sourcepub fn delete_resource_policy(&self) -> DeleteResourcePolicyFluentBuilder
pub fn delete_resource_policy(&self) -> DeleteResourcePolicyFluentBuilder
Constructs a fluent builder for the DeleteResourcePolicy operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)/set_resource_arn(Option<String>):
required: falseAmazon Resource Name (ARN) of the resource from which the policy will be removed.
- On success, responds with
DeleteResourcePolicyOutputwith field(s):resource_arn(Option<String>):Amazon Resource Name (ARN) of the resource from which the policy was deleted.
policy(Option<String>):The policy previously attached to the resource.
- On failure, responds with
SdkError<DeleteResourcePolicyError>
source§impl Client
impl Client
sourcepub fn describe_backups(&self) -> DescribeBackupsFluentBuilder
pub fn describe_backups(&self) -> DescribeBackupsFluentBuilder
Constructs a fluent builder for the DescribeBackups 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
NextTokenvalue that you received in the previous response. Use this value to get more backups.max_results(i32)/set_max_results(Option<i32>):
required: falseThe maximum number of backups to return in the response. When there are more backups than the number you specify, the response contains a
NextTokenvalue.filters(impl Into<String>, Vec::<String>)/set_filters(Option<HashMap::<String, Vec::<String>>>):
required: falseOne or more filters to limit the items returned in the response.
Use the
backupIdsfilter to return only the specified backups. Specify backups by their backup identifier (ID).Use the
sourceBackupIdsfilter to return only the backups created from a source backup. ThesourceBackupIDof a source backup is returned by theCopyBackupToRegionoperation.Use the
clusterIdsfilter to return only the backups for the specified clusters. Specify clusters by their cluster identifier (ID).Use the
statesfilter to return only backups that match the specified state.Use the
neverExpiresfilter to return backups filtered by the value in theneverExpiresparameter.Truereturns all backups exempt from the backup retention policy.Falsereturns all backups with a backup retention policy defined at the cluster.shared(bool)/set_shared(Option<bool>):
required: falseDescribe backups that are shared with you.
By default when using this option, the command returns backups that have been shared using a standard Resource Access Manager resource share. In order for a backup that was shared using the PutResourcePolicy command to be returned, the share must be promoted to a standard resource share using the RAM PromoteResourceShareCreatedFromPolicy API operation. For more information about sharing backups, see Working with shared backups in the CloudHSM User Guide.
sort_ascending(bool)/set_sort_ascending(Option<bool>):
required: falseDesignates whether or not to sort the return backups by ascending chronological order of generation.
- On success, responds with
DescribeBackupsOutputwith field(s):backups(Option<Vec::<Backup>>):A list of backups.
next_token(Option<String>):An opaque string that indicates that the response contains only a subset of backups. Use this value in a subsequent
DescribeBackupsrequest to get more backups.
- On failure, responds with
SdkError<DescribeBackupsError>
source§impl Client
impl Client
sourcepub fn describe_clusters(&self) -> DescribeClustersFluentBuilder
pub fn describe_clusters(&self) -> DescribeClustersFluentBuilder
Constructs a fluent builder for the DescribeClusters operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
filters(impl Into<String>, Vec::<String>)/set_filters(Option<HashMap::<String, Vec::<String>>>):
required: falseOne or more filters to limit the items returned in the response.
Use the
clusterIdsfilter to return only the specified clusters. Specify clusters by their cluster identifier (ID).Use the
vpcIdsfilter to return only the clusters in the specified virtual private clouds (VPCs). Specify VPCs by their VPC identifier (ID).Use the
statesfilter to return only clusters that match the specified state.next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseThe
NextTokenvalue that you received in the previous response. Use this value to get more clusters.max_results(i32)/set_max_results(Option<i32>):
required: falseThe maximum number of clusters to return in the response. When there are more clusters than the number you specify, the response contains a
NextTokenvalue.
- On success, responds with
DescribeClustersOutputwith field(s):clusters(Option<Vec::<Cluster>>):A list of clusters.
next_token(Option<String>):An opaque string that indicates that the response contains only a subset of clusters. Use this value in a subsequent
DescribeClustersrequest to get more clusters.
- On failure, responds with
SdkError<DescribeClustersError>
source§impl Client
impl Client
sourcepub fn get_resource_policy(&self) -> GetResourcePolicyFluentBuilder
pub fn get_resource_policy(&self) -> GetResourcePolicyFluentBuilder
Constructs a fluent builder for the GetResourcePolicy operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)/set_resource_arn(Option<String>):
required: falseAmazon Resource Name (ARN) of the resource to which a policy is attached.
- On success, responds with
GetResourcePolicyOutputwith field(s):policy(Option<String>):The policy attached to a resource.
- On failure, responds with
SdkError<GetResourcePolicyError>
source§impl Client
impl Client
sourcepub fn initialize_cluster(&self) -> InitializeClusterFluentBuilder
pub fn initialize_cluster(&self) -> InitializeClusterFluentBuilder
Constructs a fluent builder for the InitializeCluster operation.
- The fluent builder is configurable:
cluster_id(impl Into<String>)/set_cluster_id(Option<String>):
required: trueThe identifier (ID) of the cluster that you are claiming. To find the cluster ID, use
DescribeClusters.signed_cert(impl Into<String>)/set_signed_cert(Option<String>):
required: trueThe cluster certificate issued (signed) by your issuing certificate authority (CA). The certificate must be in PEM format and can contain a maximum of 5000 characters.
trust_anchor(impl Into<String>)/set_trust_anchor(Option<String>):
required: trueThe issuing certificate of the issuing certificate authority (CA) that issued (signed) the cluster certificate. You must use a self-signed certificate. The certificate used to sign the HSM CSR must be directly available, and thus must be the root certificate. The certificate must be in PEM format and can contain a maximum of 5000 characters.
- On success, responds with
InitializeClusterOutputwith field(s):state(Option<ClusterState>):The cluster’s state.
state_message(Option<String>):A description of the cluster’s state.
- On failure, responds with
SdkError<InitializeClusterError>
source§impl Client
impl Client
Constructs a fluent builder for the ListTags operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
resource_id(impl Into<String>)/set_resource_id(Option<String>):
required: trueThe cluster identifier (ID) for the cluster whose tags you are getting. To find the cluster ID, use
DescribeClusters.next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseThe
NextTokenvalue that you received in the previous response. Use this value to get more tags.max_results(i32)/set_max_results(Option<i32>):
required: falseThe maximum number of tags to return in the response. When there are more tags than the number you specify, the response contains a
NextTokenvalue.
- On success, responds with
ListTagsOutputwith field(s):tag_list(Vec::<Tag>):A list of tags.
next_token(Option<String>):An opaque string that indicates that the response contains only a subset of tags. Use this value in a subsequent
ListTagsrequest to get more tags.
- On failure, responds with
SdkError<ListTagsError>
source§impl Client
impl Client
sourcepub fn modify_backup_attributes(&self) -> ModifyBackupAttributesFluentBuilder
pub fn modify_backup_attributes(&self) -> ModifyBackupAttributesFluentBuilder
Constructs a fluent builder for the ModifyBackupAttributes operation.
- The fluent builder is configurable:
backup_id(impl Into<String>)/set_backup_id(Option<String>):
required: trueThe identifier (ID) of the backup to modify. To find the ID of a backup, use the
DescribeBackupsoperation.never_expires(bool)/set_never_expires(Option<bool>):
required: trueSpecifies whether the service should exempt a backup from the retention policy for the cluster.
Trueexempts a backup from the retention policy.Falsemeans the service applies the backup retention policy defined at the cluster.
- On success, responds with
ModifyBackupAttributesOutputwith field(s):backup(Option<Backup>):Contains information about a backup of an CloudHSM cluster. All backup objects contain the
BackupId,BackupState,ClusterId, andCreateTimestampparameters. Backups that were copied into a destination region additionally contain theCopyTimestamp,SourceBackup,SourceCluster, andSourceRegionparameters. A backup that is pending deletion will include theDeleteTimestampparameter.
- On failure, responds with
SdkError<ModifyBackupAttributesError>
source§impl Client
impl Client
sourcepub fn modify_cluster(&self) -> ModifyClusterFluentBuilder
pub fn modify_cluster(&self) -> ModifyClusterFluentBuilder
Constructs a fluent builder for the ModifyCluster operation.
- The fluent builder is configurable:
backup_retention_policy(BackupRetentionPolicy)/set_backup_retention_policy(Option<BackupRetentionPolicy>):
required: trueA policy that defines how the service retains backups.
cluster_id(impl Into<String>)/set_cluster_id(Option<String>):
required: trueThe identifier (ID) of the cluster that you want to modify. To find the cluster ID, use
DescribeClusters.
- On success, responds with
ModifyClusterOutputwith field(s):cluster(Option<Cluster>):Contains information about an CloudHSM cluster.
- On failure, responds with
SdkError<ModifyClusterError>
source§impl Client
impl Client
sourcepub fn put_resource_policy(&self) -> PutResourcePolicyFluentBuilder
pub fn put_resource_policy(&self) -> PutResourcePolicyFluentBuilder
Constructs a fluent builder for the PutResourcePolicy operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)/set_resource_arn(Option<String>):
required: falseAmazon Resource Name (ARN) of the resource to which you want to attach a policy.
policy(impl Into<String>)/set_policy(Option<String>):
required: falseThe policy you want to associate with a resource.
For an example policy, see Working with shared backups in the CloudHSM User Guide
- On success, responds with
PutResourcePolicyOutputwith field(s):resource_arn(Option<String>):Amazon Resource Name (ARN) of the resource to which a policy is attached.
policy(Option<String>):The policy attached to a resource.
- On failure, responds with
SdkError<PutResourcePolicyError>
source§impl Client
impl Client
sourcepub fn restore_backup(&self) -> RestoreBackupFluentBuilder
pub fn restore_backup(&self) -> RestoreBackupFluentBuilder
Constructs a fluent builder for the RestoreBackup operation.
- The fluent builder is configurable:
backup_id(impl Into<String>)/set_backup_id(Option<String>):
required: trueThe ID of the backup to be restored. To find the ID of a backup, use the
DescribeBackupsoperation.
- On success, responds with
RestoreBackupOutputwith field(s):backup(Option<Backup>):Information on the
Backupobject created.
- On failure, responds with
SdkError<RestoreBackupError>
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_id(impl Into<String>)/set_resource_id(Option<String>):
required: trueThe cluster identifier (ID) for the cluster that you are tagging. To find the cluster ID, use
DescribeClusters.tag_list(Tag)/set_tag_list(Option<Vec::<Tag>>):
required: trueA list of one 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_id(impl Into<String>)/set_resource_id(Option<String>):
required: trueThe cluster identifier (ID) for the cluster whose tags you are removing. To find the cluster ID, use
DescribeClusters.tag_key_list(impl Into<String>)/set_tag_key_list(Option<Vec::<String>>):
required: trueA list of one or more tag keys for the tags that you are removing. Specify only the tag keys, not the tag values.
- On success, responds with
UntagResourceOutput - On failure, responds with
SdkError<UntagResourceError>
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> 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