| 1 | import type * as pricing from "@distilled.cloud/aws/pricing"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | export interface GetPriceListFileUrlRequest |
| 6 | extends pricing.GetPriceListFileUrlRequest {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `pricing:GetPriceListFileUrl` — resolve a presigned |
| 10 | * download URL for one bulk Price List file. |
| 11 | * |
| 12 | * Takes a `PriceListArn` and `FileFormat` (`csv` or `json`) obtained from |
| 13 | * `ListPriceLists` and returns the URL the full offer file can be fetched |
| 14 | * from. The binding takes no arguments and grants the function |
| 15 | * `pricing:GetPriceListFileUrl` (the action has no resource-level IAM). |
| 16 | * Calls are pinned to `us-east-1`, the region that serves the Price List |
| 17 | * API. Provide the implementation with |
| 18 | * `Effect.provide(AWS.Pricing.GetPriceListFileUrlHttp)`. |
| 19 | * |
| 20 | * ### Downloading Price List Files |
| 21 | * **Example:** Resolve a Price List Download URL |
| 22 | * ```typescript |
| 23 | * // init |
| 24 | * const listPriceLists = yield* AWS.Pricing.ListPriceLists(); |
| 25 | * const getPriceListFileUrl = yield* AWS.Pricing.GetPriceListFileUrl(); |
| 26 | * |
| 27 | * // runtime |
| 28 | * const lists = yield* listPriceLists({ |
| 29 | * ServiceCode: "AmazonEC2", |
| 30 | * CurrencyCode: "USD", |
| 31 | * EffectiveDate: new Date(), |
| 32 | * RegionCode: "us-east-1", |
| 33 | * }); |
| 34 | * const arn = lists.PriceLists?.[0]?.PriceListArn; |
| 35 | * if (arn !== undefined) { |
| 36 | * const { Url } = yield* getPriceListFileUrl({ |
| 37 | * PriceListArn: arn, |
| 38 | * FileFormat: "json", |
| 39 | * }); |
| 40 | * } |
| 41 | * ``` |
| 42 | * |
| 43 | * @binding |
| 44 | */ |
| 45 | export interface GetPriceListFileUrl extends Binding.Service< |
| 46 | GetPriceListFileUrl, |
| 47 | "AWS.Pricing.GetPriceListFileUrl", |
| 48 | () => Effect.Effect< |
| 49 | ( |
| 50 | request: GetPriceListFileUrlRequest, |
| 51 | ) => Effect.Effect< |
| 52 | pricing.GetPriceListFileUrlResponse, |
| 53 | pricing.GetPriceListFileUrlError |
| 54 | > |
| 55 | > |
| 56 | > {} |
| 57 | export const GetPriceListFileUrl = Binding.Service<GetPriceListFileUrl>( |
| 58 | "AWS.Pricing.GetPriceListFileUrl", |
| 59 | ); |