Skip to content

Commit

Permalink
feat(client-compute-optimizer): This release enables AWS Compute Opti…
Browse files Browse the repository at this point in the history
…mizer to analyze and generate licensing optimization recommendations for sql server running on EC2 instances.
  • Loading branch information
awstools committed Aug 28, 2023
1 parent d76f6fc commit 3a26fc7
Show file tree
Hide file tree
Showing 16 changed files with 2,372 additions and 220 deletions.
16 changes: 16 additions & 0 deletions clients/client-compute-optimizer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ ExportLambdaFunctionRecommendations

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/classes/exportlambdafunctionrecommendationscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/interfaces/exportlambdafunctionrecommendationscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/interfaces/exportlambdafunctionrecommendationscommandoutput.html)

</details>
<details>
<summary>
ExportLicenseRecommendations
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/classes/exportlicenserecommendationscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/interfaces/exportlicenserecommendationscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/interfaces/exportlicenserecommendationscommandoutput.html)

</details>
<details>
<summary>
Expand Down Expand Up @@ -349,6 +357,14 @@ GetLambdaFunctionRecommendations

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/classes/getlambdafunctionrecommendationscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/interfaces/getlambdafunctionrecommendationscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/interfaces/getlambdafunctionrecommendationscommandoutput.html)

</details>
<details>
<summary>
GetLicenseRecommendations
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/classes/getlicenserecommendationscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/interfaces/getlicenserecommendationscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-compute-optimizer/interfaces/getlicenserecommendationscommandoutput.html)

</details>
<details>
<summary>
Expand Down
46 changes: 46 additions & 0 deletions clients/client-compute-optimizer/src/ComputeOptimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ import {
ExportLambdaFunctionRecommendationsCommandInput,
ExportLambdaFunctionRecommendationsCommandOutput,
} from "./commands/ExportLambdaFunctionRecommendationsCommand";
import {
ExportLicenseRecommendationsCommand,
ExportLicenseRecommendationsCommandInput,
ExportLicenseRecommendationsCommandOutput,
} from "./commands/ExportLicenseRecommendationsCommand";
import {
GetAutoScalingGroupRecommendationsCommand,
GetAutoScalingGroupRecommendationsCommandInput,
Expand Down Expand Up @@ -87,6 +92,11 @@ import {
GetLambdaFunctionRecommendationsCommandInput,
GetLambdaFunctionRecommendationsCommandOutput,
} from "./commands/GetLambdaFunctionRecommendationsCommand";
import {
GetLicenseRecommendationsCommand,
GetLicenseRecommendationsCommandInput,
GetLicenseRecommendationsCommandOutput,
} from "./commands/GetLicenseRecommendationsCommand";
import {
GetRecommendationPreferencesCommand,
GetRecommendationPreferencesCommandInput,
Expand Down Expand Up @@ -117,6 +127,7 @@ const commands = {
ExportEC2InstanceRecommendationsCommand,
ExportECSServiceRecommendationsCommand,
ExportLambdaFunctionRecommendationsCommand,
ExportLicenseRecommendationsCommand,
GetAutoScalingGroupRecommendationsCommand,
GetEBSVolumeRecommendationsCommand,
GetEC2InstanceRecommendationsCommand,
Expand All @@ -127,6 +138,7 @@ const commands = {
GetEnrollmentStatusCommand,
GetEnrollmentStatusesForOrganizationCommand,
GetLambdaFunctionRecommendationsCommand,
GetLicenseRecommendationsCommand,
GetRecommendationPreferencesCommand,
GetRecommendationSummariesCommand,
PutRecommendationPreferencesCommand,
Expand Down Expand Up @@ -253,6 +265,23 @@ export interface ComputeOptimizer {
cb: (err: any, data?: ExportLambdaFunctionRecommendationsCommandOutput) => void
): void;

/**
* @see {@link ExportLicenseRecommendationsCommand}
*/
exportLicenseRecommendations(
args: ExportLicenseRecommendationsCommandInput,
options?: __HttpHandlerOptions
): Promise<ExportLicenseRecommendationsCommandOutput>;
exportLicenseRecommendations(
args: ExportLicenseRecommendationsCommandInput,
cb: (err: any, data?: ExportLicenseRecommendationsCommandOutput) => void
): void;
exportLicenseRecommendations(
args: ExportLicenseRecommendationsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ExportLicenseRecommendationsCommandOutput) => void
): void;

/**
* @see {@link GetAutoScalingGroupRecommendationsCommand}
*/
Expand Down Expand Up @@ -423,6 +452,23 @@ export interface ComputeOptimizer {
cb: (err: any, data?: GetLambdaFunctionRecommendationsCommandOutput) => void
): void;

/**
* @see {@link GetLicenseRecommendationsCommand}
*/
getLicenseRecommendations(
args: GetLicenseRecommendationsCommandInput,
options?: __HttpHandlerOptions
): Promise<GetLicenseRecommendationsCommandOutput>;
getLicenseRecommendations(
args: GetLicenseRecommendationsCommandInput,
cb: (err: any, data?: GetLicenseRecommendationsCommandOutput) => void
): void;
getLicenseRecommendations(
args: GetLicenseRecommendationsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetLicenseRecommendationsCommandOutput) => void
): void;

/**
* @see {@link GetRecommendationPreferencesCommand}
*/
Expand Down
12 changes: 12 additions & 0 deletions clients/client-compute-optimizer/src/ComputeOptimizerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ import {
ExportLambdaFunctionRecommendationsCommandInput,
ExportLambdaFunctionRecommendationsCommandOutput,
} from "./commands/ExportLambdaFunctionRecommendationsCommand";
import {
ExportLicenseRecommendationsCommandInput,
ExportLicenseRecommendationsCommandOutput,
} from "./commands/ExportLicenseRecommendationsCommand";
import {
GetAutoScalingGroupRecommendationsCommandInput,
GetAutoScalingGroupRecommendationsCommandOutput,
Expand Down Expand Up @@ -118,6 +122,10 @@ import {
GetLambdaFunctionRecommendationsCommandInput,
GetLambdaFunctionRecommendationsCommandOutput,
} from "./commands/GetLambdaFunctionRecommendationsCommand";
import {
GetLicenseRecommendationsCommandInput,
GetLicenseRecommendationsCommandOutput,
} from "./commands/GetLicenseRecommendationsCommand";
import {
GetRecommendationPreferencesCommandInput,
GetRecommendationPreferencesCommandOutput,
Expand Down Expand Up @@ -156,6 +164,7 @@ export type ServiceInputTypes =
| ExportEC2InstanceRecommendationsCommandInput
| ExportECSServiceRecommendationsCommandInput
| ExportLambdaFunctionRecommendationsCommandInput
| ExportLicenseRecommendationsCommandInput
| GetAutoScalingGroupRecommendationsCommandInput
| GetEBSVolumeRecommendationsCommandInput
| GetEC2InstanceRecommendationsCommandInput
Expand All @@ -166,6 +175,7 @@ export type ServiceInputTypes =
| GetEnrollmentStatusCommandInput
| GetEnrollmentStatusesForOrganizationCommandInput
| GetLambdaFunctionRecommendationsCommandInput
| GetLicenseRecommendationsCommandInput
| GetRecommendationPreferencesCommandInput
| GetRecommendationSummariesCommandInput
| PutRecommendationPreferencesCommandInput
Expand All @@ -182,6 +192,7 @@ export type ServiceOutputTypes =
| ExportEC2InstanceRecommendationsCommandOutput
| ExportECSServiceRecommendationsCommandOutput
| ExportLambdaFunctionRecommendationsCommandOutput
| ExportLicenseRecommendationsCommandOutput
| GetAutoScalingGroupRecommendationsCommandOutput
| GetEBSVolumeRecommendationsCommandOutput
| GetEC2InstanceRecommendationsCommandOutput
Expand All @@ -192,6 +203,7 @@ export type ServiceOutputTypes =
| GetEnrollmentStatusCommandOutput
| GetEnrollmentStatusesForOrganizationCommandOutput
| GetLambdaFunctionRecommendationsCommandOutput
| GetLicenseRecommendationsCommandOutput
| GetRecommendationPreferencesCommandOutput
| GetRecommendationSummariesCommandOutput
| PutRecommendationPreferencesCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface DeleteRecommendationPreferencesCommandOutput
* // const { ComputeOptimizerClient, DeleteRecommendationPreferencesCommand } = require("@aws-sdk/client-compute-optimizer"); // CommonJS import
* const client = new ComputeOptimizerClient(config);
* const input = { // DeleteRecommendationPreferencesRequest
* resourceType: "Ec2Instance" || "AutoScalingGroup" || "EbsVolume" || "LambdaFunction" || "NotApplicable" || "EcsService", // required
* resourceType: "Ec2Instance" || "AutoScalingGroup" || "EbsVolume" || "LambdaFunction" || "NotApplicable" || "EcsService" || "License", // required
* scope: { // Scope
* name: "Organization" || "AccountId" || "ResourceArn",
* value: "STRING_VALUE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export interface DescribeRecommendationExportJobsCommandOutput
* // metadataKey: "STRING_VALUE",
* // },
* // },
* // resourceType: "Ec2Instance" || "AutoScalingGroup" || "EbsVolume" || "LambdaFunction" || "NotApplicable" || "EcsService",
* // resourceType: "Ec2Instance" || "AutoScalingGroup" || "EbsVolume" || "LambdaFunction" || "NotApplicable" || "EcsService" || "License",
* // status: "Queued" || "InProgress" || "Complete" || "Failed",
* // creationTimestamp: new Date("TIMESTAMP"),
* // lastUpdatedTimestamp: new Date("TIMESTAMP"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { Command as $Command } from "@smithy/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@smithy/types";

import { ComputeOptimizerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ComputeOptimizerClient";
import { ExportLicenseRecommendationsRequest, ExportLicenseRecommendationsResponse } from "../models/models_0";
import {
de_ExportLicenseRecommendationsCommand,
se_ExportLicenseRecommendationsCommand,
} from "../protocols/Aws_json1_0";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link ExportLicenseRecommendationsCommand}.
*/
export interface ExportLicenseRecommendationsCommandInput extends ExportLicenseRecommendationsRequest {}
/**
* @public
*
* The output of {@link ExportLicenseRecommendationsCommand}.
*/
export interface ExportLicenseRecommendationsCommandOutput
extends ExportLicenseRecommendationsResponse,
__MetadataBearer {}

/**
* @public
* <p>
* Export optimization recommendations for your licenses.
* </p>
* <p>Recommendations are exported in a comma-separated values (CSV) file, and its metadata
* in a JavaScript Object Notation (JSON) file, to an existing Amazon Simple Storage Service (Amazon S3) bucket that you specify. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/exporting-recommendations.html">Exporting
* Recommendations</a> in the <i>Compute Optimizer User
* Guide</i>.</p>
* <p>You can have only one license export job in progress per Amazon Web Services Region.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ComputeOptimizerClient, ExportLicenseRecommendationsCommand } from "@aws-sdk/client-compute-optimizer"; // ES Modules import
* // const { ComputeOptimizerClient, ExportLicenseRecommendationsCommand } = require("@aws-sdk/client-compute-optimizer"); // CommonJS import
* const client = new ComputeOptimizerClient(config);
* const input = { // ExportLicenseRecommendationsRequest
* accountIds: [ // AccountIds
* "STRING_VALUE",
* ],
* filters: [ // LicenseRecommendationFilters
* { // LicenseRecommendationFilter
* name: "Finding" || "FindingReasonCode" || "LicenseName",
* values: [ // FilterValues
* "STRING_VALUE",
* ],
* },
* ],
* fieldsToExport: [ // ExportableLicenseFields
* "AccountId" || "ResourceArn" || "LookbackPeriodInDays" || "LastRefreshTimestamp" || "Finding" || "FindingReasonCodes" || "CurrentLicenseConfigurationNumberOfCores" || "CurrentLicenseConfigurationInstanceType" || "CurrentLicenseConfigurationOperatingSystem" || "CurrentLicenseConfigurationLicenseName" || "CurrentLicenseConfigurationLicenseEdition" || "CurrentLicenseConfigurationLicenseModel" || "CurrentLicenseConfigurationLicenseVersion" || "CurrentLicenseConfigurationMetricsSource" || "RecommendationOptionsOperatingSystem" || "RecommendationOptionsLicenseEdition" || "RecommendationOptionsLicenseModel" || "RecommendationOptionsSavingsOpportunityPercentage" || "RecommendationOptionsEstimatedMonthlySavingsCurrency" || "RecommendationOptionsEstimatedMonthlySavingsValue" || "Tags",
* ],
* s3DestinationConfig: { // S3DestinationConfig
* bucket: "STRING_VALUE",
* keyPrefix: "STRING_VALUE",
* },
* fileFormat: "Csv",
* includeMemberAccounts: true || false,
* };
* const command = new ExportLicenseRecommendationsCommand(input);
* const response = await client.send(command);
* // { // ExportLicenseRecommendationsResponse
* // jobId: "STRING_VALUE",
* // s3Destination: { // S3Destination
* // bucket: "STRING_VALUE",
* // key: "STRING_VALUE",
* // metadataKey: "STRING_VALUE",
* // },
* // };
*
* ```
*
* @param ExportLicenseRecommendationsCommandInput - {@link ExportLicenseRecommendationsCommandInput}
* @returns {@link ExportLicenseRecommendationsCommandOutput}
* @see {@link ExportLicenseRecommendationsCommandInput} for command's `input` shape.
* @see {@link ExportLicenseRecommendationsCommandOutput} for command's `response` shape.
* @see {@link ComputeOptimizerClientResolvedConfig | config} for ComputeOptimizerClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>You do not have sufficient access to perform this action.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal error has occurred. Try your call again.</p>
*
* @throws {@link InvalidParameterValueException} (client fault)
* <p>The value supplied for the input parameter is out of range or not valid.</p>
*
* @throws {@link LimitExceededException} (client fault)
* <p>The request exceeds a limit of the service.</p>
*
* @throws {@link MissingAuthenticationToken} (client fault)
* <p>The request must contain either a valid (registered) Amazon Web Services access key ID
* or X.509 certificate.</p>
*
* @throws {@link OptInRequiredException} (client fault)
* <p>The account is not opted in to Compute Optimizer.</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>The request has failed due to a temporary failure of the server.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The request was denied due to request throttling.</p>
*
* @throws {@link ComputeOptimizerServiceException}
* <p>Base exception class for all service exceptions from ComputeOptimizer service.</p>
*
*/
export class ExportLicenseRecommendationsCommand extends $Command<
ExportLicenseRecommendationsCommandInput,
ExportLicenseRecommendationsCommandOutput,
ComputeOptimizerClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

/**
* @public
*/
constructor(readonly input: ExportLicenseRecommendationsCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: ComputeOptimizerClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<ExportLicenseRecommendationsCommandInput, ExportLicenseRecommendationsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, ExportLicenseRecommendationsCommand.getEndpointParameterInstructions())
);

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "ComputeOptimizerClient";
const commandName = "ExportLicenseRecommendationsCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

/**
* @internal
*/
private serialize(input: ExportLicenseRecommendationsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_ExportLicenseRecommendationsCommand(input, context);
}

/**
* @internal
*/
private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<ExportLicenseRecommendationsCommandOutput> {
return de_ExportLicenseRecommendationsCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
Loading

0 comments on commit 3a26fc7

Please sign in to comment.