Struct aws_sdk_iot1clickprojects::Client
source · pub struct Client { /* private fields */ }
Expand description
Client for AWS IoT 1-Click Projects Service
Client for invoking operations on AWS IoT 1-Click Projects Service. Each operation on AWS IoT 1-Click Projects Service 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_iot1clickprojects::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_iot1clickprojects::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 AssociateDeviceWithPlacement
operation has
a Client::associate_device_with_placement
, 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_device_with_placement()
.project_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 associate_device_with_placement(
&self
) -> AssociateDeviceWithPlacementFluentBuilder
pub fn associate_device_with_placement( &self ) -> AssociateDeviceWithPlacementFluentBuilder
Constructs a fluent builder for the AssociateDeviceWithPlacement
operation.
- The fluent builder is configurable:
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe name of the project containing the placement in which to associate the device.
placement_name(impl Into<String>)
/set_placement_name(Option<String>)
:
required: trueThe name of the placement in which to associate the device.
device_id(impl Into<String>)
/set_device_id(Option<String>)
:
required: trueThe ID of the physical device to be associated with the given placement in the project. Note that a mandatory 4 character prefix is required for all
deviceId
values.device_template_name(impl Into<String>)
/set_device_template_name(Option<String>)
:
required: trueThe device template name to associate with the device ID.
- On success, responds with
AssociateDeviceWithPlacementOutput
- On failure, responds with
SdkError<AssociateDeviceWithPlacementError>
source§impl Client
impl Client
sourcepub fn create_placement(&self) -> CreatePlacementFluentBuilder
pub fn create_placement(&self) -> CreatePlacementFluentBuilder
Constructs a fluent builder for the CreatePlacement
operation.
- The fluent builder is configurable:
placement_name(impl Into<String>)
/set_placement_name(Option<String>)
:
required: trueThe name of the placement to be created.
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe name of the project in which to create the placement.
attributes(impl Into<String>, impl Into<String>)
/set_attributes(Option<HashMap::<String, String>>)
:
required: falseOptional user-defined key/value pairs providing contextual data (such as location or function) for the placement.
- On success, responds with
CreatePlacementOutput
- On failure, responds with
SdkError<CreatePlacementError>
source§impl Client
impl Client
sourcepub fn create_project(&self) -> CreateProjectFluentBuilder
pub fn create_project(&self) -> CreateProjectFluentBuilder
Constructs a fluent builder for the CreateProject
operation.
- The fluent builder is configurable:
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe name of the project to create.
description(impl Into<String>)
/set_description(Option<String>)
:
required: falseAn optional description for the project.
placement_template(PlacementTemplate)
/set_placement_template(Option<PlacementTemplate>)
:
required: falseThe schema defining the placement to be created. A placement template defines placement default attributes and device templates. You cannot add or remove device templates after the project has been created. However, you can update
callbackOverrides
for the device templates using theUpdateProject
API.tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: falseOptional tags (metadata key/value pairs) to be associated with the project. For example,
{ {“key1”: “value1”, “key2”: “value2”} }
. For more information, see AWS Tagging Strategies.
- On success, responds with
CreateProjectOutput
- On failure, responds with
SdkError<CreateProjectError>
source§impl Client
impl Client
sourcepub fn delete_placement(&self) -> DeletePlacementFluentBuilder
pub fn delete_placement(&self) -> DeletePlacementFluentBuilder
Constructs a fluent builder for the DeletePlacement
operation.
- The fluent builder is configurable:
placement_name(impl Into<String>)
/set_placement_name(Option<String>)
:
required: trueThe name of the empty placement to delete.
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe project containing the empty placement to delete.
- On success, responds with
DeletePlacementOutput
- On failure, responds with
SdkError<DeletePlacementError>
source§impl Client
impl Client
sourcepub fn delete_project(&self) -> DeleteProjectFluentBuilder
pub fn delete_project(&self) -> DeleteProjectFluentBuilder
Constructs a fluent builder for the DeleteProject
operation.
- The fluent builder is configurable:
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe name of the empty project to delete.
- On success, responds with
DeleteProjectOutput
- On failure, responds with
SdkError<DeleteProjectError>
source§impl Client
impl Client
sourcepub fn describe_placement(&self) -> DescribePlacementFluentBuilder
pub fn describe_placement(&self) -> DescribePlacementFluentBuilder
Constructs a fluent builder for the DescribePlacement
operation.
- The fluent builder is configurable:
placement_name(impl Into<String>)
/set_placement_name(Option<String>)
:
required: trueThe name of the placement within a project.
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe project containing the placement to be described.
- On success, responds with
DescribePlacementOutput
with field(s):placement(Option<PlacementDescription>)
:An object describing the placement.
- On failure, responds with
SdkError<DescribePlacementError>
source§impl Client
impl Client
sourcepub fn describe_project(&self) -> DescribeProjectFluentBuilder
pub fn describe_project(&self) -> DescribeProjectFluentBuilder
Constructs a fluent builder for the DescribeProject
operation.
- The fluent builder is configurable:
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe name of the project to be described.
- On success, responds with
DescribeProjectOutput
with field(s):project(Option<ProjectDescription>)
:An object describing the project.
- On failure, responds with
SdkError<DescribeProjectError>
source§impl Client
impl Client
sourcepub fn disassociate_device_from_placement(
&self
) -> DisassociateDeviceFromPlacementFluentBuilder
pub fn disassociate_device_from_placement( &self ) -> DisassociateDeviceFromPlacementFluentBuilder
Constructs a fluent builder for the DisassociateDeviceFromPlacement
operation.
- The fluent builder is configurable:
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe name of the project that contains the placement.
placement_name(impl Into<String>)
/set_placement_name(Option<String>)
:
required: trueThe name of the placement that the device should be removed from.
device_template_name(impl Into<String>)
/set_device_template_name(Option<String>)
:
required: trueThe device ID that should be removed from the placement.
- On success, responds with
DisassociateDeviceFromPlacementOutput
- On failure, responds with
SdkError<DisassociateDeviceFromPlacementError>
source§impl Client
impl Client
sourcepub fn get_devices_in_placement(&self) -> GetDevicesInPlacementFluentBuilder
pub fn get_devices_in_placement(&self) -> GetDevicesInPlacementFluentBuilder
Constructs a fluent builder for the GetDevicesInPlacement
operation.
- The fluent builder is configurable:
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe name of the project containing the placement.
placement_name(impl Into<String>)
/set_placement_name(Option<String>)
:
required: trueThe name of the placement to get the devices from.
- On success, responds with
GetDevicesInPlacementOutput
with field(s):devices(HashMap::<String, String>)
:An object containing the devices (zero or more) within the placement.
- On failure, responds with
SdkError<GetDevicesInPlacementError>
source§impl Client
impl Client
sourcepub fn list_placements(&self) -> ListPlacementsFluentBuilder
pub fn list_placements(&self) -> ListPlacementsFluentBuilder
Constructs a fluent builder for the ListPlacements
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe project containing the placements to be listed.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token to retrieve the next set of results.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return per request. If not set, a default value of 100 is used.
- On success, responds with
ListPlacementsOutput
with field(s):placements(Vec::<PlacementSummary>)
:An object listing the requested placements.
next_token(Option<String>)
:The token used to retrieve the next set of results - will be effectively empty if there are no further results.
- On failure, responds with
SdkError<ListPlacementsError>
source§impl Client
impl Client
sourcepub fn list_projects(&self) -> ListProjectsFluentBuilder
pub fn list_projects(&self) -> ListProjectsFluentBuilder
Constructs a fluent builder for the ListProjects
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 token to retrieve the next set of results.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return per request. If not set, a default value of 100 is used.
- On success, responds with
ListProjectsOutput
with field(s):projects(Vec::<ProjectSummary>)
:An object containing the list of projects.
next_token(Option<String>)
:The token used to retrieve the next set of results - will be effectively empty if there are no further results.
- On failure, responds with
SdkError<ListProjectsError>
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 ARN of the resource whose tags you want to list.
- On success, responds with
ListTagsForResourceOutput
with field(s):tags(Option<HashMap::<String, String>>)
:The tags (metadata key/value pairs) which you have assigned to the resource.
- 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 ARN of the resouce for which tag(s) should be added or modified.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: trueThe new or modifying tag(s) for the resource. See AWS IoT 1-Click Service Limits for the maximum number of tags allowed per resource.
- 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 ARN of the resource whose tag you want to remove.
tag_keys(impl Into<String>)
/set_tag_keys(Option<Vec::<String>>)
:
required: trueThe keys of those tags which you want to remove.
- On success, responds with
UntagResourceOutput
- On failure, responds with
SdkError<UntagResourceError>
source§impl Client
impl Client
sourcepub fn update_placement(&self) -> UpdatePlacementFluentBuilder
pub fn update_placement(&self) -> UpdatePlacementFluentBuilder
Constructs a fluent builder for the UpdatePlacement
operation.
- The fluent builder is configurable:
placement_name(impl Into<String>)
/set_placement_name(Option<String>)
:
required: trueThe name of the placement to update.
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe name of the project containing the placement to be updated.
attributes(impl Into<String>, impl Into<String>)
/set_attributes(Option<HashMap::<String, String>>)
:
required: falseThe user-defined object of attributes used to update the placement. The maximum number of key/value pairs is 50.
- On success, responds with
UpdatePlacementOutput
- On failure, responds with
SdkError<UpdatePlacementError>
source§impl Client
impl Client
sourcepub fn update_project(&self) -> UpdateProjectFluentBuilder
pub fn update_project(&self) -> UpdateProjectFluentBuilder
Constructs a fluent builder for the UpdateProject
operation.
- The fluent builder is configurable:
project_name(impl Into<String>)
/set_project_name(Option<String>)
:
required: trueThe name of the project to be updated.
description(impl Into<String>)
/set_description(Option<String>)
:
required: falseAn optional user-defined description for the project.
placement_template(PlacementTemplate)
/set_placement_template(Option<PlacementTemplate>)
:
required: falseAn object defining the project update. Once a project has been created, you cannot add device template names to the project. However, for a given
placementTemplate
, you can update the associatedcallbackOverrides
for the device definition using this API.
- On success, responds with
UpdateProjectOutput
- On failure, responds with
SdkError<UpdateProjectError>
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> 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