def iterate_entries(
project,
environment,
limit: nil,
offset: nil,
product: nil,
timeout: nil,
&block
)def iterate_entries: (
String project,
String environment,
?limit: Integer?,
?offset: Integer?,
?product: (String | Symbol)?,
?timeout: seconds?
) -> Enumerator[version_entry_resource, nil]
| (
String project,
String environment,
?limit: Integer?,
?offset: Integer?,
?product: (String | Symbol)?,
?timeout: seconds?
) { (version_entry_resource) -> void } -> nilYields version entries individually, fetching the next page only once the current one is drained. Use it to rotate a large environment without holding its whole encrypted history in memory.
Give it a block to walk every item, or leave the block off for an Enumerator you can stop early, such as with first(10). reencrypt_entries rewrites only value and defaultValue and never adds or removes rows, so writing back mid stream does not shift the window. Publishing a version mid walk does shift it, because the new entries land in the same flat set.
Example
require "envless/sdk"
entries = Envless.versions.iterate_entries("api", "production")
batch = entries.filter_map { |entry| entry[:id] if entry[:value] }
puts batch.sizeParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | String | Yes | Project slug or project uniqueId. |
environment | String | Yes | Environment slug, since an environment uniqueId will not resolve here. |
product: | String | Symbol | No | Product slug used to disambiguate a project slug shared across products. |
limit: | Integer | No | Page size fetched behind the scenes, clamped to 100. |
offset: | Integer | No | Row to start streaming from. |
timeout: | Integer | Float | Rational | No | Seconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
An Enumerator that yields version_entry_resource values until the pages run out.
Reads the entries collection. list returns one page as an Envless::Page with items and pagination, list_all collects every page into an array, and iterate yields one item at a time to a block, fetching the next page only when it gets there. Without a block, iterate returns an Enumerator.
Worth knowing
- Buffer the yielded entries and write them back in batches. One
reencrypt_entriescall per entry works but costs a request each. - Freeze publishing while a rotation walk is in flight, otherwise a new version adds entries encrypted under the old key after you have already passed that offset.
Required scopes
versions:read and variables:read
Underlying endpoint
GET /projects/{slug}/environments/{environmentSlug}/versions/entries
Request and response schema, every error code, and a live playground.
In TypeScript
envless.versions.iterateEntries()
The same method in @goenvless/sdk, with the same request, retries and errors.