aws_sdk_verifiedpermissions/operation/get_schema/
_get_schema_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)]
5pub struct GetSchemaOutput {
6    /// <p>The ID of the policy store that contains the schema.</p>
7    pub policy_store_id: ::std::string::String,
8    /// <p>The body of the schema, written in Cedar schema JSON.</p>
9    pub schema: ::std::string::String,
10    /// <p>The date and time that the schema was originally created.</p>
11    pub created_date: ::aws_smithy_types::DateTime,
12    /// <p>The date and time that the schema was most recently updated.</p>
13    pub last_updated_date: ::aws_smithy_types::DateTime,
14    /// <p>The namespaces of the entities referenced by this schema.</p>
15    pub namespaces: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
16    _request_id: Option<String>,
17}
18impl GetSchemaOutput {
19    /// <p>The ID of the policy store that contains the schema.</p>
20    pub fn policy_store_id(&self) -> &str {
21        use std::ops::Deref;
22        self.policy_store_id.deref()
23    }
24    /// <p>The body of the schema, written in Cedar schema JSON.</p>
25    pub fn schema(&self) -> &str {
26        use std::ops::Deref;
27        self.schema.deref()
28    }
29    /// <p>The date and time that the schema was originally created.</p>
30    pub fn created_date(&self) -> &::aws_smithy_types::DateTime {
31        &self.created_date
32    }
33    /// <p>The date and time that the schema was most recently updated.</p>
34    pub fn last_updated_date(&self) -> &::aws_smithy_types::DateTime {
35        &self.last_updated_date
36    }
37    /// <p>The namespaces of the entities referenced by this schema.</p>
38    ///
39    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.namespaces.is_none()`.
40    pub fn namespaces(&self) -> &[::std::string::String] {
41        self.namespaces.as_deref().unwrap_or_default()
42    }
43}
44impl ::std::fmt::Debug for GetSchemaOutput {
45    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
46        let mut formatter = f.debug_struct("GetSchemaOutput");
47        formatter.field("policy_store_id", &self.policy_store_id);
48        formatter.field("schema", &"*** Sensitive Data Redacted ***");
49        formatter.field("created_date", &self.created_date);
50        formatter.field("last_updated_date", &self.last_updated_date);
51        formatter.field("namespaces", &"*** Sensitive Data Redacted ***");
52        formatter.field("_request_id", &self._request_id);
53        formatter.finish()
54    }
55}
56impl ::aws_types::request_id::RequestId for GetSchemaOutput {
57    fn request_id(&self) -> Option<&str> {
58        self._request_id.as_deref()
59    }
60}
61impl GetSchemaOutput {
62    /// Creates a new builder-style object to manufacture [`GetSchemaOutput`](crate::operation::get_schema::GetSchemaOutput).
63    pub fn builder() -> crate::operation::get_schema::builders::GetSchemaOutputBuilder {
64        crate::operation::get_schema::builders::GetSchemaOutputBuilder::default()
65    }
66}
67
68/// A builder for [`GetSchemaOutput`](crate::operation::get_schema::GetSchemaOutput).
69#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
70#[non_exhaustive]
71pub struct GetSchemaOutputBuilder {
72    pub(crate) policy_store_id: ::std::option::Option<::std::string::String>,
73    pub(crate) schema: ::std::option::Option<::std::string::String>,
74    pub(crate) created_date: ::std::option::Option<::aws_smithy_types::DateTime>,
75    pub(crate) last_updated_date: ::std::option::Option<::aws_smithy_types::DateTime>,
76    pub(crate) namespaces: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
77    _request_id: Option<String>,
78}
79impl GetSchemaOutputBuilder {
80    /// <p>The ID of the policy store that contains the schema.</p>
81    /// This field is required.
82    pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83        self.policy_store_id = ::std::option::Option::Some(input.into());
84        self
85    }
86    /// <p>The ID of the policy store that contains the schema.</p>
87    pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88        self.policy_store_id = input;
89        self
90    }
91    /// <p>The ID of the policy store that contains the schema.</p>
92    pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
93        &self.policy_store_id
94    }
95    /// <p>The body of the schema, written in Cedar schema JSON.</p>
96    /// This field is required.
97    pub fn schema(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98        self.schema = ::std::option::Option::Some(input.into());
99        self
100    }
101    /// <p>The body of the schema, written in Cedar schema JSON.</p>
102    pub fn set_schema(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
103        self.schema = input;
104        self
105    }
106    /// <p>The body of the schema, written in Cedar schema JSON.</p>
107    pub fn get_schema(&self) -> &::std::option::Option<::std::string::String> {
108        &self.schema
109    }
110    /// <p>The date and time that the schema was originally created.</p>
111    /// This field is required.
112    pub fn created_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
113        self.created_date = ::std::option::Option::Some(input);
114        self
115    }
116    /// <p>The date and time that the schema was originally created.</p>
117    pub fn set_created_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
118        self.created_date = input;
119        self
120    }
121    /// <p>The date and time that the schema was originally created.</p>
122    pub fn get_created_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
123        &self.created_date
124    }
125    /// <p>The date and time that the schema was most recently updated.</p>
126    /// This field is required.
127    pub fn last_updated_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
128        self.last_updated_date = ::std::option::Option::Some(input);
129        self
130    }
131    /// <p>The date and time that the schema was most recently updated.</p>
132    pub fn set_last_updated_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
133        self.last_updated_date = input;
134        self
135    }
136    /// <p>The date and time that the schema was most recently updated.</p>
137    pub fn get_last_updated_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
138        &self.last_updated_date
139    }
140    /// Appends an item to `namespaces`.
141    ///
142    /// To override the contents of this collection use [`set_namespaces`](Self::set_namespaces).
143    ///
144    /// <p>The namespaces of the entities referenced by this schema.</p>
145    pub fn namespaces(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        let mut v = self.namespaces.unwrap_or_default();
147        v.push(input.into());
148        self.namespaces = ::std::option::Option::Some(v);
149        self
150    }
151    /// <p>The namespaces of the entities referenced by this schema.</p>
152    pub fn set_namespaces(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
153        self.namespaces = input;
154        self
155    }
156    /// <p>The namespaces of the entities referenced by this schema.</p>
157    pub fn get_namespaces(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
158        &self.namespaces
159    }
160    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
161        self._request_id = Some(request_id.into());
162        self
163    }
164
165    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
166        self._request_id = request_id;
167        self
168    }
169    /// Consumes the builder and constructs a [`GetSchemaOutput`](crate::operation::get_schema::GetSchemaOutput).
170    /// This method will fail if any of the following fields are not set:
171    /// - [`policy_store_id`](crate::operation::get_schema::builders::GetSchemaOutputBuilder::policy_store_id)
172    /// - [`schema`](crate::operation::get_schema::builders::GetSchemaOutputBuilder::schema)
173    /// - [`created_date`](crate::operation::get_schema::builders::GetSchemaOutputBuilder::created_date)
174    /// - [`last_updated_date`](crate::operation::get_schema::builders::GetSchemaOutputBuilder::last_updated_date)
175    pub fn build(self) -> ::std::result::Result<crate::operation::get_schema::GetSchemaOutput, ::aws_smithy_types::error::operation::BuildError> {
176        ::std::result::Result::Ok(crate::operation::get_schema::GetSchemaOutput {
177            policy_store_id: self.policy_store_id.ok_or_else(|| {
178                ::aws_smithy_types::error::operation::BuildError::missing_field(
179                    "policy_store_id",
180                    "policy_store_id was not specified but it is required when building GetSchemaOutput",
181                )
182            })?,
183            schema: self.schema.ok_or_else(|| {
184                ::aws_smithy_types::error::operation::BuildError::missing_field(
185                    "schema",
186                    "schema was not specified but it is required when building GetSchemaOutput",
187                )
188            })?,
189            created_date: self.created_date.ok_or_else(|| {
190                ::aws_smithy_types::error::operation::BuildError::missing_field(
191                    "created_date",
192                    "created_date was not specified but it is required when building GetSchemaOutput",
193                )
194            })?,
195            last_updated_date: self.last_updated_date.ok_or_else(|| {
196                ::aws_smithy_types::error::operation::BuildError::missing_field(
197                    "last_updated_date",
198                    "last_updated_date was not specified but it is required when building GetSchemaOutput",
199                )
200            })?,
201            namespaces: self.namespaces,
202            _request_id: self._request_id,
203        })
204    }
205}
206impl ::std::fmt::Debug for GetSchemaOutputBuilder {
207    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
208        let mut formatter = f.debug_struct("GetSchemaOutputBuilder");
209        formatter.field("policy_store_id", &self.policy_store_id);
210        formatter.field("schema", &"*** Sensitive Data Redacted ***");
211        formatter.field("created_date", &self.created_date);
212        formatter.field("last_updated_date", &self.last_updated_date);
213        formatter.field("namespaces", &"*** Sensitive Data Redacted ***");
214        formatter.field("_request_id", &self._request_id);
215        formatter.finish()
216    }
217}