Skip to content

Commit

Permalink
feat(client-cloudcontrol): Added support for CloudFormation Hooks wit…
Browse files Browse the repository at this point in the history
…h Cloud Control API. The GetResourceRequestStatus API response now includes an optional HooksProgressEvent and HooksRequestToken parameter for Hooks Invocation Progress as part of resource operation with Cloud Control.
  • Loading branch information
awstools committed Nov 14, 2024
1 parent 69415e0 commit e90cde2
Show file tree
Hide file tree
Showing 9 changed files with 276 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface CancelResourceRequestCommandOutput extends CancelResourceReques
* // TypeName: "STRING_VALUE",
* // Identifier: "STRING_VALUE",
* // RequestToken: "STRING_VALUE",
* // HooksRequestToken: "STRING_VALUE",
* // Operation: "STRING_VALUE",
* // OperationStatus: "STRING_VALUE",
* // EventTime: new Date("TIMESTAMP"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export interface CreateResourceCommandOutput extends CreateResourceOutput, __Met
* // TypeName: "STRING_VALUE",
* // Identifier: "STRING_VALUE",
* // RequestToken: "STRING_VALUE",
* // HooksRequestToken: "STRING_VALUE",
* // Operation: "STRING_VALUE",
* // OperationStatus: "STRING_VALUE",
* // EventTime: new Date("TIMESTAMP"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface DeleteResourceCommandOutput extends DeleteResourceOutput, __Met
* // TypeName: "STRING_VALUE",
* // Identifier: "STRING_VALUE",
* // RequestToken: "STRING_VALUE",
* // HooksRequestToken: "STRING_VALUE",
* // Operation: "STRING_VALUE",
* // OperationStatus: "STRING_VALUE",
* // EventTime: new Date("TIMESTAMP"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface GetResourceRequestStatusCommandOutput extends GetResourceReques
* // TypeName: "STRING_VALUE",
* // Identifier: "STRING_VALUE",
* // RequestToken: "STRING_VALUE",
* // HooksRequestToken: "STRING_VALUE",
* // Operation: "STRING_VALUE",
* // OperationStatus: "STRING_VALUE",
* // EventTime: new Date("TIMESTAMP"),
Expand All @@ -59,6 +60,18 @@ export interface GetResourceRequestStatusCommandOutput extends GetResourceReques
* // ErrorCode: "STRING_VALUE",
* // RetryAfter: new Date("TIMESTAMP"),
* // },
* // HooksProgressEvent: [ // HooksProgressEvent
* // { // HookProgressEvent
* // HookTypeName: "STRING_VALUE",
* // HookTypeVersionId: "STRING_VALUE",
* // HookTypeArn: "STRING_VALUE",
* // InvocationPoint: "STRING_VALUE",
* // HookStatus: "STRING_VALUE",
* // HookEventTime: new Date("TIMESTAMP"),
* // HookStatusMessage: "STRING_VALUE",
* // FailureMode: "STRING_VALUE",
* // },
* // ],
* // };
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface ListResourceRequestsCommandOutput extends ListResourceRequestsO
* // TypeName: "STRING_VALUE",
* // Identifier: "STRING_VALUE",
* // RequestToken: "STRING_VALUE",
* // HooksRequestToken: "STRING_VALUE",
* // Operation: "STRING_VALUE",
* // OperationStatus: "STRING_VALUE",
* // EventTime: new Date("TIMESTAMP"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export interface UpdateResourceCommandOutput extends UpdateResourceOutput, __Met
* // TypeName: "STRING_VALUE",
* // Identifier: "STRING_VALUE",
* // RequestToken: "STRING_VALUE",
* // HooksRequestToken: "STRING_VALUE",
* // Operation: "STRING_VALUE",
* // OperationStatus: "STRING_VALUE",
* // EventTime: new Date("TIMESTAMP"),
Expand Down
102 changes: 102 additions & 0 deletions clients/client-cloudcontrol/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const HandlerErrorCode = {
SERVICE_LIMIT_EXCEEDED: "ServiceLimitExceeded",
SERVICE_TIMEOUT: "ServiceTimeout",
THROTTLING: "Throttling",
UNAUTHORIZED_TAGGING_OPERATION: "UnauthorizedTaggingOperation",
} as const;

/**
Expand Down Expand Up @@ -128,6 +129,12 @@ export interface ProgressEvent {
*/
RequestToken?: string | undefined;

/**
* <p>The unique token representing the Hooks operation for the request.</p>
* @public
*/
HooksRequestToken?: string | undefined;

