aws_sdk_servicediscovery/operation/create_service/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_service::_create_service_output::CreateServiceOutputBuilder;
3
4pub use crate::operation::create_service::_create_service_input::CreateServiceInputBuilder;
5
6impl crate::operation::create_service::builders::CreateServiceInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_service::CreateServiceOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_service::CreateServiceError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_service();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateService`.
24///
25/// <p>Creates a service. This action defines the configuration for the following entities:</p>
26/// <ul>
27/// <li>
28/// <p>For public and private DNS namespaces, one of the following combinations of DNS records in Amazon Route&nbsp;53:</p>
29/// <ul>
30/// <li>
31/// <p><code>A</code></p></li>
32/// <li>
33/// <p><code>AAAA</code></p></li>
34/// <li>
35/// <p><code>A</code> and <code>AAAA</code></p></li>
36/// <li>
37/// <p><code>SRV</code></p></li>
38/// <li>
39/// <p><code>CNAME</code></p></li>
40/// </ul></li>
41/// <li>
42/// <p>Optionally, a health check</p></li>
43/// </ul>
44/// <p>After you create the service, you can submit a <a href="https://docs.aws.amazon.com/cloud-map/latest/api/API_RegisterInstance.html">RegisterInstance</a> request, and Cloud Map uses the values in the configuration to create the specified entities.</p>
45/// <p>For the current quota on the number of instances that you can register using the same namespace and using the same service, see <a href="https://docs.aws.amazon.com/cloud-map/latest/dg/cloud-map-limits.html">Cloud Map quotas</a> in the <i>Cloud Map Developer Guide</i>.</p>
46#[derive(::std::clone::Clone, ::std::fmt::Debug)]
47pub struct CreateServiceFluentBuilder {
48    handle: ::std::sync::Arc<crate::client::Handle>,
49    inner: crate::operation::create_service::builders::CreateServiceInputBuilder,
50    config_override: ::std::option::Option<crate::config::Builder>,
51}
52impl
53    crate::client::customize::internal::CustomizableSend<
54        crate::operation::create_service::CreateServiceOutput,
55        crate::operation::create_service::CreateServiceError,
56    > for CreateServiceFluentBuilder
57{
58    fn send(
59        self,
60        config_override: crate::config::Builder,
61    ) -> crate::client::customize::internal::BoxFuture<
62        crate::client::customize::internal::SendResult<
63            crate::operation::create_service::CreateServiceOutput,
64            crate::operation::create_service::CreateServiceError,
65        >,
66    > {
67        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
68    }
69}
70impl CreateServiceFluentBuilder {
71    /// Creates a new `CreateServiceFluentBuilder`.
72    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
73        Self {
74            handle,
75            inner: ::std::default::Default::default(),
76            config_override: ::std::option::Option::None,
77        }
78    }
79    /// Access the CreateService as a reference.
80    pub fn as_input(&self) -> &crate::operation::create_service::builders::CreateServiceInputBuilder {
81        &self.inner
82    }
83    /// Sends the request and returns the response.
84    ///
85    /// If an error occurs, an `SdkError` will be returned with additional details that
86    /// can be matched against.
87    ///
88    /// By default, any retryable failures will be retried twice. Retry behavior
89    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
90    /// set when configuring the client.
91    pub async fn send(
92        self,
93    ) -> ::std::result::Result<
94        crate::operation::create_service::CreateServiceOutput,
95        ::aws_smithy_runtime_api::client::result::SdkError<
96            crate::operation::create_service::CreateServiceError,
97            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
98        >,
99    > {
100        let input = self
101            .inner
102            .build()
103            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
104        let runtime_plugins = crate::operation::create_service::CreateService::operation_runtime_plugins(
105            self.handle.runtime_plugins.clone(),
106            &self.handle.conf,
107            self.config_override,
108        );
109        crate::operation::create_service::CreateService::orchestrate(&runtime_plugins, input).await
110    }
111
112    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
113    pub fn customize(
114        self,
115    ) -> crate::client::customize::CustomizableOperation<
116        crate::operation::create_service::CreateServiceOutput,
117        crate::operation::create_service::CreateServiceError,
118        Self,
119    > {
120        crate::client::customize::CustomizableOperation::new(self)
121    }
122    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
123        self.set_config_override(::std::option::Option::Some(config_override.into()));
124        self
125    }
126
127    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
128        self.config_override = config_override;
129        self
130    }
131    /// <p>The name that you want to assign to the service.</p><note>
132    /// <p>Do not include sensitive information in the name if the namespace is discoverable by public DNS queries.</p>
133    /// </note>
134    /// <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>
135    /// <ul>
136    /// <li>
137    /// <p>Start the name with an underscore (_), such as <code>_exampleservice</code>.</p></li>
138    /// <li>
139    /// <p>End the name with <i>._protocol</i>, such as <code>._tcp</code>.</p></li>
140    /// </ul>
141    /// <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>
142    /// <p><code>_exampleservice._tcp.example.com</code>).</p><note>
143    /// <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>
144    /// </note>
145    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.name(input.into());
147        self
148    }
149    /// <p>The name that you want to assign to the service.</p><note>
150    /// <p>Do not include sensitive information in the name if the namespace is discoverable by public DNS queries.</p>
151    /// </note>
152    /// <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>
153    /// <ul>
154    /// <li>
155    /// <p>Start the name with an underscore (_), such as <code>_exampleservice</code>.</p></li>
156    /// <li>
157    /// <p>End the name with <i>._protocol</i>, such as <code>._tcp</code>.</p></li>
158    /// </ul>
159    /// <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>
160    /// <p><code>_exampleservice._tcp.example.com</code>).</p><note>
161    /// <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>
162    /// </note>
163    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
164        self.inner = self.inner.set_name(input);
165        self
166    }
167    /// <p>The name that you want to assign to the service.</p><note>
168    /// <p>Do not include sensitive information in the name if the namespace is discoverable by public DNS queries.</p>
169    /// </note>
170    /// <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>
171    /// <ul>
172    /// <li>
173    /// <p>Start the name with an underscore (_), such as <code>_exampleservice</code>.</p></li>
174    /// <li>
175    /// <p>End the name with <i>._protocol</i>, such as <code>._tcp</code>.</p></li>
176    /// </ul>
177    /// <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>
178    /// <p><code>_exampleservice._tcp.example.com</code>).</p><note>
179    /// <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>
180    /// </note>
181    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
182        self.inner.get_name()
183    }
184    /// <p>The ID or Amazon Resource Name (ARN) of the namespace that you want to use to create the service. For namespaces shared with your Amazon Web Services account, specify the namespace ARN. For more information about shared namespaces, see <a href="https://docs.aws.amazon.com/cloud-map/latest/dg/sharing-namespaces.html">Cross-account Cloud Map namespace sharing</a> in the <i>Cloud Map Developer Guide</i>.</p>
185    pub fn namespace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186        self.inner = self.inner.namespace_id(input.into());
187        self
188    }
189    /// <p>The ID or Amazon Resource Name (ARN) of the namespace that you want to use to create the service. For namespaces shared with your Amazon Web Services account, specify the namespace ARN. For more information about shared namespaces, see <a href="https://docs.aws.amazon.com/cloud-map/latest/dg/sharing-namespaces.html">Cross-account Cloud Map namespace sharing</a> in the <i>Cloud Map Developer Guide</i>.</p>
190    pub fn set_namespace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
191        self.inner = self.inner.set_namespace_id(input);
192        self
193    }
194    /// <p>The ID or Amazon Resource Name (ARN) of the namespace that you want to use to create the service. For namespaces shared with your Amazon Web Services account, specify the namespace ARN. For more information about shared namespaces, see <a href="https://docs.aws.amazon.com/cloud-map/latest/dg/sharing-namespaces.html">Cross-account Cloud Map namespace sharing</a> in the <i>Cloud Map Developer Guide</i>.</p>
195    pub fn get_namespace_id(&self) -> &::std::option::Option<::std::string::String> {
196        self.inner.get_namespace_id()
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 creator_request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
200        self.inner = self.inner.creator_request_id(input.into());
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 set_creator_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
205        self.inner = self.inner.set_creator_request_id(input);
206        self
207    }
208    /// <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>
209    pub fn get_creator_request_id(&self) -> &::std::option::Option<::std::string::String> {
210        self.inner.get_creator_request_id()
211    }
212    /// <p>A description for the service.</p>
213    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
214        self.inner = self.inner.description(input.into());
215        self
216    }
217    /// <p>A description for the service.</p>
218    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
219        self.inner = self.inner.set_description(input);
220        self
221    }
222    /// <p>A description for the service.</p>
223    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
224        self.inner.get_description()
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 dns_config(mut self, input: crate::types::DnsConfig) -> Self {
228        self.inner = self.inner.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 set_dns_config(mut self, input: ::std::option::Option<crate::types::DnsConfig>) -> Self {
233        self.inner = self.inner.set_dns_config(input);
234        self
235    }
236    /// <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>
237    pub fn get_dns_config(&self) -> &::std::option::Option<crate::types::DnsConfig> {
238        self.inner.get_dns_config()
239    }
240    /// <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>
241    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
242    /// </important>
243    /// <p>For information about the charges for health checks, see <a href="http://aws.amazon.com/cloud-map/pricing/">Cloud Map Pricing</a>.</p>
244    pub fn health_check_config(mut self, input: crate::types::HealthCheckConfig) -> Self {
245        self.inner = self.inner.health_check_config(input);
246        self
247    }
248    /// <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>
249    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
250    /// </important>
251    /// <p>For information about the charges for health checks, see <a href="http://aws.amazon.com/cloud-map/pricing/">Cloud Map Pricing</a>.</p>
252    pub fn set_health_check_config(mut self, input: ::std::option::Option<crate::types::HealthCheckConfig>) -> Self {
253        self.inner = self.inner.set_health_check_config(input);
254        self
255    }
256    /// <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>
257    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
258    /// </important>
259    /// <p>For information about the charges for health checks, see <a href="http://aws.amazon.com/cloud-map/pricing/">Cloud Map Pricing</a>.</p>
260    pub fn get_health_check_config(&self) -> &::std::option::Option<crate::types::HealthCheckConfig> {
261        self.inner.get_health_check_config()
262    }
263    /// <p>A complex type that contains information about an optional custom health check.</p><important>
264    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
265    /// </important>
266    /// <p>You can't add, update, or delete a <code>HealthCheckCustomConfig</code> configuration from an existing service.</p>
267    pub fn health_check_custom_config(mut self, input: crate::types::HealthCheckCustomConfig) -> Self {
268        self.inner = self.inner.health_check_custom_config(input);
269        self
270    }
271    /// <p>A complex type that contains information about an optional custom health check.</p><important>
272    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
273    /// </important>
274    /// <p>You can't add, update, or delete a <code>HealthCheckCustomConfig</code> configuration from an existing service.</p>
275    pub fn set_health_check_custom_config(mut self, input: ::std::option::Option<crate::types::HealthCheckCustomConfig>) -> Self {
276        self.inner = self.inner.set_health_check_custom_config(input);
277        self
278    }
279    /// <p>A complex type that contains information about an optional custom health check.</p><important>
280    /// <p>If you specify a health check configuration, you can specify either <code>HealthCheckCustomConfig</code> or <code>HealthCheckConfig</code> but not both.</p>
281    /// </important>
282    /// <p>You can't add, update, or delete a <code>HealthCheckCustomConfig</code> configuration from an existing service.</p>
283    pub fn get_health_check_custom_config(&self) -> &::std::option::Option<crate::types::HealthCheckCustomConfig> {
284        self.inner.get_health_check_custom_config()
285    }
286    ///
287    /// Appends an item to `Tags`.
288    ///
289    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
290    ///
291    /// <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>
292    pub fn tags(mut self, input: crate::types::Tag) -> Self {
293        self.inner = self.inner.tags(input);
294        self
295    }
296    /// <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>
297    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
298        self.inner = self.inner.set_tags(input);
299        self
300    }
301    /// <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>
302    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
303        self.inner.get_tags()
304    }
305    /// <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>
306    pub fn r#type(mut self, input: crate::types::ServiceTypeOption) -> Self {
307        self.inner = self.inner.r#type(input);
308        self
309    }
310    /// <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>
311    pub fn set_type(mut self, input: ::std::option::Option<crate::types::ServiceTypeOption>) -> Self {
312        self.inner = self.inner.set_type(input);
313        self
314    }
315    /// <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>
316    pub fn get_type(&self) -> &::std::option::Option<crate::types::ServiceTypeOption> {
317        self.inner.get_type()
318    }
319}