Skip to content

Commit 7cb6642

Browse files
author
awstools
committed
feat(client-migration-hub-refactor-spaces): This release adds the new API UpdateRoute that allows route to be updated to ACTIVE/INACTIVE state. In addition, CreateRoute API will now allow users to create route in ACTIVE/INACTIVE state.
1 parent 9ccf949 commit 7cb6642

File tree

8 files changed

+620
-55
lines changed

8 files changed

+620
-55
lines changed

clients/client-migration-hub-refactor-spaces/src/MigrationHubRefactorSpaces.ts

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ import {
9292
UntagResourceCommandInput,
9393
UntagResourceCommandOutput,
9494
} from "./commands/UntagResourceCommand";
95+
import { UpdateRouteCommand, UpdateRouteCommandInput, UpdateRouteCommandOutput } from "./commands/UpdateRouteCommand";
9596
import { MigrationHubRefactorSpacesClient } from "./MigrationHubRefactorSpacesClient";
9697

9798
/**
@@ -184,6 +185,10 @@ export class MigrationHubRefactorSpaces extends MigrationHubRefactorSpacesClient
184185
* the application. If an application does not have any routes, then the first route must be
185186
* created as a <code>DEFAULT</code>
186187
* <code>RouteType</code>.</p>
188+
* <p>When created, the default route defaults to an active state so state is not a required
189+
* input. However, like all other state values the state of the default route can be updated
190+
* after creation, but only when all other routes are also inactive. Conversely, no route can be
191+
* active without the default route also being active.</p>
187192
* <p>When you create a route, Refactor Spaces configures the Amazon API Gateway to send traffic
188193
* to the target service as follows:</p>
189194
* <ul>
@@ -201,24 +206,28 @@ export class MigrationHubRefactorSpaces extends MigrationHubRefactorSpacesClient
201206
* API Gateway to invoke the function.</p>
202207
* </li>
203208
* </ul>
204-
* <p>A one-time health check is performed on the service when the route is created. If the
205-
* health check fails, the route transitions to <code>FAILED</code>, and no traffic is sent to
209+
* <p>A one-time health check is performed on the service when either the route is updated from
210+
* inactive to active, or when it is created with an active state. If the health check fails, the
211+
* route transitions the route state to <code>FAILED</code>, an error code of
212+
* <code>SERVICE_ENDPOINT_HEALTH_CHECK_FAILURE</code> is provided, and no traffic is sent to
206213
* the service.</p>
207214
* <p>For Lambda functions, the Lambda function state is checked. If the
208215
* function is not active, the function configuration is updated so that Lambda
209216
* resources are provisioned. If the Lambda state is <code>Failed</code>, then the
210217
* 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>
211-
* <p>For public URLs, a connection is opened to the public endpoint. If the URL is not
212-
* reachable, the health check fails. For private URLs, a target group is created and the target
213-
* group health check is run.</p>
214-
* <p>The <code>HealthCheckProtocol</code>, <code>HealthCheckPort</code>, and
215-
* <code>HealthCheckPath</code> are the same protocol, port, and path specified in the URL or
218+
* <p>For Lambda endpoints, a check is performed to determine that a Lambda function with the
219+
* specified ARN exists. If it does not exist, the health check fails. For public URLs, a
220+
* connection is opened to the public endpoint. If the URL is not reachable, the health check
221+
* fails. </p>
222+
* <p>For private URLS, a target group is created on the Elastic Load Balancing and the target
223+
* group health check is run. The <code>HealthCheckProtocol</code>, <code>HealthCheckPort</code>,
224+
* and <code>HealthCheckPath</code> are the same protocol, port, and path specified in the URL or
216225
* health URL, if used. All other settings use the default values, as described in <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html">Health checks
217226
* for your target groups</a>. The health check is considered successful if at least one
218227
* target within the target group transitions to a healthy state.</p>
219228
* <p>Services can have HTTP or HTTPS URL endpoints. For HTTPS URLs, publicly-signed
220229
* certificates are supported. Private Certificate Authorities (CAs) are permitted only if the
221-
* CA's domain is publicly resolvable.</p>
230+
* CA's domain is also publicly resolvable.</p>
222231
*/
223232
public createRoute(args: CreateRouteCommandInput, options?: __HttpHandlerOptions): Promise<CreateRouteCommandOutput>;
224233
public createRoute(args: CreateRouteCommandInput, cb: (err: any, data?: CreateRouteCommandOutput) => void): void;
@@ -875,4 +884,32 @@ export class MigrationHubRefactorSpaces extends MigrationHubRefactorSpacesClient
875884
return this.send(command, optionsOrCb);
876885
}
877886
}
887+
888+
/**
889+
* <p>
890+
* Updates an Amazon Web Services Migration Hub Refactor Spaces route.
891+
* </p>
892+
*/
893+
public updateRoute(args: UpdateRouteCommandInput, options?: __HttpHandlerOptions): Promise<UpdateRouteCommandOutput>;
894+
public updateRoute(args: UpdateRouteCommandInput, cb: (err: any, data?: UpdateRouteCommandOutput) => void): void;
895+
public updateRoute(
896+
args: UpdateRouteCommandInput,
897+
options: __HttpHandlerOptions,
898+
cb: (err: any, data?: UpdateRouteCommandOutput) => void
899+
): void;
900+
public updateRoute(
901+
args: UpdateRouteCommandInput,
902+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: UpdateRouteCommandOutput) => void),
903+
cb?: (err: any, data?: UpdateRouteCommandOutput) => void
904+
): Promise<UpdateRouteCommandOutput> | void {
905+
const command = new UpdateRouteCommand(args);
906+
if (typeof optionsOrCb === "function") {
907+
this.send(command, optionsOrCb);
908+
} else if (typeof cb === "function") {
909+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
910+
this.send(command, optionsOrCb || {}, cb);
911+
} else {
912+
return this.send(command, optionsOrCb);
913+
}
914+
}
878915
}

