diff --git a/power/models/available_host_capacity.go b/power/models/available_host_capacity.go index 1b4ec156..0aed652d 100644 --- a/power/models/available_host_capacity.go +++ b/power/models/available_host_capacity.go @@ -21,7 +21,7 @@ type AvailableHostCapacity struct { // Core capacity of the host Cores *AvailableHostResourceCapacity `json:"cores,omitempty"` - // Memory capacity of the host (in MB) + // Memory capacity of the host (in GB) Memory *AvailableHostResourceCapacity `json:"memory,omitempty"` } diff --git a/power/models/available_host_resource_capacity.go b/power/models/available_host_resource_capacity.go index ba0e0591..9f0f852d 100644 --- a/power/models/available_host_resource_capacity.go +++ b/power/models/available_host_resource_capacity.go @@ -8,8 +8,10 @@ package models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // AvailableHostResourceCapacity available host resource capacity @@ -17,12 +19,31 @@ import ( // swagger:model AvailableHostResourceCapacity type AvailableHostResourceCapacity struct { - // available - Available float64 `json:"available,omitempty"` + // total + // Required: true + Total *float64 `json:"total"` } // Validate validates this available host resource capacity func (m *AvailableHostResourceCapacity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTotal(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AvailableHostResourceCapacity) validateTotal(formats strfmt.Registry) error { + + if err := validate.Required("total", "body", m.Total); err != nil { + return err + } + return nil } diff --git a/power/models/host_capacity.go b/power/models/host_capacity.go index 9ded7f72..506c43e5 100644 --- a/power/models/host_capacity.go +++ b/power/models/host_capacity.go @@ -21,7 +21,7 @@ type HostCapacity struct { // Core capacity of the host Cores *HostResourceCapacity `json:"cores,omitempty"` - // Memory capacity of the host (in MB) + // Memory capacity of the host (in GB) Memory *HostResourceCapacity `json:"memory,omitempty"` } diff --git a/power/models/host_group.go b/power/models/host_group.go index 91c21cd7..2effa932 100644 --- a/power/models/host_group.go +++ b/power/models/host_group.go @@ -33,10 +33,10 @@ type HostGroup struct { // Name of the host group Name string `json:"name,omitempty"` - // Name of the workspace owning the host group + // ID of the workspace owning the host group Primary string `json:"primary,omitempty"` - // Names of workspaces the host group has been shared with + // IDs of workspaces the host group has been shared with Secondaries []string `json:"secondaries"` } diff --git a/power/models/host_group_create.go b/power/models/host_group_create.go index ddd5fc9f..48f3e169 100644 --- a/power/models/host_group_create.go +++ b/power/models/host_group_create.go @@ -28,7 +28,7 @@ type HostGroupCreate struct { // Required: true Name *string `json:"name"` - // List of workspace names to share the host group with (optional) + // List of workspaces to share the host group with (optional) Secondaries []*Secondary `json:"secondaries"` } diff --git a/power/models/host_group_share_op.go b/power/models/host_group_share_op.go index fe1f2c99..f90d9d17 100644 --- a/power/models/host_group_share_op.go +++ b/power/models/host_group_share_op.go @@ -19,10 +19,10 @@ import ( // swagger:model HostGroupShareOp type HostGroupShareOp struct { - // List of workspace names to share the host group with + // List of workspaces to share the host group with Add []*Secondary `json:"add"` - // A workspace name to stop sharing the host group with + // A workspace ID to stop sharing the host group with Remove string `json:"remove,omitempty"` } diff --git a/power/models/host_resource_capacity.go b/power/models/host_resource_capacity.go index 4814c505..6f1943e7 100644 --- a/power/models/host_resource_capacity.go +++ b/power/models/host_resource_capacity.go @@ -8,8 +8,10 @@ package models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // HostResourceCapacity host resource capacity @@ -18,20 +20,81 @@ import ( type HostResourceCapacity struct { // available - Available float64 `json:"available,omitempty"` + // Required: true + Available *float64 `json:"available"` // reserved - Reserved float64 `json:"reserved,omitempty"` + // Required: true + Reserved *float64 `json:"reserved"` // total - Total float64 `json:"total,omitempty"` + // Required: true + Total *float64 `json:"total"` // used - Used float64 `json:"used,omitempty"` + // Required: true + Used *float64 `json:"used"` } // Validate validates this host resource capacity func (m *HostResourceCapacity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAvailable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReserved(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsed(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostResourceCapacity) validateAvailable(formats strfmt.Registry) error { + + if err := validate.Required("available", "body", m.Available); err != nil { + return err + } + + return nil +} + +func (m *HostResourceCapacity) validateReserved(formats strfmt.Registry) error { + + if err := validate.Required("reserved", "body", m.Reserved); err != nil { + return err + } + + return nil +} + +func (m *HostResourceCapacity) validateTotal(formats strfmt.Registry) error { + + if err := validate.Required("total", "body", m.Total); err != nil { + return err + } + + return nil +} + +func (m *HostResourceCapacity) validateUsed(formats strfmt.Registry) error { + + if err := validate.Required("used", "body", m.Used); err != nil { + return err + } + return nil } diff --git a/power/models/secondary.go b/power/models/secondary.go index 63bca7d5..a312c5ea 100644 --- a/power/models/secondary.go +++ b/power/models/secondary.go @@ -22,7 +22,7 @@ type Secondary struct { // Name of the host group to create in the secondary workspace Name string `json:"name,omitempty"` - // Name of the workspace to share the host group with + // ID of the workspace to share the host group with // Required: true Workspace *string `json:"workspace"` }