diff --git a/CHANGELOG.md b/CHANGELOG.md index d9d711e..1a002af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v0.2.1] - 2023-07-30 + +The release incorporates the up-to-date [API contract](openAPIDefinition.json) as of 2023-07-29 23:16:06 GMT. + +### Changed + +- The response type `CreatedBranch` of the method `CreateProjectBranch`. +- The type `Operation`: `TotalDurationMs` attribute added to reflect duration of the operation. + ## [v0.2.0] - 2023-07-26 -The release incorporates the up-to-date [API contract](openAPIDefinition.json) as of 2023-07-26 11:57:20 GMT. +The release incorporates the up-to-date [API contract](openAPIDefinition.json) as of 2023-07-26 11:57:20 GMT. ### Added @@ -25,7 +34,7 @@ The release incorporates the up-to-date [API contract](openAPIDefinition.json) a ### Changed - Module's documentation -- Order of the data structs' attributes, they will be sorted alphabetically +- Order of the data structs' attributes, they will be sorted alphabetically ### Removed diff --git a/mock.go b/mock.go index 817e337..faa754f 100644 --- a/mock.go +++ b/mock.go @@ -245,7 +245,7 @@ var endpointResponseExamples = map[string]map[string]mockResponse{ "/projects/{project_id}/branches/{branch_id}": { "DELETE": mockResponse{ - Content: `{"branch":{"active_time_seconds":100,"compute_time_seconds":100,"cpu_used_sec":100,"created_at":"2022-11-23T17:42:25Z","creation_source":"console","current_state":"ready","data_transfer_bytes":1000000,"id":"br-aged-salad-637688","logical_size":28,"name":"main","primary":true,"project_id":"shiny-wind-028834","updated_at":"2022-11-23T17:42:26Z","written_data_bytes":100800},"operations":[{"action":"suspend_compute","branch_id":"br-sweet-breeze-497520","created_at":"2022-12-01T19:53:05Z","endpoint_id":"ep-soft-violet-752733","failures_count":0,"id":"b6afbc21-2990-4a76-980b-b57d8c2948f2","project_id":"shiny-wind-028834","status":"running","updated_at":"2022-12-01T19:53:05Z"},{"action":"delete_timeline","branch_id":"br-sweet-breeze-497520","created_at":"2022-12-01T19:53:05Z","failures_count":0,"id":"b6afbc21-2990-4a76-980b-b57d8c2948f2","project_id":"shiny-wind-028834","status":"scheduling","updated_at":"2022-12-01T19:53:05Z"}]}`, + Content: `{"branch":{"active_time_seconds":100,"compute_time_seconds":100,"cpu_used_sec":100,"created_at":"2022-11-23T17:42:25Z","creation_source":"console","current_state":"ready","data_transfer_bytes":1000000,"id":"br-aged-salad-637688","logical_size":28,"name":"main","primary":true,"project_id":"shiny-wind-028834","updated_at":"2022-11-23T17:42:26Z","written_data_bytes":100800},"operations":[{"action":"suspend_compute","branch_id":"br-sweet-breeze-497520","created_at":"2022-12-01T19:53:05Z","endpoint_id":"ep-soft-violet-752733","failures_count":0,"id":"b6afbc21-2990-4a76-980b-b57d8c2948f2","project_id":"shiny-wind-028834","status":"running","total_duration_ms":100,"updated_at":"2022-12-01T19:53:05Z"},{"action":"delete_timeline","branch_id":"br-sweet-breeze-497520","created_at":"2022-12-01T19:53:05Z","failures_count":0,"id":"b6afbc21-2990-4a76-980b-b57d8c2948f2","project_id":"shiny-wind-028834","status":"scheduling","total_duration_ms":100,"updated_at":"2022-12-01T19:53:05Z"}]}`, Code: 200, }, "GET": mockResponse{ @@ -282,14 +282,14 @@ var endpointResponseExamples = map[string]map[string]mockResponse{ Code: 200, }, "POST": mockResponse{ - Content: `{"database":{"branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:15:04Z","id":876692,"name":"mydb","owner_name":"casey","updated_at":"2022-12-04T00:15:04Z"},"operations":[{"action":"apply_config","branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:15:04Z","endpoint_id":"ep-little-smoke-851426","failures_count":0,"id":"39426015-db00-40fa-85c5-1c7072df46d0","project_id":"shiny-wind-028834","status":"running","updated_at":"2022-12-04T00:15:04Z"},{"action":"suspend_compute","branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:15:04Z","endpoint_id":"ep-little-smoke-851426","failures_count":0,"id":"b7483d4e-33da-4d40-b319-ac858d4d3e69","project_id":"shiny-wind-028834","status":"scheduling","updated_at":"2022-12-04T00:15:04Z"}]}`, + Content: `{"database":{"branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:15:04Z","id":876692,"name":"mydb","owner_name":"casey","updated_at":"2022-12-04T00:15:04Z"},"operations":[{"action":"apply_config","branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:15:04Z","endpoint_id":"ep-little-smoke-851426","failures_count":0,"id":"39426015-db00-40fa-85c5-1c7072df46d0","project_id":"shiny-wind-028834","status":"running","total_duration_ms":100,"updated_at":"2022-12-04T00:15:04Z"},{"action":"suspend_compute","branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:15:04Z","endpoint_id":"ep-little-smoke-851426","failures_count":0,"id":"b7483d4e-33da-4d40-b319-ac858d4d3e69","project_id":"shiny-wind-028834","status":"scheduling","total_duration_ms":100,"updated_at":"2022-12-04T00:15:04Z"}]}`, Code: 201, }, }, "/projects/{project_id}/branches/{branch_id}/databases/{database_name}": { "DELETE": mockResponse{ - Content: `{"database":{"branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:41:46Z","id":851537,"name":"mydb","owner_name":"casey","updated_at":"2022-12-01T19:41:46Z"},"operations":[{"action":"apply_config","branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:51:41Z","endpoint_id":"ep-steep-bush-777093","failures_count":0,"id":"9ef1c2ed-dce4-43aa-bae8-78aea636bf8a","project_id":"shiny-wind-028834","status":"running","updated_at":"2022-12-01T19:51:41Z"},{"action":"suspend_compute","branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:51:41Z","endpoint_id":"ep-steep-bush-777093","failures_count":0,"id":"42dafb46-f861-497b-ae89-f2bec54f4966","project_id":"shiny-wind-028834","status":"scheduling","updated_at":"2022-12-01T19:51:41Z"}]}`, + Content: `{"database":{"branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:41:46Z","id":851537,"name":"mydb","owner_name":"casey","updated_at":"2022-12-01T19:41:46Z"},"operations":[{"action":"apply_config","branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:51:41Z","endpoint_id":"ep-steep-bush-777093","failures_count":0,"id":"9ef1c2ed-dce4-43aa-bae8-78aea636bf8a","project_id":"shiny-wind-028834","status":"running","total_duration_ms":100,"updated_at":"2022-12-01T19:51:41Z"},{"action":"suspend_compute","branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:51:41Z","endpoint_id":"ep-steep-bush-777093","failures_count":0,"id":"42dafb46-f861-497b-ae89-f2bec54f4966","project_id":"shiny-wind-028834","status":"scheduling","total_duration_ms":100,"updated_at":"2022-12-01T19:51:41Z"}]}`, Code: 200, }, "GET": mockResponse{ @@ -297,7 +297,7 @@ var endpointResponseExamples = map[string]map[string]mockResponse{ Code: 200, }, "PATCH": mockResponse{ - Content: `{"database":{"branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:15:04Z","id":876692,"name":"mydb","owner_name":"sally","updated_at":"2022-12-04T00:15:04Z"},"operations":[{"action":"apply_config","branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:21:01Z","endpoint_id":"ep-little-smoke-851426","failures_count":0,"id":"9ef1c2ed-dce4-43aa-bae8-78aea636bf8a","project_id":"shiny-wind-028834","status":"running","updated_at":"2022-12-04T00:21:01Z"},{"action":"suspend_compute","branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:21:01Z","endpoint_id":"ep-little-smoke-851426","failures_count":0,"id":"42dafb46-f861-497b-ae89-f2bec54f4966","project_id":"shiny-wind-028834","status":"scheduling","updated_at":"2022-12-04T00:21:01Z"}]}`, + Content: `{"database":{"branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:15:04Z","id":876692,"name":"mydb","owner_name":"sally","updated_at":"2022-12-04T00:15:04Z"},"operations":[{"action":"apply_config","branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:21:01Z","endpoint_id":"ep-little-smoke-851426","failures_count":0,"id":"9ef1c2ed-dce4-43aa-bae8-78aea636bf8a","project_id":"shiny-wind-028834","status":"running","total_duration_ms":100,"updated_at":"2022-12-04T00:21:01Z"},{"action":"suspend_compute","branch_id":"br-aged-salad-637688","created_at":"2022-12-04T00:21:01Z","endpoint_id":"ep-little-smoke-851426","failures_count":0,"id":"42dafb46-f861-497b-ae89-f2bec54f4966","project_id":"shiny-wind-028834","status":"scheduling","total_duration_ms":100,"updated_at":"2022-12-04T00:21:01Z"}]}`, Code: 200, }, }, @@ -322,7 +322,7 @@ var endpointResponseExamples = map[string]map[string]mockResponse{ "/projects/{project_id}/branches/{branch_id}/roles/{role_name}": { "DELETE": mockResponse{ - Content: `{"operations":[{"action":"apply_config","branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:48:11Z","endpoint_id":"ep-steep-bush-777093","failures_count":0,"id":"db646be3-eace-4910-9f60-8150823c5cb8","project_id":"shiny-wind-028834","status":"running","updated_at":"2022-12-01T19:48:11Z"},{"action":"suspend_compute","branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:48:11Z","endpoint_id":"ep-steep-bush-777093","failures_count":0,"id":"ab94cdad-7630-4943-a55e-5a0952d2e598","project_id":"shiny-wind-028834","status":"scheduling","updated_at":"2022-12-01T19:48:11Z"}],"role":{"branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T14:36:23Z","name":"thomas","protected":false,"updated_at":"2022-12-01T14:36:23Z"}}`, + Content: `{"operations":[{"action":"apply_config","branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:48:11Z","endpoint_id":"ep-steep-bush-777093","failures_count":0,"id":"db646be3-eace-4910-9f60-8150823c5cb8","project_id":"shiny-wind-028834","status":"running","total_duration_ms":100,"updated_at":"2022-12-01T19:48:11Z"},{"action":"suspend_compute","branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T19:48:11Z","endpoint_id":"ep-steep-bush-777093","failures_count":0,"id":"ab94cdad-7630-4943-a55e-5a0952d2e598","project_id":"shiny-wind-028834","status":"scheduling","total_duration_ms":100,"updated_at":"2022-12-01T19:48:11Z"}],"role":{"branch_id":"br-raspy-hill-832856","created_at":"2022-12-01T14:36:23Z","name":"thomas","protected":false,"updated_at":"2022-12-01T14:36:23Z"}}`, Code: 200, }, "GET": mockResponse{ @@ -463,7 +463,7 @@ var endpointResponseExamples = map[string]map[string]mockResponse{ "/projects/{project_id}/operations/{operation_id}": { "GET": mockResponse{ - Content: `{"operation":{"action":"create_timeline","branch_id":"br-bitter-sound-247814","created_at":"2022-10-04T18:20:17Z","endpoint_id":"ep-dark-snowflake-942567","failures_count":0,"id":"a07f8772-1877-4da9-a939-3a3ae62d1d8d","project_id":"floral-king-961888","status":"finished","updated_at":"2022-10-04T18:20:18Z"}}`, + Content: `{"operation":{"action":"create_timeline","branch_id":"br-bitter-sound-247814","created_at":"2022-10-04T18:20:17Z","endpoint_id":"ep-dark-snowflake-942567","failures_count":0,"id":"a07f8772-1877-4da9-a939-3a3ae62d1d8d","project_id":"floral-king-961888","status":"finished","total_duration_ms":100,"updated_at":"2022-10-04T18:20:18Z"}}`, Code: 200, }, }, diff --git a/openAPIDefinition.json b/openAPIDefinition.json index f5700c8..6fedfaa 100644 --- a/openAPIDefinition.json +++ b/openAPIDefinition.json @@ -248,7 +248,8 @@ "status": "finished", "failures_count": 0, "created_at": "2022-10-04T18:20:17Z", - "updated_at": "2022-10-04T18:20:18Z" + "updated_at": "2022-10-04T18:20:18Z", + "total_duration_ms": 100 } } } @@ -962,7 +963,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-01T19:53:05Z", - "updated_at": "2022-12-01T19:53:05Z" + "updated_at": "2022-12-01T19:53:05Z", + "total_duration_ms": 100 }, { "id": "b6afbc21-2990-4a76-980b-b57d8c2948f2", @@ -972,7 +974,8 @@ "status": "scheduling", "failures_count": 0, "created_at": "2022-12-01T19:53:05Z", - "updated_at": "2022-12-01T19:53:05Z" + "updated_at": "2022-12-01T19:53:05Z", + "total_duration_ms": 100 } ] } @@ -1296,7 +1299,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-04T00:15:04Z", - "updated_at": "2022-12-04T00:15:04Z" + "updated_at": "2022-12-04T00:15:04Z", + "total_duration_ms": 100 }, { "id": "b7483d4e-33da-4d40-b319-ac858d4d3e69", @@ -1307,7 +1311,8 @@ "status": "scheduling", "failures_count": 0, "created_at": "2022-12-04T00:15:04Z", - "updated_at": "2022-12-04T00:15:04Z" + "updated_at": "2022-12-04T00:15:04Z", + "total_duration_ms": 100 } ] } @@ -1433,7 +1438,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-04T00:21:01Z", - "updated_at": "2022-12-04T00:21:01Z" + "updated_at": "2022-12-04T00:21:01Z", + "total_duration_ms": 100 }, { "id": "42dafb46-f861-497b-ae89-f2bec54f4966", @@ -1444,7 +1450,8 @@ "status": "scheduling", "failures_count": 0, "created_at": "2022-12-04T00:21:01Z", - "updated_at": "2022-12-04T00:21:01Z" + "updated_at": "2022-12-04T00:21:01Z", + "total_duration_ms": 100 } ] } @@ -1490,7 +1497,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-01T19:51:41Z", - "updated_at": "2022-12-01T19:51:41Z" + "updated_at": "2022-12-01T19:51:41Z", + "total_duration_ms": 100 }, { "id": "42dafb46-f861-497b-ae89-f2bec54f4966", @@ -1501,7 +1509,8 @@ "status": "scheduling", "failures_count": 0, "created_at": "2022-12-01T19:51:41Z", - "updated_at": "2022-12-01T19:51:41Z" + "updated_at": "2022-12-01T19:51:41Z", + "total_duration_ms": 100 } ] } @@ -1625,7 +1634,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-03T11:58:29Z", - "updated_at": "2022-12-03T11:58:29Z" + "updated_at": "2022-12-03T11:58:29Z", + "total_duration_ms": 100 } ] } @@ -1733,7 +1743,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-01T19:48:11Z", - "updated_at": "2022-12-01T19:48:11Z" + "updated_at": "2022-12-01T19:48:11Z", + "total_duration_ms": 100 }, { "id": "ab94cdad-7630-4943-a55e-5a0952d2e598", @@ -1744,7 +1755,8 @@ "status": "scheduling", "failures_count": 0, "created_at": "2022-12-01T19:48:11Z", - "updated_at": "2022-12-01T19:48:11Z" + "updated_at": "2022-12-01T19:48:11Z", + "total_duration_ms": 100 } ] } @@ -1898,7 +1910,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-03T12:58:18Z", - "updated_at": "2022-12-03T12:58:18Z" + "updated_at": "2022-12-03T12:58:18Z", + "total_duration_ms": 100 }, { "id": "16b5bfca-4697-4194-a338-d2cdc9aca2af", @@ -1909,7 +1922,8 @@ "status": "scheduling", "failures_count": 0, "created_at": "2022-12-03T12:58:18Z", - "updated_at": "2022-12-03T12:58:18Z" + "updated_at": "2022-12-03T12:58:18Z", + "total_duration_ms": 100 } ] } @@ -2026,7 +2040,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-03T15:37:07Z", - "updated_at": "2022-12-03T15:37:07Z" + "updated_at": "2022-12-03T15:37:07Z", + "total_duration_ms": 100 } ] } @@ -2263,7 +2278,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-03T15:51:06Z", - "updated_at": "2022-12-03T15:51:06Z" + "updated_at": "2022-12-03T15:51:06Z", + "total_duration_ms": 100 } ] } @@ -2341,7 +2357,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-03T15:51:06Z", - "updated_at": "2022-12-03T15:51:06Z" + "updated_at": "2022-12-03T15:51:06Z", + "total_duration_ms": 100 }, { "id": "9ffda74b-a582-4cff-b0f0-aaa8d14b8e6a", @@ -2352,7 +2369,8 @@ "status": "scheduling", "failures_count": 0, "created_at": "2022-12-03T15:51:06Z", - "updated_at": "2022-12-03T15:51:06Z" + "updated_at": "2022-12-03T15:51:06Z", + "total_duration_ms": 100 } ] } @@ -2437,7 +2455,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-03T15:51:06Z", - "updated_at": "2022-12-03T15:51:06Z" + "updated_at": "2022-12-03T15:51:06Z", + "total_duration_ms": 100 } ] } @@ -2522,7 +2541,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-12-03T15:51:06Z", - "updated_at": "2022-12-03T15:51:06Z" + "updated_at": "2022-12-03T15:51:06Z", + "total_duration_ms": 100 } ] } @@ -2675,6 +2695,12 @@ { "$ref": "#/components/schemas/OperationsResponse" }, + { + "$ref": "#/components/schemas/RolesResponse" + }, + { + "$ref": "#/components/schemas/DatabasesResponse" + }, { "$ref": "#/components/schemas/ConnectionURIsOptionalResponse" } @@ -2862,7 +2888,8 @@ "status", "failures_count", "created_at", - "updated_at" + "updated_at", + "total_duration_ms" ], "properties": { "id": { @@ -2911,6 +2938,11 @@ "description": "A timestamp indicating when the operation status was last updated", "type": "string", "format": "date-time" + }, + "total_duration_ms": { + "description": "The total duration of the operation in milliseconds", + "type": "integer", + "format": "int32" } }, "example": [ @@ -2923,7 +2955,8 @@ "status": "running", "failures_count": 0, "created_at": "2022-11-08T23:33:16Z", - "updated_at": "2022-11-08T23:33:20Z" + "updated_at": "2022-11-08T23:33:20Z", + "total_duration_ms": 400 }, { "id": "d8ac46eb-a757-42b1-9907-f78322ee394e", @@ -2934,7 +2967,8 @@ "status": "finished", "failures_count": 0, "created_at": "2022-11-15T20:02:00Z", - "updated_at": "2022-11-15T20:02:02Z" + "updated_at": "2022-11-15T20:02:02Z", + "total_duration_ms": 200 } ] }, diff --git a/sdk.go b/sdk.go index 781f3ff..56614ad 100644 --- a/sdk.go +++ b/sdk.go @@ -949,8 +949,10 @@ type ConnectionURIsResponse struct { type CreatedBranch struct { BranchResponse ConnectionURIsOptionalResponse + DatabasesResponse EndpointsResponse OperationsResponse + RolesResponse } type CreatedProject struct { @@ -1166,6 +1168,8 @@ type Operation struct { // RetryAt A timestamp indicating when the operation was last retried RetryAt time.Time `json:"retry_at,omitempty"` Status OperationStatus `json:"status"` + // TotalDurationMs The total duration of the operation in milliseconds + TotalDurationMs int32 `json:"total_duration_ms"` // UpdatedAt A timestamp indicating when the operation status was last updated UpdatedAt time.Time `json:"updated_at"` }