Skip to content

Commit 53eb379

Browse files
authored
Merge pull request #523 from schnuerle/ms-policy-timestamps
Policy: use a consistent definition for timestamps
2 parents 65fb9e9 + 91676b6 commit 53eb379

1 file changed

Lines changed: 26 additions & 21 deletions

File tree

policy/README.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ The response to a client request must include a valid HTTP status code defined i
7373
- **404:** Not Found: Object(s) do not exist.
7474
- **500:** Internal server error.
7575

76+
#### Timestamps
77+
78+
As with the Provider API, `timestamp` refers to integer milliseconds since Unix epoch.
79+
7680
#### Error Responses
7781

7882
```json
@@ -100,8 +104,8 @@ Method: `GET`
100104
| Name | Type | Required / Optional | Description |
101105
| ------------ | --------- | --- | ---------------------------------------------- |
102106
| `id` | UUID | Optional | If provided, returns one policy object with the matching UUID; default is to return all policy objects. |
103-
| `start_date` | timestamp | Optional | Earliest effective date; default is policies effective as of the request time |
104-
| `end_date` | timestamp | Optional | Latest effective date; default is all policies effective in the future |
107+
| `start_date` | [timestamp][ts] | Optional | Earliest effective date; default is policies effective as of the request time |
108+
| `end_date` | [timestamp][ts] | Optional | Latest effective date; default is all policies effective in the future |
105109

106110
`start_date` and `end_date` are only considered when no `id` parameter is provided.
107111

@@ -139,8 +143,8 @@ The `updated` field in the payload wrapper should be set to the time of publishi
139143
```json
140144
{
141145
"version": "0.4.0",
142-
"updated": "1570035222868",
143-
"end_date": "1570035222868",
146+
"updated": 1570035222868,
147+
"end_date": 1570035222868,
144148
"data": {
145149
"policies": [
146150
{
@@ -161,7 +165,7 @@ The optional `end_date` field applies to all policies represented in the file.
161165
```json
162166
{
163167
"version": "0.4.0",
164-
"updated": "1570035222868",
168+
"updated": 1570035222868,
165169
"data": {
166170
"geographies": [
167171
{
@@ -186,7 +190,7 @@ Response bodies must be a `UTF-8` encoded JSON object and must minimally include
186190
```json
187191
{
188192
"version": "x.y.z",
189-
"updated": "1570035222868",
193+
"updated": 1570035222868,
190194
"data": {
191195
// endpoint/file specific payload
192196
}
@@ -197,17 +201,17 @@ Response bodies must be a `UTF-8` encoded JSON object and must minimally include
197201

198202
An individual `Policy` object is defined by the following fields:
199203

200-
| Name | Type | Required / Optional | Description |
201-
| ---------------- | --------- | --- | ----------------------------------------------------------------------------------- |
202-
| `name` | String | Required | Name of policy |
203-
| `policy_id` | UUID | Required | Unique ID of policy |
204-
| `provider_ids` | UUID[] | Optional | Providers for whom this policy is applicable; empty arrays and `null`/absent implies all Providers |
205-
| `description` | String | Required | Description of policy |
206-
| `start_date` | timestamp | Required | Beginning date/time of policy enforcement |
207-
| `end_date` | timestamp | Optional | End date/time of policy enforcement |
208-
| `published_date` | timestamp | Required | Timestamp that the policy was published |
209-
| `prev_policies` | UUID[] | Optional | Unique IDs of prior policies replaced by this one |
210-
| `rules` | Rule[] | Required | List of applicable [Rule](#rules) objects |
204+
| Name | Type | Required / Optional | Description |
205+
| ---------------- | --------------- | ---------- | ----------------------------------------------------------------------------------- |
206+
| `name` | String | Required | Name of policy |
207+
| `policy_id` | UUID | Required | Unique ID of policy |
208+
| `provider_ids` | UUID[] | Optional | Providers for whom this policy is applicable; empty arrays and `null`/absent implies all Providers |
209+
| `description` | String | Required | Description of policy |
210+
| `start_date` | [timestamp][ts] | Required | Beginning date/time of policy enforcement |
211+
| `end_date` | [timestamp][ts] | Optional | End date/time of policy enforcement |
212+
| `published_date` | [timestamp][ts] | Required | Timestamp that the policy was published |
213+
| `prev_policies` | UUID[] | Optional | Unique IDs of prior policies replaced by this one |
214+
| `rules` | Rule[] | Required | List of applicable [Rule](#rules) objects |
211215

212216
### Rules
213217

@@ -276,10 +280,10 @@ In this case, compliance is not computable from the information available to a s
276280
The payload returned from a `GET` request to the `value_url` will have the following immutable fields:
277281

278282
| Name | Type | Required / Optional | Description |
279-
| ----------- | --------- | --- | ----------------------------------- |
280-
| `value` | integer | Required | Value of whatever the rule measures |
281-
| `timestamp` | timestamp | Required | Timestamp the value was recorded |
282-
| `policy_id` | UUID | Required | Relevant `policy_id` for reference |
283+
| ----------- | --------------- | ---------- | ----------------------------------- |
284+
| `value` | integer | Required | Value of whatever the rule measures |
285+
| `timestamp` | [timestamp][ts] | Required | Timestamp the value was recorded |
286+
| `policy_id` | UUID | Required | Relevant `policy_id` for reference |
283287

284288
### Order of Operations
285289

@@ -294,3 +298,4 @@ The internal mechanics of ordering are up to the Policy editing and hosting soft
294298
[Top](#table-of-contents)
295299

296300
[general-information/versioning]: /general-information.md#versioning
301+
[ts]: #timestamps

0 commit comments

Comments
 (0)