mirror of
https://github.com/floci-io/floci.git
synced 2026-12-06 03:28:18 -05:00
A GetProducts filter read only the product's attributes, under the exact spelling of the field, so `productFamily` (held beside the attributes) and `serviceCode` (the attribute is `servicecode`) matched nothing. A filter's field is now one of the product's attributes, or else a member the product holds beside them, as productFamily is. No field is named in the code. The API reference says "Matching isn't case sensitive for any filter type", so fields and values match without regard to case under every filter type, and an exact regionCode in any case picks its Region. With FLOCI_SERVICES_PRICING_AWS_PRICE_LIST=true (off by default), GetProducts answers from the public files of AWS's Price List Bulk API instead of the bundled snapshot. The service is looked up in AWS's offer index. An exact regionCode filter reads the Region's current file, named by the service's region index; without one, the current file for every Region, named by the version index, is read. Each file is downloaded once into <persistent-path>/pricing, and again when AWS publishes a new version. It is read as a stream that keeps only the products of the page, in the file's order, with their terms. An index is reused while AWS's response says it is fresh (Cache-Control max-age less Age), and is otherwise asked for again with its ETag, so an unchanged index comes back as 304 without a body. A connection that takes 10 s to open, or stops sending for 10 s, fails the request. The offer index address is the setting FLOCI_SERVICES_PRICING_AWS_PRICE_LIST_URL. A page holds at most MaxResults products, or the most the operation models when the request names none. Pricing's request constraints come from botocore through tools/aws/regen_pricing_shapes.py, and a request that breaks one is refused in the words AWS answers with: MaxResults out of range, more than 50 Filters, a filter's Field or Value outside 1 to 1024 characters, a missing member, or a filter Type outside the modeled set. The shared request check now words a list of structures, each element's members at its position counting from 1 (filters.1.member.type), as AWS does. A missing required member is InvalidParameterException, the only validation error Pricing models, instead of ValidationException. ListPriceLists holds a timestamp, which the shared check does not word yet, so only its MaxResults is checked. A token names the file version it was read from: a token from a version AWS has replaced has expired (ExpiredNextTokenException), and a token no page wrote is answered as AWS answers it (InvalidNextTokenException). Cost Explorer reads every product of a Region, not only the first 1000, in one pass: the file is read once for where each SKU's terms are, then for the products, reading a match's terms from their place. AWS lists one product per operating system under a usage type, so a usage line is priced at the product for its operation, as the BCM Pricing Calculator matches it. Rates read from a version of AWS's file are kept until AWS publishes another. A usage line with no usage costs nothing at any rate, so no rate is looked up for it, and no Region's file is read for a service nothing used. DescribeServices, GetAttributeValues, ListPriceLists and GetPriceListFileUrl keep answering from the snapshot. Closes #8339