From 4efa02035d9a12f7d75f8315102853161a44e42d Mon Sep 17 00:00:00 2001 From: Bill Gale Date: Tue, 19 Mar 2024 13:35:42 +0000 Subject: [PATCH] chore: add make targets for getting schema and generating --- Makefile | 8 ++++++++ README.md | 2 +- go.mod | 2 +- go.sum | 7 +++---- next/client.go | 10 ++++++++-- next/katapult-openapi.json | 26 ++++++++++++++++++++++++-- 6 files changed, 45 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b46af44..8592bde 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,10 @@ check-generate: ( diff -rN "$(CURDIR)" "$(CHKDIR)" && rm -rf "$(CHKDIR)" ) || \ ( rm -rf "$(CHKDIR)" && exit 1 ) +.PHONY: generate-next +generate-next: + ( cd ./next && ./generate.sh ) + # # Katapult API Schemas # @@ -133,6 +137,10 @@ check-schemas: ( diff -rN "$(CURDIR)/schemas" "$(CHKDIR)/schemas" && rm -rf "$(CHKDIR)" ) \ || ( rm -rf "$(CHKDIR)" && exit 1 ) +.PHONY: retrieve-openapi-schema +retrieve-openapi-schema: + wget -O next/katapult-openapi.json https://api.katapult.io/core/v1/schema/openapi.json + # # Coverage # diff --git a/README.md b/README.md index 340a446..85684c3 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Documentation: -# Next Client +# Experimental "next" Client A more feature complete client is being generated in the `next` package. The aim for this client is to be generated from an openapi spec and should offer access to everything that is documented / exposed in our API documentation. diff --git a/go.mod b/go.mod index 17d1cec..273c9a3 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/augurysys/timestamp v0.3.2 github.com/dave/jennifer v1.6.0 - github.com/deepmap/oapi-codegen/v2 v2.0.0 + github.com/deepmap/oapi-codegen/v2 v2.1.0 github.com/hashicorp/go-hclog v1.4.0 github.com/jimeh/go-golden v0.1.0 github.com/jimeh/rands v0.3.0 diff --git a/go.sum b/go.sum index e3ebc8a..7be7cae 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/dave/jennifer v1.6.0/go.mod h1:AxTG893FiZKqxy3FP1kL80VMshSMuz2G+Egvsz github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deepmap/oapi-codegen/v2 v2.0.0 h1:3TS7w3r+XnjKFXcbFbc16pTWzfTy0OLPkCsutEHjWDA= -github.com/deepmap/oapi-codegen/v2 v2.0.0/go.mod h1:7zR+ZL3WzLeCkr2k8oWTxEa0v8y/F25ane0l6A5UjLA= +github.com/deepmap/oapi-codegen/v2 v2.1.0 h1:I/NMVhJCtuvL9x+S2QzZKpSjGi33oDZwPRdemvOZWyQ= +github.com/deepmap/oapi-codegen/v2 v2.1.0/go.mod h1:R1wL226vc5VmCNJUvMyYr3hJMm5reyv25j952zAVXZ8= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= @@ -54,7 +54,6 @@ github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HK github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -106,8 +105,8 @@ golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/next/client.go b/next/client.go index 8113ed0..379fed2 100644 --- a/next/client.go +++ b/next/client.go @@ -968,6 +968,7 @@ type DeleteVirtualMachine200ResponseVirtualMachine struct { State *VirtualMachineStateEnum `json:"state,omitempty"` TagNames *[]string `json:"tag_names,omitempty"` Tags *[]Tag `json:"tags,omitempty"` + UseDedicatedCpus *bool `json:"use_dedicated_cpus"` Zone *Zone `json:"zone,omitempty"` } @@ -1799,6 +1800,7 @@ type GetVirtualMachine200ResponseVirtualMachine struct { State *VirtualMachineStateEnum `json:"state,omitempty"` TagNames *[]string `json:"tag_names,omitempty"` Tags *[]Tag `json:"tags,omitempty"` + UseDedicatedCpus *bool `json:"use_dedicated_cpus"` Zone *Zone `json:"zone,omitempty"` } @@ -2613,6 +2615,7 @@ type PatchVirtualMachine200ResponseVirtualMachine struct { State *VirtualMachineStateEnum `json:"state,omitempty"` TagNames *[]string `json:"tag_names,omitempty"` Tags *[]Tag `json:"tags,omitempty"` + UseDedicatedCpus *bool `json:"use_dedicated_cpus"` Zone *Zone `json:"zone,omitempty"` } @@ -3233,6 +3236,7 @@ type VirtualMachine struct { State *VirtualMachineStateEnum `json:"state,omitempty"` TagNames *[]string `json:"tag_names,omitempty"` Tags *[]Tag `json:"tags,omitempty"` + UseDedicatedCpus *bool `json:"use_dedicated_cpus"` Zone *Zone `json:"zone,omitempty"` } @@ -3270,8 +3274,9 @@ type VirtualMachineDiskAttachmentStateEnum string // VirtualMachineFlexibleResources All 'resources[]' params are mutually exclusive, only one can be provided. type VirtualMachineFlexibleResources struct { - CpuCores int `json:"cpu_cores"` - MemoryInGb int `json:"memory_in_gb"` + CpuCores int `json:"cpu_cores"` + MemoryInGb int `json:"memory_in_gb"` + UseDedicatedCpus *bool `json:"use_dedicated_cpus,omitempty"` } // VirtualMachineGPU defines model for VirtualMachineGPU. @@ -3374,6 +3379,7 @@ type VirtualMachinePackage struct { Permalink *string `json:"permalink,omitempty"` Privacy *PrivacyTypesEnum `json:"privacy,omitempty"` StorageInGb *int `json:"storage_in_gb,omitempty"` + UseDedicatedCpus *bool `json:"use_dedicated_cpus,omitempty"` } // VirtualMachinePackageLookup All 'virtual_machine_package[]' params are mutually exclusive, only one can be provided. diff --git a/next/katapult-openapi.json b/next/katapult-openapi.json index 1f87732..775ad8a 100644 --- a/next/katapult-openapi.json +++ b/next/katapult-openapi.json @@ -7,7 +7,7 @@ }, "servers": [ { - "url": "http://katapult-api.localhost/core/v1" + "url": "https://api.katapult.io/core/v1" } ], "paths": { @@ -10133,6 +10133,10 @@ "type": "integer", "nullable": true }, + "use_dedicated_cpus": { + "type": "boolean", + "nullable": true + }, "gpu_type": { "allOf": [ { @@ -10241,6 +10245,9 @@ } ], "nullable": true + }, + "use_dedicated_cpus": { + "type": "boolean" } } }, @@ -10606,6 +10613,10 @@ "type": "integer", "nullable": true }, + "use_dedicated_cpus": { + "type": "boolean", + "nullable": true + }, "gpu_type": { "allOf": [ { @@ -10730,6 +10741,10 @@ "type": "integer", "nullable": true }, + "use_dedicated_cpus": { + "type": "boolean", + "nullable": true + }, "gpu_type": { "allOf": [ { @@ -10992,6 +11007,9 @@ }, "memory_in_gb": { "type": "integer" + }, + "use_dedicated_cpus": { + "type": "boolean" } }, "required": [ @@ -11927,6 +11945,10 @@ "type": "integer", "nullable": true }, + "use_dedicated_cpus": { + "type": "boolean", + "nullable": true + }, "gpu_type": { "allOf": [ { @@ -16413,4 +16435,4 @@ ] } ] -} +} \ No newline at end of file