Skip to content

Commit

Permalink
feat(client-pricing): This release adds 2 new APIs - ListPriceLists w…
Browse files Browse the repository at this point in the history
…hich returns a list of applicable price lists, and GetPriceListFileUrl which outputs a URL to retrieve your price lists from the generated file from ListPriceLists
  • Loading branch information
awstools committed Mar 1, 2023
1 parent 6458cf1 commit f7201bf
Show file tree
Hide file tree
Showing 12 changed files with 1,620 additions and 262 deletions.
16 changes: 16 additions & 0 deletions clients/client-pricing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ GetAttributeValues

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/classes/getattributevaluescommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/interfaces/getattributevaluescommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/interfaces/getattributevaluescommandoutput.html)

</details>
<details>
<summary>
GetPriceListFileUrl
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/classes/getpricelistfileurlcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/interfaces/getpricelistfileurlcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/interfaces/getpricelistfileurlcommandoutput.html)

</details>
<details>
<summary>
Expand All @@ -253,3 +261,11 @@ GetProducts
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/classes/getproductscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/interfaces/getproductscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/interfaces/getproductscommandoutput.html)

</details>
<details>
<summary>
ListPriceLists
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/classes/listpricelistscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/interfaces/listpricelistscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-pricing/interfaces/listpricelistscommandoutput.html)

</details>
94 changes: 94 additions & 0 deletions clients/client-pricing/src/Pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ import {
GetAttributeValuesCommandInput,
GetAttributeValuesCommandOutput,
} from "./commands/GetAttributeValuesCommand";
import {
GetPriceListFileUrlCommand,
GetPriceListFileUrlCommandInput,
GetPriceListFileUrlCommandOutput,
} from "./commands/GetPriceListFileUrlCommand";
import { GetProductsCommand, GetProductsCommandInput, GetProductsCommandOutput } from "./commands/GetProductsCommand";
import {
ListPriceListsCommand,
ListPriceListsCommandInput,
ListPriceListsCommandOutput,
} from "./commands/ListPriceListsCommand";
import { PricingClient } from "./PricingClient";

/**
Expand Down Expand Up @@ -114,6 +124,46 @@ export class Pricing extends PricingClient {
}
}

/**
* <p>
* <i>
* <b>This feature is in preview release and is subject to change. Your use of Amazon Web Services Price List API is subject to the Beta Service Participation terms of the <a href="https://aws.amazon.com/service-terms/">Amazon Web Services Service Terms</a> (Section 1.10).</b>
* </i>
* </p>
* <p>This returns the URL that you can retrieve your Price List file from. This URL is based on
* the <code>PriceListArn</code> and <code>FileFormat</code> that you retrieve from the <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_pricing_ListPriceLists.html">
* <code>ListPriceLists</code>
* </a> response. </p>
*/
public getPriceListFileUrl(
args: GetPriceListFileUrlCommandInput,
options?: __HttpHandlerOptions
): Promise<GetPriceListFileUrlCommandOutput>;
public getPriceListFileUrl(
args: GetPriceListFileUrlCommandInput,
cb: (err: any, data?: GetPriceListFileUrlCommandOutput) => void
): void;
public getPriceListFileUrl(
args: GetPriceListFileUrlCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetPriceListFileUrlCommandOutput) => void
): void;
public getPriceListFileUrl(
args: GetPriceListFileUrlCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetPriceListFileUrlCommandOutput) => void),
cb?: (err: any, data?: GetPriceListFileUrlCommandOutput) => void
): Promise<GetPriceListFileUrlCommandOutput> | void {
const command = new GetPriceListFileUrlCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Returns a list of all products that match the filter criteria.</p>
*/
Expand All @@ -139,4 +189,48 @@ export class Pricing extends PricingClient {
return this.send(command, optionsOrCb);
}
}

