aws_sdk_pcaconnectorad/types/error/
_conflict_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>This request cannot be completed for one of the following reasons because the requested resource was being concurrently modified by another request.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ConflictException {
7    #[allow(missing_docs)] // documentation missing in model
8    pub message: ::std::string::String,
9    /// <p>The identifier of the Amazon Web Services resource.</p>
10    pub resource_id: ::std::string::String,
11    /// <p>The resource type, which can be one of <code>Connector</code>, <code>Template</code>, <code>TemplateGroupAccessControlEntry</code>, <code>ServicePrincipalName</code>, or <code>DirectoryRegistration</code>.</p>
12    pub resource_type: ::std::string::String,
13    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
14}
15impl ConflictException {
16    /// <p>The identifier of the Amazon Web Services resource.</p>
17    pub fn resource_id(&self) -> &str {
18        use std::ops::Deref;
19        self.resource_id.deref()
20    }
21    /// <p>The resource type, which can be one of <code>Connector</code>, <code>Template</code>, <code>TemplateGroupAccessControlEntry</code>, <code>ServicePrincipalName</code>, or <code>DirectoryRegistration</code>.</p>
22    pub fn resource_type(&self) -> &str {
23        use std::ops::Deref;
24        self.resource_type.deref()
25    }
26}
27impl ConflictException {
28    /// Returns the error message.
29    pub fn message(&self) -> &str {
30        &self.message
31    }
32}
33impl ::std::fmt::Display for ConflictException {
34    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35        ::std::write!(f, "ConflictException")?;
36        {
37            ::std::write!(f, ": {}", &self.message)?;
38        }
39        Ok(())
40    }
41}
42impl ::std::error::Error for ConflictException {}
43impl ::aws_types::request_id::RequestId for crate::types::error::ConflictException {
44    fn request_id(&self) -> Option<&str> {
45        use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
46        self.meta().request_id()
47    }
48}
49impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ConflictException {
50    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
51        &self.meta
52    }
53}
54impl ConflictException {
55    /// Creates a new builder-style object to manufacture [`ConflictException`](crate::types::error::ConflictException).
56    pub fn builder() -> crate::types::error::builders::ConflictExceptionBuilder {
57        crate::types::error::builders::ConflictExceptionBuilder::default()
58    }
59}
60
61/// A builder for [`ConflictException`](crate::types::error::ConflictException).
62#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
63#[non_exhaustive]
64pub struct ConflictExceptionBuilder {
65    pub(crate) message: ::std::option::Option<::std::string::String>,
66    pub(crate) resource_id: ::std::option::Option<::std::string::String>,
67    pub(crate) resource_type: ::std::option::Option<::std::string::String>,
68    meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
69}
70impl ConflictExceptionBuilder {
71    #[allow(missing_docs)] // documentation missing in model
72    /// This field is required.
73    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.message = ::std::option::Option::Some(input.into());
75        self
76    }
77    #[allow(missing_docs)] // documentation missing in model
78    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.message = input;
80        self
81    }
82    #[allow(missing_docs)] // documentation missing in model
83    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
84        &self.message
85    }
86    /// <p>The identifier of the Amazon Web Services resource.</p>
87    /// This field is required.
88    pub fn resource_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.resource_id = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <p>The identifier of the Amazon Web Services resource.</p>
93    pub fn set_resource_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.resource_id = input;
95        self
96    }
97    /// <p>The identifier of the Amazon Web Services resource.</p>
98    pub fn get_resource_id(&self) -> &::std::option::Option<::std::string::String> {
99        &self.resource_id
100    }
101    /// <p>The resource type, which can be one of <code>Connector</code>, <code>Template</code>, <code>TemplateGroupAccessControlEntry</code>, <code>ServicePrincipalName</code>, or <code>DirectoryRegistration</code>.</p>
102    /// This field is required.
103    pub fn resource_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.resource_type = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>The resource type, which can be one of <code>Connector</code>, <code>Template</code>, <code>TemplateGroupAccessControlEntry</code>, <code>ServicePrincipalName</code>, or <code>DirectoryRegistration</code>.</p>
108    pub fn set_resource_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.resource_type = input;
110        self
111    }
112    /// <p>The resource type, which can be one of <code>Connector</code>, <code>Template</code>, <code>TemplateGroupAccessControlEntry</code>, <code>ServicePrincipalName</code>, or <code>DirectoryRegistration</code>.</p>
113    pub fn get_resource_type(&self) -> &::std::option::Option<::std::string::String> {
114        &self.resource_type
115    }
116    /// Sets error metadata
117    pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self {
118        self.meta = Some(meta);
119        self
120    }
121
122    /// Sets error metadata
123    pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self {
124        self.meta = meta;
125        self
126    }
127    /// Consumes the builder and constructs a [`ConflictException`](crate::types::error::ConflictException).
128    /// This method will fail if any of the following fields are not set:
129    /// - [`message`](crate::types::error::builders::ConflictExceptionBuilder::message)
130    /// - [`resource_id`](crate::types::error::builders::ConflictExceptionBuilder::resource_id)
131    /// - [`resource_type`](crate::types::error::builders::ConflictExceptionBuilder::resource_type)
132    pub fn build(self) -> ::std::result::Result<crate::types::error::ConflictException, ::aws_smithy_types::error::operation::BuildError> {
133        ::std::result::Result::Ok(crate::types::error::ConflictException {
134            message: self.message.ok_or_else(|| {
135                ::aws_smithy_types::error::operation::BuildError::missing_field(
136                    "message",
137                    "message was not specified but it is required when building ConflictException",
138                )
139            })?,
140            resource_id: self.resource_id.ok_or_else(|| {
141                ::aws_smithy_types::error::operation::BuildError::missing_field(
142                    "resource_id",
143                    "resource_id was not specified but it is required when building ConflictException",
144                )
145            })?,
146            resource_type: self.resource_type.ok_or_else(|| {
147                ::aws_smithy_types::error::operation::BuildError::missing_field(
148                    "resource_type",
149                    "resource_type was not specified but it is required when building ConflictException",
150                )
151            })?,
152            meta: self.meta.unwrap_or_default(),
153        })
154    }
155}