+ * Gets information about the specified safety lever. + *
+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { FisClient, GetSafetyLeverCommand } from "@aws-sdk/client-fis"; // ES Modules import + * // const { FisClient, GetSafetyLeverCommand } = require("@aws-sdk/client-fis"); // CommonJS import + * const client = new FisClient(config); + * const input = { // GetSafetyLeverRequest + * id: "STRING_VALUE", // required + * }; + * const command = new GetSafetyLeverCommand(input); + * const response = await client.send(command); + * // { // GetSafetyLeverResponse + * // safetyLever: { // SafetyLever + * // id: "STRING_VALUE", + * // arn: "STRING_VALUE", + * // state: { // SafetyLeverState + * // status: "disengaged" || "engaged" || "engaging", + * // reason: "STRING_VALUE", + * // }, + * // }, + * // }; + * + * ``` + * + * @param GetSafetyLeverCommandInput - {@link GetSafetyLeverCommandInput} + * @returns {@link GetSafetyLeverCommandOutput} + * @see {@link GetSafetyLeverCommandInput} for command's `input` shape. + * @see {@link GetSafetyLeverCommandOutput} for command's `response` shape. + * @see {@link FisClientResolvedConfig | config} for FisClient's `config` shape. + * + * @throws {@link ResourceNotFoundException} (client fault) + *The specified resource cannot be found.
+ * + * @throws {@link FisServiceException} + *Base exception class for all service exceptions from Fis service.
+ * + * @public + */ +export class GetSafetyLeverCommand extends $Command + .classBuilder< + GetSafetyLeverCommandInput, + GetSafetyLeverCommandOutput, + FisClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep({ + ...commonParams, + }) + .m(function (this: any, Command: any, cs: any, config: FisClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("FaultInjectionSimulator", "GetSafetyLever", {}) + .n("FisClient", "GetSafetyLeverCommand") + .f(void 0, void 0) + .ser(se_GetSafetyLeverCommand) + .de(de_GetSafetyLeverCommand) + .build() {} diff --git a/clients/client-fis/src/commands/ListExperimentsCommand.ts b/clients/client-fis/src/commands/ListExperimentsCommand.ts index 9568fc21d6cc..ccf60b00d016 100644 --- a/clients/client-fis/src/commands/ListExperimentsCommand.ts +++ b/clients/client-fis/src/commands/ListExperimentsCommand.ts @@ -49,7 +49,7 @@ export interface ListExperimentsCommandOutput extends ListExperimentsResponse, _ * // arn: "STRING_VALUE", * // experimentTemplateId: "STRING_VALUE", * // state: { // ExperimentState - * // status: "pending" || "initiating" || "running" || "completed" || "stopping" || "stopped" || "failed", + * // status: "pending" || "initiating" || "running" || "completed" || "stopping" || "stopped" || "failed" || "cancelled", * // reason: "STRING_VALUE", * // error: { // ExperimentError * // accountId: "STRING_VALUE", diff --git a/clients/client-fis/src/commands/StartExperimentCommand.ts b/clients/client-fis/src/commands/StartExperimentCommand.ts index c9e5f24146fb..fd8da8328bf4 100644 --- a/clients/client-fis/src/commands/StartExperimentCommand.ts +++ b/clients/client-fis/src/commands/StartExperimentCommand.ts @@ -54,7 +54,7 @@ export interface StartExperimentCommandOutput extends StartExperimentResponse, _ * // experimentTemplateId: "STRING_VALUE", * // roleArn: "STRING_VALUE", * // state: { // ExperimentState - * // status: "pending" || "initiating" || "running" || "completed" || "stopping" || "stopped" || "failed", + * // status: "pending" || "initiating" || "running" || "completed" || "stopping" || "stopped" || "failed" || "cancelled", * // reason: "STRING_VALUE", * // error: { // ExperimentError * // accountId: "STRING_VALUE", diff --git a/clients/client-fis/src/commands/StopExperimentCommand.ts b/clients/client-fis/src/commands/StopExperimentCommand.ts index 973af5e3cd5d..24e6cb64aa18 100644 --- a/clients/client-fis/src/commands/StopExperimentCommand.ts +++ b/clients/client-fis/src/commands/StopExperimentCommand.ts @@ -47,7 +47,7 @@ export interface StopExperimentCommandOutput extends StopExperimentResponse, __M * // experimentTemplateId: "STRING_VALUE", * // roleArn: "STRING_VALUE", * // state: { // ExperimentState - * // status: "pending" || "initiating" || "running" || "completed" || "stopping" || "stopped" || "failed", + * // status: "pending" || "initiating" || "running" || "completed" || "stopping" || "stopped" || "failed" || "cancelled", * // reason: "STRING_VALUE", * // error: { // ExperimentError * // accountId: "STRING_VALUE", diff --git a/clients/client-fis/src/commands/UpdateSafetyLeverStateCommand.ts b/clients/client-fis/src/commands/UpdateSafetyLeverStateCommand.ts new file mode 100644 index 000000000000..9bf7bb140a69 --- /dev/null +++ b/clients/client-fis/src/commands/UpdateSafetyLeverStateCommand.ts @@ -0,0 +1,104 @@ +// smithy-typescript generated code +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { commonParams } from "../endpoint/EndpointParameters"; +import { FisClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../FisClient"; +import { UpdateSafetyLeverStateRequest, UpdateSafetyLeverStateResponse } from "../models/models_0"; +import { de_UpdateSafetyLeverStateCommand, se_UpdateSafetyLeverStateCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link UpdateSafetyLeverStateCommand}. + */ +export interface UpdateSafetyLeverStateCommandInput extends UpdateSafetyLeverStateRequest {} +/** + * @public + * + * The output of {@link UpdateSafetyLeverStateCommand}. + */ +export interface UpdateSafetyLeverStateCommandOutput extends UpdateSafetyLeverStateResponse, __MetadataBearer {} + +/** + *+ * Updates the specified safety lever state. + *
+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { FisClient, UpdateSafetyLeverStateCommand } from "@aws-sdk/client-fis"; // ES Modules import + * // const { FisClient, UpdateSafetyLeverStateCommand } = require("@aws-sdk/client-fis"); // CommonJS import + * const client = new FisClient(config); + * const input = { // UpdateSafetyLeverStateRequest + * id: "STRING_VALUE", // required + * state: { // UpdateSafetyLeverStateInput + * status: "disengaged" || "engaged", // required + * reason: "STRING_VALUE", // required + * }, + * }; + * const command = new UpdateSafetyLeverStateCommand(input); + * const response = await client.send(command); + * // { // UpdateSafetyLeverStateResponse + * // safetyLever: { // SafetyLever + * // id: "STRING_VALUE", + * // arn: "STRING_VALUE", + * // state: { // SafetyLeverState + * // status: "disengaged" || "engaged" || "engaging", + * // reason: "STRING_VALUE", + * // }, + * // }, + * // }; + * + * ``` + * + * @param UpdateSafetyLeverStateCommandInput - {@link UpdateSafetyLeverStateCommandInput} + * @returns {@link UpdateSafetyLeverStateCommandOutput} + * @see {@link UpdateSafetyLeverStateCommandInput} for command's `input` shape. + * @see {@link UpdateSafetyLeverStateCommandOutput} for command's `response` shape. + * @see {@link FisClientResolvedConfig | config} for FisClient's `config` shape. + * + * @throws {@link ConflictException} (client fault) + *The request could not be processed because of a conflict.
+ * + * @throws {@link ResourceNotFoundException} (client fault) + *The specified resource cannot be found.
+ * + * @throws {@link ValidationException} (client fault) + *The specified input is not valid, or fails to satisfy the constraints for the request.
+ * + * @throws {@link FisServiceException} + *Base exception class for all service exceptions from Fis service.
+ * + * @public + */ +export class UpdateSafetyLeverStateCommand extends $Command + .classBuilder< + UpdateSafetyLeverStateCommandInput, + UpdateSafetyLeverStateCommandOutput, + FisClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep({ + ...commonParams, + }) + .m(function (this: any, Command: any, cs: any, config: FisClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("FaultInjectionSimulator", "UpdateSafetyLeverState", {}) + .n("FisClient", "UpdateSafetyLeverStateCommand") + .f(void 0, void 0) + .ser(se_UpdateSafetyLeverStateCommand) + .de(de_UpdateSafetyLeverStateCommand) + .build() {} diff --git a/clients/client-fis/src/commands/index.ts b/clients/client-fis/src/commands/index.ts index 6ad213f1bb07..bafb3456f2ba 100644 --- a/clients/client-fis/src/commands/index.ts +++ b/clients/client-fis/src/commands/index.ts @@ -7,6 +7,7 @@ export * from "./GetActionCommand"; export * from "./GetExperimentCommand"; export * from "./GetExperimentTargetAccountConfigurationCommand"; export * from "./GetExperimentTemplateCommand"; +export * from "./GetSafetyLeverCommand"; export * from "./GetTargetAccountConfigurationCommand"; export * from "./GetTargetResourceTypeCommand"; export * from "./ListActionsCommand"; @@ -22,4 +23,5 @@ export * from "./StopExperimentCommand"; export * from "./TagResourceCommand"; export * from "./UntagResourceCommand"; export * from "./UpdateExperimentTemplateCommand"; +export * from "./UpdateSafetyLeverStateCommand"; export * from "./UpdateTargetAccountConfigurationCommand"; diff --git a/clients/client-fis/src/models/models_0.ts b/clients/client-fis/src/models/models_0.ts index e28bf5fc843c..b7c00b29e321 100644 --- a/clients/client-fis/src/models/models_0.ts +++ b/clients/client-fis/src/models/models_0.ts @@ -1103,6 +1103,7 @@ export interface ExperimentError { * @enum */ export const ExperimentStatus = { + cancelled: "cancelled", completed: "completed", failed: "failed", initiating: "initiating", @@ -1547,6 +1548,103 @@ export interface GetExperimentTemplateResponse { experimentTemplate?: ExperimentTemplate; } +/** + * @public + */ +export interface GetSafetyLeverRequest { + /** + *+ * The ID of the safety lever. + *
+ * @public + */ + id: string | undefined; +} + +/** + * @public + * @enum + */ +export const SafetyLeverStatus = { + DISENGAGED: "disengaged", + ENGAGED: "engaged", + ENGAGING: "engaging", +} as const; + +/** + * @public + */ +export type SafetyLeverStatus = (typeof SafetyLeverStatus)[keyof typeof SafetyLeverStatus]; + +/** + *+ * Describes the state of the safety lever. + *
+ * @public + */ +export interface SafetyLeverState { + /** + *+ * The state of the safety lever. + *
+ * @public + */ + status?: SafetyLeverStatus; + + /** + *+ * The reason for the state of the safety lever. + *
+ * @public + */ + reason?: string; +} + +/** + *+ * Describes a safety lever. + *
+ * @public + */ +export interface SafetyLever { + /** + *+ * The ID of the safety lever. + *
+ * @public + */ + id?: string; + + /** + *+ * The Amazon Resource Name (ARN) of the safety lever. + *
+ * @public + */ + arn?: string; + + /** + *+ * The state of the safety lever. + *
+ * @public + */ + state?: SafetyLeverState; +} + +/** + * @public + */ +export interface GetSafetyLeverResponse { + /** + *+ * Information about the safety lever. + *
+ * @public + */ + safetyLever?: SafetyLever; +} + /** * @public */ @@ -2311,6 +2409,78 @@ export interface UpdateExperimentTemplateResponse { experimentTemplate?: ExperimentTemplate; } +/** + * @public + * @enum + */ +export const SafetyLeverStatusInput = { + DISENGAGED: "disengaged", + ENGAGED: "engaged", +} as const; + +/** + * @public + */ +export type SafetyLeverStatusInput = (typeof SafetyLeverStatusInput)[keyof typeof SafetyLeverStatusInput]; + +/** + *+ * Specifies a state for a safety lever. + *
+ * @public + */ +export interface UpdateSafetyLeverStateInput { + /** + *+ * The updated state of the safety lever. + *
+ * @public + */ + status: SafetyLeverStatusInput | undefined; + + /** + *+ * The reason for updating the state of the safety lever. + *
+ * @public + */ + reason: string | undefined; +} + +/** + * @public + */ +export interface UpdateSafetyLeverStateRequest { + /** + *+ * The ID of the safety lever. + *
+ * @public + */ + id: string | undefined; + + /** + *+ * The state of the safety lever. + *
+ * @public + */ + state: UpdateSafetyLeverStateInput | undefined; +} + +/** + * @public + */ +export interface UpdateSafetyLeverStateResponse { + /** + *+ * Information about the safety lever. + *
+ * @public + */ + safetyLever?: SafetyLever; +} + /** * @public */ diff --git a/clients/client-fis/src/protocols/Aws_restJson1.ts b/clients/client-fis/src/protocols/Aws_restJson1.ts index 228dd7d7ec35..ca8d700d545d 100644 --- a/clients/client-fis/src/protocols/Aws_restJson1.ts +++ b/clients/client-fis/src/protocols/Aws_restJson1.ts @@ -51,6 +51,7 @@ import { GetExperimentTemplateCommandInput, GetExperimentTemplateCommandOutput, } from "../commands/GetExperimentTemplateCommand"; +import { GetSafetyLeverCommandInput, GetSafetyLeverCommandOutput } from "../commands/GetSafetyLeverCommand"; import { GetTargetAccountConfigurationCommandInput, GetTargetAccountConfigurationCommandOutput, @@ -93,6 +94,10 @@ import { UpdateExperimentTemplateCommandInput, UpdateExperimentTemplateCommandOutput, } from "../commands/UpdateExperimentTemplateCommand"; +import { + UpdateSafetyLeverStateCommandInput, + UpdateSafetyLeverStateCommandOutput, +} from "../commands/UpdateSafetyLeverStateCommand"; import { UpdateTargetAccountConfigurationCommandInput, UpdateTargetAccountConfigurationCommandOutput, @@ -121,6 +126,7 @@ import { UpdateExperimentTemplateLogConfigurationInput, UpdateExperimentTemplateStopConditionInput, UpdateExperimentTemplateTargetInput, + UpdateSafetyLeverStateInput, ValidationException, } from "../models/models_0"; @@ -278,6 +284,22 @@ export const se_GetExperimentTemplateCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1GetSafetyLeverCommand + */ +export const se_GetSafetyLeverCommand = async ( + input: GetSafetyLeverCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/safetyLevers/{id}"); + b.p("id", () => input.id!, "{id}", false); + let body: any; + b.m("GET").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1GetTargetAccountConfigurationCommand */ @@ -576,6 +598,29 @@ export const se_UpdateExperimentTemplateCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1UpdateSafetyLeverStateCommand + */ +export const se_UpdateSafetyLeverStateCommand = async ( + input: UpdateSafetyLeverStateCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/safetyLevers/{id}/state"); + b.p("id", () => input.id!, "{id}", false); + let body: any; + body = JSON.stringify( + take(input, { + state: (_) => _json(_), + }) + ); + b.m("PATCH").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1UpdateTargetAccountConfigurationCommand */ @@ -769,6 +814,27 @@ export const de_GetExperimentTemplateCommand = async ( return contents; }; +/** + * deserializeAws_restJson1GetSafetyLeverCommand + */ +export const de_GetSafetyLeverCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise