Skip to content

Commit

Permalink
feat(client-cost-explorer): This release introduces the new API 'GetS…
Browse files Browse the repository at this point in the history
…avingsPlanPurchaseRecommendationDetails', which retrieves the details for a Savings Plan recommendation. It also updates the existing API 'GetSavingsPlansPurchaseRecommendation' to include the recommendation detail ID.
  • Loading branch information
awstools committed Jul 24, 2023
1 parent a6743ba commit 42c7966
Show file tree
Hide file tree
Showing 14 changed files with 1,775 additions and 786 deletions.
8 changes: 8 additions & 0 deletions clients/client-cost-explorer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,14 @@ GetRightsizingRecommendation

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-explorer/classes/getrightsizingrecommendationcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-explorer/interfaces/getrightsizingrecommendationcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-explorer/interfaces/getrightsizingrecommendationcommandoutput.html)

</details>
<details>
<summary>
GetSavingsPlanPurchaseRecommendationDetails
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-explorer/classes/getsavingsplanpurchaserecommendationdetailscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-explorer/interfaces/getsavingsplanpurchaserecommendationdetailscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cost-explorer/interfaces/getsavingsplanpurchaserecommendationdetailscommandoutput.html)

</details>
<details>
<summary>
Expand Down
23 changes: 23 additions & 0 deletions clients/client-cost-explorer/src/CostExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ import {
GetRightsizingRecommendationCommandInput,
GetRightsizingRecommendationCommandOutput,
} from "./commands/GetRightsizingRecommendationCommand";
import {
GetSavingsPlanPurchaseRecommendationDetailsCommand,
GetSavingsPlanPurchaseRecommendationDetailsCommandInput,
GetSavingsPlanPurchaseRecommendationDetailsCommandOutput,
} from "./commands/GetSavingsPlanPurchaseRecommendationDetailsCommand";
import {
GetSavingsPlansCoverageCommand,
GetSavingsPlansCoverageCommandInput,
Expand Down Expand Up @@ -201,6 +206,7 @@ const commands = {
GetReservationPurchaseRecommendationCommand,
GetReservationUtilizationCommand,
GetRightsizingRecommendationCommand,
GetSavingsPlanPurchaseRecommendationDetailsCommand,
GetSavingsPlansCoverageCommand,
GetSavingsPlansPurchaseRecommendationCommand,
GetSavingsPlansUtilizationCommand,
Expand Down Expand Up @@ -533,6 +539,23 @@ export interface CostExplorer {
cb: (err: any, data?: GetRightsizingRecommendationCommandOutput) => void
): void;

/**
* @see {@link GetSavingsPlanPurchaseRecommendationDetailsCommand}
*/
getSavingsPlanPurchaseRecommendationDetails(
args: GetSavingsPlanPurchaseRecommendationDetailsCommandInput,
options?: __HttpHandlerOptions
): Promise<GetSavingsPlanPurchaseRecommendationDetailsCommandOutput>;
getSavingsPlanPurchaseRecommendationDetails(
args: GetSavingsPlanPurchaseRecommendationDetailsCommandInput,
cb: (err: any, data?: GetSavingsPlanPurchaseRecommendationDetailsCommandOutput) => void
): void;
getSavingsPlanPurchaseRecommendationDetails(
args: GetSavingsPlanPurchaseRecommendationDetailsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetSavingsPlanPurchaseRecommendationDetailsCommandOutput) => void
): void;

/**
* @see {@link GetSavingsPlansCoverageCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-cost-explorer/src/CostExplorerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ import {
GetRightsizingRecommendationCommandInput,
GetRightsizingRecommendationCommandOutput,
} from "./commands/GetRightsizingRecommendationCommand";
import {
GetSavingsPlanPurchaseRecommendationDetailsCommandInput,
GetSavingsPlanPurchaseRecommendationDetailsCommandOutput,
} from "./commands/GetSavingsPlanPurchaseRecommendationDetailsCommand";
import {
GetSavingsPlansCoverageCommandInput,
GetSavingsPlansCoverageCommandOutput,
Expand Down Expand Up @@ -200,6 +204,7 @@ export type ServiceInputTypes =
| GetReservationPurchaseRecommendationCommandInput
| GetReservationUtilizationCommandInput
| GetRightsizingRecommendationCommandInput
| GetSavingsPlanPurchaseRecommendationDetailsCommandInput
| GetSavingsPlansCoverageCommandInput
| GetSavingsPlansPurchaseRecommendationCommandInput
| GetSavingsPlansUtilizationCommandInput
Expand Down Expand Up @@ -242,6 +247,7 @@ export type ServiceOutputTypes =
| GetReservationPurchaseRecommendationCommandOutput
| GetReservationUtilizationCommandOutput
| GetRightsizingRecommendationCommandOutput
| GetSavingsPlanPurchaseRecommendationDetailsCommandOutput
| GetSavingsPlansCoverageCommandOutput
| GetSavingsPlansPurchaseRecommendationCommandOutput
| GetSavingsPlansUtilizationCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
// 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 { CostExplorerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CostExplorerClient";
import {
GetSavingsPlanPurchaseRecommendationDetailsRequest,
GetSavingsPlanPurchaseRecommendationDetailsResponse,
} from "../models/models_0";
import {
de_GetSavingsPlanPurchaseRecommendationDetailsCommand,
se_GetSavingsPlanPurchaseRecommendationDetailsCommand,
} from "../protocols/Aws_json1_1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link GetSavingsPlanPurchaseRecommendationDetailsCommand}.
*/
export interface GetSavingsPlanPurchaseRecommendationDetailsCommandInput
extends GetSavingsPlanPurchaseRecommendationDetailsRequest {}
/**
* @public
*
* The output of {@link GetSavingsPlanPurchaseRecommendationDetailsCommand}.
*/
export interface GetSavingsPlanPurchaseRecommendationDetailsCommandOutput
extends GetSavingsPlanPurchaseRecommendationDetailsResponse,
__MetadataBearer {}

/**
* @public
* <p>Retrieves the details for a Savings Plan recommendation. These details include the hourly
* data-points that construct the new cost, coverage, and utilization charts.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { CostExplorerClient, GetSavingsPlanPurchaseRecommendationDetailsCommand } from "@aws-sdk/client-cost-explorer"; // ES Modules import
* // const { CostExplorerClient, GetSavingsPlanPurchaseRecommendationDetailsCommand } = require("@aws-sdk/client-cost-explorer"); // CommonJS import
* const client = new CostExplorerClient(config);
* const input = { // GetSavingsPlanPurchaseRecommendationDetailsRequest
* RecommendationDetailId: "STRING_VALUE", // required
* };
* const command = new GetSavingsPlanPurchaseRecommendationDetailsCommand(input);
* const response = await client.send(command);
* // { // GetSavingsPlanPurchaseRecommendationDetailsResponse
* // RecommendationDetailId: "STRING_VALUE",
* // RecommendationDetailData: { // RecommendationDetailData
* // AccountScope: "PAYER" || "LINKED",
* // LookbackPeriodInDays: "SEVEN_DAYS" || "THIRTY_DAYS" || "SIXTY_DAYS",
* // SavingsPlansType: "COMPUTE_SP" || "EC2_INSTANCE_SP" || "SAGEMAKER_SP",
* // TermInYears: "ONE_YEAR" || "THREE_YEARS",
* // PaymentOption: "NO_UPFRONT" || "PARTIAL_UPFRONT" || "ALL_UPFRONT" || "LIGHT_UTILIZATION" || "MEDIUM_UTILIZATION" || "HEAVY_UTILIZATION",
* // AccountId: "STRING_VALUE",
* // CurrencyCode: "STRING_VALUE",
* // InstanceFamily: "STRING_VALUE",
* // Region: "STRING_VALUE",
* // OfferingId: "STRING_VALUE",
* // GenerationTimestamp: "STRING_VALUE",
* // LatestUsageTimestamp: "STRING_VALUE",
* // CurrentAverageHourlyOnDemandSpend: "STRING_VALUE",
* // CurrentMaximumHourlyOnDemandSpend: "STRING_VALUE",
* // CurrentMinimumHourlyOnDemandSpend: "STRING_VALUE",
* // EstimatedAverageUtilization: "STRING_VALUE",
* // EstimatedMonthlySavingsAmount: "STRING_VALUE",
* // EstimatedOnDemandCost: "STRING_VALUE",
* // EstimatedOnDemandCostWithCurrentCommitment: "STRING_VALUE",
* // EstimatedROI: "STRING_VALUE",
* // EstimatedSPCost: "STRING_VALUE",
* // EstimatedSavingsAmount: "STRING_VALUE",
* // EstimatedSavingsPercentage: "STRING_VALUE",
* // ExistingHourlyCommitment: "STRING_VALUE",
* // HourlyCommitmentToPurchase: "STRING_VALUE",
* // UpfrontCost: "STRING_VALUE",
* // CurrentAverageCoverage: "STRING_VALUE",
* // EstimatedAverageCoverage: "STRING_VALUE",
* // MetricsOverLookbackPeriod: [ // MetricsOverLookbackPeriod
* // { // RecommendationDetailHourlyMetrics
* // StartTime: "STRING_VALUE",
* // EstimatedOnDemandCost: "STRING_VALUE",
* // CurrentCoverage: "STRING_VALUE",
* // EstimatedCoverage: "STRING_VALUE",
* // EstimatedNewCommitmentUtilization: "STRING_VALUE",
* // },
* // ],
* // },
* // };
*
* ```
*
* @param GetSavingsPlanPurchaseRecommendationDetailsCommandInput - {@link GetSavingsPlanPurchaseRecommendationDetailsCommandInput}
* @returns {@link GetSavingsPlanPurchaseRecommendationDetailsCommandOutput}
* @see {@link GetSavingsPlanPurchaseRecommendationDetailsCommandInput} for command's `input` shape.
* @see {@link GetSavingsPlanPurchaseRecommendationDetailsCommandOutput} for command's `response` shape.
* @see {@link CostExplorerClientResolvedConfig | config} for CostExplorerClient's `config` shape.
*
* @throws {@link DataUnavailableException} (client fault)
* <p>The requested data is unavailable.</p>
*
* @throws {@link LimitExceededException} (client fault)
* <p>You made too many calls in a short period of time. Try again later.</p>
*
* @throws {@link CostExplorerServiceException}
* <p>Base exception class for all service exceptions from CostExplorer service.</p>
*
*/
export class GetSavingsPlanPurchaseRecommendationDetailsCommand extends $Command<
GetSavingsPlanPurchaseRecommendationDetailsCommandInput,
GetSavingsPlanPurchaseRecommendationDetailsCommandOutput,
CostExplorerClientResolvedConfig
> {
// 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: GetSavingsPlanPurchaseRecommendationDetailsCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: CostExplorerClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<
GetSavingsPlanPurchaseRecommendationDetailsCommandInput,
GetSavingsPlanPurchaseRecommendationDetailsCommandOutput
> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(
configuration,
GetSavingsPlanPurchaseRecommendationDetailsCommand.getEndpointParameterInstructions()
)
);

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

const { logger } = configuration;
const clientName = "CostExplorerClient";
const commandName = "GetSavingsPlanPurchaseRecommendationDetailsCommand";
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: GetSavingsPlanPurchaseRecommendationDetailsCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> {
return se_GetSavingsPlanPurchaseRecommendationDetailsCommand(input, context);
}

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

// Start section: command_body_extra
// End section: command_body_extra
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export interface GetSavingsPlansPurchaseRecommendationCommandOutput
* // CurrentMinimumHourlyOnDemandSpend: "STRING_VALUE",
* // CurrentMaximumHourlyOnDemandSpend: "STRING_VALUE",
* // CurrentAverageHourlyOnDemandSpend: "STRING_VALUE",
* // RecommendationDetailId: "STRING_VALUE",
* // },
* // ],
* // SavingsPlansPurchaseRecommendationSummary: { // SavingsPlansPurchaseRecommendationSummary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ export interface ListSavingsPlansPurchaseRecommendationGenerationCommandOutput
* @see {@link ListSavingsPlansPurchaseRecommendationGenerationCommandOutput} for command's `response` shape.
* @see {@link CostExplorerClientResolvedConfig | config} for CostExplorerClient's `config` shape.
*
* @throws {@link DataUnavailableException} (client fault)
* <p>The requested data is unavailable.</p>
*
* @throws {@link InvalidNextTokenException} (client fault)
* <p>The pagination token is invalid. Try again without a pagination token.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export interface StartSavingsPlansPurchaseRecommendationGenerationCommandOutput
* @see {@link StartSavingsPlansPurchaseRecommendationGenerationCommandOutput} for command's `response` shape.
* @see {@link CostExplorerClientResolvedConfig | config} for CostExplorerClient's `config` shape.
*
* @throws {@link DataUnavailableException} (client fault)
* <p>The requested data is unavailable.</p>
*
* @throws {@link GenerationExistsException} (client fault)
* <p>A request to generate a recommendation is already in progress.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ export interface UpdateAnomalySubscriptionCommandOutput extends UpdateAnomalySub

/**
* @public
* <p>Updates an existing cost anomaly monitor subscription. </p>
* <p>Updates an existing cost anomaly subscription. Specify the fields that you want to update.
* Omitted fields are unchanged.</p>
* <note>
* <p>The JSON below describes the generic construct for each type. See <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_UpdateAnomalySubscription.html#API_UpdateAnomalySubscription_RequestParameters">Request Parameters</a> for possible values as they apply to
* <code>AnomalySubscription</code>.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
1 change: 1 addition & 0 deletions clients/client-cost-explorer/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export * from "./GetReservationCoverageCommand";
export * from "./GetReservationPurchaseRecommendationCommand";
export * from "./GetReservationUtilizationCommand";
export * from "./GetRightsizingRecommendationCommand";
export * from "./GetSavingsPlanPurchaseRecommendationDetailsCommand";
export * from "./GetSavingsPlansCoverageCommand";
export * from "./GetSavingsPlansPurchaseRecommendationCommand";
export * from "./GetSavingsPlansUtilizationCommand";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const resolveClientEndpointParameters = <T>(
};

export interface EndpointParameters extends __EndpointParameters {
Region: string;
Region?: string;
UseDualStack?: boolean;
UseFIPS?: boolean;
Endpoint?: string;
Expand Down
Loading

0 comments on commit 42c7966

Please sign in to comment.