| 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 GetAttributeValuesRequest |
| 6 | extends pricing.GetAttributeValuesRequest {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `pricing:GetAttributeValues` — list the values of a |
| 10 | * filterable attribute (e.g. every `volumeType` AWS prices for |
| 11 | * `AmazonEC2`). |
| 12 | * |
| 13 | * Use `DescribeServices` to discover attribute names, then this binding to |
| 14 | * enumerate their values, and feed both into `GetProducts` filters. The |
| 15 | * binding takes no arguments and grants the function |
| 16 | * `pricing:GetAttributeValues` (the action has no resource-level IAM). |
| 17 | * Calls are pinned to `us-east-1`, the region that serves the Price List |
| 18 | * API. Provide the implementation with |
| 19 | * `Effect.provide(AWS.Pricing.GetAttributeValuesHttp)`. |
| 20 | * |
| 21 | * ### Listing Attribute Values |
| 22 | * **Example:** List EC2 Volume Types |
| 23 | * ```typescript |
| 24 | * // init |
| 25 | * const getAttributeValues = yield* AWS.Pricing.GetAttributeValues(); |
| 26 | * |
| 27 | * // runtime |
| 28 | * const result = yield* getAttributeValues({ |
| 29 | * ServiceCode: "AmazonEC2", |
| 30 | * AttributeName: "volumeType", |
| 31 | * }); |
| 32 | * const volumeTypes = (result.AttributeValues ?? []).map((v) => v.Value); |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | */ |
| 37 | export interface GetAttributeValues extends Binding.Service< |
| 38 | GetAttributeValues, |
| 39 | "AWS.Pricing.GetAttributeValues", |
| 40 | () => Effect.Effect< |
| 41 | ( |
| 42 | request: GetAttributeValuesRequest, |
| 43 | ) => Effect.Effect< |
| 44 | pricing.GetAttributeValuesResponse, |
| 45 | pricing.GetAttributeValuesError |
| 46 | > |
| 47 | > |
| 48 | > {} |
| 49 | export const GetAttributeValues = Binding.Service<GetAttributeValues>( |
| 50 | "AWS.Pricing.GetAttributeValues", |
| 51 | ); |