Skip to content

Commit

Permalink
feat(client-sns): Message Archiving and Replay is now supported in Am…
Browse files Browse the repository at this point in the history
…azon SNS for FIFO topics.
  • Loading branch information
awstools committed Oct 26, 2023
1 parent 6a156d7 commit 10014a8
Show file tree
Hide file tree
Showing 9 changed files with 225 additions and 17 deletions.
3 changes: 3 additions & 0 deletions clients/client-sns/src/commands/ConfirmSubscriptionCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ export interface ConfirmSubscriptionCommandOutput extends ConfirmSubscriptionRes
* @throws {@link NotFoundException} (client fault)
* <p>Indicates that the requested resource does not exist.</p>
*
* @throws {@link ReplayLimitExceededException} (client fault)
* <p>Indicates that the request parameter has exceeded the maximum number of concurrent message replays.</p>
*
* @throws {@link SubscriptionLimitExceededException} (client fault)
* <p>Indicates that the customer already owns the maximum allowed number of
* subscriptions.</p>
Expand Down
3 changes: 3 additions & 0 deletions clients/client-sns/src/commands/DeleteTopicCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export interface DeleteTopicCommandOutput extends __MetadataBearer {}
* <p>Indicates that a request parameter does not comply with the associated
* constraints.</p>
*
* @throws {@link InvalidStateException} (client fault)
* <p>Indicates that the specified state is not a valid state for an event source.</p>
*
* @throws {@link NotFoundException} (client fault)
* <p>Indicates that the requested resource does not exist.</p>
*
Expand Down
5 changes: 2 additions & 3 deletions clients/client-sns/src/commands/PublishBatchCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,12 @@ export interface PublishBatchCommandOutput extends PublishBatchResponse, __Metad
* to.</p>
*
* @throws {@link KMSDisabledException} (client fault)
* <p>The request was rejected because the specified customer master key (CMK) isn't
* <p>The request was rejected because the specified Amazon Web Services KMS key isn't
* enabled.</p>
*
* @throws {@link KMSInvalidStateException} (client fault)
* <p>The request was rejected because the state of the specified resource isn't valid for
* this request. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">How Key State Affects Use of a
* Customer Master Key</a> in the <i>Key Management Service Developer
* this request. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of Amazon Web Services KMS keys</a> in the <i>Key Management Service Developer
* Guide</i>.</p>
*
* @throws {@link KMSNotFoundException} (client fault)
Expand Down
5 changes: 2 additions & 3 deletions clients/client-sns/src/commands/PublishCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,12 @@ export interface PublishCommandOutput extends PublishResponse, __MetadataBearer
* to.</p>
*
* @throws {@link KMSDisabledException} (client fault)
* <p>The request was rejected because the specified customer master key (CMK) isn't
* <p>The request was rejected because the specified Amazon Web Services KMS key isn't
* enabled.</p>
*
* @throws {@link KMSInvalidStateException} (client fault)
* <p>The request was rejected because the state of the specified resource isn't valid for
* this request. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">How Key State Affects Use of a
* Customer Master Key</a> in the <i>Key Management Service Developer
* this request. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of Amazon Web Services KMS keys</a> in the <i>Key Management Service Developer
* Guide</i>.</p>
*
* @throws {@link KMSNotFoundException} (client fault)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ export interface SetSubscriptionAttributesCommandOutput extends __MetadataBearer
* @throws {@link NotFoundException} (client fault)
* <p>Indicates that the requested resource does not exist.</p>
*
* @throws {@link ReplayLimitExceededException} (client fault)
* <p>Indicates that the request parameter has exceeded the maximum number of concurrent message replays.</p>
*
* @throws {@link SNSServiceException}
* <p>Base exception class for all service exceptions from SNS service.</p>
*
Expand Down
5 changes: 4 additions & 1 deletion clients/client-sns/src/commands/SubscribeCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface SubscribeCommandOutput extends SubscribeResponse, __MetadataBea
* if the endpoint and the topic are not in the same Amazon Web Services account, the endpoint owner must
* run the <code>ConfirmSubscription</code> action to confirm the subscription.</p>
* <p>You call the <code>ConfirmSubscription</code> action with the token from the
* subscription response. Confirmation tokens are valid for three days.</p>
* subscription response. Confirmation tokens are valid for two days.</p>
* <p>This action is throttled at 100 transactions per second (TPS).</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down Expand Up @@ -94,6 +94,9 @@ export interface SubscribeCommandOutput extends SubscribeResponse, __MetadataBea
* @throws {@link NotFoundException} (client fault)
* <p>Indicates that the requested resource does not exist.</p>
*
* @throws {@link ReplayLimitExceededException} (client fault)
* <p>Indicates that the request parameter has exceeded the maximum number of concurrent message replays.</p>
*
* @throws {@link SubscriptionLimitExceededException} (client fault)
* <p>Indicates that the customer already owns the maximum allowed number of
* subscriptions.</p>
Expand Down
94 changes: 89 additions & 5 deletions clients/client-sns/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,26 @@ export class FilterPolicyLimitExceededException extends __BaseException {
}
}

