diff --git a/CHANGELOG.md b/CHANGELOG.md index 77eb246..bdd5c1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [1.7.4](https://github.com/cloudquery/cloudquery-api-go/compare/v1.7.3...v1.7.4) (2024-02-14) + + +### Bug Fixes + +* Generate CloudQuery Go API Client from `spec.json` ([#121](https://github.com/cloudquery/cloudquery-api-go/issues/121)) ([a4a1c08](https://github.com/cloudquery/cloudquery-api-go/commit/a4a1c08e064a0e0a3a377001a0730bf481c633ab)) +* Generate CloudQuery Go API Client from `spec.json` ([#123](https://github.com/cloudquery/cloudquery-api-go/issues/123)) ([37ddfcc](https://github.com/cloudquery/cloudquery-api-go/commit/37ddfcc2ae4e2505ab7e1783850a39fdda361756)) +* Generate CloudQuery Go API Client from `spec.json` ([#124](https://github.com/cloudquery/cloudquery-api-go/issues/124)) ([fc41e37](https://github.com/cloudquery/cloudquery-api-go/commit/fc41e371042da4be7420df48524b4d8c82af75ed)) +* Generate CloudQuery Go API Client from `spec.json` ([#125](https://github.com/cloudquery/cloudquery-api-go/issues/125)) ([daa185d](https://github.com/cloudquery/cloudquery-api-go/commit/daa185d354063a2d21698c629f84178812a5d882)) +* Generate CloudQuery Go API Client from `spec.json` ([#126](https://github.com/cloudquery/cloudquery-api-go/issues/126)) ([5a45b73](https://github.com/cloudquery/cloudquery-api-go/commit/5a45b734fb24be6a3316516bb61404e8b73ff698)) + ## [1.7.3](https://github.com/cloudquery/cloudquery-api-go/compare/v1.7.2...v1.7.3) (2024-02-01) diff --git a/client.gen.go b/client.gen.go index d1086a2..4619846 100644 --- a/client.gen.go +++ b/client.gen.go @@ -427,7 +427,7 @@ type ClientInterface interface { UpdateSyncRun(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, body UpdateSyncRunJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetSyncRunLogs request - GetSyncRunLogs(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, reqEditors ...RequestEditorFn) (*http.Response, error) + GetSyncRunLogs(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, params *GetSyncRunLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateSyncRunProgressWithBody request with any body CreateSyncRunProgressWithBody(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1945,8 +1945,8 @@ func (c *Client) UpdateSyncRun(ctx context.Context, teamName TeamName, syncName return c.Client.Do(req) } -func (c *Client) GetSyncRunLogs(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSyncRunLogsRequest(c.Server, teamName, syncName, syncRunId) +func (c *Client) GetSyncRunLogs(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, params *GetSyncRunLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetSyncRunLogsRequest(c.Server, teamName, syncName, syncRunId, params) if err != nil { return nil, err } @@ -7495,7 +7495,7 @@ func NewUpdateSyncRunRequestWithBody(server string, teamName TeamName, syncName } // NewGetSyncRunLogsRequest generates requests for GetSyncRunLogs -func NewGetSyncRunLogsRequest(server string, teamName TeamName, syncName SyncName, syncRunId SyncRunId) (*http.Request, error) { +func NewGetSyncRunLogsRequest(server string, teamName TeamName, syncName SyncName, syncRunId SyncRunId, params *GetSyncRunLogsParams) (*http.Request, error) { var err error var pathParam0 string @@ -7539,6 +7539,21 @@ func NewGetSyncRunLogsRequest(server string, teamName TeamName, syncName SyncNam return nil, err } + if params != nil { + + if params.Accept != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept) + if err != nil { + return nil, err + } + + req.Header.Set("Accept", headerParam0) + } + + } + return req, nil } @@ -8488,7 +8503,7 @@ type ClientWithResponsesInterface interface { UpdateSyncRunWithResponse(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, body UpdateSyncRunJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateSyncRunResponse, error) // GetSyncRunLogsWithResponse request - GetSyncRunLogsWithResponse(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, reqEditors ...RequestEditorFn) (*GetSyncRunLogsResponse, error) + GetSyncRunLogsWithResponse(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, params *GetSyncRunLogsParams, reqEditors ...RequestEditorFn) (*GetSyncRunLogsResponse, error) // CreateSyncRunProgressWithBodyWithResponse request with any body CreateSyncRunProgressWithBodyWithResponse(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSyncRunProgressResponse, error) @@ -8633,7 +8648,7 @@ func (r DeleteAddonByTeamAndNameResponse) StatusCode() int { type GetAddonResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *Addon + JSON200 *ListAddon JSON401 *RequiresAuthentication JSON404 *NotFound JSON500 *InternalError @@ -9033,7 +9048,7 @@ func (r DeletePluginByTeamAndPluginNameResponse) StatusCode() int { type GetPluginResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *Plugin + JSON200 *ListPlugin JSON401 *RequiresAuthentication JSON404 *NotFound JSON500 *InternalError @@ -10503,6 +10518,7 @@ type CreateSyncDestinationResponse struct { JSON201 *SyncDestination JSON400 *BadRequest JSON401 *RequiresAuthentication + JSON404 *NotFound JSON422 *UnprocessableEntity JSON500 *InternalError } @@ -10634,6 +10650,7 @@ type CreateSyncSourceResponse struct { JSON201 *SyncSource JSON400 *BadRequest JSON401 *RequiresAuthentication + JSON404 *NotFound JSON422 *UnprocessableEntity JSON500 *InternalError } @@ -10972,11 +10989,15 @@ func (r UpdateSyncRunResponse) StatusCode() int { type GetSyncRunLogsResponse struct { Body []byte HTTPResponse *http.Response - JSON400 *BadRequest - JSON401 *RequiresAuthentication - JSON404 *NotFound - JSON422 *UnprocessableEntity - JSON500 *InternalError + JSON200 *struct { + // Location The location to download the sync run logs from + Location string `json:"location"` + } + JSON400 *BadRequest + JSON401 *RequiresAuthentication + JSON404 *NotFound + JSON422 *UnprocessableEntity + JSON500 *InternalError } // Status returns HTTPResponse.Status @@ -12365,8 +12386,8 @@ func (c *ClientWithResponses) UpdateSyncRunWithResponse(ctx context.Context, tea } // GetSyncRunLogsWithResponse request returning *GetSyncRunLogsResponse -func (c *ClientWithResponses) GetSyncRunLogsWithResponse(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, reqEditors ...RequestEditorFn) (*GetSyncRunLogsResponse, error) { - rsp, err := c.GetSyncRunLogs(ctx, teamName, syncName, syncRunId, reqEditors...) +func (c *ClientWithResponses) GetSyncRunLogsWithResponse(ctx context.Context, teamName TeamName, syncName SyncName, syncRunId SyncRunId, params *GetSyncRunLogsParams, reqEditors ...RequestEditorFn) (*GetSyncRunLogsResponse, error) { + rsp, err := c.GetSyncRunLogs(ctx, teamName, syncName, syncRunId, params, reqEditors...) if err != nil { return nil, err } @@ -12678,7 +12699,7 @@ func ParseGetAddonResponse(rsp *http.Response) (*GetAddonResponse, error) { switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Addon + var dest ListAddon if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -13486,7 +13507,7 @@ func ParseGetPluginResponse(rsp *http.Response) (*GetPluginResponse, error) { switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Plugin + var dest ListPlugin if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -16539,6 +16560,13 @@ func ParseCreateSyncDestinationResponse(rsp *http.Response) (*CreateSyncDestinat } response.JSON401 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest UnprocessableEntity if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -16798,6 +16826,13 @@ func ParseCreateSyncSourceResponse(rsp *http.Response) (*CreateSyncSourceRespons } response.JSON401 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: var dest UnprocessableEntity if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -17464,6 +17499,16 @@ func ParseGetSyncRunLogsResponse(rsp *http.Response) (*GetSyncRunLogsResponse, e } switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + // Location The location to download the sync run logs from + Location string `json:"location"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -17499,6 +17544,9 @@ func ParseGetSyncRunLogsResponse(rsp *http.Response) (*GetSyncRunLogsResponse, e } response.JSON500 = &dest + case rsp.StatusCode == 200: + // Content-type (text/plain) unsupported + } return response, nil diff --git a/models.gen.go b/models.gen.go index 49166fc..0066627 100644 --- a/models.gen.go +++ b/models.gen.go @@ -90,9 +90,23 @@ const ( // Defines values for PluginReleaseStage. const ( - ComingSoon PluginReleaseStage = "coming-soon" - Ga PluginReleaseStage = "ga" - Preview PluginReleaseStage = "preview" + PluginReleaseStageComingSoon PluginReleaseStage = "coming-soon" + PluginReleaseStageGa PluginReleaseStage = "ga" + PluginReleaseStagePreview PluginReleaseStage = "preview" +) + +// Defines values for PluginReleaseStageCreate. +const ( + PluginReleaseStageCreateComingSoon PluginReleaseStageCreate = "coming-soon" + PluginReleaseStageCreateGa PluginReleaseStageCreate = "ga" + PluginReleaseStageCreatePreview PluginReleaseStageCreate = "preview" +) + +// Defines values for PluginReleaseStageUpdate. +const ( + ComingSoon PluginReleaseStageUpdate = "coming-soon" + Ga PluginReleaseStageUpdate = "ga" + Preview PluginReleaseStageUpdate = "preview" ) // Defines values for PluginTier. @@ -781,8 +795,8 @@ type PluginCreate struct { // The Coming Soon stage is for plugins that are not yet ready for Preview, but users can subscribe to be notified when they are ready. // Both Preview and GA plugins follow semantic versioning. The main differences between the two stages are: // Preview plugins are still experimental and may have frequent breaking changes. Preview plugins might get deprecated due to lack of usage. Long Term Support with community Discord and bug fixes is only guaranteed for GA plugins. Premium plugins are often discounted or free during the Preview stage. - ReleaseStage *PluginReleaseStage `json:"release_stage,omitempty"` - Repository *string `json:"repository,omitempty"` + ReleaseStage *PluginReleaseStageCreate `json:"release_stage,omitempty"` + Repository *string `json:"repository,omitempty"` // ShortDescription Short description of the plugin. This will be shown in the CloudQuery Hub. ShortDescription string `json:"short_description"` @@ -896,6 +910,18 @@ type PluginProtocols = []int // Preview plugins are still experimental and may have frequent breaking changes. Preview plugins might get deprecated due to lack of usage. Long Term Support with community Discord and bug fixes is only guaranteed for GA plugins. Premium plugins are often discounted or free during the Preview stage. type PluginReleaseStage string +// PluginReleaseStageCreate Official plugins can go through three release stages: Coming Soon, Preview, and GA. +// The Coming Soon stage is for plugins that are not yet ready for Preview, but users can subscribe to be notified when they are ready. +// Both Preview and GA plugins follow semantic versioning. The main differences between the two stages are: +// Preview plugins are still experimental and may have frequent breaking changes. Preview plugins might get deprecated due to lack of usage. Long Term Support with community Discord and bug fixes is only guaranteed for GA plugins. Premium plugins are often discounted or free during the Preview stage. +type PluginReleaseStageCreate string + +// PluginReleaseStageUpdate Official plugins can go through three release stages: Coming Soon, Preview, and GA. +// The Coming Soon stage is for plugins that are not yet ready for Preview, but users can subscribe to be notified when they are ready. +// Both Preview and GA plugins follow semantic versioning. The main differences between the two stages are: +// Preview plugins are still experimental and may have frequent breaking changes. Preview plugins might get deprecated due to lack of usage. Long Term Support with community Discord and bug fixes is only guaranteed for GA plugins. Premium plugins are often discounted or free during the Preview stage. +type PluginReleaseStageUpdate string + // PluginSpecJSONSchema The specification of the plugin. This is a JSON schema that describes the configuration of the plugin. type PluginSpecJSONSchema = string @@ -1028,8 +1054,8 @@ type PluginUpdate struct { // The Coming Soon stage is for plugins that are not yet ready for Preview, but users can subscribe to be notified when they are ready. // Both Preview and GA plugins follow semantic versioning. The main differences between the two stages are: // Preview plugins are still experimental and may have frequent breaking changes. Preview plugins might get deprecated due to lack of usage. Long Term Support with community Discord and bug fixes is only guaranteed for GA plugins. Premium plugins are often discounted or free during the Preview stage. - ReleaseStage *PluginReleaseStage `json:"release_stage,omitempty"` - Repository *string `json:"repository,omitempty"` + ReleaseStage *PluginReleaseStageUpdate `json:"release_stage,omitempty"` + Repository *string `json:"repository,omitempty"` // ShortDescription Short description of the plugin. This will be shown in the CloudQuery Hub. ShortDescription *string `json:"short_description,omitempty"` @@ -1889,9 +1915,6 @@ type CreateTeamJSONBody struct { // Name The unique name for the team. Name TeamName `json:"name"` - - // Plan The plan the team is on - Plan *TeamPlan `json:"plan,omitempty"` } // UpdateTeamJSONBody defines parameters for UpdateTeam. @@ -2066,10 +2089,18 @@ type UpdateSyncRunJSONBody struct { Status *SyncRunStatus `json:"status,omitempty"` } +// GetSyncRunLogsParams defines parameters for GetSyncRunLogs. +type GetSyncRunLogsParams struct { + Accept *string `json:"Accept,omitempty"` +} + // CreateSyncRunProgressJSONBody defines parameters for CreateSyncRunProgress. type CreateSyncRunProgressJSONBody struct { // Rows Number of rows synced so far Rows int64 `json:"rows"` + + // Status The status of the sync run + Status *SyncRunStatus `json:"status,omitempty"` } // ListTeamPluginUsageParams defines parameters for ListTeamPluginUsage. diff --git a/spec.json b/spec.json index e1b1ae8..d521df6 100644 --- a/spec.json +++ b/spec.json @@ -411,7 +411,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Plugin" + "$ref": "#/components/schemas/ListPlugin" } } }, @@ -1752,7 +1752,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Addon" + "$ref": "#/components/schemas/ListAddon" } } }, @@ -2332,9 +2332,6 @@ "description": "The team's display name", "minLength": 1, "maxLength": 255 - }, - "plan": { - "$ref": "#/components/schemas/TeamPlan" } } } @@ -4642,6 +4639,9 @@ "401": { "$ref": "#/components/responses/RequiresAuthentication" }, + "404": { + "$ref": "#/components/responses/NotFound" + }, "422": { "$ref": "#/components/responses/UnprocessableEntity" }, @@ -4865,6 +4865,9 @@ "401": { "$ref": "#/components/responses/RequiresAuthentication" }, + "404": { + "$ref": "#/components/responses/NotFound" + }, "422": { "$ref": "#/components/responses/UnprocessableEntity" }, @@ -5051,7 +5054,7 @@ } }, "post": { - "description": "Create new Sync definition. Sync runs can be scheduled automatically and manually after sync is created.", + "description": "Create new Sync definition. Sync runs can be scheduled automatically, or triggered manually after sync is created.", "operationId": "CreateSync", "tags": [ "syncs" @@ -5189,7 +5192,7 @@ } }, "delete": { - "description": "Delete Sync. This will delete Sync configuration and all associated sync runs", + "description": "Delete Sync. This will delete Sync configuration and all associated sync runs, but will not delete the associated source and destination(s). These will need to be deleted separately.", "operationId": "DeleteSync", "tags": [ "syncs" @@ -5451,6 +5454,9 @@ "type": "integer", "format": "int64", "description": "Number of rows synced so far" + }, + "status": { + "$ref": "#/components/schemas/SyncRunStatus" } } } @@ -5487,6 +5493,14 @@ "syncs" ], "parameters": [ + { + "in": "header", + "name": "Accept", + "required": false, + "schema": { + "type": "string" + } + }, { "$ref": "#/components/parameters/team_name" }, @@ -5499,12 +5513,29 @@ ], "responses": { "200": { - "description": "Chunked response logs for a sync run that is in progress.", + "description": "Response", "content": { + "application/json": { + "schema": { + "additionalProperties": false, + "required": [ + "location" + ], + "properties": { + "location": { + "type": "string", + "format": "uri", + "description": "The location to download the sync run logs from" + } + }, + "title": "Sync Run Logs", + "type": "object" + } + }, "text/plain": { "schema": { "type": "string", - "description": "A stream of logs for a sync run." + "description": "Chunked response logs for a sync run that is in progress." } } } @@ -5734,8 +5765,7 @@ "coming-soon", "preview", "ga" - ], - "default": "coming-soon" + ] }, "PluginTier": { "description": "Supported tiers for plugins", @@ -5864,6 +5894,16 @@ } ] }, + "PluginReleaseStageCreate": { + "description": "Official plugins can go through three release stages: Coming Soon, Preview, and GA.\nThe Coming Soon stage is for plugins that are not yet ready for Preview, but users can subscribe to be notified when they are ready.\nBoth Preview and GA plugins follow semantic versioning. The main differences between the two stages are:\nPreview plugins are still experimental and may have frequent breaking changes. Preview plugins might get deprecated due to lack of usage. Long Term Support with community Discord and bug fixes is only guaranteed for GA plugins. Premium plugins are often discounted or free during the Preview stage.", + "type": "string", + "enum": [ + "coming-soon", + "preview", + "ga" + ], + "default": "coming-soon" + }, "PluginCreate": { "type": "object", "required": [ @@ -5921,7 +5961,7 @@ "example": "https://github.com/cloudquery/cloudquery" }, "release_stage": { - "$ref": "#/components/schemas/PluginReleaseStage" + "$ref": "#/components/schemas/PluginReleaseStageCreate" }, "logo": { "type": "string", @@ -5943,6 +5983,15 @@ } } }, + "PluginReleaseStageUpdate": { + "description": "Official plugins can go through three release stages: Coming Soon, Preview, and GA.\nThe Coming Soon stage is for plugins that are not yet ready for Preview, but users can subscribe to be notified when they are ready.\nBoth Preview and GA plugins follow semantic versioning. The main differences between the two stages are:\nPreview plugins are still experimental and may have frequent breaking changes. Preview plugins might get deprecated due to lack of usage. Long Term Support with community Discord and bug fixes is only guaranteed for GA plugins. Premium plugins are often discounted or free during the Preview stage.", + "type": "string", + "enum": [ + "coming-soon", + "preview", + "ga" + ] + }, "PluginUpdate": { "type": "object", "properties": { @@ -5984,7 +6033,7 @@ "description": "If plugin is not public, it won't be visible to other teams in the CloudQuery Hub." }, "release_stage": { - "$ref": "#/components/schemas/PluginReleaseStage" + "$ref": "#/components/schemas/PluginReleaseStageUpdate" }, "usd_per_row": { "type": "string",