Struct aws_sdk_mwaa::Client
source · pub struct Client { /* private fields */ }Expand description
Client for AmazonMWAA
Client for invoking operations on AmazonMWAA. Each operation on AmazonMWAA 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_mwaa::Client::new(&config);Occasionally, SDKs may have additional service-specific 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_mwaa::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 CreateCliToken operation has
a Client::create_cli_token, 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_cli_token()
.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.
Implementations§
source§impl Client
impl Client
sourcepub fn create_cli_token(&self) -> CreateCliTokenFluentBuilder
pub fn create_cli_token(&self) -> CreateCliTokenFluentBuilder
Constructs a fluent builder for the CreateCliToken operation.
- The fluent builder is configurable:
name(impl ::std::convert::Into<String>)/set_name(Option<String>):The name of the Amazon MWAA environment. For example,
MyMWAAEnvironment.
- On success, responds with
CreateCliTokenOutputwith field(s):cli_token(Option<String>):An Airflow CLI login token.
web_server_hostname(Option<String>):The Airflow web server hostname for the environment.
- On failure, responds with
SdkError<CreateCliTokenError>
source§impl Client
impl Client
sourcepub fn create_environment(&self) -> CreateEnvironmentFluentBuilder
pub fn create_environment(&self) -> CreateEnvironmentFluentBuilder
Constructs a fluent builder for the CreateEnvironment operation.
- The fluent builder is configurable:
name(impl ::std::convert::Into<String>)/set_name(Option<String>):The name of the Amazon MWAA environment. For example,
MyMWAAEnvironment.execution_role_arn(impl ::std::convert::Into<String>)/set_execution_role_arn(Option<String>):The Amazon Resource Name (ARN) of the execution role for your environment. An execution role is an Amazon Web Services Identity and Access Management (IAM) role that grants MWAA permission to access Amazon Web Services services and resources used by your environment. For example,
arn:aws:iam::123456789:role/my-execution-role. For more information, see Amazon MWAA Execution role.source_bucket_arn(impl ::std::convert::Into<String>)/set_source_bucket_arn(Option<String>):The Amazon Resource Name (ARN) of the Amazon S3 bucket where your DAG code and supporting files are stored. For example,
arn:aws:s3:::my-airflow-bucket-unique-name. For more information, see Create an Amazon S3 bucket for Amazon MWAA.dag_s3_path(impl ::std::convert::Into<String>)/set_dag_s3_path(Option<String>):The relative path to the DAGs folder on your Amazon S3 bucket. For example,
dags. For more information, see Adding or updating DAGs.network_configuration(NetworkConfiguration)/set_network_configuration(Option<NetworkConfiguration>):The VPC networking components used to secure and enable network traffic between the Amazon Web Services resources for your environment. For more information, see About networking on Amazon MWAA.
plugins_s3_path(impl ::std::convert::Into<String>)/set_plugins_s3_path(Option<String>):The relative path to the
plugins.zipfile on your Amazon S3 bucket. For example,plugins.zip. If specified, then theplugins.zipversion is required. For more information, see Installing custom plugins.plugins_s3_object_version(impl ::std::convert::Into<String>)/set_plugins_s3_object_version(Option<String>):The version of the plugins.zip file on your Amazon S3 bucket. You must specify a version each time a plugins.zip file is updated. For more information, see How S3 Versioning works.
requirements_s3_path(impl ::std::convert::Into<String>)/set_requirements_s3_path(Option<String>):The relative path to the
requirements.txtfile on your Amazon S3 bucket. For example,requirements.txt. If specified, then a version is required. For more information, see Installing Python dependencies.requirements_s3_object_version(impl ::std::convert::Into<String>)/set_requirements_s3_object_version(Option<String>):The version of the
requirements.txtfile on your Amazon S3 bucket. You must specify a version each time a requirements.txt file is updated. For more information, see How S3 Versioning works.startup_script_s3_path(impl ::std::convert::Into<String>)/set_startup_script_s3_path(Option<String>):The relative path to the startup shell script in your Amazon S3 bucket. For example,
s3://mwaa-environment/startup.sh.Amazon MWAA runs the script as your environment starts, and before running the Apache Airflow process. You can use this script to install dependencies, modify Apache Airflow configuration options, and set environment variables. For more information, see Using a startup script.
startup_script_s3_object_version(impl ::std::convert::Into<String>)/set_startup_script_s3_object_version(Option<String>):The version of the startup shell script in your Amazon S3 bucket. You must specify the version ID that Amazon S3 assigns to the file every time you update the script.
Version IDs are Unicode, UTF-8 encoded, URL-ready, opaque strings that are no more than 1,024 bytes long. The following is an example:
3sL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUoFor more information, see Using a startup script.
airflow_configuration_options(HashMap<String, String>)/set_airflow_configuration_options(Option<HashMap<String, String>>):A list of key-value pairs containing the Apache Airflow configuration options you want to attach to your environment. For more information, see Apache Airflow configuration options.
environment_class(impl ::std::convert::Into<String>)/set_environment_class(Option<String>):The environment class type. Valid values:
mw1.small,mw1.medium,mw1.large. For more information, see Amazon MWAA environment class.max_workers(i32)/set_max_workers(Option<i32>):The maximum number of workers that you want to run in your environment. MWAA scales the number of Apache Airflow workers up to the number you specify in the
MaxWorkersfield. For example,20. When there are no more tasks running, and no more in the queue, MWAA disposes of the extra workers leaving the one worker that is included with your environment, or the number you specify inMinWorkers.kms_key(impl ::std::convert::Into<String>)/set_kms_key(Option<String>):The Amazon Web Services Key Management Service (KMS) key to encrypt the data in your environment. You can use an Amazon Web Services owned CMK, or a Customer managed CMK (advanced). For more information, see Create an Amazon MWAA environment.
airflow_version(impl ::std::convert::Into<String>)/set_airflow_version(Option<String>):The Apache Airflow version for your environment. If no value is specified, it defaults to the latest version. Valid values:
1.10.12,2.0.2,2.2.2,2.4.3, and2.5.1. For more information, see Apache Airflow versions on Amazon Managed Workflows for Apache Airflow (MWAA).logging_configuration(LoggingConfigurationInput)/set_logging_configuration(Option<LoggingConfigurationInput>):Defines the Apache Airflow logs to send to CloudWatch Logs.
weekly_maintenance_window_start(impl ::std::convert::Into<String>)/set_weekly_maintenance_window_start(Option<String>):The day and time of the week in Coordinated Universal Time (UTC) 24-hour standard time to start weekly maintenance updates of your environment in the following format:
DAY:HH:MM. For example:TUE:03:30. You can specify a start time in 30 minute increments only.tags(HashMap<String, String>)/set_tags(Option<HashMap<String, String>>):The key-value tag pairs you want to associate to your environment. For example,
“Environment”: “Staging”. For more information, see Tagging Amazon Web Services resources.webserver_access_mode(WebserverAccessMode)/set_webserver_access_mode(Option<WebserverAccessMode>):The Apache Airflow Web server access mode. For more information, see Apache Airflow access modes.
min_workers(i32)/set_min_workers(Option<i32>):The minimum number of workers that you want to run in your environment. MWAA scales the number of Apache Airflow workers up to the number you specify in the
MaxWorkersfield. When there are no more tasks running, and no more in the queue, MWAA disposes of the extra workers leaving the worker count you specify in theMinWorkersfield. For example,2.schedulers(i32)/set_schedulers(Option<i32>):The number of Apache Airflow schedulers to run in your environment. Valid values:
-
v2 - Accepts between 2 to 5. Defaults to 2.
-
v1 - Accepts 1.
-
- On success, responds with
CreateEnvironmentOutputwith field(s):arn(Option<String>):The Amazon Resource Name (ARN) returned in the response for the environment.
- On failure, responds with
SdkError<CreateEnvironmentError>
source§impl Client
impl Client
sourcepub fn create_web_login_token(&self) -> CreateWebLoginTokenFluentBuilder
pub fn create_web_login_token(&self) -> CreateWebLoginTokenFluentBuilder
Constructs a fluent builder for the CreateWebLoginToken operation.
- The fluent builder is configurable:
name(impl ::std::convert::Into<String>)/set_name(Option<String>):The name of the Amazon MWAA environment. For example,
MyMWAAEnvironment.
- On success, responds with
CreateWebLoginTokenOutputwith field(s):web_token(Option<String>):An Airflow web server login token.
web_server_hostname(Option<String>):The Airflow web server hostname for the environment.
- On failure, responds with
SdkError<CreateWebLoginTokenError>
source§impl Client
impl Client
sourcepub fn delete_environment(&self) -> DeleteEnvironmentFluentBuilder
pub fn delete_environment(&self) -> DeleteEnvironmentFluentBuilder
Constructs a fluent builder for the DeleteEnvironment operation.
- The fluent builder is configurable:
name(impl ::std::convert::Into<String>)/set_name(Option<String>):The name of the Amazon MWAA environment. For example,
MyMWAAEnvironment.
- On success, responds with
DeleteEnvironmentOutput - On failure, responds with
SdkError<DeleteEnvironmentError>
source§impl Client
impl Client
sourcepub fn get_environment(&self) -> GetEnvironmentFluentBuilder
pub fn get_environment(&self) -> GetEnvironmentFluentBuilder
Constructs a fluent builder for the GetEnvironment operation.
- The fluent builder is configurable:
name(impl ::std::convert::Into<String>)/set_name(Option<String>):The name of the Amazon MWAA environment. For example,
MyMWAAEnvironment.
- On success, responds with
GetEnvironmentOutputwith field(s):environment(Option<Environment>):An object containing all available details about the environment.
- On failure, responds with
SdkError<GetEnvironmentError>
source§impl Client
impl Client
sourcepub fn list_environments(&self) -> ListEnvironmentsFluentBuilder
pub fn list_environments(&self) -> ListEnvironmentsFluentBuilder
Constructs a fluent builder for the ListEnvironments operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl ::std::convert::Into<String>)/set_next_token(Option<String>):Retrieves the next page of the results.
max_results(i32)/set_max_results(Option<i32>):The maximum number of results to retrieve per page. For example,
5environments per page.
- On success, responds with
ListEnvironmentsOutputwith field(s):environments(Option<Vec<String>>):Returns a list of Amazon MWAA environments.
next_token(Option<String>):Retrieves the next page of the results.
- On failure, responds with
SdkError<ListEnvironmentsError>
source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForResource operation.
- The fluent builder is configurable:
resource_arn(impl ::std::convert::Into<String>)/set_resource_arn(Option<String>):The Amazon Resource Name (ARN) of the Amazon MWAA environment. For example,
arn:aws:airflow:us-east-1:123456789012:environment/MyMWAAEnvironment.
- On success, responds with
ListTagsForResourceOutputwith field(s):tags(Option<HashMap<String, String>>):The key-value tag pairs associated to your environment. For more information, see Tagging Amazon Web Services resources.
- On failure, responds with
SdkError<ListTagsForResourceError>
source§impl Client
impl Client
sourcepub fn publish_metrics(&self) -> PublishMetricsFluentBuilder
pub fn publish_metrics(&self) -> PublishMetricsFluentBuilder
Constructs a fluent builder for the PublishMetrics operation.
- The fluent builder is configurable:
environment_name(impl ::std::convert::Into<String>)/set_environment_name(Option<String>):Internal only. The name of the environment.
metric_data(Vec<MetricDatum>)/set_metric_data(Option<Vec<MetricDatum>>):Internal only. Publishes metrics to Amazon CloudWatch. To learn more about the metrics published to Amazon CloudWatch, see Amazon MWAA performance metrics in Amazon CloudWatch.
- On success, responds with
PublishMetricsOutput - On failure, responds with
SdkError<PublishMetricsError>
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 ::std::convert::Into<String>)/set_resource_arn(Option<String>):The Amazon Resource Name (ARN) of the Amazon MWAA environment. For example,
arn:aws:airflow:us-east-1:123456789012:environment/MyMWAAEnvironment.tags(HashMap<String, String>)/set_tags(Option<HashMap<String, String>>):The key-value tag pairs you want to associate to your environment. For example,
“Environment”: “Staging”. For more information, see Tagging Amazon Web Services resources.
- 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 ::std::convert::Into<String>)/set_resource_arn(Option<String>):The Amazon Resource Name (ARN) of the Amazon MWAA environment. For example,
arn:aws:airflow:us-east-1:123456789012:environment/MyMWAAEnvironment.tag_keys(Vec<String>)/set_tag_keys(Option<Vec<String>>):The key-value tag pair you want to remove. For example,
“Environment”: “Staging”.
- On success, responds with
UntagResourceOutput - On failure, responds with
SdkError<UntagResourceError>
source§impl Client
impl Client
sourcepub fn update_environment(&self) -> UpdateEnvironmentFluentBuilder
pub fn update_environment(&self) -> UpdateEnvironmentFluentBuilder
Constructs a fluent builder for the UpdateEnvironment operation.
- The fluent builder is configurable:
name(impl ::std::convert::Into<String>)/set_name(Option<String>):The name of your Amazon MWAA environment. For example,
MyMWAAEnvironment.execution_role_arn(impl ::std::convert::Into<String>)/set_execution_role_arn(Option<String>):The Amazon Resource Name (ARN) of the execution role in IAM that allows MWAA to access Amazon Web Services resources in your environment. For example,
arn:aws:iam::123456789:role/my-execution-role. For more information, see Amazon MWAA Execution role.airflow_version(impl ::std::convert::Into<String>)/set_airflow_version(Option<String>):The Apache Airflow version for your environment. To upgrade your environment, specify a newer version of Apache Airflow supported by Amazon MWAA.
Before you upgrade an environment, make sure your requirements, DAGs, plugins, and other resources used in your workflows are compatible with the new Apache Airflow version. For more information about updating your resources, see Upgrading an Amazon MWAA environment.
Valid values:
1.10.12,2.0.2,2.2.2,2.4.3, and2.5.1.source_bucket_arn(impl ::std::convert::Into<String>)/set_source_bucket_arn(Option<String>):The Amazon Resource Name (ARN) of the Amazon S3 bucket where your DAG code and supporting files are stored. For example,
arn:aws:s3:::my-airflow-bucket-unique-name. For more information, see Create an Amazon S3 bucket for Amazon MWAA.dag_s3_path(impl ::std::convert::Into<String>)/set_dag_s3_path(Option<String>):The relative path to the DAGs folder on your Amazon S3 bucket. For example,
dags. For more information, see Adding or updating DAGs.plugins_s3_path(impl ::std::convert::Into<String>)/set_plugins_s3_path(Option<String>):The relative path to the
plugins.zipfile on your Amazon S3 bucket. For example,plugins.zip. If specified, then the plugins.zip version is required. For more information, see Installing custom plugins.plugins_s3_object_version(impl ::std::convert::Into<String>)/set_plugins_s3_object_version(Option<String>):The version of the plugins.zip file on your Amazon S3 bucket. You must specify a version each time a
plugins.zipfile is updated. For more information, see How S3 Versioning works.requirements_s3_path(impl ::std::convert::Into<String>)/set_requirements_s3_path(Option<String>):The relative path to the
requirements.txtfile on your Amazon S3 bucket. For example,requirements.txt. If specified, then a file version is required. For more information, see Installing Python dependencies.requirements_s3_object_version(impl ::std::convert::Into<String>)/set_requirements_s3_object_version(Option<String>):The version of the requirements.txt file on your Amazon S3 bucket. You must specify a version each time a
requirements.txtfile is updated. For more information, see How S3 Versioning works.startup_script_s3_path(impl ::std::convert::Into<String>)/set_startup_script_s3_path(Option<String>):The relative path to the startup shell script in your Amazon S3 bucket. For example,
s3://mwaa-environment/startup.sh.Amazon MWAA runs the script as your environment starts, and before running the Apache Airflow process. You can use this script to install dependencies, modify Apache Airflow configuration options, and set environment variables. For more information, see Using a startup script.
startup_script_s3_object_version(impl ::std::convert::Into<String>)/set_startup_script_s3_object_version(Option<String>):The version of the startup shell script in your Amazon S3 bucket. You must specify the version ID that Amazon S3 assigns to the file every time you update the script.
Version IDs are Unicode, UTF-8 encoded, URL-ready, opaque strings that are no more than 1,024 bytes long. The following is an example:
3sL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUoFor more information, see Using a startup script.
airflow_configuration_options(HashMap<String, String>)/set_airflow_configuration_options(Option<HashMap<String, String>>):A list of key-value pairs containing the Apache Airflow configuration options you want to attach to your environment. For more information, see Apache Airflow configuration options.
environment_class(impl ::std::convert::Into<String>)/set_environment_class(Option<String>):The environment class type. Valid values:
mw1.small,mw1.medium,mw1.large. For more information, see Amazon MWAA environment class.max_workers(i32)/set_max_workers(Option<i32>):The maximum number of workers that you want to run in your environment. MWAA scales the number of Apache Airflow workers up to the number you specify in the
MaxWorkersfield. For example,20. When there are no more tasks running, and no more in the queue, MWAA disposes of the extra workers leaving the one worker that is included with your environment, or the number you specify inMinWorkers.network_configuration(UpdateNetworkConfigurationInput)/set_network_configuration(Option<UpdateNetworkConfigurationInput>):The VPC networking components used to secure and enable network traffic between the Amazon Web Services resources for your environment. For more information, see About networking on Amazon MWAA.
logging_configuration(LoggingConfigurationInput)/set_logging_configuration(Option<LoggingConfigurationInput>):The Apache Airflow log types to send to CloudWatch Logs.
weekly_maintenance_window_start(impl ::std::convert::Into<String>)/set_weekly_maintenance_window_start(Option<String>):The day and time of the week in Coordinated Universal Time (UTC) 24-hour standard time to start weekly maintenance updates of your environment in the following format:
DAY:HH:MM. For example:TUE:03:30. You can specify a start time in 30 minute increments only.webserver_access_mode(WebserverAccessMode)/set_webserver_access_mode(Option<WebserverAccessMode>):The Apache Airflow Web server access mode. For more information, see Apache Airflow access modes.
min_workers(i32)/set_min_workers(Option<i32>):The minimum number of workers that you want to run in your environment. MWAA scales the number of Apache Airflow workers up to the number you specify in the
MaxWorkersfield. When there are no more tasks running, and no more in the queue, MWAA disposes of the extra workers leaving the worker count you specify in theMinWorkersfield. For example,2.schedulers(i32)/set_schedulers(Option<i32>):The number of Apache Airflow schedulers to run in your Amazon MWAA environment.
- On success, responds with
UpdateEnvironmentOutputwith field(s):arn(Option<String>):The Amazon Resource Name (ARN) of the Amazon MWAA environment. For example,
arn:aws:airflow:us-east-1:123456789012:environment/MyMWAAEnvironment.
- On failure, responds with
SdkError<UpdateEnvironmentError>
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 if the
confis 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
confis missing an HTTP connector. If you experience this panic, set thehttp_connectoron the Config passed into this function to fix it.
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.