diff --git a/VERSION_OMICRON b/VERSION_OMICRON index 2845ca0..56a1549 100644 --- a/VERSION_OMICRON +++ b/VERSION_OMICRON @@ -1 +1 @@ -e036c80 \ No newline at end of file +b537d4e diff --git a/internal/generate/main.go b/internal/generate/main.go index fc72cf1..0239baf 100644 --- a/internal/generate/main.go +++ b/internal/generate/main.go @@ -9,6 +9,7 @@ import ( "net/url" "os" "path/filepath" + "strings" "github.com/getkin/kin-openapi/openapi3" ) @@ -58,7 +59,7 @@ func loadAPIFromFile(file string) (*openapi3.T, error) { if err != nil { return nil, fmt.Errorf("error retrieving Omicron version: %v", err) } - ov := string(omicronVersion) + ov := strings.TrimSpace(string(omicronVersion)) // TODO: actually host the spec here. // uri := "https://api.oxide.computer" diff --git a/oxide/paths.go b/oxide/paths.go index 2b571f5..6f1df8e 100644 --- a/oxide/paths.go +++ b/oxide/paths.go @@ -8286,7 +8286,7 @@ func (c *Client) NetworkingSwitchPortSettingsListAllPages(ctx context.Context, p } // NetworkingSwitchPortSettingsCreate: Create switch port settings -func (c *Client) NetworkingSwitchPortSettingsCreate(ctx context.Context, params NetworkingSwitchPortSettingsCreateParams) (*SwitchPortSettingsView, error) { +func (c *Client) NetworkingSwitchPortSettingsCreate(ctx context.Context, params NetworkingSwitchPortSettingsCreateParams) (*SwitchPortSettingsWithChecksum, error) { if err := params.Validate(); err != nil { return nil, err } @@ -8326,7 +8326,7 @@ func (c *Client) NetworkingSwitchPortSettingsCreate(ctx context.Context, params return nil, errors.New("request returned an empty body in the response") } - var body SwitchPortSettingsView + var body SwitchPortSettingsWithChecksum if err := json.NewDecoder(resp.Body).Decode(&body); err != nil { return nil, fmt.Errorf("error decoding response body: %v", err) } @@ -8371,7 +8371,7 @@ func (c *Client) NetworkingSwitchPortSettingsDelete(ctx context.Context, params } // NetworkingSwitchPortSettingsView: Get information about switch port -func (c *Client) NetworkingSwitchPortSettingsView(ctx context.Context, params NetworkingSwitchPortSettingsViewParams) (*SwitchPortSettingsView, error) { +func (c *Client) NetworkingSwitchPortSettingsView(ctx context.Context, params NetworkingSwitchPortSettingsViewParams) (*SwitchPortSettingsWithChecksum, error) { if err := params.Validate(); err != nil { return nil, err } @@ -8407,7 +8407,7 @@ func (c *Client) NetworkingSwitchPortSettingsView(ctx context.Context, params Ne return nil, errors.New("request returned an empty body in the response") } - var body SwitchPortSettingsView + var body SwitchPortSettingsWithChecksum if err := json.NewDecoder(resp.Body).Decode(&body); err != nil { return nil, fmt.Errorf("error decoding response body: %v", err) } diff --git a/oxide/types.go b/oxide/types.go index 92b3b14..7c08837 100644 --- a/oxide/types.go +++ b/oxide/types.go @@ -5561,8 +5561,23 @@ type SwitchPortAddressConfig struct { // Required fields: // - PortSettings type SwitchPortApplySettings struct { - // PortSettings is a name or id to use when applying switch port settings. - PortSettings NameOrId `json:"port_settings,omitempty" yaml:"port_settings,omitempty"` + // PortSettings is name or ID of the desired configuration + PortSettings NameOrId `json:"port_settings,omitempty" yaml:"port_settings,omitempty"` + Precondition SwitchPortApplySettingsChecksums `json:"precondition,omitempty" yaml:"precondition,omitempty"` +} + +// SwitchPortApplySettingsChecksums is parameters for applying a precondition to SwitchPortApplySettings +// +// Required fields: +// - NewSettingsChecksum +type SwitchPortApplySettingsChecksums struct { + // CurrentSettingsChecksum is md5 checksum of current SwitchPortApplySettings body This field protects against + // concurrent modification of `SwitchPortApplySettings` Set to `None` if you expect there to not be any settings + // currently applied. + CurrentSettingsChecksum string `json:"current_settings_checksum,omitempty" yaml:"current_settings_checksum,omitempty"` + // NewSettingsChecksum is md5 checksum of the desired configuration body This field ensures that the port + // settings you are applying have not been modified since you last viewed them + NewSettingsChecksum string `json:"new_settings_checksum,omitempty" yaml:"new_settings_checksum,omitempty"` } // SwitchPortConfig is a physical port configuration for a port settings object. @@ -5707,6 +5722,8 @@ type SwitchPortSettingsCreate struct { Name Name `json:"name,omitempty" yaml:"name,omitempty"` // PortConfig is physical switch port configuration. PortConfig SwitchPortConfigCreate `json:"port_config,omitempty" yaml:"port_config,omitempty"` + // Precondition is optional checksum to provide for detecting conflicting concurrent updates + Precondition string `json:"precondition,omitempty" yaml:"precondition,omitempty"` // Routes is routes indexed by interface name. Routes RouteConfig `json:"routes,omitempty" yaml:"routes,omitempty"` } @@ -5776,6 +5793,18 @@ type SwitchPortSettingsView struct { VlanInterfaces []SwitchVlanInterfaceConfig `json:"vlan_interfaces,omitempty" yaml:"vlan_interfaces,omitempty"` } +// SwitchPortSettingsWithChecksum is the type definition for a SwitchPortSettingsWithChecksum. +// +// Required fields: +// - Checksum +// - Value +type SwitchPortSettingsWithChecksum struct { + // Checksum is checksum of value to use for concurrency control + Checksum string `json:"checksum,omitempty" yaml:"checksum,omitempty"` + // Value is value of response + Value SwitchPortSettingsView `json:"value,omitempty" yaml:"value,omitempty"` +} + // SwitchResultsPage is a single page of results // // Required fields: