diff --git a/power/models/capability_details.go b/power/models/capability_details.go new file mode 100644 index 00000000..1b2c0f42 --- /dev/null +++ b/power/models/capability_details.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CapabilityDetails capability details +// +// swagger:model CapabilityDetails +type CapabilityDetails struct { + + // Disaster Recovery Information + // Required: true + DisasterRecovery *DisasterRecovery `json:"disasterRecovery"` + + // Datacenter System Types Information + // Required: true + SupportedSystems *SupportedSystems `json:"supportedSystems"` +} + +// Validate validates this capability details +func (m *CapabilityDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisasterRecovery(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSupportedSystems(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilityDetails) validateDisasterRecovery(formats strfmt.Registry) error { + + if err := validate.Required("disasterRecovery", "body", m.DisasterRecovery); err != nil { + return err + } + + if m.DisasterRecovery != nil { + if err := m.DisasterRecovery.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilityDetails) validateSupportedSystems(formats strfmt.Registry) error { + + if err := validate.Required("supportedSystems", "body", m.SupportedSystems); err != nil { + return err + } + + if m.SupportedSystems != nil { + if err := m.SupportedSystems.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// ContextValidate validate this capability details based on the context it is used +func (m *CapabilityDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDisasterRecovery(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSupportedSystems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CapabilityDetails) contextValidateDisasterRecovery(ctx context.Context, formats strfmt.Registry) error { + + if m.DisasterRecovery != nil { + + if err := m.DisasterRecovery.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disasterRecovery") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disasterRecovery") + } + return err + } + } + + return nil +} + +func (m *CapabilityDetails) contextValidateSupportedSystems(ctx context.Context, formats strfmt.Registry) error { + + if m.SupportedSystems != nil { + + if err := m.SupportedSystems.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("supportedSystems") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("supportedSystems") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CapabilityDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CapabilityDetails) UnmarshalBinary(b []byte) error { + var res CapabilityDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/replication_services.go b/power/models/replication_services.go new file mode 100644 index 00000000..637125d0 --- /dev/null +++ b/power/models/replication_services.go @@ -0,0 +1,159 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ReplicationServices replication services +// +// swagger:model ReplicationServices +type ReplicationServices struct { + + // Asynchronous Replication Target Information + // Required: true + AsynchronousReplication *ReplicationService `json:"asynchronousReplication"` + + // Synchronous Replication Target Information + SynchronousReplication *ReplicationService `json:"synchronousReplication,omitempty"` +} + +// Validate validates this replication services +func (m *ReplicationServices) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAsynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSynchronousReplication(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationServices) validateAsynchronousReplication(formats strfmt.Registry) error { + + if err := validate.Required("asynchronousReplication", "body", m.AsynchronousReplication); err != nil { + return err + } + + if m.AsynchronousReplication != nil { + if err := m.AsynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *ReplicationServices) validateSynchronousReplication(formats strfmt.Registry) error { + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if m.SynchronousReplication != nil { + if err := m.SynchronousReplication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// ContextValidate validate this replication services based on the context it is used +func (m *ReplicationServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAsynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSynchronousReplication(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReplicationServices) contextValidateAsynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.AsynchronousReplication != nil { + + if err := m.AsynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("asynchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("asynchronousReplication") + } + return err + } + } + + return nil +} + +func (m *ReplicationServices) contextValidateSynchronousReplication(ctx context.Context, formats strfmt.Registry) error { + + if m.SynchronousReplication != nil { + + if swag.IsZero(m.SynchronousReplication) { // not required + return nil + } + + if err := m.SynchronousReplication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("synchronousReplication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("synchronousReplication") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ReplicationServices) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReplicationServices) UnmarshalBinary(b []byte) error { + var res ReplicationServices + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}