aws_sdk_apigateway/operation/create_model/
_create_model_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Request to add a new Model to an existing RestApi resource.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateModelInput {
7    /// <p>The RestApi identifier under which the Model will be created.</p>
8    pub rest_api_id: ::std::option::Option<::std::string::String>,
9    /// <p>The name of the model. Must be alphanumeric.</p>
10    pub name: ::std::option::Option<::std::string::String>,
11    /// <p>The description of the model.</p>
12    pub description: ::std::option::Option<::std::string::String>,
13    /// <p>The schema for the model. For <code>application/json</code> models, this should be JSON schema draft 4 model. The maximum size of the model is 400 KB.</p>
14    pub schema: ::std::option::Option<::std::string::String>,
15    /// <p>The content-type for the model.</p>
16    pub content_type: ::std::option::Option<::std::string::String>,
17}
18impl CreateModelInput {
19    /// <p>The RestApi identifier under which the Model will be created.</p>
20    pub fn rest_api_id(&self) -> ::std::option::Option<&str> {
21        self.rest_api_id.as_deref()
22    }
23    /// <p>The name of the model. Must be alphanumeric.</p>
24    pub fn name(&self) -> ::std::option::Option<&str> {
25        self.name.as_deref()
26    }
27    /// <p>The description of the model.</p>
28    pub fn description(&self) -> ::std::option::Option<&str> {
29        self.description.as_deref()
30    }
31    /// <p>The schema for the model. For <code>application/json</code> models, this should be JSON schema draft 4 model. The maximum size of the model is 400 KB.</p>
32    pub fn schema(&self) -> ::std::option::Option<&str> {
33        self.schema.as_deref()
34    }
35    /// <p>The content-type for the model.</p>
36    pub fn content_type(&self) -> ::std::option::Option<&str> {
37        self.content_type.as_deref()
38    }
39}
40impl CreateModelInput {
41    /// Creates a new builder-style object to manufacture [`CreateModelInput`](crate::operation::create_model::CreateModelInput).
42    pub fn builder() -> crate::operation::create_model::builders::CreateModelInputBuilder {
43        crate::operation::create_model::builders::CreateModelInputBuilder::default()
44    }
45}
46
47/// A builder for [`CreateModelInput`](crate::operation::create_model::CreateModelInput).
48#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
49#[non_exhaustive]
50pub struct CreateModelInputBuilder {
51    pub(crate) rest_api_id: ::std::option::Option<::std::string::String>,
52    pub(crate) name: ::std::option::Option<::std::string::String>,
53    pub(crate) description: ::std::option::Option<::std::string::String>,
54    pub(crate) schema: ::std::option::Option<::std::string::String>,
55    pub(crate) content_type: ::std::option::Option<::std::string::String>,
56}
57impl CreateModelInputBuilder {
58    /// <p>The RestApi identifier under which the Model will be created.</p>
59    /// This field is required.
60    pub fn rest_api_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
61        self.rest_api_id = ::std::option::Option::Some(input.into());
62        self
63    }
64    /// <p>The RestApi identifier under which the Model will be created.</p>
65    pub fn set_rest_api_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
66        self.rest_api_id = input;
67        self
68    }
69    /// <p>The RestApi identifier under which the Model will be created.</p>
70    pub fn get_rest_api_id(&self) -> &::std::option::Option<::std::string::String> {
71        &self.rest_api_id
72    }
73    /// <p>The name of the model. Must be alphanumeric.</p>
74    /// This field is required.
75    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.name = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The name of the model. Must be alphanumeric.</p>
80    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.name = input;
82        self
83    }
84    /// <p>The name of the model. Must be alphanumeric.</p>
85    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
86        &self.name
87    }
88    /// <p>The description of the model.</p>
89    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
90        self.description = ::std::option::Option::Some(input.into());
91        self
92    }
93    /// <p>The description of the model.</p>
94    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
95        self.description = input;
96        self
97    }
98    /// <p>The description of the model.</p>
99    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
100        &self.description
101    }
102    /// <p>The schema for the model. For <code>application/json</code> models, this should be JSON schema draft 4 model. The maximum size of the model is 400 KB.</p>
103    pub fn schema(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.schema = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>The schema for the model. For <code>application/json</code> models, this should be JSON schema draft 4 model. The maximum size of the model is 400 KB.</p>
108    pub fn set_schema(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.schema = input;
110        self
111    }
112    /// <p>The schema for the model. For <code>application/json</code> models, this should be JSON schema draft 4 model. The maximum size of the model is 400 KB.</p>
113    pub fn get_schema(&self) -> &::std::option::Option<::std::string::String> {
114        &self.schema
115    }
116    /// <p>The content-type for the model.</p>
117    /// This field is required.
118    pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.content_type = ::std::option::Option::Some(input.into());
120        self
121    }
122    /// <p>The content-type for the model.</p>
123    pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.content_type = input;
125        self
126    }
127    /// <p>The content-type for the model.</p>
128    pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
129        &self.content_type
130    }
131    /// Consumes the builder and constructs a [`CreateModelInput`](crate::operation::create_model::CreateModelInput).
132    pub fn build(self) -> ::std::result::Result<crate::operation::create_model::CreateModelInput, ::aws_smithy_types::error::operation::BuildError> {
133        ::std::result::Result::Ok(crate::operation::create_model::CreateModelInput {
134            rest_api_id: self.rest_api_id,
135            name: self.name,
136            description: self.description,
137            schema: self.schema,
138            content_type: self.content_type,
139        })
140    }
141}