exoscale / egoscale

exoscale golang bindings
https://pkg.go.dev/github.com/exoscale/egoscale/v3
Apache License 2.0
31 stars 14 forks source link

Update oapi & patch the codegen bug #580

Closed kobajagi closed 1 year ago

kobajagi commented 1 year ago

This PR updates oapi code. Due to a bug in deepmap/oapi-codegen generated code was manually patched by reverting particular code block (nested slice of Instance).

shortcut-integration[bot] commented 1 year ago

This pull request has been linked to Shortcut Story #65724: Grafana: CLI integration.

kobajagi commented 1 year ago

DIff between generated code and patched code:

diff --git a/v2/oapi/oapi.gen.go b/v2/oapi/oapi.gen.go
index 8d66a78..254ddcf 100644
--- a/v2/oapi/oapi.gen.go
+++ b/v2/oapi/oapi.gen.go
@@ -22557,7 +22557,48 @@ type ListInstancesResponse struct {
    Body         []byte
    HTTPResponse *http.Response
    JSON200      *struct {
-       Instances *[]Instance `json:"instances,omitempty"`
+       Instances *[]struct {
+           // Instance creation date
+           CreatedAt *time.Time `json:"created-at,omitempty"`
+
+           // Instance ID
+           Id *string `json:"id,omitempty"`
+
+           // Compute instance type
+           InstanceType *InstanceType `json:"instance-type,omitempty"`
+
+           // Instance IPv6 address
+           Ipv6Address *string `json:"ipv6-address,omitempty"`
+           Labels      *Labels `json:"labels,omitempty"`
+
+           // Resource manager
+           Manager *Manager `json:"manager,omitempty"`
+
+           // Instance name
+           Name *string `json:"name,omitempty"`
+
+           // Instance Private Networks
+           PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"`
+
+           // Instance public IPv4 address
+           PublicIp           *string             `json:"public-ip,omitempty"`
+           PublicIpAssignment *PublicIpAssignment `json:"public-ip-assignment,omitempty"`
+
+           // Instance Security Groups
+           SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"`
+
+           // SSH key
+           SshKey *SshKey `json:"ssh-key,omitempty"`
+
+           // Instance SSH Keys
+           SshKeys *[]SshKey `json:"ssh-keys,omitempty"`
+
+           // Instance state
+           State *N200InstancesState `json:"state,omitempty"`
+
+           // Instance template
+           Template *Template `json:"template,omitempty"`
+       } `json:"instances,omitempty"`
    }
 }

@@ -30929,7 +30970,48 @@ func ParseListInstancesResponse(rsp *http.Response) (*ListInstancesResponse, err
    switch {
    case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
        var dest struct {
-           Instances *[]Instance `json:"instances,omitempty"`
+           Instances *[]struct {
+               // Instance creation date
+               CreatedAt *time.Time `json:"created-at,omitempty"`
+
+               // Instance ID
+               Id *string `json:"id,omitempty"`
+
+               // Compute instance type
+               InstanceType *InstanceType `json:"instance-type,omitempty"`
+
+               // Instance IPv6 address
+               Ipv6Address *string `json:"ipv6-address,omitempty"`
+               Labels      *Labels `json:"labels,omitempty"`
+
+               // Resource manager
+               Manager *Manager `json:"manager,omitempty"`
+
+               // Instance name
+               Name *string `json:"name,omitempty"`
+
+               // Instance Private Networks
+               PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"`
+
+               // Instance public IPv4 address
+               PublicIp           *string             `json:"public-ip,omitempty"`
+               PublicIpAssignment *PublicIpAssignment `json:"public-ip-assignment,omitempty"`
+
+               // Instance Security Groups
+               SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"`
+
+               // SSH key
+               SshKey *SshKey `json:"ssh-key,omitempty"`
+
+               // Instance SSH Keys
+               SshKeys *[]SshKey `json:"ssh-keys,omitempty"`
+
+               // Instance state
+               State *N200InstancesState `json:"state,omitempty"`
+
+               // Instance template
+               Template *Template `json:"template,omitempty"`
+           } `json:"instances,omitempty"`
        }
        if err := json.Unmarshal(bodyBytes, &dest); err != nil {
            return nil, err