aws_sdk_codestarconnections/operation/create_connection/_create_connection_output.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateConnectionOutput {
6 /// <p>The Amazon Resource Name (ARN) of the connection to be created. The ARN is used as the connection reference when the connection is shared between Amazon Web Services services.</p><note>
7 /// <p>The ARN is never reused if the connection is deleted.</p>
8 /// </note>
9 pub connection_arn: ::std::string::String,
10 /// <p>Specifies the tags applied to the resource.</p>
11 pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
12 _request_id: Option<String>,
13}
14impl CreateConnectionOutput {
15 /// <p>The Amazon Resource Name (ARN) of the connection to be created. The ARN is used as the connection reference when the connection is shared between Amazon Web Services services.</p><note>
16 /// <p>The ARN is never reused if the connection is deleted.</p>
17 /// </note>
18 pub fn connection_arn(&self) -> &str {
19 use std::ops::Deref;
20 self.connection_arn.deref()
21 }
22 /// <p>Specifies the tags applied to the resource.</p>
23 ///
24 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
25 pub fn tags(&self) -> &[crate::types::Tag] {
26 self.tags.as_deref().unwrap_or_default()
27 }
28}
29impl ::aws_types::request_id::RequestId for CreateConnectionOutput {
30 fn request_id(&self) -> Option<&str> {
31 self._request_id.as_deref()
32 }
33}
34impl CreateConnectionOutput {
35 /// Creates a new builder-style object to manufacture [`CreateConnectionOutput`](crate::operation::create_connection::CreateConnectionOutput).
36 pub fn builder() -> crate::operation::create_connection::builders::CreateConnectionOutputBuilder {
37 crate::operation::create_connection::builders::CreateConnectionOutputBuilder::default()
38 }
39}
40
41/// A builder for [`CreateConnectionOutput`](crate::operation::create_connection::CreateConnectionOutput).
42#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
43#[non_exhaustive]
44pub struct CreateConnectionOutputBuilder {
45 pub(crate) connection_arn: ::std::option::Option<::std::string::String>,
46 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
47 _request_id: Option<String>,
48}
49impl CreateConnectionOutputBuilder {
50 /// <p>The Amazon Resource Name (ARN) of the connection to be created. The ARN is used as the connection reference when the connection is shared between Amazon Web Services services.</p><note>
51 /// <p>The ARN is never reused if the connection is deleted.</p>
52 /// </note>
53 /// This field is required.
54 pub fn connection_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55 self.connection_arn = ::std::option::Option::Some(input.into());
56 self
57 }
58 /// <p>The Amazon Resource Name (ARN) of the connection to be created. The ARN is used as the connection reference when the connection is shared between Amazon Web Services services.</p><note>
59 /// <p>The ARN is never reused if the connection is deleted.</p>
60 /// </note>
61 pub fn set_connection_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62 self.connection_arn = input;
63 self
64 }
65 /// <p>The Amazon Resource Name (ARN) of the connection to be created. The ARN is used as the connection reference when the connection is shared between Amazon Web Services services.</p><note>
66 /// <p>The ARN is never reused if the connection is deleted.</p>
67 /// </note>
68 pub fn get_connection_arn(&self) -> &::std::option::Option<::std::string::String> {
69 &self.connection_arn
70 }
71 /// Appends an item to `tags`.
72 ///
73 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
74 ///
75 /// <p>Specifies the tags applied to the resource.</p>
76 pub fn tags(mut self, input: crate::types::Tag) -> Self {
77 let mut v = self.tags.unwrap_or_default();
78 v.push(input);
79 self.tags = ::std::option::Option::Some(v);
80 self
81 }
82 /// <p>Specifies the tags applied to the resource.</p>
83 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
84 self.tags = input;
85 self
86 }
87 /// <p>Specifies the tags applied to the resource.</p>
88 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
89 &self.tags
90 }
91 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
92 self._request_id = Some(request_id.into());
93 self
94 }
95
96 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
97 self._request_id = request_id;
98 self
99 }
100 /// Consumes the builder and constructs a [`CreateConnectionOutput`](crate::operation::create_connection::CreateConnectionOutput).
101 /// This method will fail if any of the following fields are not set:
102 /// - [`connection_arn`](crate::operation::create_connection::builders::CreateConnectionOutputBuilder::connection_arn)
103 pub fn build(
104 self,
105 ) -> ::std::result::Result<crate::operation::create_connection::CreateConnectionOutput, ::aws_smithy_types::error::operation::BuildError> {
106 ::std::result::Result::Ok(crate::operation::create_connection::CreateConnectionOutput {
107 connection_arn: self.connection_arn.ok_or_else(|| {
108 ::aws_smithy_types::error::operation::BuildError::missing_field(
109 "connection_arn",
110 "connection_arn was not specified but it is required when building CreateConnectionOutput",
111 )
112 })?,
113 tags: self.tags,
114 _request_id: self._request_id,
115 })
116 }
117}