use std::error::Error;
use std::fmt;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::credential::ProvideAwsCredentials;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoError, RusotoFuture};
use rusoto_core::param::{Params, ServiceParams};
use rusoto_core::proto;
use rusoto_core::signature::SignedRequest;
use serde_json;
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateDeviceWithPlacementRequest {
#[serde(rename = "deviceId")]
pub device_id: String,
#[serde(rename = "deviceTemplateName")]
pub device_template_name: String,
#[serde(rename = "placementName")]
pub placement_name: String,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateDeviceWithPlacementResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreatePlacementRequest {
#[serde(rename = "attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "placementName")]
pub placement_name: String,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreatePlacementResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateProjectRequest {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "placementTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_template: Option<PlacementTemplate>,
#[serde(rename = "projectName")]
pub project_name: String,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateProjectResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeletePlacementRequest {
#[serde(rename = "placementName")]
pub placement_name: String,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeletePlacementResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteProjectRequest {
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteProjectResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribePlacementRequest {
#[serde(rename = "placementName")]
pub placement_name: String,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribePlacementResponse {
#[serde(rename = "placement")]
pub placement: PlacementDescription,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeProjectRequest {
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeProjectResponse {
#[serde(rename = "project")]
pub project: ProjectDescription,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeviceTemplate {
#[serde(rename = "callbackOverrides")]
#[serde(skip_serializing_if = "Option::is_none")]
pub callback_overrides: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "deviceType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisassociateDeviceFromPlacementRequest {
#[serde(rename = "deviceTemplateName")]
pub device_template_name: String,
#[serde(rename = "placementName")]
pub placement_name: String,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisassociateDeviceFromPlacementResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetDevicesInPlacementRequest {
#[serde(rename = "placementName")]
pub placement_name: String,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetDevicesInPlacementResponse {
#[serde(rename = "devices")]
pub devices: ::std::collections::HashMap<String, String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListPlacementsRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListPlacementsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "placements")]
pub placements: Vec<PlacementSummary>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListProjectsRequest {
#[serde(rename = "maxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListProjectsResponse {
#[serde(rename = "nextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "projects")]
pub projects: Vec<ProjectSummary>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListTagsForResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListTagsForResourceResponse {
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PlacementDescription {
#[serde(rename = "attributes")]
pub attributes: ::std::collections::HashMap<String, String>,
#[serde(rename = "createdDate")]
pub created_date: f64,
#[serde(rename = "placementName")]
pub placement_name: String,
#[serde(rename = "projectName")]
pub project_name: String,
#[serde(rename = "updatedDate")]
pub updated_date: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct PlacementSummary {
#[serde(rename = "createdDate")]
pub created_date: f64,
#[serde(rename = "placementName")]
pub placement_name: String,
#[serde(rename = "projectName")]
pub project_name: String,
#[serde(rename = "updatedDate")]
pub updated_date: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PlacementTemplate {
#[serde(rename = "defaultAttributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub default_attributes: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "deviceTemplates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub device_templates: Option<::std::collections::HashMap<String, DeviceTemplate>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ProjectDescription {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "createdDate")]
pub created_date: f64,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "placementTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_template: Option<PlacementTemplate>,
#[serde(rename = "projectName")]
pub project_name: String,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "updatedDate")]
pub updated_date: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ProjectSummary {
#[serde(rename = "arn")]
#[serde(skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
#[serde(rename = "createdDate")]
pub created_date: f64,
#[serde(rename = "projectName")]
pub project_name: String,
#[serde(rename = "tags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "updatedDate")]
pub updated_date: f64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct TagResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tags")]
pub tags: ::std::collections::HashMap<String, String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct TagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UntagResourceRequest {
#[serde(rename = "resourceArn")]
pub resource_arn: String,
#[serde(rename = "tagKeys")]
pub tag_keys: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UntagResourceResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdatePlacementRequest {
#[serde(rename = "attributes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub attributes: Option<::std::collections::HashMap<String, String>>,
#[serde(rename = "placementName")]
pub placement_name: String,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdatePlacementResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateProjectRequest {
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "placementTemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_template: Option<PlacementTemplate>,
#[serde(rename = "projectName")]
pub project_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateProjectResponse {}
#[derive(Debug, PartialEq)]
pub enum AssociateDeviceWithPlacementError {
InternalFailure(String),
InvalidRequest(String),
ResourceConflict(String),
ResourceNotFound(String),
}
impl AssociateDeviceWithPlacementError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<AssociateDeviceWithPlacementError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(
AssociateDeviceWithPlacementError::InternalFailure(err.msg),
)
}
"InvalidRequestException" => {
return RusotoError::Service(AssociateDeviceWithPlacementError::InvalidRequest(
err.msg,
))
}
"ResourceConflictException" => {
return RusotoError::Service(
AssociateDeviceWithPlacementError::ResourceConflict(err.msg),
)
}
"ResourceNotFoundException" => {
return RusotoError::Service(
AssociateDeviceWithPlacementError::ResourceNotFound(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for AssociateDeviceWithPlacementError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateDeviceWithPlacementError {
fn description(&self) -> &str {
match *self {
AssociateDeviceWithPlacementError::InternalFailure(ref cause) => cause,
AssociateDeviceWithPlacementError::InvalidRequest(ref cause) => cause,
AssociateDeviceWithPlacementError::ResourceConflict(ref cause) => cause,
AssociateDeviceWithPlacementError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreatePlacementError {
InternalFailure(String),
InvalidRequest(String),
ResourceConflict(String),
ResourceNotFound(String),
}
impl CreatePlacementError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreatePlacementError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(CreatePlacementError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(CreatePlacementError::InvalidRequest(err.msg))
}
"ResourceConflictException" => {
return RusotoError::Service(CreatePlacementError::ResourceConflict(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(CreatePlacementError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for CreatePlacementError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreatePlacementError {
fn description(&self) -> &str {
match *self {
CreatePlacementError::InternalFailure(ref cause) => cause,
CreatePlacementError::InvalidRequest(ref cause) => cause,
CreatePlacementError::ResourceConflict(ref cause) => cause,
CreatePlacementError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateProjectError {
InternalFailure(String),
InvalidRequest(String),
ResourceConflict(String),
}
impl CreateProjectError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<CreateProjectError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(CreateProjectError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(CreateProjectError::InvalidRequest(err.msg))
}
"ResourceConflictException" => {
return RusotoError::Service(CreateProjectError::ResourceConflict(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for CreateProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateProjectError {
fn description(&self) -> &str {
match *self {
CreateProjectError::InternalFailure(ref cause) => cause,
CreateProjectError::InvalidRequest(ref cause) => cause,
CreateProjectError::ResourceConflict(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeletePlacementError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl DeletePlacementError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeletePlacementError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(DeletePlacementError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(DeletePlacementError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeletePlacementError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(DeletePlacementError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DeletePlacementError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeletePlacementError {
fn description(&self) -> &str {
match *self {
DeletePlacementError::InternalFailure(ref cause) => cause,
DeletePlacementError::InvalidRequest(ref cause) => cause,
DeletePlacementError::ResourceNotFound(ref cause) => cause,
DeletePlacementError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteProjectError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl DeleteProjectError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DeleteProjectError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(DeleteProjectError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(DeleteProjectError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DeleteProjectError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(DeleteProjectError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DeleteProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteProjectError {
fn description(&self) -> &str {
match *self {
DeleteProjectError::InternalFailure(ref cause) => cause,
DeleteProjectError::InvalidRequest(ref cause) => cause,
DeleteProjectError::ResourceNotFound(ref cause) => cause,
DeleteProjectError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribePlacementError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
}
impl DescribePlacementError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribePlacementError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(DescribePlacementError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(DescribePlacementError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribePlacementError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribePlacementError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribePlacementError {
fn description(&self) -> &str {
match *self {
DescribePlacementError::InternalFailure(ref cause) => cause,
DescribePlacementError::InvalidRequest(ref cause) => cause,
DescribePlacementError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DescribeProjectError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
}
impl DescribeProjectError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<DescribeProjectError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(DescribeProjectError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(DescribeProjectError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(DescribeProjectError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DescribeProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DescribeProjectError {
fn description(&self) -> &str {
match *self {
DescribeProjectError::InternalFailure(ref cause) => cause,
DescribeProjectError::InvalidRequest(ref cause) => cause,
DescribeProjectError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisassociateDeviceFromPlacementError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl DisassociateDeviceFromPlacementError {
pub fn from_response(
res: BufferedHttpResponse,
) -> RusotoError<DisassociateDeviceFromPlacementError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(
DisassociateDeviceFromPlacementError::InternalFailure(err.msg),
)
}
"InvalidRequestException" => {
return RusotoError::Service(
DisassociateDeviceFromPlacementError::InvalidRequest(err.msg),
)
}
"ResourceNotFoundException" => {
return RusotoError::Service(
DisassociateDeviceFromPlacementError::ResourceNotFound(err.msg),
)
}
"TooManyRequestsException" => {
return RusotoError::Service(
DisassociateDeviceFromPlacementError::TooManyRequests(err.msg),
)
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for DisassociateDeviceFromPlacementError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisassociateDeviceFromPlacementError {
fn description(&self) -> &str {
match *self {
DisassociateDeviceFromPlacementError::InternalFailure(ref cause) => cause,
DisassociateDeviceFromPlacementError::InvalidRequest(ref cause) => cause,
DisassociateDeviceFromPlacementError::ResourceNotFound(ref cause) => cause,
DisassociateDeviceFromPlacementError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetDevicesInPlacementError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
}
impl GetDevicesInPlacementError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetDevicesInPlacementError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(GetDevicesInPlacementError::InternalFailure(
err.msg,
))
}
"InvalidRequestException" => {
return RusotoError::Service(GetDevicesInPlacementError::InvalidRequest(
err.msg,
))
}
"ResourceNotFoundException" => {
return RusotoError::Service(GetDevicesInPlacementError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for GetDevicesInPlacementError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetDevicesInPlacementError {
fn description(&self) -> &str {
match *self {
GetDevicesInPlacementError::InternalFailure(ref cause) => cause,
GetDevicesInPlacementError::InvalidRequest(ref cause) => cause,
GetDevicesInPlacementError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListPlacementsError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
}
impl ListPlacementsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListPlacementsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(ListPlacementsError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(ListPlacementsError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListPlacementsError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListPlacementsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListPlacementsError {
fn description(&self) -> &str {
match *self {
ListPlacementsError::InternalFailure(ref cause) => cause,
ListPlacementsError::InvalidRequest(ref cause) => cause,
ListPlacementsError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListProjectsError {
InternalFailure(String),
InvalidRequest(String),
}
impl ListProjectsError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListProjectsError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(ListProjectsError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(ListProjectsError::InvalidRequest(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListProjectsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListProjectsError {
fn description(&self) -> &str {
match *self {
ListProjectsError::InternalFailure(ref cause) => cause,
ListProjectsError::InvalidRequest(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListTagsForResourceError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
}
impl ListTagsForResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListTagsForResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(ListTagsForResourceError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(ListTagsForResourceError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(ListTagsForResourceError::ResourceNotFound(
err.msg,
))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for ListTagsForResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListTagsForResourceError {
fn description(&self) -> &str {
match *self {
ListTagsForResourceError::InternalFailure(ref cause) => cause,
ListTagsForResourceError::InvalidRequest(ref cause) => cause,
ListTagsForResourceError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum TagResourceError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
}
impl TagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<TagResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(TagResourceError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(TagResourceError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(TagResourceError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for TagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for TagResourceError {
fn description(&self) -> &str {
match *self {
TagResourceError::InternalFailure(ref cause) => cause,
TagResourceError::InvalidRequest(ref cause) => cause,
TagResourceError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UntagResourceError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
}
impl UntagResourceError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UntagResourceError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(UntagResourceError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(UntagResourceError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UntagResourceError::ResourceNotFound(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UntagResourceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UntagResourceError {
fn description(&self) -> &str {
match *self {
UntagResourceError::InternalFailure(ref cause) => cause,
UntagResourceError::InvalidRequest(ref cause) => cause,
UntagResourceError::ResourceNotFound(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdatePlacementError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl UpdatePlacementError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdatePlacementError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(UpdatePlacementError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(UpdatePlacementError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UpdatePlacementError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(UpdatePlacementError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdatePlacementError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdatePlacementError {
fn description(&self) -> &str {
match *self {
UpdatePlacementError::InternalFailure(ref cause) => cause,
UpdatePlacementError::InvalidRequest(ref cause) => cause,
UpdatePlacementError::ResourceNotFound(ref cause) => cause,
UpdatePlacementError::TooManyRequests(ref cause) => cause,
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateProjectError {
InternalFailure(String),
InvalidRequest(String),
ResourceNotFound(String),
TooManyRequests(String),
}
impl UpdateProjectError {
pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateProjectError> {
if let Some(err) = proto::json::Error::parse_rest(&res) {
match err.typ.as_str() {
"InternalFailureException" => {
return RusotoError::Service(UpdateProjectError::InternalFailure(err.msg))
}
"InvalidRequestException" => {
return RusotoError::Service(UpdateProjectError::InvalidRequest(err.msg))
}
"ResourceNotFoundException" => {
return RusotoError::Service(UpdateProjectError::ResourceNotFound(err.msg))
}
"TooManyRequestsException" => {
return RusotoError::Service(UpdateProjectError::TooManyRequests(err.msg))
}
"ValidationException" => return RusotoError::Validation(err.msg),
_ => {}
}
}
return RusotoError::Unknown(res);
}
}
impl fmt::Display for UpdateProjectError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateProjectError {
fn description(&self) -> &str {
match *self {
UpdateProjectError::InternalFailure(ref cause) => cause,
UpdateProjectError::InvalidRequest(ref cause) => cause,
UpdateProjectError::ResourceNotFound(ref cause) => cause,
UpdateProjectError::TooManyRequests(ref cause) => cause,
}
}
}
pub trait Iot1ClickProjects {
fn associate_device_with_placement(
&self,
input: AssociateDeviceWithPlacementRequest,
) -> RusotoFuture<AssociateDeviceWithPlacementResponse, AssociateDeviceWithPlacementError>;
fn create_placement(
&self,
input: CreatePlacementRequest,
) -> RusotoFuture<CreatePlacementResponse, CreatePlacementError>;
fn create_project(
&self,
input: CreateProjectRequest,
) -> RusotoFuture<CreateProjectResponse, CreateProjectError>;
fn delete_placement(
&self,
input: DeletePlacementRequest,
) -> RusotoFuture<DeletePlacementResponse, DeletePlacementError>;
fn delete_project(
&self,
input: DeleteProjectRequest,
) -> RusotoFuture<DeleteProjectResponse, DeleteProjectError>;
fn describe_placement(
&self,
input: DescribePlacementRequest,
) -> RusotoFuture<DescribePlacementResponse, DescribePlacementError>;
fn describe_project(
&self,
input: DescribeProjectRequest,
) -> RusotoFuture<DescribeProjectResponse, DescribeProjectError>;
fn disassociate_device_from_placement(
&self,
input: DisassociateDeviceFromPlacementRequest,
) -> RusotoFuture<DisassociateDeviceFromPlacementResponse, DisassociateDeviceFromPlacementError>;
fn get_devices_in_placement(
&self,
input: GetDevicesInPlacementRequest,
) -> RusotoFuture<GetDevicesInPlacementResponse, GetDevicesInPlacementError>;
fn list_placements(
&self,
input: ListPlacementsRequest,
) -> RusotoFuture<ListPlacementsResponse, ListPlacementsError>;
fn list_projects(
&self,
input: ListProjectsRequest,
) -> RusotoFuture<ListProjectsResponse, ListProjectsError>;
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError>;
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError>;
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError>;
fn update_placement(
&self,
input: UpdatePlacementRequest,
) -> RusotoFuture<UpdatePlacementResponse, UpdatePlacementError>;
fn update_project(
&self,
input: UpdateProjectRequest,
) -> RusotoFuture<UpdateProjectResponse, UpdateProjectError>;
}
#[derive(Clone)]
pub struct Iot1ClickProjectsClient {
client: Client,
region: region::Region,
}
impl Iot1ClickProjectsClient {
pub fn new(region: region::Region) -> Iot1ClickProjectsClient {
Iot1ClickProjectsClient {
client: Client::shared(),
region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> Iot1ClickProjectsClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
Iot1ClickProjectsClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region,
}
}
}
impl Iot1ClickProjects for Iot1ClickProjectsClient {
fn associate_device_with_placement(
&self,
input: AssociateDeviceWithPlacementRequest,
) -> RusotoFuture<AssociateDeviceWithPlacementResponse, AssociateDeviceWithPlacementError> {
let request_uri = format!(
"/projects/{project_name}/placements/{placement_name}/devices/{device_template_name}",
device_template_name = input.device_template_name,
placement_name = input.placement_name,
project_name = input.project_name
);
let mut request = SignedRequest::new("PUT", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<AssociateDeviceWithPlacementResponse, _>()?;
Ok(result)
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AssociateDeviceWithPlacementError::from_response(response))
}))
}
})
}
fn create_placement(
&self,
input: CreatePlacementRequest,
) -> RusotoFuture<CreatePlacementResponse, CreatePlacementError> {
let request_uri = format!(
"/projects/{project_name}/placements",
project_name = input.project_name
);
let mut request = SignedRequest::new("POST", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<CreatePlacementResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreatePlacementError::from_response(response))),
)
}
})
}
fn create_project(
&self,
input: CreateProjectRequest,
) -> RusotoFuture<CreateProjectResponse, CreateProjectError> {
let request_uri = "/projects";
let mut request = SignedRequest::new("POST", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<CreateProjectResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateProjectError::from_response(response))),
)
}
})
}
fn delete_placement(
&self,
input: DeletePlacementRequest,
) -> RusotoFuture<DeletePlacementResponse, DeletePlacementError> {
let request_uri = format!(
"/projects/{project_name}/placements/{placement_name}",
placement_name = input.placement_name,
project_name = input.project_name
);
let mut request = SignedRequest::new("DELETE", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DeletePlacementResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeletePlacementError::from_response(response))),
)
}
})
}
fn delete_project(
&self,
input: DeleteProjectRequest,
) -> RusotoFuture<DeleteProjectResponse, DeleteProjectError> {
let request_uri = format!(
"/projects/{project_name}",
project_name = input.project_name
);
let mut request = SignedRequest::new("DELETE", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DeleteProjectResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteProjectError::from_response(response))),
)
}
})
}
fn describe_placement(
&self,
input: DescribePlacementRequest,
) -> RusotoFuture<DescribePlacementResponse, DescribePlacementError> {
let request_uri = format!(
"/projects/{project_name}/placements/{placement_name}",
placement_name = input.placement_name,
project_name = input.project_name
);
let mut request = SignedRequest::new("GET", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DescribePlacementResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribePlacementError::from_response(response))),
)
}
})
}
fn describe_project(
&self,
input: DescribeProjectRequest,
) -> RusotoFuture<DescribeProjectResponse, DescribeProjectError> {
let request_uri = format!(
"/projects/{project_name}",
project_name = input.project_name
);
let mut request = SignedRequest::new("GET", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DescribeProjectResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DescribeProjectError::from_response(response))),
)
}
})
}
fn disassociate_device_from_placement(
&self,
input: DisassociateDeviceFromPlacementRequest,
) -> RusotoFuture<DisassociateDeviceFromPlacementResponse, DisassociateDeviceFromPlacementError>
{
let request_uri = format!(
"/projects/{project_name}/placements/{placement_name}/devices/{device_template_name}",
device_template_name = input.device_template_name,
placement_name = input.placement_name,
project_name = input.project_name
);
let mut request = SignedRequest::new("DELETE", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<DisassociateDeviceFromPlacementResponse, _>()?;
Ok(result)
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DisassociateDeviceFromPlacementError::from_response(
response,
))
}))
}
})
}
fn get_devices_in_placement(
&self,
input: GetDevicesInPlacementRequest,
) -> RusotoFuture<GetDevicesInPlacementResponse, GetDevicesInPlacementError> {
let request_uri = format!(
"/projects/{project_name}/placements/{placement_name}/devices",
placement_name = input.placement_name,
project_name = input.project_name
);
let mut request = SignedRequest::new("GET", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<GetDevicesInPlacementResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetDevicesInPlacementError::from_response(response))
}),
)
}
})
}
fn list_placements(
&self,
input: ListPlacementsRequest,
) -> RusotoFuture<ListPlacementsResponse, ListPlacementsError> {
let request_uri = format!(
"/projects/{project_name}/placements",
project_name = input.project_name
);
let mut request = SignedRequest::new("GET", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListPlacementsResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListPlacementsError::from_response(response))),
)
}
})
}
fn list_projects(
&self,
input: ListProjectsRequest,
) -> RusotoFuture<ListProjectsResponse, ListProjectsError> {
let request_uri = "/projects";
let mut request = SignedRequest::new("GET", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
let mut params = Params::new();
if let Some(ref x) = input.max_results {
params.put("maxResults", x);
}
if let Some(ref x) = input.next_token {
params.put("nextToken", x);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListProjectsResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListProjectsError::from_response(response))),
)
}
})
}
fn list_tags_for_resource(
&self,
input: ListTagsForResourceRequest,
) -> RusotoFuture<ListTagsForResourceResponse, ListTagsForResourceError> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("GET", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<ListTagsForResourceResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListTagsForResourceError::from_response(response))
}),
)
}
})
}
fn tag_resource(
&self,
input: TagResourceRequest,
) -> RusotoFuture<TagResourceResponse, TagResourceError> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("POST", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<TagResourceResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(TagResourceError::from_response(response))),
)
}
})
}
fn untag_resource(
&self,
input: UntagResourceRequest,
) -> RusotoFuture<UntagResourceResponse, UntagResourceError> {
let request_uri = format!("/tags/{resource_arn}", resource_arn = input.resource_arn);
let mut request = SignedRequest::new("DELETE", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
let mut params = Params::new();
for item in input.tag_keys.iter() {
params.put("tagKeys", item);
}
request.set_params(params);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UntagResourceResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UntagResourceError::from_response(response))),
)
}
})
}
fn update_placement(
&self,
input: UpdatePlacementRequest,
) -> RusotoFuture<UpdatePlacementResponse, UpdatePlacementError> {
let request_uri = format!(
"/projects/{project_name}/placements/{placement_name}",
placement_name = input.placement_name,
project_name = input.project_name
);
let mut request = SignedRequest::new("PUT", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UpdatePlacementResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdatePlacementError::from_response(response))),
)
}
})
}
fn update_project(
&self,
input: UpdateProjectRequest,
) -> RusotoFuture<UpdateProjectResponse, UpdateProjectError> {
let request_uri = format!(
"/projects/{project_name}",
project_name = input.project_name
);
let mut request = SignedRequest::new("PUT", "iot1click", &self.region, &request_uri);
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.set_endpoint_prefix("projects.iot1click".to_string());
let encoded = Some(serde_json::to_vec(&input).unwrap());
request.set_payload(encoded);
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().and_then(|response| {
let result = proto::json::ResponsePayload::new(&response)
.deserialize::<UpdateProjectResponse, _>()?;
Ok(result)
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateProjectError::from_response(response))),
)
}
})
}
}