From d8528b0b610c7a67e990421cdafd391123de4afb Mon Sep 17 00:00:00 2001 From: CloudQuery Bot <102256036+cq-bot@users.noreply.github.com> Date: Wed, 31 Jan 2024 12:57:06 +0200 Subject: [PATCH] fix: Generate CloudQuery Go API Client from `spec.json` (#115) This PR was created by a scheduled workflow to generate the CloudQuery Go API Client from `spec.json` --- client.gen.go | 8 ++++---- models.gen.go | 57 ++++++++++++++++++++++++++++++++++++++++++++++++--- spec.json | 49 ++++++++++++++++++++++++++++++++----------- 3 files changed, 95 insertions(+), 19 deletions(-) diff --git a/client.gen.go b/client.gen.go index cdd96fa..d1086a2 100644 --- a/client.gen.go +++ b/client.gen.go @@ -9167,8 +9167,8 @@ type ListPluginVersionsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { - Items []PluginVersion `json:"items"` - Metadata ListMetadata `json:"metadata"` + Items []PluginVersionList `json:"items"` + Metadata ListMetadata `json:"metadata"` } JSON401 *RequiresAuthentication JSON403 *Forbidden @@ -13760,8 +13760,8 @@ func ParseListPluginVersionsResponse(rsp *http.Response) (*ListPluginVersionsRes switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { - Items []PluginVersion `json:"items"` - Metadata ListMetadata `json:"metadata"` + Items []PluginVersionList `json:"items"` + Metadata ListMetadata `json:"metadata"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err diff --git a/models.gen.go b/models.gen.go index bf06630..46c264a 100644 --- a/models.gen.go +++ b/models.gen.go @@ -896,6 +896,9 @@ 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 +// PluginSpecJSONSchema The specification of the plugin. This is a JSON schema that describes the configuration of the plugin. +type PluginSpecJSONSchema = string + // PluginTable CloudQuery Plugin Table type PluginTable struct { // Description Description of the table @@ -1038,7 +1041,7 @@ type PluginUpdate struct { USDPerRow *string `json:"usd_per_row,omitempty"` } -// PluginVersion CloudQuery Plugin Version +// PluginVersion defines model for PluginVersion. type PluginVersion struct { // Checksums The checksums of the plugin assets Checksums []string `json:"checksums"` @@ -1067,6 +1070,42 @@ type PluginVersion struct { // Retracted If a plugin version is retracted, assets will still be available for download, but the version will be marked as retracted to discourage use. Retracted bool `json:"retracted"` + // SpecJsonSchema The specification of the plugin. This is a JSON schema that describes the configuration of the plugin. + SpecJsonSchema *PluginSpecJSONSchema `json:"spec_json_schema,omitempty"` + + // SupportedTargets The targets supported by this plugin version, formatted as _ + SupportedTargets []string `json:"supported_targets"` +} + +// PluginVersionBase CloudQuery Plugin Version +type PluginVersionBase struct { + // Checksums The checksums of the plugin assets + Checksums []string `json:"checksums"` + + // CreatedAt The date and time the plugin version was created. + CreatedAt time.Time `json:"created_at"` + + // Draft If a plugin version is in draft, it will not show to members outside the team or be counted as the latest version. + Draft bool `json:"draft"` + + // Message Description of what's new or changed in this version (supports markdown) + Message string `json:"message"` + + // Name The version in semantic version format. + Name VersionName `json:"name"` + + // PackageType The package type of the plugin assets + PackageType PluginPackageType `json:"package_type"` + + // Protocols The CloudQuery protocols supported by this plugin version (only protocol 3 is supported by new plugins). + Protocols PluginProtocols `json:"protocols"` + + // PublishedAt The date and time the plugin version was set to non-draft (published). + PublishedAt *time.Time `json:"published_at,omitempty"` + + // Retracted If a plugin version is retracted, assets will still be available for download, but the version will be marked as retracted to discourage use. + Retracted bool `json:"retracted"` + // SupportedTargets The targets supported by this plugin version, formatted as _ SupportedTargets []string `json:"supported_targets"` } @@ -1103,10 +1142,16 @@ type PluginVersionDetails struct { // Retracted If a plugin version is retracted, assets will still be available for download, but the version will be marked as retracted to discourage use. Retracted bool `json:"retracted"` + // SpecJsonSchema The specification of the plugin. This is a JSON schema that describes the configuration of the plugin. + SpecJsonSchema *PluginSpecJSONSchema `json:"spec_json_schema,omitempty"` + // SupportedTargets The targets supported by this plugin version, formatted as _ SupportedTargets []string `json:"supported_targets"` } +// PluginVersionList CloudQuery Plugin Version +type PluginVersionList = PluginVersionBase + // PluginVersionUpdate defines model for PluginVersionUpdate. type PluginVersionUpdate struct { // Checksums The SHA-256 checksums of the plugin binaries, one per supported target. @@ -1125,8 +1170,11 @@ type PluginVersionUpdate struct { Protocols *PluginProtocols `json:"protocols,omitempty"` // Retracted If a plugin version is retracted, assets will still be available for download, but the version will be marked as retracted to discourage use. - Retracted *bool `json:"retracted,omitempty"` - SupportedTargets *[]string `json:"supported_targets,omitempty"` + Retracted *bool `json:"retracted,omitempty"` + + // SpecJsonSchema The specification of the plugin. This is a JSON schema that describes the configuration of the plugin. + SpecJsonSchema *PluginSpecJSONSchema `json:"spec_json_schema,omitempty"` + SupportedTargets *[]string `json:"supported_targets,omitempty"` } // RegistryAuthToken JWT token for the image registry @@ -1743,6 +1791,9 @@ type CreatePluginVersionJSONBody struct { // Protocols The CloudQuery protocols supported by this plugin version (only protocol 3 is supported by new plugins). Protocols PluginProtocols `json:"protocols"` + // SpecJsonSchema The specification of the plugin. This is a JSON schema that describes the configuration of the plugin. + SpecJsonSchema *PluginSpecJSONSchema `json:"spec_json_schema,omitempty"` + // SupportedTargets The targets supported by this plugin version, formatted as _ SupportedTargets []string `json:"supported_targets"` } diff --git a/spec.json b/spec.json index 890a378..f4c099c 100644 --- a/spec.json +++ b/spec.json @@ -35,21 +35,12 @@ { "name": "plugins" }, - { - "name": "uploads" - }, { "name": "images" }, { "name": "healthcheck" }, - { - "name": "limits" - }, - { - "name": "usage" - }, { "name": "addons" }, @@ -724,7 +715,7 @@ "properties": { "items": { "items": { - "$ref": "#/components/schemas/PluginVersion" + "$ref": "#/components/schemas/PluginVersionList" }, "type": "array" }, @@ -863,6 +854,9 @@ }, "package_type": { "$ref": "#/components/schemas/PluginPackageType" + }, + "spec_json_schema": { + "$ref": "#/components/schemas/PluginSpecJSONSchema" } } } @@ -6097,7 +6091,7 @@ "docker" ] }, - "PluginVersion": { + "PluginVersionBase": { "additionalProperties": false, "description": "CloudQuery Plugin Version", "required": [ @@ -6169,6 +6163,32 @@ "title": "CloudQuery Plugin Version", "type": "object" }, + "PluginVersionList": { + "allOf": [ + { + "$ref": "#/components/schemas/PluginVersionBase" + } + ] + }, + "PluginSpecJSONSchema": { + "description": "The specification of the plugin. This is a JSON schema that describes the configuration of the plugin.", + "type": "string" + }, + "PluginVersion": { + "allOf": [ + { + "$ref": "#/components/schemas/PluginVersionBase" + }, + { + "type": "object", + "properties": { + "spec_json_schema": { + "$ref": "#/components/schemas/PluginSpecJSONSchema" + } + } + } + ] + }, "PluginVersionDetails": { "allOf": [ { @@ -6223,6 +6243,9 @@ "package_type": { "type": "string", "description": "The package type of the plugin binaries" + }, + "spec_json_schema": { + "$ref": "#/components/schemas/PluginSpecJSONSchema" } } }, @@ -7996,11 +8019,13 @@ "cpu": { "type": "string", "description": "CPU quota for the sync", + "example": "1", "x-go-name": "CPU" }, "memory": { "type": "string", - "description": "Memory quota for the sync" + "description": "Memory quota for the sync", + "example": "2Gi" }, "created_at": { "type": "string",