Skip to content

Commit

Permalink
feat(client-guardduty): Add AccessDeniedException 403 Error message c…
Browse files Browse the repository at this point in the history
…ode to support 3 Tagging related APIs
  • Loading branch information
awstools committed May 8, 2023
1 parent 9351f60 commit cef7c65
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 12 deletions.
Expand Up @@ -60,6 +60,9 @@ export interface ListTagsForResourceCommandOutput extends ListTagsForResourceRes
* @see {@link ListTagsForResourceCommandOutput} for command's `response` shape.
* @see {@link GuardDutyClientResolvedConfig | config} for GuardDutyClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>An access denied exception object.</p>
*
* @throws {@link BadRequestException} (client fault)
* <p>A bad request exception object.</p>
*
Expand Down
Expand Up @@ -14,7 +14,8 @@ import {
} from "@aws-sdk/types";

import { GuardDutyClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GuardDutyClient";
import { StartMonitoringMembersRequest, StartMonitoringMembersResponse } from "../models/models_0";
import { StartMonitoringMembersRequest } from "../models/models_0";
import { StartMonitoringMembersResponse } from "../models/models_1";
import { de_StartMonitoringMembersCommand, se_StartMonitoringMembersCommand } from "../protocols/Aws_restJson1";

/**
Expand Down
3 changes: 3 additions & 0 deletions clients/client-guardduty/src/commands/TagResourceCommand.ts
Expand Up @@ -57,6 +57,9 @@ export interface TagResourceCommandOutput extends TagResourceResponse, __Metadat
* @see {@link TagResourceCommandOutput} for command's `response` shape.
* @see {@link GuardDutyClientResolvedConfig | config} for GuardDutyClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>An access denied exception object.</p>
*
* @throws {@link BadRequestException} (client fault)
* <p>A bad request exception object.</p>
*
Expand Down
3 changes: 3 additions & 0 deletions clients/client-guardduty/src/commands/UntagResourceCommand.ts
Expand Up @@ -57,6 +57,9 @@ export interface UntagResourceCommandOutput extends UntagResourceResponse, __Met
* @see {@link UntagResourceCommandOutput} for command's `response` shape.
* @see {@link GuardDutyClientResolvedConfig | config} for GuardDutyClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>An access denied exception object.</p>
*
* @throws {@link BadRequestException} (client fault)
* <p>A bad request exception object.</p>
*
Expand Down
42 changes: 31 additions & 11 deletions clients/client-guardduty/src/models/models_0.ts
Expand Up @@ -137,6 +137,37 @@ export interface AccessControlList {
AllowsPublicWriteAccess?: boolean;
}

/**
* @public
* <p>An access denied exception object.</p>
*/
export class AccessDeniedException extends __BaseException {
readonly name: "AccessDeniedException" = "AccessDeniedException";
readonly $fault: "client" = "client";
/**
* <p>The error message.</p>
*/
Message?: string;

/**
* <p>The error type.</p>
*/
Type?: string;
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<AccessDeniedException, __BaseException>) {
super({
name: "AccessDeniedException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, AccessDeniedException.prototype);
this.Message = opts.Message;
this.Type = opts.Type;
}
}

/**
* @public
* <p>Contains information about the access keys.</p>
Expand Down Expand Up @@ -6582,14 +6613,3 @@ export interface StartMonitoringMembersRequest {
*/
AccountIds: string[] | undefined;
}

/**
* @public
*/
export interface StartMonitoringMembersResponse {
/**
* <p>A list of objects that contain the unprocessed account and a result string that explains
* why it was unprocessed.</p>
*/
UnprocessedAccounts: UnprocessedAccount[] | undefined;
}
11 changes: 11 additions & 0 deletions clients/client-guardduty/src/models/models_1.ts
Expand Up @@ -17,6 +17,17 @@ import {
UnprocessedAccount,
} from "./models_0";

/**
* @public
*/
export interface StartMonitoringMembersResponse {
/**
* <p>A list of objects that contain the unprocessed account and a result string that explains
* why it was unprocessed.</p>
*/
UnprocessedAccounts: UnprocessedAccount[] | undefined;
}

/**
* @public
*/
Expand Down
31 changes: 31 additions & 0 deletions clients/client-guardduty/src/protocols/Aws_restJson1.ts
Expand Up @@ -192,6 +192,7 @@ import {
import { GuardDutyServiceException as __BaseException } from "../models/GuardDutyServiceException";
import {
AccessControlList,
AccessDeniedException,
AccessKeyDetails,
AccountDetail,
AccountFreeTrialInfo,
Expand Down Expand Up @@ -5026,6 +5027,9 @@ const de_ListTagsForResourceCommandError = async (
};
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
switch (errorCode) {
case "AccessDeniedException":
case "com.amazonaws.guardduty#AccessDeniedException":
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
case "BadRequestException":
case "com.amazonaws.guardduty#BadRequestException":
throw await de_BadRequestExceptionRes(parsedOutput, context);
Expand Down Expand Up @@ -5276,6 +5280,9 @@ const de_TagResourceCommandError = async (
};
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
switch (errorCode) {
case "AccessDeniedException":
case "com.amazonaws.guardduty#AccessDeniedException":
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
case "BadRequestException":
case "com.amazonaws.guardduty#BadRequestException":
throw await de_BadRequestExceptionRes(parsedOutput, context);
Expand Down Expand Up @@ -5368,6 +5375,9 @@ const de_UntagResourceCommandError = async (
};
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
switch (errorCode) {
case "AccessDeniedException":
case "com.amazonaws.guardduty#AccessDeniedException":
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
case "BadRequestException":
case "com.amazonaws.guardduty#BadRequestException":
throw await de_BadRequestExceptionRes(parsedOutput, context);
Expand Down Expand Up @@ -5807,6 +5817,27 @@ const de_UpdateThreatIntelSetCommandError = async (
};

const throwDefaultError = withBaseException(__BaseException);
/**
* deserializeAws_restJson1AccessDeniedExceptionRes
*/
const de_AccessDeniedExceptionRes = async (
parsedOutput: any,
context: __SerdeContext
): Promise<AccessDeniedException> => {
const contents: any = map({});
const data: any = parsedOutput.body;
const doc = take(data, {
Message: [, __expectString, `message`],
Type: [, __expectString, `__type`],
});
Object.assign(contents, doc);
const exception = new AccessDeniedException({
$metadata: deserializeMetadata(parsedOutput),
...contents,
});
return __decorateServiceException(exception, parsedOutput.body);
};

/**
* deserializeAws_restJson1BadRequestExceptionRes
*/
Expand Down
33 changes: 33 additions & 0 deletions codegen/sdk-codegen/aws-models/guardduty.json
Expand Up @@ -192,6 +192,30 @@
"smithy.api#documentation": "<p>Contains information on the current access control policies for the bucket.</p>"
}
},
"com.amazonaws.guardduty#AccessDeniedException": {
"type": "structure",
"members": {
"Message": {
"target": "com.amazonaws.guardduty#String",
"traits": {
"smithy.api#documentation": "<p>The error message.</p>",
"smithy.api#jsonName": "message"
}
},
"Type": {
"target": "com.amazonaws.guardduty#String",
"traits": {
"smithy.api#documentation": "<p>The error type.</p>",
"smithy.api#jsonName": "__type"
}
}
},
"traits": {
"smithy.api#documentation": "<p>An access denied exception object.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 403
}
},
"com.amazonaws.guardduty#AccessKeyDetails": {
"type": "structure",
"members": {
Expand Down Expand Up @@ -8896,6 +8920,9 @@
"target": "com.amazonaws.guardduty#ListTagsForResourceResponse"
},
"errors": [
{
"target": "com.amazonaws.guardduty#AccessDeniedException"
},
{
"target": "com.amazonaws.guardduty#BadRequestException"
},
Expand Down Expand Up @@ -12047,6 +12074,9 @@
"target": "com.amazonaws.guardduty#TagResourceResponse"
},
"errors": [
{
"target": "com.amazonaws.guardduty#AccessDeniedException"
},
{
"target": "com.amazonaws.guardduty#BadRequestException"
},
Expand Down Expand Up @@ -12474,6 +12504,9 @@
"target": "com.amazonaws.guardduty#UntagResourceResponse"
},
"errors": [
{
"target": "com.amazonaws.guardduty#AccessDeniedException"
},
{
"target": "com.amazonaws.guardduty#BadRequestException"
},
Expand Down

0 comments on commit cef7c65

Please sign in to comment.