aws_sdk_deadline/client.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[derive(Debug)]
3pub(crate) struct Handle {
4 pub(crate) conf: crate::Config,
5 #[allow(dead_code)] // unused when a service does not provide any operations
6 pub(crate) runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
7}
8
9/// Client for AWSDeadlineCloud
10///
11/// Client for invoking operations on AWSDeadlineCloud. Each operation on AWSDeadlineCloud is a method on this
12/// this struct. `.send()` MUST be invoked on the generated operations to dispatch the request to the service.
13/// ## Constructing a `Client`
14///
15/// A [`Config`] is required to construct a client. For most use cases, the [`aws-config`]
16/// crate should be used to automatically resolve this config using
17/// [`aws_config::load_from_env()`], since this will resolve an [`SdkConfig`] which can be shared
18/// across multiple different AWS SDK clients. This config resolution process can be customized
19/// by calling [`aws_config::from_env()`] instead, which returns a [`ConfigLoader`] that uses
20/// the [builder pattern] to customize the default config.
21///
22/// In the simplest case, creating a client looks as follows:
23/// ```rust,no_run
24/// # async fn wrapper() {
25/// let config = aws_config::load_from_env().await;
26/// let client = aws_sdk_deadline::Client::new(&config);
27/// # }
28/// ```
29///
30/// Occasionally, SDKs may have additional service-specific values that can be set on the [`Config`] that
31/// is absent from [`SdkConfig`], or slightly different settings for a specific client may be desired.
32/// The [`Builder`](crate::config::Builder) struct implements `From<&SdkConfig>`, so setting these specific settings can be
33/// done as follows:
34///
35/// ```rust,no_run
36/// # async fn wrapper() {
37/// let sdk_config = ::aws_config::load_from_env().await;
38/// let config = aws_sdk_deadline::config::Builder::from(&sdk_config)
39/// # /*
40/// .some_service_specific_setting("value")
41/// # */
42/// .build();
43/// # }
44/// ```
45///
46/// See the [`aws-config` docs] and [`Config`] for more information on customizing configuration.
47///
48/// _Note:_ Client construction is expensive due to connection thread pool initialization, and should
49/// be done once at application start-up.
50///
51/// [`Config`]: crate::Config
52/// [`ConfigLoader`]: https://docs.rs/aws-config/*/aws_config/struct.ConfigLoader.html
53/// [`SdkConfig`]: https://docs.rs/aws-config/*/aws_config/struct.SdkConfig.html
54/// [`aws-config` docs]: https://docs.rs/aws-config/*
55/// [`aws-config`]: https://crates.io/crates/aws-config
56/// [`aws_config::from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.from_env.html
57/// [`aws_config::load_from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.load_from_env.html
58/// [builder pattern]: https://rust-lang.github.io/api-guidelines/type-safety.html#builders-enable-construction-of-complex-values-c-builder
59/// # Using the `Client`
60///
61/// A client has a function for every operation that can be performed by the service.
62/// For example, the [`AssociateMemberToFarm`](crate::operation::associate_member_to_farm) operation has
63/// a [`Client::associate_member_to_farm`], function which returns a builder for that operation.
64/// The fluent builder ultimately has a `send()` function that returns an async future that
65/// returns a result, as illustrated below:
66///
67/// ```rust,ignore
68/// let result = client.associate_member_to_farm()
69/// .farm_id("example")
70/// .send()
71/// .await;
72/// ```
73///
74/// The underlying HTTP requests that get made by this can be modified with the `customize_operation`
75/// function on the fluent builder. See the [`customize`](crate::client::customize) module for more
76/// information.
77/// # Waiters
78///
79/// This client provides `wait_until` methods behind the [`Waiters`](crate::client::Waiters) trait.
80/// To use them, simply import the trait, and then call one of the `wait_until` methods. This will
81/// return a waiter fluent builder that takes various parameters, which are documented on the builder
82/// type. Once parameters have been provided, the `wait` method can be called to initiate waiting.
83///
84/// For example, if there was a `wait_until_thing` method, it could look like:
85/// ```rust,ignore
86/// let result = client.wait_until_thing()
87/// .thing_id("someId")
88/// .wait(Duration::from_secs(120))
89/// .await;
90/// ```
91#[derive(::std::clone::Clone, ::std::fmt::Debug)]
92pub struct Client {
93 handle: ::std::sync::Arc<Handle>,
94}
95
96impl Client {
97 /// Creates a new client from the service [`Config`](crate::Config).
98 ///
99 /// # Panics
100 ///
101 /// This method will panic in the following cases:
102 ///
103 /// - Retries or timeouts are enabled without a `sleep_impl` configured.
104 /// - Identity caching is enabled without a `sleep_impl` and `time_source` configured.
105 /// - No `behavior_version` is provided.
106 ///
107 /// The panic message for each of these will have instructions on how to resolve them.
108 #[track_caller]
109 pub fn from_conf(conf: crate::Config) -> Self {
110 let handle = Handle {
111 conf: conf.clone(),
112 runtime_plugins: crate::config::base_client_runtime_plugins(conf),
113 };
114 if let Err(err) = Self::validate_config(&handle) {
115 panic!("Invalid client configuration: {err}");
116 }
117 Self {
118 handle: ::std::sync::Arc::new(handle),
119 }
120 }
121
122 /// Returns the client's configuration.
123 pub fn config(&self) -> &crate::Config {
124 &self.handle.conf
125 }
126
127 fn validate_config(handle: &Handle) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
128 let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
129 handle
130 .runtime_plugins
131 .apply_client_configuration(&mut cfg)?
132 .validate_base_client_config(&cfg)?;
133 Ok(())
134 }
135}
136
137///
138/// Waiter functions for the client.
139///
140/// Import this trait to get `wait_until` methods on the client.
141///
142pub trait Waiters {
143 /// Wait until a Fleet is activated. Use this after invoking CreateFleet or UpdateFleet.
144 fn wait_until_fleet_active(&self) -> crate::waiters::fleet_active::FleetActiveFluentBuilder;
145 /// Wait until a Job is created. Use this after invoking CreateJob.
146 fn wait_until_job_create_complete(&self) -> crate::waiters::job_create_complete::JobCreateCompleteFluentBuilder;
147 /// Wait until a LicenseEndpoint is Ready. Use this after invoking CreateLicenseEndpoint.
148 fn wait_until_license_endpoint_valid(&self) -> crate::waiters::license_endpoint_valid::LicenseEndpointValidFluentBuilder;
149 /// Wait until a LicenseEndpoint is Deleted. Use this after invoking DeleteLicenseEndpoint.
150 fn wait_until_license_endpoint_deleted(&self) -> crate::waiters::license_endpoint_deleted::LicenseEndpointDeletedFluentBuilder;
151 /// Wait for `queue_scheduling_blocked`
152 fn wait_until_queue_scheduling_blocked(&self) -> crate::waiters::queue_scheduling_blocked::QueueSchedulingBlockedFluentBuilder;
153 /// Wait for `queue_scheduling`
154 fn wait_until_queue_scheduling(&self) -> crate::waiters::queue_scheduling::QueueSchedulingFluentBuilder;
155 /// Wait until a QueueFleetAssociation is stopped. Use this after setting the status to STOP_SCHEDULING_AND_COMPLETE_TASKS or STOP_SCHEDULING_AND_CANCEL_TASKS to wait for a QueueFleetAssociation to reach STOPPED
156 fn wait_until_queue_fleet_association_stopped(
157 &self,
158 ) -> crate::waiters::queue_fleet_association_stopped::QueueFleetAssociationStoppedFluentBuilder;
159 /// Wait until a QueueLimitAssociation is stopped. Use this after setting the status to STOP_LIMIT_USAGE_AND_COMPLETE_TASKS or STOP_LIMIT_USAGE_AND_CANCEL_TASKS to wait for a QueueLimitAssociation to reach STOPPED
160 fn wait_until_queue_limit_association_stopped(
161 &self,
162 ) -> crate::waiters::queue_limit_association_stopped::QueueLimitAssociationStoppedFluentBuilder;
163}
164impl Waiters for Client {
165 fn wait_until_fleet_active(&self) -> crate::waiters::fleet_active::FleetActiveFluentBuilder {
166 crate::waiters::fleet_active::FleetActiveFluentBuilder::new(self.handle.clone())
167 }
168 fn wait_until_job_create_complete(&self) -> crate::waiters::job_create_complete::JobCreateCompleteFluentBuilder {
169 crate::waiters::job_create_complete::JobCreateCompleteFluentBuilder::new(self.handle.clone())
170 }
171 fn wait_until_license_endpoint_valid(&self) -> crate::waiters::license_endpoint_valid::LicenseEndpointValidFluentBuilder {
172 crate::waiters::license_endpoint_valid::LicenseEndpointValidFluentBuilder::new(self.handle.clone())
173 }
174 fn wait_until_license_endpoint_deleted(&self) -> crate::waiters::license_endpoint_deleted::LicenseEndpointDeletedFluentBuilder {
175 crate::waiters::license_endpoint_deleted::LicenseEndpointDeletedFluentBuilder::new(self.handle.clone())
176 }
177 fn wait_until_queue_scheduling_blocked(&self) -> crate::waiters::queue_scheduling_blocked::QueueSchedulingBlockedFluentBuilder {
178 crate::waiters::queue_scheduling_blocked::QueueSchedulingBlockedFluentBuilder::new(self.handle.clone())
179 }
180 fn wait_until_queue_scheduling(&self) -> crate::waiters::queue_scheduling::QueueSchedulingFluentBuilder {
181 crate::waiters::queue_scheduling::QueueSchedulingFluentBuilder::new(self.handle.clone())
182 }
183 fn wait_until_queue_fleet_association_stopped(
184 &self,
185 ) -> crate::waiters::queue_fleet_association_stopped::QueueFleetAssociationStoppedFluentBuilder {
186 crate::waiters::queue_fleet_association_stopped::QueueFleetAssociationStoppedFluentBuilder::new(self.handle.clone())
187 }
188 fn wait_until_queue_limit_association_stopped(
189 &self,
190 ) -> crate::waiters::queue_limit_association_stopped::QueueLimitAssociationStoppedFluentBuilder {
191 crate::waiters::queue_limit_association_stopped::QueueLimitAssociationStoppedFluentBuilder::new(self.handle.clone())
192 }
193}
194
195impl Client {
196 /// Creates a new client from an [SDK Config](::aws_types::sdk_config::SdkConfig).
197 ///
198 /// # Panics
199 ///
200 /// - This method will panic if the `sdk_config` is missing an async sleep implementation. If you experience this panic, set
201 /// the `sleep_impl` on the Config passed into this function to fix it.
202 /// - This method will panic if the `sdk_config` is missing an HTTP connector. If you experience this panic, set the
203 /// `http_connector` on the Config passed into this function to fix it.
204 /// - 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.
205 #[track_caller]
206 pub fn new(sdk_config: &::aws_types::sdk_config::SdkConfig) -> Self {
207 Self::from_conf(sdk_config.into())
208 }
209}
210
211mod associate_member_to_farm;
212
213mod associate_member_to_fleet;
214
215mod associate_member_to_job;
216
217mod associate_member_to_queue;
218
219mod assume_fleet_role_for_read;
220
221mod assume_fleet_role_for_worker;
222
223mod assume_queue_role_for_read;
224
225mod assume_queue_role_for_user;
226
227mod assume_queue_role_for_worker;
228
229mod batch_get_job_entity;
230
231mod copy_job_template;
232
233mod create_budget;
234
235mod create_farm;
236
237mod create_fleet;
238
239mod create_job;
240
241mod create_license_endpoint;
242
243mod create_limit;
244
245mod create_monitor;
246
247mod create_queue;
248
249mod create_queue_environment;
250
251mod create_queue_fleet_association;
252
253mod create_queue_limit_association;
254
255mod create_storage_profile;
256
257mod create_worker;
258
259/// Operation customization and supporting types.
260///
261/// The underlying HTTP requests made during an operation can be customized
262/// by calling the `customize()` method on the builder returned from a client
263/// operation call. For example, this can be used to add an additional HTTP header:
264///
265/// ```ignore
266/// # async fn wrapper() -> ::std::result::Result<(), aws_sdk_deadline::Error> {
267/// # let client: aws_sdk_deadline::Client = unimplemented!();
268/// use ::http::header::{HeaderName, HeaderValue};
269///
270/// let result = client.associate_member_to_farm()
271/// .customize()
272/// .mutate_request(|req| {
273/// // Add `x-example-header` with value
274/// req.headers_mut()
275/// .insert(
276/// HeaderName::from_static("x-example-header"),
277/// HeaderValue::from_static("1"),
278/// );
279/// })
280/// .send()
281/// .await;
282/// # }
283/// ```
284pub mod customize;
285
286mod delete_budget;
287
288mod delete_farm;
289
290mod delete_fleet;
291
292mod delete_license_endpoint;
293
294mod delete_limit;
295
296mod delete_metered_product;
297
298mod delete_monitor;
299
300mod delete_queue;
301
302mod delete_queue_environment;
303
304mod delete_queue_fleet_association;
305
306mod delete_queue_limit_association;
307
308mod delete_storage_profile;
309
310mod delete_worker;
311
312mod disassociate_member_from_farm;
313
314mod disassociate_member_from_fleet;
315
316mod disassociate_member_from_job;
317
318mod disassociate_member_from_queue;
319
320mod get_budget;
321
322mod get_farm;
323
324mod get_fleet;
325
326mod get_job;
327
328mod get_license_endpoint;
329
330mod get_limit;
331
332mod get_monitor;
333
334mod get_queue;
335
336mod get_queue_environment;
337
338mod get_queue_fleet_association;
339
340mod get_queue_limit_association;
341
342mod get_session;
343
344mod get_session_action;
345
346mod get_sessions_statistics_aggregation;
347
348mod get_step;
349
350mod get_storage_profile;
351
352mod get_storage_profile_for_queue;
353
354mod get_task;
355
356mod get_worker;
357
358mod list_available_metered_products;
359
360mod list_budgets;
361
362mod list_farm_members;
363
364mod list_farms;
365
366mod list_fleet_members;
367
368mod list_fleets;
369
370mod list_job_members;
371
372mod list_job_parameter_definitions;
373
374mod list_jobs;
375
376mod list_license_endpoints;
377
378mod list_limits;
379
380mod list_metered_products;
381
382mod list_monitors;
383
384mod list_queue_environments;
385
386mod list_queue_fleet_associations;
387
388mod list_queue_limit_associations;
389
390mod list_queue_members;
391
392mod list_queues;
393
394mod list_session_actions;
395
396mod list_sessions;
397
398mod list_sessions_for_worker;
399
400mod list_step_consumers;
401
402mod list_step_dependencies;
403
404mod list_steps;
405
406mod list_storage_profiles;
407
408mod list_storage_profiles_for_queue;
409
410mod list_tags_for_resource;
411
412mod list_tasks;
413
414mod list_workers;
415
416mod put_metered_product;
417
418mod search_jobs;
419
420mod search_steps;
421
422mod search_tasks;
423
424mod search_workers;
425
426mod start_sessions_statistics_aggregation;
427
428mod tag_resource;
429
430mod untag_resource;
431
432mod update_budget;
433
434mod update_farm;
435
436mod update_fleet;
437
438mod update_job;
439
440mod update_limit;
441
442mod update_monitor;
443
444mod update_queue;
445
446mod update_queue_environment;
447
448mod update_queue_fleet_association;
449
450mod update_queue_limit_association;
451
452mod update_session;
453
454mod update_step;
455
456mod update_storage_profile;
457
458mod update_task;
459
460mod update_worker;
461
462mod update_worker_schedule;