clients/client-migration-hub-refactor-spaces/src/MigrationHubRefactorSpacesClient.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ import {
8585
import { PutResourcePolicyCommandInput, PutResourcePolicyCommandOutput } from "./commands/PutResourcePolicyCommand";
8686
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
8787
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
88+
import { UpdateRouteCommandInput, UpdateRouteCommandOutput } from "./commands/UpdateRouteCommand";
8889
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
8990

9091
export type ServiceInputTypes =
@@ -110,7 +111,8 @@ export type ServiceInputTypes =
110111
| ListTagsForResourceCommandInput
111112
| PutResourcePolicyCommandInput
112113
| TagResourceCommandInput
113-
| UntagResourceCommandInput;
114+
| UntagResourceCommandInput
115+
| UpdateRouteCommandInput;
114116

115117
export type ServiceOutputTypes =
116118
| CreateApplicationCommandOutput
@@ -135,7 +137,8 @@ export type ServiceOutputTypes =
135137
| ListTagsForResourceCommandOutput
136138
| PutResourcePolicyCommandOutput
137139
| TagResourceCommandOutput
138-
| UntagResourceCommandOutput;
140+
| UntagResourceCommandOutput
141+
| UpdateRouteCommandOutput;
139142

140143
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
141144
/**

clients/client-migration-hub-refactor-spaces/src/commands/CreateRouteCommand.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export interface CreateRouteCommandOutput extends CreateRouteResponse, __Metadat
3232
* the application. If an application does not have any routes, then the first route must be
3333
* created as a <code>DEFAULT</code>
3434
* <code>RouteType</code>.</p>
35+
* <p>When created, the default route defaults to an active state so state is not a required
36+
* input. However, like all other state values the state of the default route can be updated
37+
* after creation, but only when all other routes are also inactive. Conversely, no route can be
38+
* active without the default route also being active.</p>
3539
* <p>When you create a route, Refactor Spaces configures the Amazon API Gateway to send traffic
3640
* to the target service as follows:</p>
3741
* <ul>
@@ -49,24 +53,28 @@ export interface CreateRouteCommandOutput extends CreateRouteResponse, __Metadat
4953
* API Gateway to invoke the function.</p>
5054
* </li>
5155
* </ul>
52-
* <p>A one-time health check is performed on the service when the route is created. If the
53-
* health check fails, the route transitions to <code>FAILED</code>, and no traffic is sent to
56+
* <p>A one-time health check is performed on the service when either the route is updated from
57+
* inactive to active, or when it is created with an active state. If the health check fails, the
58+
* route transitions the route state to <code>FAILED</code>, an error code of
59+
* <code>SERVICE_ENDPOINT_HEALTH_CHECK_FAILURE</code> is provided, and no traffic is sent to
5460
* the service.</p>
5561
* <p>For Lambda functions, the Lambda function state is checked. If the
5662
* function is not active, the function configuration is updated so that Lambda
5763
* resources are provisioned. If the Lambda state is <code>Failed</code>, then the
5864
* 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>
59-
* <p>For public URLs, a connection is opened to the public endpoint. If the URL is not
60-
* reachable, the health check fails. For private URLs, a target group is created and the target
61-
* group health check is run.</p>
62-
* <p>The <code>HealthCheckProtocol</code>, <code>HealthCheckPort</code>, and
63-
* <code>HealthCheckPath</code> are the same protocol, port, and path specified in the URL or
65+
* <p>For Lambda endpoints, a check is performed to determine that a Lambda function with the
66+
* specified ARN exists. If it does not exist, the health check fails. For public URLs, a
67+
* connection is opened to the public endpoint. If the URL is not reachable, the health check
68+
* fails. </p>
69+
* <p>For private URLS, a target group is created on the Elastic Load Balancing and the target
70+
* group health check is run. The <code>HealthCheckProtocol</code>, <code>HealthCheckPort</code>,
71+
* and <code>HealthCheckPath</code> are the same protocol, port, and path specified in the URL or
6472
* health URL, if used. All other settings use the default values, as described in <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html">Health checks
6573
* for your target groups</a>. The health check is considered successful if at least one
6674
* target within the target group transitions to a healthy state.</p>
6775
* <p>Services can have HTTP or HTTPS URL endpoints. For HTTPS URLs, publicly-signed
6876
* certificates are supported. Private Certificate Authorities (CAs) are permitted only if the
69-
* CA's domain is publicly resolvable.</p>
77+
* CA's domain is also publicly resolvable.</p>
7078
* @example
7179
* Use a bare-bones client and the command you need to make an API call.
7280
* ```javascript
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import {
16+
MigrationHubRefactorSpacesClientResolvedConfig,
17+
ServiceInputTypes,
18+
ServiceOutputTypes,
19+
} from "../MigrationHubRefactorSpacesClient";
20+
import { UpdateRouteRequest, UpdateRouteResponse } from "../models/models_0";
21+
import {
22+
deserializeAws_restJson1UpdateRouteCommand,
23+
serializeAws_restJson1UpdateRouteCommand,
24+
} from "../protocols/Aws_restJson1";
25+
26+
export interface UpdateRouteCommandInput extends UpdateRouteRequest {}
27+
export interface UpdateRouteCommandOutput extends UpdateRouteResponse, __MetadataBearer {}
28+
29+
/**
30+
* <p>
31+
* Updates an Amazon Web Services Migration Hub Refactor Spaces route.
32+
* </p>
33+
* @example
34+
* Use a bare-bones client and the command you need to make an API call.
35+
* ```javascript
36+
* import { MigrationHubRefactorSpacesClient, UpdateRouteCommand } from "@aws-sdk/client-migration-hub-refactor-spaces"; // ES Modules import
37+
* // const { MigrationHubRefactorSpacesClient, UpdateRouteCommand } = require("@aws-sdk/client-migration-hub-refactor-spaces"); // CommonJS import
38+
* const client = new MigrationHubRefactorSpacesClient(config);
39+
* const command = new UpdateRouteCommand(input);
40+
* const response = await client.send(command);
41+
* ```
42+
*
43+
* @see {@link UpdateRouteCommandInput} for command's `input` shape.
44+
* @see {@link UpdateRouteCommandOutput} for command's `response` shape.
45+
* @see {@link MigrationHubRefactorSpacesClientResolvedConfig | config} for MigrationHubRefactorSpacesClient's `config` shape.
46+
*
47+
*/
48+
export class UpdateRouteCommand extends $Command<
49+
UpdateRouteCommandInput,
50+
UpdateRouteCommandOutput,
51+
MigrationHubRefactorSpacesClientResolvedConfig
52+
> {
53+
// Start section: command_properties
54+
// End section: command_properties
55+
56+
constructor(readonly input: UpdateRouteCommandInput) {
57+
// Start section: command_constructor
58+
super();
59+
// End section: command_constructor
60+
}
61+
62+
/**
63+
* @internal
64+
*/
65+
resolveMiddleware(
66+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
67+
configuration: MigrationHubRefactorSpacesClientResolvedConfig,
68+
options?: __HttpHandlerOptions
69+
): Handler<UpdateRouteCommandInput, UpdateRouteCommandOutput> {
70+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
71+
72+
const stack = clientStack.concat(this.middlewareStack);
73+
74+
const { logger } = configuration;
75+
const clientName = "MigrationHubRefactorSpacesClient";
76+
const commandName = "UpdateRouteCommand";
77+
const handlerExecutionContext: HandlerExecutionContext = {
78+
logger,
79+
clientName,
80+
commandName,
81+
inputFilterSensitiveLog: UpdateRouteRequest.filterSensitiveLog,
82+
outputFilterSensitiveLog: UpdateRouteResponse.filterSensitiveLog,
83+
};
84+
const { requestHandler } = configuration;
85+
return stack.resolve(
86+
(request: FinalizeHandlerArguments<any>) =>
87+
requestHandler.handle(request.request as __HttpRequest, options || {}),
88+
handlerExecutionContext
89+
);
90+
}
91+
92+
private serialize(input: UpdateRouteCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
93+
return serializeAws_restJson1UpdateRouteCommand(input, context);
94+
}
95+
96+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<UpdateRouteCommandOutput> {
97+
return deserializeAws_restJson1UpdateRouteCommand(output, context);
98+
}
99+
100+
// Start section: command_body_extra
101+
// End section: command_body_extra
102+
}

clients/client-migration-hub-refactor-spaces/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ export * from "./ListTagsForResourceCommand";
2222
export * from "./PutResourcePolicyCommand";
2323
export * from "./TagResourceCommand";
2424
export * from "./UntagResourceCommand";
25+
export * from "./UpdateRouteCommand";

0 commit comments

Comments
 (0)