From 5a8bba36303b825b1f85aaf61d573cb25dd44523 Mon Sep 17 00:00:00 2001 From: cq-bot Date: Sat, 7 Oct 2023 08:05:30 +0000 Subject: [PATCH] fix: Generate CloudQuery Go API Client from `spec.json` --- client.gen.go | 8 ++++++++ models.gen.go | 28 +++++++++++++++++++++----- spec.json | 54 ++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 82 insertions(+), 8 deletions(-) diff --git a/client.gen.go b/client.gen.go index a92178e..3b0abda 100644 --- a/client.gen.go +++ b/client.gen.go @@ -3912,6 +3912,7 @@ type UpdatePluginResponse struct { JSON400 *BadRequest JSON403 *Forbidden JSON404 *NotFound + JSON422 *UnprocessableEntity JSON500 *InternalError } @@ -5732,6 +5733,13 @@ func ParseUpdatePluginResponse(rsp *http.Response) (*UpdatePluginResponse, error } 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 { + return nil, err + } + response.JSON422 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError if err := json.Unmarshal(bodyBytes, &dest); err != nil { diff --git a/models.gen.go b/models.gen.go index c30f70e..e7a593a 100644 --- a/models.gen.go +++ b/models.gen.go @@ -224,8 +224,11 @@ type Plugin struct { CreatedAt time.Time `json:"created_at"` // DisplayName The plugin's display name - DisplayName string `json:"display_name"` - Homepage *string `json:"homepage,omitempty"` + DisplayName string `json:"display_name"` + + // FreeRowsPerMonth The number of rows that can be synced for free each month. + FreeRowsPerMonth int64 `json:"free_rows_per_month"` + Homepage *string `json:"homepage,omitempty"` // Kind The kind of plugin, ie. source or destination. Kind PluginKind `json:"kind"` @@ -247,6 +250,9 @@ type Plugin struct { // Tier Supported tiers for plugins Tier PluginTier `json:"tier"` + + // UsdPerRow The price per row in USD. This is used to calculate the price of a sync. + USDPerRow string `json:"usd_per_row"` } // PluginCategory Supported categories for plugins @@ -258,8 +264,11 @@ type PluginCreate struct { Category PluginCategory `json:"category"` // DisplayName The plugin's display name, as shown in the CloudQuery Hub. - DisplayName string `json:"display_name"` - Homepage *string `json:"homepage,omitempty"` + DisplayName string `json:"display_name"` + + // FreeRowsPerMonth The number of rows that can be synced for free each month. + FreeRowsPerMonth *int64 `json:"free_rows_per_month,omitempty"` + Homepage *string `json:"homepage,omitempty"` // Kind The kind of plugin, ie. source or destination. Kind PluginKind `json:"kind"` @@ -282,6 +291,9 @@ type PluginCreate struct { // Tier Supported tiers for plugins Tier PluginTier `json:"tier"` + + // UsdPerRow The price per row in USD. This is used to calculate the price of a sync. + USDPerRow *string `json:"usd_per_row,omitempty"` } // PluginDocsPage CloudQuery Plugin Documentation Page @@ -428,7 +440,10 @@ type PluginUpdate struct { // DisplayName The plugin's display name, as shown in the CloudQuery Hub. DisplayName *string `json:"display_name,omitempty"` - Homepage *string `json:"homepage,omitempty"` + + // FreeRowsPerMonth The number of rows that can be synced for free each month. + FreeRowsPerMonth *int64 `json:"free_rows_per_month,omitempty"` + Homepage *string `json:"homepage,omitempty"` // Logo URL to the plugin's logo. This will be shown in the CloudQuery Hub. This must point to https://images.cloudquery.io/... Logo *string `json:"logo,omitempty"` @@ -442,6 +457,9 @@ type PluginUpdate struct { // Tier Supported tiers for plugins Tier *PluginTier `json:"tier,omitempty"` + + // UsdPerRow The price per row in USD. This is used to calculate the price of a sync. + USDPerRow *string `json:"usd_per_row,omitempty"` } // PluginVersion CloudQuery Plugin Version diff --git a/spec.json b/spec.json index 9822056..010522e 100644 --- a/spec.json +++ b/spec.json @@ -133,7 +133,9 @@ "official": true, "short_description": "Sync data from AWS to any destination", "repository": "https://github.com/cloudquery/cloudquery", - "tier": "free" + "tier": "paid", + "usd_per_row": "0.00123", + "free_rows_per_month": 10000 } ] }, @@ -288,6 +290,9 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "422": { + "$ref": "#/components/responses/UnprocessableEntity" + }, "500": { "$ref": "#/components/responses/InternalError" } @@ -1443,7 +1448,9 @@ "official": true, "short_description": "Sync data from AWS to any destination", "repository": "https://github.com/cloudquery/cloudquery", - "tier": "free" + "tier": "paid", + "usd_per_row": "0.00123", + "free_rows_per_month": 10000 } ] }, @@ -2596,6 +2603,19 @@ "public": { "description": "Whether the plugin is listed in the CloudQuery Hub. If false, the plugin will not be shown in the CloudQuery Hub and will only be visible to members of the plugin's team.", "type": "boolean" + }, + "usd_per_row": { + "type": "string", + "pattern": "^\\d+(?:\\.\\d{1,10})?$", + "description": "The price per row in USD. This is used to calculate the price of a sync.", + "example": "0.0001", + "x-go-name": "USDPerRow" + }, + "free_rows_per_month": { + "type": "integer", + "format": "int64", + "description": "The number of rows that can be synced for free each month.", + "example": 1000 } }, "required": [ @@ -2608,7 +2628,9 @@ "display_name", "official", "short_description", - "tier" + "tier", + "usd_per_row", + "free_rows_per_month" ], "title": "CloudQuery Plugin", "type": "object" @@ -2683,6 +2705,19 @@ "type": "string", "description": "URL to the plugin's logo. This will be shown in the CloudQuery Hub. This must point to https://images.cloudquery.io/...", "example": "https://images.cloudquery.io/logos/aws.png" + }, + "usd_per_row": { + "type": "string", + "pattern": "^\\d+(?:\\.\\d{1,10})?$", + "description": "The price per row in USD. This is used to calculate the price of a sync.", + "example": "0.0001", + "x-go-name": "USDPerRow" + }, + "free_rows_per_month": { + "type": "integer", + "format": "int64", + "description": "The number of rows that can be synced for free each month.", + "example": 1000 } } }, @@ -2749,6 +2784,19 @@ "public": { "type": "boolean", "description": "If plugin is not public, it won't be visible to other teams in the CloudQuery Hub." + }, + "usd_per_row": { + "type": "string", + "pattern": "^\\d+(?:\\.\\d{1,10})?$", + "description": "The price per row in USD. This is used to calculate the price of a sync.", + "example": "0.0001", + "x-go-name": "USDPerRow" + }, + "free_rows_per_month": { + "type": "integer", + "format": "int64", + "description": "The number of rows that can be synced for free each month.", + "example": 1000 } } },