Dataset retention service#
Manages retention policies and exemptions for datasets.
OpenAPI file: nominal.storage.v1.json
Endpoints#
Upsert dataset retention exemption#
POST /storage/dataset-retention/v1/exemptions
Create or update a retention exemption for a dataset. The exemption is keyed by (dataset_rid, source_id) — upserting with the same key updates the time range.
Body
datasetRidstring required
sourceIdstring required
boundsRangerequiredInclusive time range to exempt from retention.
descriptionstringAt most 1,024 characters.
Response
exemptionDatasetRetentionExemption
Fields of
DatasetRetentionExemptiondatasetRidstringThe dataset this exemption applies to.
sourceIdstringIdentifier for the source of this exemption (e.g. run RID).
boundsRangeInclusive time range to exempt from retention.
descriptionstringAt most 1,024 characters.
Request
curl -X POST "https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"datasetRid": "<dataset rid>",
"sourceId": "<source id>",
"bounds": {
"start": {
"seconds": "1",
"nanos": "1"
},
"end": {
"seconds": "1",
"nanos": "1"
}
}
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions",
headers={"Authorization": "Bearer <api key>"},
json={
"datasetRid": "<dataset rid>",
"sourceId": "<source id>",
"bounds": {
"start": {"seconds": "1", "nanos": "1"},
"end": {"seconds": "1", "nanos": "1"},
},
},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions",
headers={"Authorization": "Bearer <api key>"},
json={
"datasetRid": "<dataset rid>",
"sourceId": "<source id>",
"bounds": {
"start": {"seconds": "1", "nanos": "1"},
"end": {"seconds": "1", "nanos": "1"},
},
},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.post(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions",
headers={"Authorization": "Bearer <api key>"},
json={
"datasetRid": "<dataset rid>",
"sourceId": "<source id>",
"bounds": {
"start": {"seconds": "1", "nanos": "1"},
"end": {"seconds": "1", "nanos": "1"},
},
},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"exemption": {
"datasetRid": "<dataset rid>",
"sourceId": "<source id>",
"bounds": {
"start": {
"seconds": "1",
"nanos": "1"
},
"end": {
"seconds": "1",
"nanos": "1"
}
},
"description": "<description>"
}
}
List dataset retention exemptions#
POST /storage/dataset-retention/v1/exemptions/list
List retention exemptions for a dataset, filtered to those overlapping the given time range.
Body
datasetRidstring required
boundsRangerequiredFilter exemptions that overlap with this time range.
pageSizeintegerFrom 1 to 1,000.
nextPageTokenstring
Response
exemptionsarray ofDatasetRetentionExemption
Fields of
DatasetRetentionExemptiondatasetRidstringThe dataset this exemption applies to.
sourceIdstringIdentifier for the source of this exemption (e.g. run RID).
boundsRangeInclusive time range to exempt from retention.
descriptionstringAt most 1,024 characters.
nextPageTokenstring
Request
curl -X POST "https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions/list" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"datasetRid": "<dataset rid>",
"bounds": {
"start": {
"seconds": "1",
"nanos": "1"
},
"end": {
"seconds": "1",
"nanos": "1"
}
}
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions/list",
headers={"Authorization": "Bearer <api key>"},
json={
"datasetRid": "<dataset rid>",
"bounds": {
"start": {"seconds": "1", "nanos": "1"},
"end": {"seconds": "1", "nanos": "1"},
},
},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions/list",
headers={"Authorization": "Bearer <api key>"},
json={
"datasetRid": "<dataset rid>",
"bounds": {
"start": {"seconds": "1", "nanos": "1"},
"end": {"seconds": "1", "nanos": "1"},
},
},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.post(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions/list",
headers={"Authorization": "Bearer <api key>"},
json={
"datasetRid": "<dataset rid>",
"bounds": {
"start": {"seconds": "1", "nanos": "1"},
"end": {"seconds": "1", "nanos": "1"},
},
},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"exemptions": [
{
"datasetRid": "<dataset rid>",
"sourceId": "<source id>",
"bounds": {
"start": {
"seconds": "1",
"nanos": "1"
},
"end": {
"seconds": "1",
"nanos": "1"
}
},
"description": "<description>"
}
],
"nextPageToken": "<next page token>"
}
Delete dataset retention exemption#
DELETE /storage/dataset-retention/v1/exemptions/{datasetRid}/{sourceId}
Delete a retention exemption for a dataset.
Path parameters
datasetRidstring required
sourceIdstring required
Response
An empty JSON object, {}.
Request
curl -X DELETE "https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions/<dataset rid>/<source id>" \
-H "Authorization: Bearer <api key>"
import requests
response = requests.delete(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions/<dataset rid>/<source id>",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.delete(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions/<dataset rid>/<source id>",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.delete(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/exemptions/<dataset rid>/<source id>",
headers={"Authorization": "Bearer <api key>"},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{}
Update retention policy#
PUT /storage/dataset-retention/v1/policy/{datasetRid}
Update or remove the retention policy for a dataset. When a policy is set, data older than the policy’s expiry will be deleted.
Path parameters
datasetRidstring required
Body
retentionPolicyRetentionPolicyIf absent, the retention policy is removed (reverts to default/keep-forever).
Fields of
RetentionPolicy- one of
keepForever,keepUntilExpiryrequired
keepForeverKeepForever
keepUntilExpiryKeepUntilExpiry
Fields of
KeepUntilExpiryexpiryDaysintegerGreater than 0.
- one of
Response
An empty JSON object, {}.
Request
curl -X PUT "https://api.gov.nominal.io/api/storage/dataset-retention/v1/policy/<dataset rid>" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"retentionPolicy": {
"keepForever": {}
}
}'
import requests
response = requests.put(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/policy/<dataset rid>",
headers={"Authorization": "Bearer <api key>"},
json={"retentionPolicy": {"keepForever": {}}},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.put(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/policy/<dataset rid>",
headers={"Authorization": "Bearer <api key>"},
json={"retentionPolicy": {"keepForever": {}}},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.put(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/policy/<dataset rid>",
headers={"Authorization": "Bearer <api key>"},
json={"retentionPolicy": {"keepForever": {}}},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{}
Get dataset retention watermark#
GET /storage/dataset-retention/v1/watermarks/{datasetRid}
Get the retention watermark for a dataset.
Path parameters
datasetRidstring required
Response
watermarkTimestamp
Fields of
Timestampsecondsstring (int64)
nanosstring (int64)
Request
curl "https://api.gov.nominal.io/api/storage/dataset-retention/v1/watermarks/<dataset rid>" \
-H "Authorization: Bearer <api key>"
import requests
response = requests.get(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/watermarks/<dataset rid>",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.get(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/watermarks/<dataset rid>",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.get(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/watermarks/<dataset rid>",
headers={"Authorization": "Bearer <api key>"},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"watermark": {
"seconds": "1",
"nanos": "1"
}
}
Update dataset retention watermark#
PUT /storage/dataset-retention/v1/watermarks/{datasetRid}
Update the retention watermark for a dataset.
Path parameters
datasetRidstring required
Body
watermarkTimestamprequired
Fields of
Timestampsecondsstring (int64)
nanosstring (int64)
Response
watermarkTimestamp
Fields of
Timestampsecondsstring (int64)
nanosstring (int64)
Request
curl -X PUT "https://api.gov.nominal.io/api/storage/dataset-retention/v1/watermarks/<dataset rid>" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"watermark": {
"seconds": "1",
"nanos": "1"
}
}'
import requests
response = requests.put(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/watermarks/<dataset rid>",
headers={"Authorization": "Bearer <api key>"},
json={"watermark": {"seconds": "1", "nanos": "1"}},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.put(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/watermarks/<dataset rid>",
headers={"Authorization": "Bearer <api key>"},
json={"watermark": {"seconds": "1", "nanos": "1"}},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.put(
"https://api.gov.nominal.io/api/storage/dataset-retention/v1/watermarks/<dataset rid>",
headers={"Authorization": "Bearer <api key>"},
json={"watermark": {"seconds": "1", "nanos": "1"}},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"watermark": {
"seconds": "1",
"nanos": "1"
}
}
Types#
DatasetRetentionExemption#
A retention exemption for a dataset, representing a time range that should be preserved regardless of the dataset’s retention policy.
datasetRidstring requiredThe dataset this exemption applies to.
sourceIdstring requiredIdentifier for the source of this exemption (e.g. run RID).
boundsRangerequiredInclusive time range to exempt from retention.
descriptionstringAt most 1,024 characters.
KeepForever#
An empty JSON object, {}.
KeepUntilExpiry#
expiryDaysintegerGreater than 0.
Range#
Deprecated for new APIs. Define an API-owned range with the endpoint semantics it needs instead.
RetentionPolicy#
Set exactly one of the fields below.
- one of
keepForever,keepUntilExpiryrequired
keepForeverKeepForever
keepUntilExpiryKeepUntilExpiry
Timestamp#
Deprecated for new APIs. Use google.protobuf.Timestamp for absolute instants.
This legacy nanosecond-precision timestamp is represented by an epoch time in seconds and a nanosecond offset. The nanosecond offset is from the start of the epoch second, so must be less than 1 billion.
secondsstring (int64)
nanosstring (int64)
Page design based on Scalar, MIT License.