aws_sdk_servicediscovery/operation/create_service/
_create_service_input.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 CreateServiceInput {
6    /// <p>The name that you want to assign to the service.</p><note>
7    /// <p>Do not include sensitive information in the name if the namespace is discoverable by public DNS queries.</p>
8    /// </note>
9    /// <p>If you want Cloud Map to create an <code>SRV</code> record when you register an instance and you're using a system that requires a specific <code>SRV</code> format, such as <a href="http://www.haproxy.org/">HAProxy</a>, specify the following for <code>Name</code>:</p>
10    /// <ul>
11    /// <li>
12    /// <p>Start the name with an underscore (_), such as <code>_exampleservice</code>.</p></li>
13    /// <li>
14    /// <p>End the name with <i>._protocol</i>, such as <code>._tcp</code>.</p></li>
15    /// </ul>
16    /// <p>When you register an instance, Cloud Map creates an <code>SRV</code> record and assigns a name to the record by concatenating the service name and the namespace name (for example,</p>
17    /// <p><code>_exampleservice._tcp.example.com</code>).</p><note>
18    /// <p>For services that are accessible by DNS queries, you can't create multiple services with names that differ only by case (such as EXAMPLE and example). Otherwise, these services have the same DNS name and can't be distinguished. However, if you use a namespace that's only accessible by API calls, then you can create services that with names that differ only by case.</p>
19    /// </note>
20    pub name: ::std::option::Option<::std::string::String>,
21    /// <p>The ID of the namespace that you want to use to create the service. The namespace ID must be specified, but it can be specified either here or in the <code>DnsConfig</code> object.</p>
22    pub namespace_id: ::std::option::Option<::std::string::String>,
23    /// <p>A unique string that identifies the request and that allows failed <code>CreateService</code> requests to be retried without the risk of running the operation twice. <code>CreatorRequestId</code> can be any unique string (for example, a date/timestamp).</p>
24    pub creator_request_id: ::std::option::Option<::std::string::String>,
25    /// <p>A description for the service.</p>
26    pub description: ::std::option::Option<::std::string::String>,
27    /// <p>A complex type that contains information about the Amazon Route&nbsp;53 records that you want Cloud Map to create when you register an instance.</p>
28    pub dns_config: ::std::option::Option<crate::types::DnsConfig>,
29    /// <p><i>Public DNS and HTTP namespaces only.</i> A complex type that contains settings for an optional Route&nbsp;53 health check. If you specify settings for a health check, Cloud Map associates the health check with all the Route&nbsp;53 DNS records that you specify in <code>DnsConfig</code>.</p><important>
30    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
31    /// </important>
32    /// <p>For information about the charges for health checks, see <a href="http://aws.amazon.com/cloud-map/pricing/">Cloud Map Pricing</a>.</p>
33    pub health_check_config: ::std::option::Option<crate::types::HealthCheckConfig>,
34    /// <p>A complex type that contains information about an optional custom health check.</p><important>
35    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
36    /// </important>
37    /// <p>You can't add, update, or delete a <code>HealthCheckCustomConfig</code> configuration from an existing service.</p>
38    pub health_check_custom_config: ::std::option::Option<crate::types::HealthCheckCustomConfig>,
39    /// <p>The tags to add to the service. Each tag consists of a key and an optional value that you define. Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.</p>
40    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
41    /// <p>If present, specifies that the service instances are only discoverable using the <code>DiscoverInstances</code> API operation. No DNS records is registered for the service instances. The only valid value is <code>HTTP</code>.</p>
42    pub r#type: ::std::option::Option<crate::types::ServiceTypeOption>,
43}
44impl CreateServiceInput {
45    /// <p>The name that you want to assign to the service.</p><note>
46    /// <p>Do not include sensitive information in the name if the namespace is discoverable by public DNS queries.</p>
47    /// </note>
48    /// <p>If you want Cloud Map to create an <code>SRV</code> record when you register an instance and you're using a system that requires a specific <code>SRV</code> format, such as <a href="http://www.haproxy.org/">HAProxy</a>, specify the following for <code>Name</code>:</p>
49    /// <ul>
50    /// <li>
51    /// <p>Start the name with an underscore (_), such as <code>_exampleservice</code>.</p></li>
52    /// <li>
53    /// <p>End the name with <i>._protocol</i>, such as <code>._tcp</code>.</p></li>
54    /// </ul>
55    /// <p>When you register an instance, Cloud Map creates an <code>SRV</code> record and assigns a name to the record by concatenating the service name and the namespace name (for example,</p>
56    /// <p><code>_exampleservice._tcp.example.com</code>).</p><note>
57    /// <p>For services that are accessible by DNS queries, you can't create multiple services with names that differ only by case (such as EXAMPLE and example). Otherwise, these services have the same DNS name and can't be distinguished. However, if you use a namespace that's only accessible by API calls, then you can create services that with names that differ only by case.</p>
58    /// </note>
59    pub fn name(&self) -> ::std::option::Option<&str> {
60        self.name.as_deref()
61    }
62    /// <p>The ID of the namespace that you want to use to create the service. The namespace ID must be specified, but it can be specified either here or in the <code>DnsConfig</code> object.</p>
63    pub fn namespace_id(&self) -> ::std::option::Option<&str> {
64        self.namespace_id.as_deref()
65    }
66    /// <p>A unique string that identifies the request and that allows failed <code>CreateService</code> requests to be retried without the risk of running the operation twice. <code>CreatorRequestId</code> can be any unique string (for example, a date/timestamp).</p>
67    pub fn creator_request_id(&self) -> ::std::option::Option<&str> {
68        self.creator_request_id.as_deref()
69    }
70    /// <p>A description for the service.</p>
71    pub fn description(&self) -> ::std::option::Option<&str> {
72        self.description.as_deref()
73    }
74    /// <p>A complex type that contains information about the Amazon Route&nbsp;53 records that you want Cloud Map to create when you register an instance.</p>
75    pub fn dns_config(&self) -> ::std::option::Option<&crate::types::DnsConfig> {
76        self.dns_config.as_ref()
77    }
78    /// <p><i>Public DNS and HTTP namespaces only.</i> A complex type that contains settings for an optional Route&nbsp;53 health check. If you specify settings for a health check, Cloud Map associates the health check with all the Route&nbsp;53 DNS records that you specify in <code>DnsConfig</code>.</p><important>
79    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
80    /// </important>
81    /// <p>For information about the charges for health checks, see <a href="http://aws.amazon.com/cloud-map/pricing/">Cloud Map Pricing</a>.</p>
82    pub fn health_check_config(&self) -> ::std::option::Option<&crate::types::HealthCheckConfig> {
83        self.health_check_config.as_ref()
84    }
85    /// <p>A complex type that contains information about an optional custom health check.</p><important>
86    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
87    /// </important>
88    /// <p>You can't add, update, or delete a <code>HealthCheckCustomConfig</code> configuration from an existing service.</p>
89    pub fn health_check_custom_config(&self) -> ::std::option::Option<&crate::types::HealthCheckCustomConfig> {
90        self.health_check_custom_config.as_ref()
91    }
92    /// <p>The tags to add to the service. Each tag consists of a key and an optional value that you define. Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.</p>
93    ///
94    /// 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()`.
95    pub fn tags(&self) -> &[crate::types::Tag] {
96        self.tags.as_deref().unwrap_or_default()
97    }
98    /// <p>If present, specifies that the service instances are only discoverable using the <code>DiscoverInstances</code> API operation. No DNS records is registered for the service instances. The only valid value is <code>HTTP</code>.</p>
99    pub fn r#type(&self) -> ::std::option::Option<&crate::types::ServiceTypeOption> {
100        self.r#type.as_ref()
101    }
102}
103impl CreateServiceInput {
104    /// Creates a new builder-style object to manufacture [`CreateServiceInput`](crate::operation::create_service::CreateServiceInput).
105    pub fn builder() -> crate::operation::create_service::builders::CreateServiceInputBuilder {
106        crate::operation::create_service::builders::CreateServiceInputBuilder::default()
107    }
108}
109
110/// A builder for [`CreateServiceInput`](crate::operation::create_service::CreateServiceInput).
111#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
112#[non_exhaustive]
113pub struct CreateServiceInputBuilder {
114    pub(crate) name: ::std::option::Option<::std::string::String>,
115    pub(crate) namespace_id: ::std::option::Option<::std::string::String>,
116    pub(crate) creator_request_id: ::std::option::Option<::std::string::String>,
117    pub(crate) description: ::std::option::Option<::std::string::String>,
118    pub(crate) dns_config: ::std::option::Option<crate::types::DnsConfig>,
119    pub(crate) health_check_config: ::std::option::Option<crate::types::HealthCheckConfig>,
120    pub(crate) health_check_custom_config: ::std::option::Option<crate::types::HealthCheckCustomConfig>,
121    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
122    pub(crate) r#type: ::std::option::Option<crate::types::ServiceTypeOption>,
123}
124impl CreateServiceInputBuilder {
125    /// <p>The name that you want to assign to the service.</p><note>
126    /// <p>Do not include sensitive information in the name if the namespace is discoverable by public DNS queries.</p>
127    /// </note>
128    /// <p>If you want Cloud Map to create an <code>SRV</code> record when you register an instance and you're using a system that requires a specific <code>SRV</code> format, such as <a href="http://www.haproxy.org/">HAProxy</a>, specify the following for <code>Name</code>:</p>
129    /// <ul>
130    /// <li>
131    /// <p>Start the name with an underscore (_), such as <code>_exampleservice</code>.</p></li>
132    /// <li>
133    /// <p>End the name with <i>._protocol</i>, such as <code>._tcp</code>.</p></li>
134    /// </ul>
135    /// <p>When you register an instance, Cloud Map creates an <code>SRV</code> record and assigns a name to the record by concatenating the service name and the namespace name (for example,</p>
136    /// <p><code>_exampleservice._tcp.example.com</code>).</p><note>
137    /// <p>For services that are accessible by DNS queries, you can't create multiple services with names that differ only by case (such as EXAMPLE and example). Otherwise, these services have the same DNS name and can't be distinguished. However, if you use a namespace that's only accessible by API calls, then you can create services that with names that differ only by case.</p>
138    /// </note>
139    /// This field is required.
140    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.name = ::std::option::Option::Some(input.into());
142        self
143    }
144    /// <p>The name that you want to assign to the service.</p><note>
145    /// <p>Do not include sensitive information in the name if the namespace is discoverable by public DNS queries.</p>
146    /// </note>
147    /// <p>If you want Cloud Map to create an <code>SRV</code> record when you register an instance and you're using a system that requires a specific <code>SRV</code> format, such as <a href="http://www.haproxy.org/">HAProxy</a>, specify the following for <code>Name</code>:</p>
148    /// <ul>
149    /// <li>
150    /// <p>Start the name with an underscore (_), such as <code>_exampleservice</code>.</p></li>
151    /// <li>
152    /// <p>End the name with <i>._protocol</i>, such as <code>._tcp</code>.</p></li>
153    /// </ul>
154    /// <p>When you register an instance, Cloud Map creates an <code>SRV</code> record and assigns a name to the record by concatenating the service name and the namespace name (for example,</p>
155    /// <p><code>_exampleservice._tcp.example.com</code>).</p><note>
156    /// <p>For services that are accessible by DNS queries, you can't create multiple services with names that differ only by case (such as EXAMPLE and example). Otherwise, these services have the same DNS name and can't be distinguished. However, if you use a namespace that's only accessible by API calls, then you can create services that with names that differ only by case.</p>
157    /// </note>
158    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
159        self.name = input;
160        self
161    }
162    /// <p>The name that you want to assign to the service.</p><note>
163    /// <p>Do not include sensitive information in the name if the namespace is discoverable by public DNS queries.</p>
164    /// </note>
165    /// <p>If you want Cloud Map to create an <code>SRV</code> record when you register an instance and you're using a system that requires a specific <code>SRV</code> format, such as <a href="http://www.haproxy.org/">HAProxy</a>, specify the following for <code>Name</code>:</p>
166    /// <ul>
167    /// <li>
168    /// <p>Start the name with an underscore (_), such as <code>_exampleservice</code>.</p></li>
169    /// <li>
170    /// <p>End the name with <i>._protocol</i>, such as <code>._tcp</code>.</p></li>
171    /// </ul>
172    /// <p>When you register an instance, Cloud Map creates an <code>SRV</code> record and assigns a name to the record by concatenating the service name and the namespace name (for example,</p>
173    /// <p><code>_exampleservice._tcp.example.com</code>).</p><note>
174    /// <p>For services that are accessible by DNS queries, you can't create multiple services with names that differ only by case (such as EXAMPLE and example). Otherwise, these services have the same DNS name and can't be distinguished. However, if you use a namespace that's only accessible by API calls, then you can create services that with names that differ only by case.</p>
175    /// </note>
176    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
177        &self.name
178    }
179    /// <p>The ID of the namespace that you want to use to create the service. The namespace ID must be specified, but it can be specified either here or in the <code>DnsConfig</code> object.</p>
180    pub fn namespace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181        self.namespace_id = ::std::option::Option::Some(input.into());
182        self
183    }
184    /// <p>The ID of the namespace that you want to use to create the service. The namespace ID must be specified, but it can be specified either here or in the <code>DnsConfig</code> object.</p>
185    pub fn set_namespace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186        self.namespace_id = input;
187        self
188    }
189    /// <p>The ID of the namespace that you want to use to create the service. The namespace ID must be specified, but it can be specified either here or in the <code>DnsConfig</code> object.</p>
190    pub fn get_namespace_id(&self) -> &::std::option::Option<::std::string::String> {
191        &self.namespace_id
192    }
193    /// <p>A unique string that identifies the request and that allows failed <code>CreateService</code> requests to be retried without the risk of running the operation twice. <code>CreatorRequestId</code> can be any unique string (for example, a date/timestamp).</p>
194    pub fn creator_request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
195        self.creator_request_id = ::std::option::Option::Some(input.into());
196        self
197    }
198    /// <p>A unique string that identifies the request and that allows failed <code>CreateService</code> requests to be retried without the risk of running the operation twice. <code>CreatorRequestId</code> can be any unique string (for example, a date/timestamp).</p>
199    pub fn set_creator_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
200        self.creator_request_id = input;
201        self
202    }
203    /// <p>A unique string that identifies the request and that allows failed <code>CreateService</code> requests to be retried without the risk of running the operation twice. <code>CreatorRequestId</code> can be any unique string (for example, a date/timestamp).</p>
204    pub fn get_creator_request_id(&self) -> &::std::option::Option<::std::string::String> {
205        &self.creator_request_id
206    }
207    /// <p>A description for the service.</p>
208    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209        self.description = ::std::option::Option::Some(input.into());
210        self
211    }
212    /// <p>A description for the service.</p>
213    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
214        self.description = input;
215        self
216    }
217    /// <p>A description for the service.</p>
218    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
219        &self.description
220    }
221    /// <p>A complex type that contains information about the Amazon Route&nbsp;53 records that you want Cloud Map to create when you register an instance.</p>
222    pub fn dns_config(mut self, input: crate::types::DnsConfig) -> Self {
223        self.dns_config = ::std::option::Option::Some(input);
224        self
225    }
226    /// <p>A complex type that contains information about the Amazon Route&nbsp;53 records that you want Cloud Map to create when you register an instance.</p>
227    pub fn set_dns_config(mut self, input: ::std::option::Option<crate::types::DnsConfig>) -> Self {
228        self.dns_config = input;
229        self
230    }
231    /// <p>A complex type that contains information about the Amazon Route&nbsp;53 records that you want Cloud Map to create when you register an instance.</p>
232    pub fn get_dns_config(&self) -> &::std::option::Option<crate::types::DnsConfig> {
233        &self.dns_config
234    }
235    /// <p><i>Public DNS and HTTP namespaces only.</i> A complex type that contains settings for an optional Route&nbsp;53 health check. If you specify settings for a health check, Cloud Map associates the health check with all the Route&nbsp;53 DNS records that you specify in <code>DnsConfig</code>.</p><important>
236    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
237    /// </important>
238    /// <p>For information about the charges for health checks, see <a href="http://aws.amazon.com/cloud-map/pricing/">Cloud Map Pricing</a>.</p>
239    pub fn health_check_config(mut self, input: crate::types::HealthCheckConfig) -> Self {
240        self.health_check_config = ::std::option::Option::Some(input);
241        self
242    }
243    /// <p><i>Public DNS and HTTP namespaces only.</i> A complex type that contains settings for an optional Route&nbsp;53 health check. If you specify settings for a health check, Cloud Map associates the health check with all the Route&nbsp;53 DNS records that you specify in <code>DnsConfig</code>.</p><important>
244    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
245    /// </important>
246    /// <p>For information about the charges for health checks, see <a href="http://aws.amazon.com/cloud-map/pricing/">Cloud Map Pricing</a>.</p>
247    pub fn set_health_check_config(mut self, input: ::std::option::Option<crate::types::HealthCheckConfig>) -> Self {
248        self.health_check_config = input;
249        self
250    }
251    /// <p><i>Public DNS and HTTP namespaces only.</i> A complex type that contains settings for an optional Route&nbsp;53 health check. If you specify settings for a health check, Cloud Map associates the health check with all the Route&nbsp;53 DNS records that you specify in <code>DnsConfig</code>.</p><important>
252    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
253    /// </important>
254    /// <p>For information about the charges for health checks, see <a href="http://aws.amazon.com/cloud-map/pricing/">Cloud Map Pricing</a>.</p>
255    pub fn get_health_check_config(&self) -> &::std::option::Option<crate::types::HealthCheckConfig> {
256        &self.health_check_config
257    }
258    /// <p>A complex type that contains information about an optional custom health check.</p><important>
259    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
260    /// </important>
261    /// <p>You can't add, update, or delete a <code>HealthCheckCustomConfig</code> configuration from an existing service.</p>
262    pub fn health_check_custom_config(mut self, input: crate::types::HealthCheckCustomConfig) -> Self {
263        self.health_check_custom_config = ::std::option::Option::Some(input);
264        self
265    }
266    /// <p>A complex type that contains information about an optional custom health check.</p><important>
267    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
268    /// </important>
269    /// <p>You can't add, update, or delete a <code>HealthCheckCustomConfig</code> configuration from an existing service.</p>
270    pub fn set_health_check_custom_config(mut self, input: ::std::option::Option<crate::types::HealthCheckCustomConfig>) -> Self {
271        self.health_check_custom_config = input;
272        self
273    }
274    /// <p>A complex type that contains information about an optional custom health check.</p><important>
275    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
276    /// </important>
277    /// <p>You can't add, update, or delete a <code>HealthCheckCustomConfig</code> configuration from an existing service.</p>
278    pub fn get_health_check_custom_config(&self) -> &::std::option::Option<crate::types::HealthCheckCustomConfig> {
279        &self.health_check_custom_config
280    }
281    /// Appends an item to `tags`.
282    ///
283    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
284    ///
285    /// <p>The tags to add to the service. Each tag consists of a key and an optional value that you define. Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.</p>
286    pub fn tags(mut self, input: crate::types::Tag) -> Self {
287        let mut v = self.tags.unwrap_or_default();
288        v.push(input);
289        self.tags = ::std::option::Option::Some(v);
290        self
291    }
292    /// <p>The tags to add to the service. Each tag consists of a key and an optional value that you define. Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.</p>
293    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
294        self.tags = input;
295        self
296    }
297    /// <p>The tags to add to the service. Each tag consists of a key and an optional value that you define. Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.</p>
298    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
299        &self.tags
300    }
301    /// <p>If present, specifies that the service instances are only discoverable using the <code>DiscoverInstances</code> API operation. No DNS records is registered for the service instances. The only valid value is <code>HTTP</code>.</p>
302    pub fn r#type(mut self, input: crate::types::ServiceTypeOption) -> Self {
303        self.r#type = ::std::option::Option::Some(input);
304        self
305    }
306    /// <p>If present, specifies that the service instances are only discoverable using the <code>DiscoverInstances</code> API operation. No DNS records is registered for the service instances. The only valid value is <code>HTTP</code>.</p>
307    pub fn set_type(mut self, input: ::std::option::Option<crate::types::ServiceTypeOption>) -> Self {
308        self.r#type = input;
309        self
310    }
311    /// <p>If present, specifies that the service instances are only discoverable using the <code>DiscoverInstances</code> API operation. No DNS records is registered for the service instances. The only valid value is <code>HTTP</code>.</p>
312    pub fn get_type(&self) -> &::std::option::Option<crate::types::ServiceTypeOption> {
313        &self.r#type
314    }
315    /// Consumes the builder and constructs a [`CreateServiceInput`](crate::operation::create_service::CreateServiceInput).
316    pub fn build(
317        self,
318    ) -> ::std::result::Result<crate::operation::create_service::CreateServiceInput, ::aws_smithy_types::error::operation::BuildError> {
319        ::std::result::Result::Ok(crate::operation::create_service::CreateServiceInput {
320            name: self.name,
321            namespace_id: self.namespace_id,
322            creator_request_id: self.creator_request_id,
323            description: self.description,
324            dns_config: self.dns_config,
325            health_check_config: self.health_check_config,
326            health_check_custom_config: self.health_check_custom_config,
327            tags: self.tags,
328            r#type: self.r#type,
329        })
330    }
331}