Struct aws_sdk_opsworkscm::Client

source ·
pub struct Client { /* private fields */ }
Expand description

Client for AWS OpsWorks CM

Client for invoking operations on AWS OpsWorks CM. Each operation on AWS OpsWorks CM 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_opsworkscm::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_opsworkscm::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 AssociateNode operation has a Client::associate_node, 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.associate_node()
    .server_name("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.

§Waiters

This client provides wait_until methods behind the Waiters trait. To use them, simply import the trait, and then call one of the wait_until methods. This will return a waiter fluent builder that takes various parameters, which are documented on the builder type. Once parameters have been provided, the wait method can be called to initiate waiting.

For example, if there was a wait_until_thing method, it could look like:

let result = client.wait_until_thing()
    .thing_id("someId")
    .wait(Duration::from_secs(120))
    .await;

Implementations§

source§

impl Client

source

pub fn associate_node(&self) -> AssociateNodeFluentBuilder

Constructs a fluent builder for the AssociateNode operation.

source§

impl Client

source

pub fn create_backup(&self) -> CreateBackupFluentBuilder

Constructs a fluent builder for the CreateBackup operation.

source§

impl Client

source

pub fn create_server(&self) -> CreateServerFluentBuilder

Constructs a fluent builder for the CreateServer operation.

  • The fluent builder is configurable:
    • associate_public_ip_address(bool) / set_associate_public_ip_address(Option<bool>):
      required: false

      Associate a public IP address with a server that you are launching. Valid values are true or false. The default value is true.


    • custom_domain(impl Into<String>) / set_custom_domain(Option<String>):
      required: false

      An optional public endpoint of a server, such as https://aws.my-company.com. To access the server, create a CNAME DNS record in your preferred DNS service that points the custom domain to the endpoint that is generated when the server is created (the value of the CreateServer Endpoint attribute). You cannot access the server by using the generated Endpoint value if the server is using a custom domain. If you specify a custom domain, you must also specify values for CustomCertificate and CustomPrivateKey.


    • custom_certificate(impl Into<String>) / set_custom_certificate(Option<String>):
      required: false

      A PEM-formatted HTTPS certificate. The value can be be a single, self-signed certificate, or a certificate chain. If you specify a custom certificate, you must also specify values for CustomDomain and CustomPrivateKey. The following are requirements for the CustomCertificate value:

      • You can provide either a self-signed, custom certificate, or the full certificate chain.

      • The certificate must be a valid X509 certificate, or a certificate chain in PEM format.

      • The certificate must be valid at the time of upload. A certificate can’t be used before its validity period begins (the certificate’s NotBefore date), or after it expires (the certificate’s NotAfter date).

      • The certificate’s common name or subject alternative names (SANs), if present, must match the value of CustomDomain.

      • The certificate must match the value of CustomPrivateKey.


    • custom_private_key(impl Into<String>) / set_custom_private_key(Option<String>):
      required: false

      A private key in PEM format for connecting to the server by using HTTPS. The private key must not be encrypted; it cannot be protected by a password or passphrase. If you specify a custom private key, you must also specify values for CustomDomain and CustomCertificate.


    • disable_automated_backup(bool) / set_disable_automated_backup(Option<bool>):
      required: false

      Enable or disable scheduled backups. Valid values are true or false. The default value is true.


    • engine(impl Into<String>) / set_engine(Option<String>):
      required: true

      The configuration management engine to use. Valid values include ChefAutomate and Puppet.


    • engine_model(impl Into<String>) / set_engine_model(Option<String>):
      required: false

      The engine model of the server. Valid values in this release include Monolithic for Puppet and Single for Chef.


    • engine_version(impl Into<String>) / set_engine_version(Option<String>):
      required: false

      The major release version of the engine that you want to use. For a Chef server, the valid value for EngineVersion is currently 2. For a Puppet server, valid values are 2019 or 2017.


    • engine_attributes(EngineAttribute) / set_engine_attributes(Option<Vec::<EngineAttribute>>):
      required: false

      Optional engine attributes on a specified server.

      Attributes accepted in a Chef createServer request:

      • CHEF_AUTOMATE_PIVOTAL_KEY: A base64-encoded RSA public key. The corresponding private key is required to access the Chef API. When no CHEF_AUTOMATE_PIVOTAL_KEY is set, a private key is generated and returned in the response.

      • CHEF_AUTOMATE_ADMIN_PASSWORD: The password for the administrative user in the Chef Automate web-based dashboard. The password length is a minimum of eight characters, and a maximum of 32. The password can contain letters, numbers, and special characters (!/@#$%^&+=_). The password must contain at least one lower case letter, one upper case letter, one number, and one special character. When no CHEF_AUTOMATE_ADMIN_PASSWORD is set, one is generated and returned in the response.

      Attributes accepted in a Puppet createServer request:

      • PUPPET_ADMIN_PASSWORD: To work with the Puppet Enterprise console, a password must use ASCII characters.

      • PUPPET_R10K_REMOTE: The r10k remote is the URL of your control repository (for example, ssh://git@your.git-repo.com:user/control-repo.git). Specifying an r10k remote opens TCP port 8170.

      • PUPPET_R10K_PRIVATE_KEY: If you are using a private Git repository, add PUPPET_R10K_PRIVATE_KEY to specify a PEM-encoded private SSH key.


    • backup_retention_count(i32) / set_backup_retention_count(Option<i32>):
      required: false

      The number of automated backups that you want to keep. Whenever a new backup is created, AWS OpsWorks CM deletes the oldest backups if this number is exceeded. The default value is 1.


    • server_name(impl Into<String>) / set_server_name(Option<String>):
      required: true

      The name of the server. The server name must be unique within your AWS account, within each region. Server names must start with a letter; then letters, numbers, or hyphens (-) are allowed, up to a maximum of 40 characters.


    • instance_profile_arn(impl Into<String>) / set_instance_profile_arn(Option<String>):
      required: true

      The ARN of the instance profile that your Amazon EC2 instances use. Although the AWS OpsWorks console typically creates the instance profile for you, if you are using API commands instead, run the service-role-creation.yaml AWS CloudFormation template, located at https://s3.amazonaws.com/opsworks-cm-us-east-1-prod-default-assets/misc/opsworks-cm-roles.yaml. This template creates a CloudFormation stack that includes the instance profile you need.


    • instance_type(impl Into<String>) / set_instance_type(Option<String>):
      required: true

      The Amazon EC2 instance type to use. For example, m5.large.


    • key_pair(impl Into<String>) / set_key_pair(Option<String>):
      required: false

      The Amazon EC2 key pair to set for the instance. This parameter is optional; if desired, you may specify this parameter to connect to your instances by using SSH.


    • preferred_maintenance_window(impl Into<String>) / set_preferred_maintenance_window(Option<String>):
      required: false

      The start time for a one-hour period each week during which AWS OpsWorks CM performs maintenance on the instance. Valid values must be specified in the following format: DDD:HH:MM. MM must be specified as 00. The specified time is in coordinated universal time (UTC). The default value is a random one-hour period on Tuesday, Wednesday, or Friday. See TimeWindowDefinition for more information.

      Example: Mon:08:00, which represents a start time of every Monday at 08:00 UTC. (8:00 a.m.)


    • preferred_backup_window(impl Into<String>) / set_preferred_backup_window(Option<String>):
      required: false

      The start time for a one-hour period during which AWS OpsWorks CM backs up application-level data on your server if automated backups are enabled. Valid values must be specified in one of the following formats:

      • HH:MM for daily backups

      • DDD:HH:MM for weekly backups

      MM must be specified as 00. The specified time is in coordinated universal time (UTC). The default value is a random, daily start time.

      Example: 08:00, which represents a daily start time of 08:00 UTC.

      Example: Mon:08:00, which represents a start time of every Monday at 08:00 UTC. (8:00 a.m.)


    • security_group_ids(impl Into<String>) / set_security_group_ids(Option<Vec::<String>>):
      required: false

      A list of security group IDs to attach to the Amazon EC2 instance. If you add this parameter, the specified security groups must be within the VPC that is specified by SubnetIds.

      If you do not specify this parameter, AWS OpsWorks CM creates one new security group that uses TCP ports 22 and 443, open to 0.0.0.0/0 (everyone).


    • service_role_arn(impl Into<String>) / set_service_role_arn(Option<String>):
      required: true

      The service role that the AWS OpsWorks CM service backend uses to work with your account. Although the AWS OpsWorks management console typically creates the service role for you, if you are using the AWS CLI or API commands, run the service-role-creation.yaml AWS CloudFormation template, located at https://s3.amazonaws.com/opsworks-cm-us-east-1-prod-default-assets/misc/opsworks-cm-roles.yaml. This template creates a CloudFormation stack that includes the service role and instance profile that you need.


    • subnet_ids(impl Into<String>) / set_subnet_ids(Option<Vec::<String>>):
      required: false

      The IDs of subnets in which to launch the server EC2 instance.

      Amazon EC2-Classic customers: This field is required. All servers must run within a VPC. The VPC must have “Auto Assign Public IP” enabled.

      EC2-VPC customers: This field is optional. If you do not specify subnet IDs, your EC2 instances are created in a default subnet that is selected by Amazon EC2. If you specify subnet IDs, the VPC must have “Auto Assign Public IP” enabled.

      For more information about supported Amazon EC2 platforms, see Supported Platforms.


    • tags(Tag) / set_tags(Option<Vec::<Tag>>):
      required: false

      A map that contains tag keys and tag values to attach to an AWS OpsWorks for Chef Automate or AWS OpsWorks for Puppet Enterprise server.

      • The key cannot be empty.

      • The key can be a maximum of 127 characters, and can contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : / @

      • The value can be a maximum 255 characters, and contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : / @

      • Leading and trailing white spaces are trimmed from both the key and value.

      • A maximum of 50 user-applied tags is allowed for any AWS OpsWorks-CM server.


    • backup_id(impl Into<String>) / set_backup_id(Option<String>):
      required: false

      If you specify this field, AWS OpsWorks CM creates the server by using the backup represented by BackupId.


  • On success, responds with CreateServerOutput with field(s):
  • On failure, responds with SdkError<CreateServerError>
source§

impl Client

source

pub fn delete_backup(&self) -> DeleteBackupFluentBuilder

Constructs a fluent builder for the DeleteBackup operation.

source§

impl Client

source

pub fn delete_server(&self) -> DeleteServerFluentBuilder

Constructs a fluent builder for the DeleteServer operation.

source§

impl Client

source

pub fn describe_account_attributes( &self ) -> DescribeAccountAttributesFluentBuilder

Constructs a fluent builder for the DescribeAccountAttributes operation.

source§

impl Client

source

pub fn describe_backups(&self) -> DescribeBackupsFluentBuilder

Constructs a fluent builder for the DescribeBackups operation. This operation supports pagination; See into_paginator().

source§

impl Client

source

pub fn describe_events(&self) -> DescribeEventsFluentBuilder

Constructs a fluent builder for the DescribeEvents operation. This operation supports pagination; See into_paginator().

  • The fluent builder is configurable:
    • server_name(impl Into<String>) / set_server_name(Option<String>):
      required: true

      The name of the server for which you want to view events.


    • next_token(impl Into<String>) / set_next_token(Option<String>):
      required: false

      NextToken is a string that is returned in some command responses. It indicates that not all entries have been returned, and that you must run at least one more request to get remaining items. To get remaining results, call DescribeEvents again, and assign the token from the previous results as the value of the nextToken parameter. If there are no more results, the response object’s nextToken parameter value is null. Setting a nextToken value that was not returned in your previous results causes an InvalidNextTokenException to occur.


    • max_results(i32) / set_max_results(Option<i32>):
      required: false

      To receive a paginated response, use this parameter to specify the maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.


  • On success, responds with DescribeEventsOutput with field(s):
    • server_events(Option<Vec::<ServerEvent>>):

      Contains the response to a DescribeEvents request.

    • next_token(Option<String>):

      NextToken is a string that is returned in some command responses. It indicates that not all entries have been returned, and that you must run at least one more request to get remaining items. To get remaining results, call DescribeEvents again, and assign the token from the previous results as the value of the nextToken parameter. If there are no more results, the response object’s nextToken parameter value is null. Setting a nextToken value that was not returned in your previous results causes an InvalidNextTokenException to occur.

  • On failure, responds with SdkError<DescribeEventsError>
source§

impl Client

source

pub fn describe_node_association_status( &self ) -> DescribeNodeAssociationStatusFluentBuilder

Constructs a fluent builder for the DescribeNodeAssociationStatus operation.

source§

impl Client

source

pub fn describe_servers(&self) -> DescribeServersFluentBuilder

Constructs a fluent builder for the DescribeServers operation. This operation supports pagination; See into_paginator().

  • The fluent builder is configurable:
  • On success, responds with DescribeServersOutput with field(s):
    • servers(Option<Vec::<Server>>):

      Contains the response to a DescribeServers request.

      For Chef Automate servers: If DescribeServersResponse$Servers$EngineAttributes includes CHEF_MAJOR_UPGRADE_AVAILABLE, you can upgrade the Chef Automate server to Chef Automate 2. To be eligible for upgrade, a server running Chef Automate 1 must have had at least one successful maintenance run after November 1, 2019.

      For Puppet servers: DescribeServersResponse$Servers$EngineAttributes contains the following two responses:

      • PUPPET_API_CA_CERT, the PEM-encoded CA certificate that is used by the Puppet API over TCP port number 8140. The CA certificate is also used to sign node certificates.

      • PUPPET_API_CRL, a certificate revocation list. The certificate revocation list is for internal maintenance purposes only. For more information about the Puppet certificate revocation list, see Man Page: puppet certificate_revocation_list in the Puppet documentation.

    • next_token(Option<String>):

      This is not currently implemented for DescribeServers requests.

  • On failure, responds with SdkError<DescribeServersError>
source§

impl Client

source

pub fn disassociate_node(&self) -> DisassociateNodeFluentBuilder

Constructs a fluent builder for the DisassociateNode operation.

source§

impl Client

source

pub fn export_server_engine_attribute( &self ) -> ExportServerEngineAttributeFluentBuilder

Constructs a fluent builder for the ExportServerEngineAttribute operation.

source§

impl Client

source

pub fn list_tags_for_resource(&self) -> ListTagsForResourceFluentBuilder

Constructs a fluent builder for the ListTagsForResource operation. This operation supports pagination; See into_paginator().

  • The fluent builder is configurable:
    • resource_arn(impl Into<String>) / set_resource_arn(Option<String>):
      required: true

      The Amazon Resource Number (ARN) of an AWS OpsWorks for Chef Automate or AWS OpsWorks for Puppet Enterprise server for which you want to show applied tags. For example, arn:aws:opsworks-cm:us-west-2:123456789012:server/test-owcm-server/EXAMPLE-66b0-4196-8274-d1a2bEXAMPLE.


    • next_token(impl Into<String>) / set_next_token(Option<String>):
      required: false

      NextToken is a string that is returned in some command responses. It indicates that not all entries have been returned, and that you must run at least one more request to get remaining items. To get remaining results, call ListTagsForResource again, and assign the token from the previous results as the value of the nextToken parameter. If there are no more results, the response object’s nextToken parameter value is null. Setting a nextToken value that was not returned in your previous results causes an InvalidNextTokenException to occur.


    • max_results(i32) / set_max_results(Option<i32>):
      required: false

      To receive a paginated response, use this parameter to specify the maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.


  • On success, responds with ListTagsForResourceOutput with field(s):
  • On failure, responds with SdkError<ListTagsForResourceError>
source§

impl Client

source

pub fn restore_server(&self) -> RestoreServerFluentBuilder

Constructs a fluent builder for the RestoreServer operation.

source§

impl Client

source

pub fn start_maintenance(&self) -> StartMaintenanceFluentBuilder

Constructs a fluent builder for the StartMaintenance operation.

source§

impl Client

source

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: true

      The Amazon Resource Number (ARN) of a resource to which you want to apply tags. For example, arn:aws:opsworks-cm:us-west-2:123456789012:server/test-owcm-server/EXAMPLE-66b0-4196-8274-d1a2bEXAMPLE.


    • tags(Tag) / set_tags(Option<Vec::<Tag>>):
      required: true

      A map that contains tag keys and tag values to attach to AWS OpsWorks-CM servers or backups.

      • The key cannot be empty.

      • The key can be a maximum of 127 characters, and can contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : /

      • The value can be a maximum 255 characters, and contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : /

      • Leading and trailing white spaces are trimmed from both the key and value.

      • A maximum of 50 user-applied tags is allowed for any AWS OpsWorks-CM server or backup.


  • On success, responds with TagResourceOutput
  • On failure, responds with SdkError<TagResourceError>
source§

impl Client

source

pub fn untag_resource(&self) -> UntagResourceFluentBuilder

Constructs a fluent builder for the UntagResource operation.

source§

impl Client

source

pub fn update_server(&self) -> UpdateServerFluentBuilder

Constructs a fluent builder for the UpdateServer operation.

source§

impl Client

source

pub fn update_server_engine_attributes( &self ) -> UpdateServerEngineAttributesFluentBuilder

Constructs a fluent builder for the UpdateServerEngineAttributes operation.

source§

impl Client

source

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 and time_source configured.
  • No behavior_version is provided.

The panic message for each of these will have instructions on how to resolve them.

source

pub fn config(&self) -> &Config

Returns the client’s configuration.

source§

impl Client

source

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 the sleep_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 the http_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, set behavior_version on the Config or enable the behavior-version-latest Cargo feature.

Trait Implementations§

source§

impl Clone for Client

source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Client

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Waiters for Client

source§

fn wait_until_node_associated(&self) -> NodeAssociatedFluentBuilder

Wait until node is associated or disassociated.

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more