From 059361e507350cdf167bf0a3afe57e04771d51a4 Mon Sep 17 00:00:00 2001 From: awstools Date: Tue, 18 Jul 2023 18:17:35 +0000 Subject: [PATCH] feat(client-m2): Allows UpdateEnvironment to update the environment to 0 host capacity. New GetSignedBluinsightsUrl API --- clients/client-m2/README.md | 8 + clients/client-m2/src/M2.ts | 23 +++ clients/client-m2/src/M2Client.ts | 6 + .../GetSignedBluinsightsUrlCommand.ts | 149 ++++++++++++++++++ clients/client-m2/src/commands/index.ts | 1 + clients/client-m2/src/models/models_0.ts | 20 ++- .../client-m2/src/protocols/Aws_restJson1.ts | 82 ++++++++++ codegen/sdk-codegen/aws-models/m2.json | 75 +++++++-- 8 files changed, 344 insertions(+), 20 deletions(-) create mode 100644 clients/client-m2/src/commands/GetSignedBluinsightsUrlCommand.ts diff --git a/clients/client-m2/README.md b/clients/client-m2/README.md index de72565442ca..493661f7173f 100644 --- a/clients/client-m2/README.md +++ b/clients/client-m2/README.md @@ -326,6 +326,14 @@ GetEnvironment [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-m2/classes/getenvironmentcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-m2/interfaces/getenvironmentcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-m2/interfaces/getenvironmentcommandoutput.html) + +
+ +GetSignedBluinsightsUrl + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-m2/classes/getsignedbluinsightsurlcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-m2/interfaces/getsignedbluinsightsurlcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-m2/interfaces/getsignedbluinsightsurlcommandoutput.html) +
diff --git a/clients/client-m2/src/M2.ts b/clients/client-m2/src/M2.ts index 0520167ce0d0..d9c165a201df 100644 --- a/clients/client-m2/src/M2.ts +++ b/clients/client-m2/src/M2.ts @@ -77,6 +77,11 @@ import { GetEnvironmentCommandInput, GetEnvironmentCommandOutput, } from "./commands/GetEnvironmentCommand"; +import { + GetSignedBluinsightsUrlCommand, + GetSignedBluinsightsUrlCommandInput, + GetSignedBluinsightsUrlCommandOutput, +} from "./commands/GetSignedBluinsightsUrlCommand"; import { ListApplicationsCommand, ListApplicationsCommandInput, @@ -176,6 +181,7 @@ const commands = { GetDataSetImportTaskCommand, GetDeploymentCommand, GetEnvironmentCommand, + GetSignedBluinsightsUrlCommand, ListApplicationsCommand, ListApplicationVersionsCommand, ListBatchJobDefinitionsCommand, @@ -439,6 +445,23 @@ export interface M2 { cb: (err: any, data?: GetEnvironmentCommandOutput) => void ): void; + /** + * @see {@link GetSignedBluinsightsUrlCommand} + */ + getSignedBluinsightsUrl( + args: GetSignedBluinsightsUrlCommandInput, + options?: __HttpHandlerOptions + ): Promise; + getSignedBluinsightsUrl( + args: GetSignedBluinsightsUrlCommandInput, + cb: (err: any, data?: GetSignedBluinsightsUrlCommandOutput) => void + ): void; + getSignedBluinsightsUrl( + args: GetSignedBluinsightsUrlCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GetSignedBluinsightsUrlCommandOutput) => void + ): void; + /** * @see {@link ListApplicationsCommand} */ diff --git a/clients/client-m2/src/M2Client.ts b/clients/client-m2/src/M2Client.ts index 9555637f9bf2..6fb303260898 100644 --- a/clients/client-m2/src/M2Client.ts +++ b/clients/client-m2/src/M2Client.ts @@ -82,6 +82,10 @@ import { } from "./commands/GetDataSetImportTaskCommand"; import { GetDeploymentCommandInput, GetDeploymentCommandOutput } from "./commands/GetDeploymentCommand"; import { GetEnvironmentCommandInput, GetEnvironmentCommandOutput } from "./commands/GetEnvironmentCommand"; +import { + GetSignedBluinsightsUrlCommandInput, + GetSignedBluinsightsUrlCommandOutput, +} from "./commands/GetSignedBluinsightsUrlCommand"; import { ListApplicationsCommandInput, ListApplicationsCommandOutput } from "./commands/ListApplicationsCommand"; import { ListApplicationVersionsCommandInput, @@ -143,6 +147,7 @@ export type ServiceInputTypes = | GetDataSetImportTaskCommandInput | GetDeploymentCommandInput | GetEnvironmentCommandInput + | GetSignedBluinsightsUrlCommandInput | ListApplicationVersionsCommandInput | ListApplicationsCommandInput | ListBatchJobDefinitionsCommandInput @@ -180,6 +185,7 @@ export type ServiceOutputTypes = | GetDataSetImportTaskCommandOutput | GetDeploymentCommandOutput | GetEnvironmentCommandOutput + | GetSignedBluinsightsUrlCommandOutput | ListApplicationVersionsCommandOutput | ListApplicationsCommandOutput | ListBatchJobDefinitionsCommandOutput diff --git a/clients/client-m2/src/commands/GetSignedBluinsightsUrlCommand.ts b/clients/client-m2/src/commands/GetSignedBluinsightsUrlCommand.ts new file mode 100644 index 000000000000..e6186cb165e9 --- /dev/null +++ b/clients/client-m2/src/commands/GetSignedBluinsightsUrlCommand.ts @@ -0,0 +1,149 @@ +// smithy-typescript generated code +import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint"; +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http"; +import { Command as $Command } from "@smithy/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@smithy/types"; + +import { M2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../M2Client"; +import { GetSignedBluinsightsUrlResponse } from "../models/models_0"; +import { de_GetSignedBluinsightsUrlCommand, se_GetSignedBluinsightsUrlCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link GetSignedBluinsightsUrlCommand}. + */ +export interface GetSignedBluinsightsUrlCommandInput {} +/** + * @public + * + * The output of {@link GetSignedBluinsightsUrlCommand}. + */ +export interface GetSignedBluinsightsUrlCommandOutput extends GetSignedBluinsightsUrlResponse, __MetadataBearer {} + +/** + * @public + *

Gets a single sign-on URL that can be used to connect to AWS Blu Insights.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { M2Client, GetSignedBluinsightsUrlCommand } from "@aws-sdk/client-m2"; // ES Modules import + * // const { M2Client, GetSignedBluinsightsUrlCommand } = require("@aws-sdk/client-m2"); // CommonJS import + * const client = new M2Client(config); + * const input = {}; + * const command = new GetSignedBluinsightsUrlCommand(input); + * const response = await client.send(command); + * // { // GetSignedBluinsightsUrlResponse + * // signedBiUrl: "STRING_VALUE", // required + * // }; + * + * ``` + * + * @param GetSignedBluinsightsUrlCommandInput - {@link GetSignedBluinsightsUrlCommandInput} + * @returns {@link GetSignedBluinsightsUrlCommandOutput} + * @see {@link GetSignedBluinsightsUrlCommandInput} for command's `input` shape. + * @see {@link GetSignedBluinsightsUrlCommandOutput} for command's `response` shape. + * @see {@link M2ClientResolvedConfig | config} for M2Client's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

The account or role doesn't have the right permissions to make the request.

+ * + * @throws {@link InternalServerException} (server fault) + *

An unexpected error occurred during the processing of the request.

+ * + * @throws {@link ThrottlingException} (client fault) + *

The number of requests made exceeds the limit.

+ * + * @throws {@link M2ServiceException} + *

Base exception class for all service exceptions from M2 service.

+ * + */ +export class GetSignedBluinsightsUrlCommand extends $Command< + GetSignedBluinsightsUrlCommandInput, + GetSignedBluinsightsUrlCommandOutput, + M2ClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + public static getEndpointParameterInstructions(): EndpointParameterInstructions { + return { + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }, + }; + } + + /** + * @public + */ + constructor(readonly input: GetSignedBluinsightsUrlCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: M2ClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + this.middlewareStack.use( + getEndpointPlugin(configuration, GetSignedBluinsightsUrlCommand.getEndpointParameterInstructions()) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "M2Client"; + const commandName = "GetSignedBluinsightsUrlCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (_: any) => _, + outputFilterSensitiveLog: (_: any) => _, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + /** + * @internal + */ + private serialize(input: GetSignedBluinsightsUrlCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return se_GetSignedBluinsightsUrlCommand(input, context); + } + + /** + * @internal + */ + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return de_GetSignedBluinsightsUrlCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-m2/src/commands/index.ts b/clients/client-m2/src/commands/index.ts index ff32cbfb533f..0fdecfdbc4d3 100644 --- a/clients/client-m2/src/commands/index.ts +++ b/clients/client-m2/src/commands/index.ts @@ -14,6 +14,7 @@ export * from "./GetDataSetDetailsCommand"; export * from "./GetDataSetImportTaskCommand"; export * from "./GetDeploymentCommand"; export * from "./GetEnvironmentCommand"; +export * from "./GetSignedBluinsightsUrlCommand"; export * from "./ListApplicationVersionsCommand"; export * from "./ListApplicationsCommand"; export * from "./ListBatchJobDefinitionsCommand"; diff --git a/clients/client-m2/src/models/models_0.ts b/clients/client-m2/src/models/models_0.ts index 7b4b703f93df..4e594fbcef99 100644 --- a/clients/client-m2/src/models/models_0.ts +++ b/clients/client-m2/src/models/models_0.ts @@ -376,7 +376,8 @@ export interface CreateApplicationRequest { kmsKeyId?: string; /** - *

The Amazon Resource Name (ARN) of the role associated with the application.

+ *

The Amazon Resource Name (ARN) that identifies a role that the application uses to access Amazon Web Services resources + * that are not part of the application or are in a different Amazon Web Services account.

*/ roleArn?: string; } @@ -481,7 +482,8 @@ export interface PoAttributes { encoding?: string; /** - *

An array containing one or more filename extensions, allowing you to specify which files to be included as PDS member.

+ *

An array containing one or more filename extensions, allowing you to specify which files + * to be included as PDS member.

*/ memberFileExtensions: string[] | undefined; } @@ -2519,7 +2521,7 @@ export interface UpdateApplicationResponse { */ export interface HighAvailabilityConfig { /** - *

The number of instances in a high availability configuration.

+ *

The number of instances in a high availability configuration. The minimum possible value is 1 and the maximum is 100.

*/ desiredCapacity: number | undefined; } @@ -2992,7 +2994,7 @@ export interface UpdateEnvironmentRequest { environmentId: string | undefined; /** - *

The desired capacity for the runtime environment to update.

+ *

The desired capacity for the runtime environment to update. The minimum possible value is 0 and the maximum is 100.

*/ desiredCapacity?: number; @@ -3032,6 +3034,16 @@ export interface UpdateEnvironmentResponse { environmentId: string | undefined; } +/** + * @public + */ +export interface GetSignedBluinsightsUrlResponse { + /** + *

Single sign-on AWS Blu Insights URL.

+ */ + signedBiUrl: string | undefined; +} + /** * @public */ diff --git a/clients/client-m2/src/protocols/Aws_restJson1.ts b/clients/client-m2/src/protocols/Aws_restJson1.ts index cddfcf2efe87..214da544052d 100644 --- a/clients/client-m2/src/protocols/Aws_restJson1.ts +++ b/clients/client-m2/src/protocols/Aws_restJson1.ts @@ -59,6 +59,10 @@ import { } from "../commands/GetDataSetImportTaskCommand"; import { GetDeploymentCommandInput, GetDeploymentCommandOutput } from "../commands/GetDeploymentCommand"; import { GetEnvironmentCommandInput, GetEnvironmentCommandOutput } from "../commands/GetEnvironmentCommand"; +import { + GetSignedBluinsightsUrlCommandInput, + GetSignedBluinsightsUrlCommandOutput, +} from "../commands/GetSignedBluinsightsUrlCommand"; import { ListApplicationsCommandInput, ListApplicationsCommandOutput } from "../commands/ListApplicationsCommand"; import { ListApplicationVersionsCommandInput, @@ -664,6 +668,31 @@ export const se_GetEnvironmentCommand = async ( }); }; +/** + * serializeAws_restJson1GetSignedBluinsightsUrlCommand + */ +export const se_GetSignedBluinsightsUrlCommand = async ( + input: GetSignedBluinsightsUrlCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signed-bi-url"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + /** * serializeAws_restJson1ListApplicationsCommand */ @@ -2225,6 +2254,59 @@ const de_GetEnvironmentCommandError = async ( } }; +/** + * deserializeAws_restJson1GetSignedBluinsightsUrlCommand + */ +export const de_GetSignedBluinsightsUrlCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_GetSignedBluinsightsUrlCommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + signedBiUrl: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + +/** + * deserializeAws_restJson1GetSignedBluinsightsUrlCommandError + */ +const de_GetSignedBluinsightsUrlCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseErrorBody(output.body, context), + }; + const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "AccessDeniedException": + case "com.amazonaws.m2#AccessDeniedException": + throw await de_AccessDeniedExceptionRes(parsedOutput, context); + case "InternalServerException": + case "com.amazonaws.m2#InternalServerException": + throw await de_InternalServerExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.m2#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + return throwDefaultError({ + output, + parsedBody, + errorCode, + }); + } +}; + /** * deserializeAws_restJson1ListApplicationsCommand */ diff --git a/codegen/sdk-codegen/aws-models/m2.json b/codegen/sdk-codegen/aws-models/m2.json index 4771e6a9739d..4fcdc94a326c 100644 --- a/codegen/sdk-codegen/aws-models/m2.json +++ b/codegen/sdk-codegen/aws-models/m2.json @@ -392,6 +392,9 @@ "type": "service", "version": "2021-04-28", "operations": [ + { + "target": "com.amazonaws.m2#GetSignedBluinsightsUrl" + }, { "target": "com.amazonaws.m2#ListEngineVersions" }, @@ -1485,13 +1488,7 @@ "members": {} }, "com.amazonaws.m2#CapacityValue": { - "type": "integer", - "traits": { - "smithy.api#range": { - "min": 1, - "max": 100 - } - } + "type": "integer" }, "com.amazonaws.m2#ConflictException": { "type": "structure", @@ -1614,7 +1611,7 @@ "roleArn": { "target": "com.amazonaws.m2#Arn", "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the role associated with the application.

" + "smithy.api#documentation": "

The Amazon Resource Name (ARN) that identifies a role that the application uses to access Amazon Web Services resources\n that are not part of the application or are in a different Amazon Web Services account.

" } } } @@ -2730,6 +2727,10 @@ "value": "Available", "name": "AVAILABLE" }, + { + "value": "Updating", + "name": "UPDATING" + }, { "value": "Deleting", "name": "DELETING" @@ -2737,10 +2738,6 @@ { "value": "Failed", "name": "FAILED" - }, - { - "value": "Updating", - "name": "UPDATING" } ] } @@ -3874,13 +3871,59 @@ } } }, + "com.amazonaws.m2#GetSignedBluinsightsUrl": { + "type": "operation", + "input": { + "target": "smithy.api#Unit" + }, + "output": { + "target": "com.amazonaws.m2#GetSignedBluinsightsUrlResponse" + }, + "errors": [ + { + "target": "com.amazonaws.m2#AccessDeniedException" + }, + { + "target": "com.amazonaws.m2#InternalServerException" + }, + { + "target": "com.amazonaws.m2#ThrottlingException" + } + ], + "traits": { + "aws.api#controlPlane": {}, + "aws.iam#actionPermissionDescription": "Grants permission to create a signed Bluinsights url", + "smithy.api#documentation": "

Gets a single sign-on URL that can be used to connect to AWS Blu Insights.

", + "smithy.api#http": { + "method": "GET", + "uri": "/signed-bi-url", + "code": 200 + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.m2#GetSignedBluinsightsUrlResponse": { + "type": "structure", + "members": { + "signedBiUrl": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

Single sign-on AWS Blu Insights URL.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.m2#HighAvailabilityConfig": { "type": "structure", "members": { "desiredCapacity": { "target": "com.amazonaws.m2#CapacityValue", "traits": { - "smithy.api#documentation": "

The number of instances in a high availability configuration.

", + "smithy.api#documentation": "

The number of instances in a high availability configuration. The minimum possible value is 1 and the maximum is 100.

", "smithy.api#required": {} } } @@ -4950,7 +4993,7 @@ "traits": { "smithy.api#range": { "min": 1, - "max": 100 + "max": 2000 } } }, @@ -4999,7 +5042,7 @@ "memberFileExtensions": { "target": "com.amazonaws.m2#String20List", "traits": { - "smithy.api#documentation": "

An array containing one or more filename extensions, allowing you to specify which files to be included as PDS member.

", + "smithy.api#documentation": "

An array containing one or more filename extensions, allowing you to specify which files\n to be included as PDS member.

", "smithy.api#required": {} } } @@ -5857,7 +5900,7 @@ "target": "com.amazonaws.m2#CapacityValue", "traits": { "smithy.api#default": null, - "smithy.api#documentation": "

The desired capacity for the runtime environment to update.

" + "smithy.api#documentation": "

The desired capacity for the runtime environment to update. The minimum possible value is 0 and the maximum is 100.

" } }, "instanceType": {