/**
* <p>The resource operation type.</p>
* @public
Expand Down Expand Up @@ -949,6 +956,95 @@ export interface GetResourceRequestStatusInput {
RequestToken: string | undefined;
}

/**
* <p>Represents the current status of applicable Hooks for a resource operation request. It contains list of
* Hook invocation information for the resource specified in the request since the same target can invoke multiple Hooks.
* For more information, see <a href="https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-manage-requests.html">Managing resource operation requests with Amazon Web Services Cloud Control API
* </a>.</p>
* @public
*/
export interface HookProgressEvent {
/**
* <p>The type name of the Hook being invoked.</p>
* @public
*/
HookTypeName?: string | undefined;

/**
* <p>The type version of the Hook being invoked.</p>
* @public
*/
HookTypeVersionId?: string | undefined;

/**
* <p>The ARN of the Hook being invoked.</p>
* @public
*/
HookTypeArn?: string | undefined;

/**
* <p>States whether the Hook is invoked before or after resource provisioning.</p>
* @public
*/
InvocationPoint?: string | undefined;

/**
* <p>The status of the Hook invocation. The following are potential statuses:</p>
* <ul>
* <li>
* <p>
* <code>HOOK_PENDING</code>: The Hook was added to the invocation plan, but not yet invoked.</p>
* </li>
* <li>
* <p>
* <code>HOOK_IN_PROGRESS</code>: The Hook was invoked, but hasn't completed.</p>
* </li>
* <li>
* <p>
* <code>HOOK_COMPLETE_SUCCEEDED</code>: The Hook invocation is complete with a successful result.</p>
* </li>
* <li>
* <p>
* <code>HOOK_COMPLETE_FAILED</code>: The Hook invocation is complete with a failed result.</p>
* </li>
* <li>
* <p>
* <code>HOOK_FAILED</code>: The Hook invocation didn't complete successfully.</p>
* </li>
* </ul>
* @public
*/
HookStatus?: string | undefined;

/**
* <p>The time that the Hook invocation request initiated.</p>
* @public
*/
HookEventTime?: Date | undefined;

/**
* <p>The message explaining the current Hook status.</p>
* @public
*/
HookStatusMessage?: string | undefined;

/**
* <p>The failure mode of the invocation. The following are the potential statuses:</p>
* <ul>
* <li>
* <p>
* <code>FAIL</code>: This will fail the Hook invocation and the request associated with it.</p>
* </li>
* <li>
* <p>
* <code>WARN</code>: This will fail the Hook invocation, but not the request associated with it.</p>
* </li>
* </ul>
* @public
*/
FailureMode?: string | undefined;
}

/**
* @public
*/
Expand All @@ -958,6 +1054,12 @@ export interface GetResourceRequestStatusOutput {
* @public
*/
ProgressEvent?: ProgressEvent | undefined;

/**
* <p>Lists Hook invocations for the specified target in the request. This is a list since the same target can invoke multiple Hooks.</p>
* @public
*/
HooksProgressEvent?: HookProgressEvent[] | undefined;
}

/**
Expand Down
31 changes: 31 additions & 0 deletions clients/client-cloudcontrol/src/protocols/Aws_json1_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
GetResourceRequestStatusOutput,
HandlerFailureException,
HandlerInternalFailureException,
HookProgressEvent,
InvalidCredentialsException,
InvalidRequestException,
ListResourceRequestsInput,
Expand Down Expand Up @@ -860,6 +861,7 @@ const de_DeleteResourceOutput = (output: any, context: __SerdeContext): DeleteRe
*/
const de_GetResourceRequestStatusOutput = (output: any, context: __SerdeContext): GetResourceRequestStatusOutput => {
return take(output, {
HooksProgressEvent: (_: any) => de_HooksProgressEvent(_, context),
ProgressEvent: (_: any) => de_ProgressEvent(_, context),
}) as any;
};
Expand All @@ -868,6 +870,34 @@ const de_GetResourceRequestStatusOutput = (output: any, context: __SerdeContext)

// de_HandlerInternalFailureException omitted.

/**
* deserializeAws_json1_0HookProgressEvent
*/
const de_HookProgressEvent = (output: any, context: __SerdeContext): HookProgressEvent => {
return take(output, {
FailureMode: __expectString,
HookEventTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
HookStatus: __expectString,
HookStatusMessage: __expectString,
HookTypeArn: __expectString,
HookTypeName: __expectString,
HookTypeVersionId: __expectString,
InvocationPoint: __expectString,
}) as any;
};

/**
* deserializeAws_json1_0HooksProgressEvent
*/
const de_HooksProgressEvent = (output: any, context: __SerdeContext): HookProgressEvent[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
.map((entry: any) => {
return de_HookProgressEvent(entry, context);
});
return retVal;
};

// de_InvalidCredentialsException omitted.

// de_InvalidRequestException omitted.
Expand Down Expand Up @@ -899,6 +929,7 @@ const de_ProgressEvent = (output: any, context: __SerdeContext): ProgressEvent =
return take(output, {
ErrorCode: __expectString,
EventTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
HooksRequestToken: __expectString,
Identifier: __expectString,
Operation: __expectString,
OperationStatus: __expectString,
Expand Down
Loading

0 comments on commit e90cde2

Please sign in to comment.