aws_sdk_migrationhubrefactorspaces/operation/create_route/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_route::_create_route_output::CreateRouteOutputBuilder;
3
4pub use crate::operation::create_route::_create_route_input::CreateRouteInputBuilder;
5
6impl crate::operation::create_route::builders::CreateRouteInputBuilder {
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_route::CreateRouteOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_route::CreateRouteError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_route();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateRoute`.
24///
25/// <p>Creates an Amazon Web Services Migration Hub Refactor Spaces route. The account owner of the service resource is always the environment owner, regardless of which account creates the route. Routes target a service in the application. If an application does not have any routes, then the first route must be created as a <code>DEFAULT</code> <code>RouteType</code>.</p>
26/// <p>When created, the default route defaults to an active state so state is not a required input. However, like all other state values the state of the default route can be updated after creation, but only when all other routes are also inactive. Conversely, no route can be active without the default route also being active.</p>
27/// <p>When you create a route, Refactor Spaces configures the Amazon API Gateway to send traffic to the target service as follows:</p>
28/// <ul>
29/// <li>
30/// <p><b>URL Endpoints</b></p>
31/// <p>If the service has a URL endpoint, and the endpoint resolves to a private IP address, Refactor Spaces routes traffic using the API Gateway VPC link. If a service endpoint resolves to a public IP address, Refactor Spaces routes traffic over the public internet. Services can have HTTP or HTTPS URL endpoints. For HTTPS URLs, publicly-signed certificates are supported. Private Certificate Authorities (CAs) are permitted only if the CA's domain is also publicly resolvable.</p>
32/// <p>Refactor Spaces automatically resolves the public Domain Name System (DNS) names that are set in <code>CreateService:UrlEndpoint </code>when you create a service. The DNS names resolve when the DNS time-to-live (TTL) expires, or every 60 seconds for TTLs less than 60 seconds. This periodic DNS resolution ensures that the route configuration remains up-to-date.</p>
33/// <p></p>
34/// <p><b>One-time health check</b></p>
35/// <p>A one-time health check is performed on the service when either the route is updated from inactive to active, or when it is created with an active state. If the health check fails, the route transitions the route state to <code>FAILED</code>, an error code of <code>SERVICE_ENDPOINT_HEALTH_CHECK_FAILURE</code> is provided, and no traffic is sent to the service.</p>
36/// <p>For private URLs, a target group is created on the Network Load Balancer and the load balancer target group runs default target health checks. By default, the health check is run against the service endpoint URL. Optionally, the health check can be performed against a different protocol, port, and/or path using the <a href="https://docs.aws.amazon.com/migrationhub-refactor-spaces/latest/APIReference/API_CreateService.html#migrationhubrefactorspaces-CreateService-request-UrlEndpoint">CreateService:UrlEndpoint</a> parameter. All other health check settings for the load balancer use the default values described in the <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html">Health checks for your target groups</a> in the <i>Elastic Load Balancing guide</i>. The health check is considered successful if at least one target within the target group transitions to a healthy state.</p>
37/// <p></p></li>
38/// <li>
39/// <p><b>Lambda function endpoints</b></p>
40/// <p>If the service has an Lambda function endpoint, then Refactor Spaces configures the Lambda function's resource policy to allow the application's API Gateway to invoke the function.</p>
41/// <p>The Lambda function state is checked. If the function is not active, the function configuration is updated so that Lambda resources are provisioned. If the Lambda state is <code>Failed</code>, then the route creation fails. For more information, see the <a href="https://docs.aws.amazon.com/lambda/latest/dg/API_GetFunctionConfiguration.html#SSS-GetFunctionConfiguration-response-State">GetFunctionConfiguration's State response parameter</a> in the <i>Lambda Developer Guide</i>.</p>
42/// <p>A check is performed to determine that a Lambda function with the specified ARN exists. If it does not exist, the health check fails. For public URLs, a connection is opened to the public endpoint. If the URL is not reachable, the health check fails.</p></li>
43/// </ul>
44/// <p><b>Environments without a network bridge</b></p>
45/// <p>When you create environments without a network bridge (<a href="https://docs.aws.amazon.com/migrationhub-refactor-spaces/latest/APIReference/API_CreateEnvironment.html#migrationhubrefactorspaces-CreateEnvironment-request-NetworkFabricType">CreateEnvironment:NetworkFabricType</a> is <code>NONE)</code> and you use your own networking infrastructure, you need to configure <a href="https://docs.aws.amazon.com/whitepapers/latest/aws-vpc-connectivity-options/amazon-vpc-to-amazon-vpc-connectivity-options.html">VPC to VPC connectivity</a> between your network and the application proxy VPC. Route creation from the application proxy to service endpoints will fail if your network is not configured to connect to the application proxy VPC. For more information, see <a href="https://docs.aws.amazon.com/migrationhub-refactor-spaces/latest/userguide/getting-started-create-role.html"> Create a route</a> in the <i>Refactor Spaces User Guide</i>.</p>
46/// <p></p>
47#[derive(::std::clone::Clone, ::std::fmt::Debug)]
48pub struct CreateRouteFluentBuilder {
49 handle: ::std::sync::Arc<crate::client::Handle>,
50 inner: crate::operation::create_route::builders::CreateRouteInputBuilder,
51 config_override: ::std::option::Option<crate::config::Builder>,
52}
53impl
54 crate::client::customize::internal::CustomizableSend<
55 crate::operation::create_route::CreateRouteOutput,
56 crate::operation::create_route::CreateRouteError,
57 > for CreateRouteFluentBuilder
58{
59 fn send(
60 self,
61 config_override: crate::config::Builder,
62 ) -> crate::client::customize::internal::BoxFuture<
63 crate::client::customize::internal::SendResult<
64 crate::operation::create_route::CreateRouteOutput,
65 crate::operation::create_route::CreateRouteError,
66 >,
67 > {
68 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
69 }
70}
71impl CreateRouteFluentBuilder {
72 /// Creates a new `CreateRouteFluentBuilder`.
73 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
74 Self {
75 handle,
76 inner: ::std::default::Default::default(),
77 config_override: ::std::option::Option::None,
78 }
79 }
80 /// Access the CreateRoute as a reference.
81 pub fn as_input(&self) -> &crate::operation::create_route::builders::CreateRouteInputBuilder {
82 &self.inner
83 }
84 /// Sends the request and returns the response.
85 ///
86 /// If an error occurs, an `SdkError` will be returned with additional details that
87 /// can be matched against.
88 ///
89 /// By default, any retryable failures will be retried twice. Retry behavior
90 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
91 /// set when configuring the client.
92 pub async fn send(
93 self,
94 ) -> ::std::result::Result<
95 crate::operation::create_route::CreateRouteOutput,
96 ::aws_smithy_runtime_api::client::result::SdkError<
97 crate::operation::create_route::CreateRouteError,
98 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
99 >,
100 > {
101 let input = self
102 .inner
103 .build()
104 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
105 let runtime_plugins = crate::operation::create_route::CreateRoute::operation_runtime_plugins(
106 self.handle.runtime_plugins.clone(),
107 &self.handle.conf,
108 self.config_override,
109 );
110 crate::operation::create_route::CreateRoute::orchestrate(&runtime_plugins, input).await
111 }
112
113 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
114 pub fn customize(
115 self,
116 ) -> crate::client::customize::CustomizableOperation<
117 crate::operation::create_route::CreateRouteOutput,
118 crate::operation::create_route::CreateRouteError,
119 Self,
120 > {
121 crate::client::customize::CustomizableOperation::new(self)
122 }
123 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
124 self.set_config_override(::std::option::Option::Some(config_override.into()));
125 self
126 }
127
128 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
129 self.config_override = config_override;
130 self
131 }
132 /// <p>The ID of the environment in which the route is created.</p>
133 pub fn environment_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134 self.inner = self.inner.environment_identifier(input.into());
135 self
136 }
137 /// <p>The ID of the environment in which the route is created.</p>
138 pub fn set_environment_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139 self.inner = self.inner.set_environment_identifier(input);
140 self
141 }
142 /// <p>The ID of the environment in which the route is created.</p>
143 pub fn get_environment_identifier(&self) -> &::std::option::Option<::std::string::String> {
144 self.inner.get_environment_identifier()
145 }
146 /// <p>The ID of the application within which the route is being created.</p>
147 pub fn application_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148 self.inner = self.inner.application_identifier(input.into());
149 self
150 }
151 /// <p>The ID of the application within which the route is being created.</p>
152 pub fn set_application_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153 self.inner = self.inner.set_application_identifier(input);
154 self
155 }
156 /// <p>The ID of the application within which the route is being created.</p>
157 pub fn get_application_identifier(&self) -> &::std::option::Option<::std::string::String> {
158 self.inner.get_application_identifier()
159 }
160 /// <p>The ID of the service in which the route is created. Traffic that matches this route is forwarded to this service.</p>
161 pub fn service_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162 self.inner = self.inner.service_identifier(input.into());
163 self
164 }
165 /// <p>The ID of the service in which the route is created. Traffic that matches this route is forwarded to this service.</p>
166 pub fn set_service_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167 self.inner = self.inner.set_service_identifier(input);
168 self
169 }
170 /// <p>The ID of the service in which the route is created. Traffic that matches this route is forwarded to this service.</p>
171 pub fn get_service_identifier(&self) -> &::std::option::Option<::std::string::String> {
172 self.inner.get_service_identifier()
173 }
174 /// <p>The route type of the route. <code>DEFAULT</code> indicates that all traffic that does not match another route is forwarded to the default route. Applications must have a default route before any other routes can be created. <code>URI_PATH</code> indicates a route that is based on a URI path.</p>
175 pub fn route_type(mut self, input: crate::types::RouteType) -> Self {
176 self.inner = self.inner.route_type(input);
177 self
178 }
179 /// <p>The route type of the route. <code>DEFAULT</code> indicates that all traffic that does not match another route is forwarded to the default route. Applications must have a default route before any other routes can be created. <code>URI_PATH</code> indicates a route that is based on a URI path.</p>
180 pub fn set_route_type(mut self, input: ::std::option::Option<crate::types::RouteType>) -> Self {
181 self.inner = self.inner.set_route_type(input);
182 self
183 }
184 /// <p>The route type of the route. <code>DEFAULT</code> indicates that all traffic that does not match another route is forwarded to the default route. Applications must have a default route before any other routes can be created. <code>URI_PATH</code> indicates a route that is based on a URI path.</p>
185 pub fn get_route_type(&self) -> &::std::option::Option<crate::types::RouteType> {
186 self.inner.get_route_type()
187 }
188 /// <p>Configuration for the default route type.</p>
189 pub fn default_route(mut self, input: crate::types::DefaultRouteInput) -> Self {
190 self.inner = self.inner.default_route(input);
191 self
192 }
193 /// <p>Configuration for the default route type.</p>
194 pub fn set_default_route(mut self, input: ::std::option::Option<crate::types::DefaultRouteInput>) -> Self {
195 self.inner = self.inner.set_default_route(input);
196 self
197 }
198 /// <p>Configuration for the default route type.</p>
199 pub fn get_default_route(&self) -> &::std::option::Option<crate::types::DefaultRouteInput> {
200 self.inner.get_default_route()
201 }
202 /// <p>The configuration for the URI path route type.</p>
203 pub fn uri_path_route(mut self, input: crate::types::UriPathRouteInput) -> Self {
204 self.inner = self.inner.uri_path_route(input);
205 self
206 }
207 /// <p>The configuration for the URI path route type.</p>
208 pub fn set_uri_path_route(mut self, input: ::std::option::Option<crate::types::UriPathRouteInput>) -> Self {
209 self.inner = self.inner.set_uri_path_route(input);
210 self
211 }
212 /// <p>The configuration for the URI path route type.</p>
213 pub fn get_uri_path_route(&self) -> &::std::option::Option<crate::types::UriPathRouteInput> {
214 self.inner.get_uri_path_route()
215 }
216 ///
217 /// Adds a key-value pair to `Tags`.
218 ///
219 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
220 ///
221 /// <p>The tags to assign to the route. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key-value pair..</p>
222 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
223 self.inner = self.inner.tags(k.into(), v.into());
224 self
225 }
226 /// <p>The tags to assign to the route. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key-value pair..</p>
227 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
228 self.inner = self.inner.set_tags(input);
229 self
230 }
231 /// <p>The tags to assign to the route. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key-value pair..</p>
232 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
233 self.inner.get_tags()
234 }
235 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
236 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
237 self.inner = self.inner.client_token(input.into());
238 self
239 }
240 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
241 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
242 self.inner = self.inner.set_client_token(input);
243 self
244 }
245 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
246 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
247 self.inner.get_client_token()
248 }
249}