|
| 1 | +// smithy-typescript generated code |
| 2 | +import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint"; |
| 3 | +import { getSerdePlugin } from "@smithy/middleware-serde"; |
| 4 | +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http"; |
| 5 | +import { Command as $Command } from "@smithy/smithy-client"; |
| 6 | +import { |
| 7 | + FinalizeHandlerArguments, |
| 8 | + Handler, |
| 9 | + HandlerExecutionContext, |
| 10 | + HttpHandlerOptions as __HttpHandlerOptions, |
| 11 | + MetadataBearer as __MetadataBearer, |
| 12 | + MiddlewareStack, |
| 13 | + SerdeContext as __SerdeContext, |
| 14 | + SMITHY_CONTEXT_KEY, |
| 15 | +} from "@smithy/types"; |
| 16 | + |
| 17 | +import { GuardDutyClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GuardDutyClient"; |
| 18 | +import { GetOrganizationStatisticsResponse } from "../models/models_0"; |
| 19 | +import { de_GetOrganizationStatisticsCommand, se_GetOrganizationStatisticsCommand } from "../protocols/Aws_restJson1"; |
| 20 | + |
| 21 | +/** |
| 22 | + * @public |
| 23 | + */ |
| 24 | +export { __MetadataBearer, $Command }; |
| 25 | +/** |
| 26 | + * @public |
| 27 | + * |
| 28 | + * The input for {@link GetOrganizationStatisticsCommand}. |
| 29 | + */ |
| 30 | +export interface GetOrganizationStatisticsCommandInput {} |
| 31 | +/** |
| 32 | + * @public |
| 33 | + * |
| 34 | + * The output of {@link GetOrganizationStatisticsCommand}. |
| 35 | + */ |
| 36 | +export interface GetOrganizationStatisticsCommandOutput extends GetOrganizationStatisticsResponse, __MetadataBearer {} |
| 37 | + |
| 38 | +/** |
| 39 | + * @public |
| 40 | + * <p>Retrieves how many active member accounts |
| 41 | + * in your Amazon Web Services organization have |
| 42 | + * each feature enabled within GuardDuty. Only a delegated GuardDuty administrator of an organization can run this API.</p> |
| 43 | + * <p>When you create a new Amazon Web Services organization, it might take up to 24 |
| 44 | + * hours to generate the statistics for the entire organization.</p> |
| 45 | + * @example |
| 46 | + * Use a bare-bones client and the command you need to make an API call. |
| 47 | + * ```javascript |
| 48 | + * import { GuardDutyClient, GetOrganizationStatisticsCommand } from "@aws-sdk/client-guardduty"; // ES Modules import |
| 49 | + * // const { GuardDutyClient, GetOrganizationStatisticsCommand } = require("@aws-sdk/client-guardduty"); // CommonJS import |
| 50 | + * const client = new GuardDutyClient(config); |
| 51 | + * const input = {}; |
| 52 | + * const command = new GetOrganizationStatisticsCommand(input); |
| 53 | + * const response = await client.send(command); |
| 54 | + * // { // GetOrganizationStatisticsResponse |
| 55 | + * // OrganizationDetails: { // OrganizationDetails |
| 56 | + * // UpdatedAt: new Date("TIMESTAMP"), |
| 57 | + * // OrganizationStatistics: { // OrganizationStatistics |
| 58 | + * // TotalAccountsCount: Number("int"), |
| 59 | + * // MemberAccountsCount: Number("int"), |
| 60 | + * // ActiveAccountsCount: Number("int"), |
| 61 | + * // EnabledAccountsCount: Number("int"), |
| 62 | + * // CountByFeature: [ // OrganizationFeatureStatisticsResults |
| 63 | + * // { // OrganizationFeatureStatistics |
| 64 | + * // Name: "S3_DATA_EVENTS" || "EKS_AUDIT_LOGS" || "EBS_MALWARE_PROTECTION" || "RDS_LOGIN_EVENTS" || "EKS_RUNTIME_MONITORING" || "LAMBDA_NETWORK_LOGS" || "RUNTIME_MONITORING", |
| 65 | + * // EnabledAccountsCount: Number("int"), |
| 66 | + * // AdditionalConfiguration: [ // OrganizationFeatureStatisticsAdditionalConfigurations |
| 67 | + * // { // OrganizationFeatureStatisticsAdditionalConfiguration |
| 68 | + * // Name: "EKS_ADDON_MANAGEMENT" || "ECS_FARGATE_AGENT_MANAGEMENT", |
| 69 | + * // EnabledAccountsCount: Number("int"), |
| 70 | + * // }, |
| 71 | + * // ], |
| 72 | + * // }, |
| 73 | + * // ], |
| 74 | + * // }, |
| 75 | + * // }, |
| 76 | + * // }; |
| 77 | + * |
| 78 | + * ``` |
| 79 | + * |
| 80 | + * @param GetOrganizationStatisticsCommandInput - {@link GetOrganizationStatisticsCommandInput} |
| 81 | + * @returns {@link GetOrganizationStatisticsCommandOutput} |
| 82 | + * @see {@link GetOrganizationStatisticsCommandInput} for command's `input` shape. |
| 83 | + * @see {@link GetOrganizationStatisticsCommandOutput} for command's `response` shape. |
| 84 | + * @see {@link GuardDutyClientResolvedConfig | config} for GuardDutyClient's `config` shape. |
| 85 | + * |
| 86 | + * @throws {@link BadRequestException} (client fault) |
| 87 | + * <p>A bad request exception object.</p> |
| 88 | + * |
| 89 | + * @throws {@link InternalServerErrorException} (server fault) |
| 90 | + * <p>An internal server error exception object.</p> |
| 91 | + * |
| 92 | + * @throws {@link GuardDutyServiceException} |
| 93 | + * <p>Base exception class for all service exceptions from GuardDuty service.</p> |
| 94 | + * |
| 95 | + */ |
| 96 | +export class GetOrganizationStatisticsCommand extends $Command< |
| 97 | + GetOrganizationStatisticsCommandInput, |
| 98 | + GetOrganizationStatisticsCommandOutput, |
| 99 | + GuardDutyClientResolvedConfig |
| 100 | +> { |
| 101 | + public static getEndpointParameterInstructions(): EndpointParameterInstructions { |
| 102 | + return { |
| 103 | + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, |
| 104 | + Endpoint: { type: "builtInParams", name: "endpoint" }, |
| 105 | + Region: { type: "builtInParams", name: "region" }, |
| 106 | + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }, |
| 107 | + }; |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * @public |
| 112 | + */ |
| 113 | + constructor(readonly input: GetOrganizationStatisticsCommandInput) { |
| 114 | + super(); |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * @internal |
| 119 | + */ |
| 120 | + resolveMiddleware( |
| 121 | + clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, |
| 122 | + configuration: GuardDutyClientResolvedConfig, |
| 123 | + options?: __HttpHandlerOptions |
| 124 | + ): Handler<GetOrganizationStatisticsCommandInput, GetOrganizationStatisticsCommandOutput> { |
| 125 | + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); |
| 126 | + this.middlewareStack.use( |
| 127 | + getEndpointPlugin(configuration, GetOrganizationStatisticsCommand.getEndpointParameterInstructions()) |
| 128 | + ); |
| 129 | + |
| 130 | + const stack = clientStack.concat(this.middlewareStack); |
| 131 | + |
| 132 | + const { logger } = configuration; |
| 133 | + const clientName = "GuardDutyClient"; |
| 134 | + const commandName = "GetOrganizationStatisticsCommand"; |
| 135 | + const handlerExecutionContext: HandlerExecutionContext = { |
| 136 | + logger, |
| 137 | + clientName, |
| 138 | + commandName, |
| 139 | + inputFilterSensitiveLog: (_: any) => _, |
| 140 | + outputFilterSensitiveLog: (_: any) => _, |
| 141 | + [SMITHY_CONTEXT_KEY]: { |
| 142 | + service: "GuardDutyAPIService", |
| 143 | + operation: "GetOrganizationStatistics", |
| 144 | + }, |
| 145 | + }; |
| 146 | + const { requestHandler } = configuration; |
| 147 | + return stack.resolve( |
| 148 | + (request: FinalizeHandlerArguments<any>) => |
| 149 | + requestHandler.handle(request.request as __HttpRequest, options || {}), |
| 150 | + handlerExecutionContext |
| 151 | + ); |
| 152 | + } |
| 153 | + |
| 154 | + /** |
| 155 | + * @internal |
| 156 | + */ |
| 157 | + private serialize(input: GetOrganizationStatisticsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { |
| 158 | + return se_GetOrganizationStatisticsCommand(input, context); |
| 159 | + } |
| 160 | + |
| 161 | + /** |
| 162 | + * @internal |
| 163 | + */ |
| 164 | + private deserialize( |
| 165 | + output: __HttpResponse, |
| 166 | + context: __SerdeContext |
| 167 | + ): Promise<GetOrganizationStatisticsCommandOutput> { |
| 168 | + return de_GetOrganizationStatisticsCommand(output, context); |
| 169 | + } |
| 170 | +} |
0 commit comments