/**
* <p>
* <i>
* <b>This feature is in preview release and is subject to change. Your use of Amazon Web Services Price List API is subject to the Beta Service Participation terms of the <a href="https://aws.amazon.com/service-terms/">Amazon Web Services Service Terms</a> (Section 1.10).</b>
* </i>
* </p>
* <p>This returns a list of Price List references that the requester if authorized to view, given a <code>ServiceCode</code>, <code>CurrencyCode</code>, and an <code>EffectiveDate</code>.
* Use without a <code>RegionCode</code> filter to list Price List references from all
* available Amazon Web Services Regions. Use with a <code>RegionCode</code> filter to get the
* Price List reference that's specific to a specific Amazon Web Services Region. You can use
* the <code>PriceListArn</code> from the response to get your preferred Price List files
* through the <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_pricing_GetPriceListFileUrl.html">
* <code>GetPriceListFileUrl</code>
* </a> API.</p>
*/
public listPriceLists(
args: ListPriceListsCommandInput,
options?: __HttpHandlerOptions
): Promise<ListPriceListsCommandOutput>;
public listPriceLists(
args: ListPriceListsCommandInput,
cb: (err: any, data?: ListPriceListsCommandOutput) => void
): void;
public listPriceLists(
args: ListPriceListsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListPriceListsCommandOutput) => void
): void;
public listPriceLists(
args: ListPriceListsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListPriceListsCommandOutput) => void),
cb?: (err: any, data?: ListPriceListsCommandOutput) => void
): Promise<ListPriceListsCommandOutput> | void {
const command = new ListPriceListsCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}
}
16 changes: 14 additions & 2 deletions clients/client-pricing/src/PricingClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ import {

import { DescribeServicesCommandInput, DescribeServicesCommandOutput } from "./commands/DescribeServicesCommand";
import { GetAttributeValuesCommandInput, GetAttributeValuesCommandOutput } from "./commands/GetAttributeValuesCommand";
import {
GetPriceListFileUrlCommandInput,
GetPriceListFileUrlCommandOutput,
} from "./commands/GetPriceListFileUrlCommand";
import { GetProductsCommandInput, GetProductsCommandOutput } from "./commands/GetProductsCommand";
import { ListPriceListsCommandInput, ListPriceListsCommandOutput } from "./commands/ListPriceListsCommand";
import {
ClientInputEndpointParameters,
ClientResolvedEndpointParameters,
Expand All @@ -60,12 +65,19 @@ import {
} from "./endpoint/EndpointParameters";
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";

export type ServiceInputTypes = DescribeServicesCommandInput | GetAttributeValuesCommandInput | GetProductsCommandInput;
export type ServiceInputTypes =
| DescribeServicesCommandInput
| GetAttributeValuesCommandInput
| GetPriceListFileUrlCommandInput
| GetProductsCommandInput
| ListPriceListsCommandInput;

export type ServiceOutputTypes =
| DescribeServicesCommandOutput
| GetAttributeValuesCommandOutput
| GetProductsCommandOutput;
| GetPriceListFileUrlCommandOutput
| GetProductsCommandOutput
| ListPriceListsCommandOutput;

export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
/**
Expand Down
128 changes: 128 additions & 0 deletions clients/client-pricing/src/commands/GetPriceListFileUrlCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import {
GetPriceListFileUrlRequest,
GetPriceListFileUrlRequestFilterSensitiveLog,
GetPriceListFileUrlResponse,
GetPriceListFileUrlResponseFilterSensitiveLog,
} from "../models/models_0";
import { PricingClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../PricingClient";
import {
deserializeAws_json1_1GetPriceListFileUrlCommand,
serializeAws_json1_1GetPriceListFileUrlCommand,
} from "../protocols/Aws_json1_1";

/**
* The input for {@link GetPriceListFileUrlCommand}.
*/
export interface GetPriceListFileUrlCommandInput extends GetPriceListFileUrlRequest {}
/**
* The output of {@link GetPriceListFileUrlCommand}.
*/
export interface GetPriceListFileUrlCommandOutput extends GetPriceListFileUrlResponse, __MetadataBearer {}

/**
* <p>
* <i>
* <b>This feature is in preview release and is subject to change. Your use of Amazon Web Services Price List API is subject to the Beta Service Participation terms of the <a href="https://aws.amazon.com/service-terms/">Amazon Web Services Service Terms</a> (Section 1.10).</b>
* </i>
* </p>
* <p>This returns the URL that you can retrieve your Price List file from. This URL is based on
* the <code>PriceListArn</code> and <code>FileFormat</code> that you retrieve from the <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_pricing_ListPriceLists.html">
* <code>ListPriceLists</code>
* </a> response. </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { PricingClient, GetPriceListFileUrlCommand } from "@aws-sdk/client-pricing"; // ES Modules import
* // const { PricingClient, GetPriceListFileUrlCommand } = require("@aws-sdk/client-pricing"); // CommonJS import
* const client = new PricingClient(config);
* const command = new GetPriceListFileUrlCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link GetPriceListFileUrlCommandInput} for command's `input` shape.
* @see {@link GetPriceListFileUrlCommandOutput} for command's `response` shape.
* @see {@link PricingClientResolvedConfig | config} for PricingClient's `config` shape.
*
*/
export class GetPriceListFileUrlCommand extends $Command<
GetPriceListFileUrlCommandInput,
GetPriceListFileUrlCommandOutput,
PricingClientResolvedConfig
> {
// 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" },
};
}

constructor(readonly input: GetPriceListFileUrlCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: PricingClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<GetPriceListFileUrlCommandInput, GetPriceListFileUrlCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, GetPriceListFileUrlCommand.getEndpointParameterInstructions())
);

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

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

private serialize(input: GetPriceListFileUrlCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_json1_1GetPriceListFileUrlCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetPriceListFileUrlCommandOutput> {
return deserializeAws_json1_1GetPriceListFileUrlCommand(output, context);
}

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

0 comments on commit f7201bf

Please sign in to comment.