| 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 DescribeServicesRequest |
| 6 | extends pricing.DescribeServicesRequest {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `pricing:DescribeServices` — list the service codes |
| 10 | * known to the AWS Price List API, or the filterable attribute names of one |
| 11 | * service. |
| 12 | * |
| 13 | * Call it without a `ServiceCode` to enumerate every service code, or with |
| 14 | * one (e.g. `AmazonEC2`) to get the attribute names you can filter |
| 15 | * `GetProducts` by (`instanceType`, `location`, `operatingSystem`, ...). |
| 16 | * The binding takes no arguments and grants the function |
| 17 | * `pricing:DescribeServices` (the action has no resource-level IAM). Calls |
| 18 | * are pinned to `us-east-1`, the region that serves the Price List API. |
| 19 | * Provide the implementation with |
| 20 | * `Effect.provide(AWS.Pricing.DescribeServicesHttp)`. |
| 21 | * |
| 22 | * ### Discovering Services |
| 23 | * **Example:** List Filterable Attributes for EC2 |
| 24 | * ```typescript |
| 25 | * // init |
| 26 | * const describeServices = yield* AWS.Pricing.DescribeServices(); |
| 27 | * |
| 28 | * // runtime |
| 29 | * const result = yield* describeServices({ ServiceCode: "AmazonEC2" }); |
| 30 | * const attributeNames = result.Services?.[0]?.AttributeNames ?? []; |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface DescribeServices extends Binding.Service< |
| 36 | DescribeServices, |
| 37 | "AWS.Pricing.DescribeServices", |
| 38 | () => Effect.Effect< |
| 39 | ( |
| 40 | request?: DescribeServicesRequest, |
| 41 | ) => Effect.Effect< |
| 42 | pricing.DescribeServicesResponse, |
| 43 | pricing.DescribeServicesError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const DescribeServices = Binding.Service<DescribeServices>( |
| 48 | "AWS.Pricing.DescribeServices", |
| 49 | ); |