/**
* @public
* <p>Indicates that the request parameter has exceeded the maximum number of concurrent message replays.</p>
*/
export class ReplayLimitExceededException extends __BaseException {
readonly name: "ReplayLimitExceededException" = "ReplayLimitExceededException";
readonly $fault: "client" = "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<ReplayLimitExceededException, __BaseException>) {
super({
name: "ReplayLimitExceededException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ReplayLimitExceededException.prototype);
}
}

/**
* @public
* <p>Indicates that the customer already owns the maximum allowed number of
Expand Down Expand Up @@ -544,8 +564,15 @@ export interface CreateTopicInput {
* <ul>
* <li>
* <p>
* <code>FifoTopic</code> – When this is set to <code>true</code>, a FIFO
* topic is created.</p>
* <code>ArchivePolicy</code> – Adds or updates an inline policy document
* to archive messages stored in the specified Amazon SNS topic.</p>
* </li>
* <li>
* <p>
* <code>BeginningArchiveTime</code> – The earliest starting point at
* which a message in the topic’s archive can be replayed from. This point in time
* is based on the configured message retention period set by the topic’s message
* archiving policy.</p>
* </li>
* <li>
* <p>
Expand Down Expand Up @@ -780,6 +807,26 @@ export interface DeleteTopicInput {
TopicArn: string | undefined;
}

/**
* @public
* <p>Indicates that the specified state is not a valid state for an event source.</p>
*/
export class InvalidStateException extends __BaseException {
readonly name: "InvalidStateException" = "InvalidStateException";
readonly $fault: "client" = "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<InvalidStateException, __BaseException>) {
super({
name: "InvalidStateException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, InvalidStateException.prototype);
}
}

/**
* @public
*/
Expand Down Expand Up @@ -1812,7 +1859,7 @@ export class KMSAccessDeniedException extends __BaseException {

/**
* @public
* <p>The request was rejected because the specified customer master key (CMK) isn't
* <p>The request was rejected because the specified Amazon Web Services KMS key isn't
* enabled.</p>
*/
export class KMSDisabledException extends __BaseException {
Expand All @@ -1834,8 +1881,7 @@ export class KMSDisabledException extends __BaseException {
/**
* @public
* <p>The request was rejected because the state of the specified resource isn't valid for
* this request. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">How Key State Affects Use of a
* Customer Master Key</a> in the <i>Key Management Service Developer
* this request. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of Amazon Web Services KMS keys</a> in the <i>Key Management Service Developer
* Guide</i>.</p>
*/
export class KMSInvalidStateException extends __BaseException {
Expand Down Expand Up @@ -3299,6 +3345,44 @@ export interface SubscribeInput {
* to Kinesis Data Firehose delivery streams</a> in the <i>Amazon SNS Developer Guide</i>.</p>
* </li>
* </ul>
* <p>The following attributes apply only to <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-fifo-topics.html">FIFO topics</a>:</p>
* <ul>
* <li>
* <p>
* <code>ReplayPolicy</code> – Adds or updates an inline policy document
* for a subscription to replay messages stored in the specified Amazon SNS
* topic.</p>
* </li>
* <li>
* <p>
* <code>ReplayStatus</code> – Retrieves the status of the subscription
* message replay, which can be one of the following:</p>
* <ul>
* <li>
* <p>
* <code>Completed</code> – The replay has successfully
* redelivered all messages, and is now delivering newly published
* messages. If an ending point was specified in the
* <code>ReplayPolicy</code> then the subscription will no longer
* receive newly published messages.</p>
* </li>
* <li>
* <p>
* <code>In progress</code> – The replay is currently replaying
* the selected messages.</p>
* </li>
* <li>
* <p>
* <code>Failed</code> – The replay was unable to complete.</p>
* </li>
* <li>
* <p>
* <code>Pending</code> – The default state while the replay
* initiates.</p>
* </li>
* </ul>
* </li>
* </ul>
*/
Attributes?: Record<string, string>;

Expand Down
68 changes: 68 additions & 0 deletions clients/client-sns/src/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ import {
InvalidParameterException,
InvalidParameterValueException,
InvalidSecurityException,
InvalidStateException,
KMSAccessDeniedException,
KMSDisabledException,
KMSInvalidStateException,
Expand Down Expand Up @@ -222,6 +223,7 @@ import {
PublishResponse,
PutDataProtectionPolicyInput,
RemovePermissionInput,
ReplayLimitExceededException,
ResourceNotFoundException,
SetEndpointAttributesInput,
SetPlatformApplicationAttributesInput,
Expand Down Expand Up @@ -1124,6 +1126,9 @@ const de_ConfirmSubscriptionCommandError = async (
case "NotFound":
case "com.amazonaws.sns#NotFoundException":
throw await de_NotFoundExceptionRes(parsedOutput, context);
case "ReplayLimitExceeded":
case "com.amazonaws.sns#ReplayLimitExceededException":
throw await de_ReplayLimitExceededExceptionRes(parsedOutput, context);
case "SubscriptionLimitExceeded":
case "com.amazonaws.sns#SubscriptionLimitExceededException":
throw await de_SubscriptionLimitExceededExceptionRes(parsedOutput, context);
Expand Down Expand Up @@ -1576,6 +1581,9 @@ const de_DeleteTopicCommandError = async (
case "InvalidParameter":
case "com.amazonaws.sns#InvalidParameterException":
throw await de_InvalidParameterExceptionRes(parsedOutput, context);
case "InvalidState":
case "com.amazonaws.sns#InvalidStateException":
throw await de_InvalidStateExceptionRes(parsedOutput, context);
case "NotFound":
case "com.amazonaws.sns#NotFoundException":
throw await de_NotFoundExceptionRes(parsedOutput, context);
Expand Down Expand Up @@ -3035,6 +3043,9 @@ const de_SetSubscriptionAttributesCommandError = async (
case "NotFound":
case "com.amazonaws.sns#NotFoundException":
throw await de_NotFoundExceptionRes(parsedOutput, context);
case "ReplayLimitExceeded":
case "com.amazonaws.sns#ReplayLimitExceededException":
throw await de_ReplayLimitExceededExceptionRes(parsedOutput, context);
default:
const parsedBody = parsedOutput.body;
return throwDefaultError({
Expand Down Expand Up @@ -3151,6 +3162,9 @@ const de_SubscribeCommandError = async (
case "NotFound":
case "com.amazonaws.sns#NotFoundException":
throw await de_NotFoundExceptionRes(parsedOutput, context);
case "ReplayLimitExceeded":
case "com.amazonaws.sns#ReplayLimitExceededException":
throw await de_ReplayLimitExceededExceptionRes(parsedOutput, context);
case "SubscriptionLimitExceeded":
case "com.amazonaws.sns#SubscriptionLimitExceededException":
throw await de_SubscriptionLimitExceededExceptionRes(parsedOutput, context);
Expand Down Expand Up @@ -3600,6 +3614,22 @@ const de_InvalidSecurityExceptionRes = async (
return __decorateServiceException(exception, body);
};

/**
* deserializeAws_queryInvalidStateExceptionRes
*/
const de_InvalidStateExceptionRes = async (
parsedOutput: any,
context: __SerdeContext
): Promise<InvalidStateException> => {
const body = parsedOutput.body;
const deserialized: any = de_InvalidStateException(body.Error, context);
const exception = new InvalidStateException({
$metadata: deserializeMetadata(parsedOutput),
...deserialized,
});
return __decorateServiceException(exception, body);
};

/**
* deserializeAws_queryKMSAccessDeniedExceptionRes
*/
Expand Down Expand Up @@ -3735,6 +3765,22 @@ const de_PlatformApplicationDisabledExceptionRes = async (
return __decorateServiceException(exception, body);
};

/**
* deserializeAws_queryReplayLimitExceededExceptionRes
*/
const de_ReplayLimitExceededExceptionRes = async (
parsedOutput: any,
context: __SerdeContext
): Promise<ReplayLimitExceededException> => {
const body = parsedOutput.body;
const deserialized: any = de_ReplayLimitExceededException(body.Error, context);
const exception = new ReplayLimitExceededException({
$metadata: deserializeMetadata(parsedOutput),
...deserialized,
});
return __decorateServiceException(exception, body);
};

/**
* deserializeAws_queryResourceNotFoundExceptionRes
*/
Expand Down Expand Up @@ -5171,6 +5217,17 @@ const de_InvalidSecurityException = (output: any, context: __SerdeContext): Inva
return contents;
};

/**
* deserializeAws_queryInvalidStateException
*/
const de_InvalidStateException = (output: any, context: __SerdeContext): InvalidStateException => {
const contents: any = {};
if (output["message"] !== undefined) {
contents.message = __expectString(output["message"]);
}
return contents;
};

/**
* deserializeAws_queryKMSAccessDeniedException
*/
Expand Down Expand Up @@ -5624,6 +5681,17 @@ const de_PublishResponse = (output: any, context: __SerdeContext): PublishRespon
return contents;
};

/**
* deserializeAws_queryReplayLimitExceededException
*/
const de_ReplayLimitExceededException = (output: any, context: __SerdeContext): ReplayLimitExceededException => {
const contents: any = {};
if (output["message"] !== undefined) {
contents.message = __expectString(output["message"]);
}
return contents;
};

/**
* deserializeAws_queryResourceNotFoundException
*/
Expand Down
Loading

0 comments on commit 10014a8

Please sign in to comment.