Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
904 changed files
with
54,665 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package proxy | ||
|
||
import ( | ||
"github.com/RackHD/neighborhood-manager/rackhd/models" | ||
) | ||
|
||
// GetAddresses fetches services for passed ServiceName. | ||
// It then creates a map with the (ip:port)'s retrieved from the GetService call | ||
func getAllAddresses() (map[string]struct{}, error) { | ||
entries, err := models.GetAllRhd() | ||
if err != nil { | ||
return nil, err | ||
} | ||
addresses := make(map[string]struct{}) | ||
for _, entry := range entries { | ||
http := entry.HTTPConf | ||
addr := http.URL | ||
addresses[addr.Host] = struct{}{} | ||
} | ||
return addresses, nil | ||
} | ||
|
||
func getAddrForNode(uuid string) (string, error) { | ||
entry, err := models.GetRhdIDByNodeID(uuid) | ||
if err != nil { | ||
return "", err | ||
} | ||
return entry, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
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 ( | ||
"encoding/json" | ||
|
||
strfmt "github.com/go-openapi/strfmt" | ||
|
||
"github.com/go-openapi/errors" | ||
"github.com/go-openapi/validate" | ||
) | ||
|
||
// Action Action object | ||
// swagger:model action | ||
type Action struct { | ||
|
||
// Command to execute | ||
// Required: true | ||
Command *string `json:"command"` | ||
|
||
// Command options object | ||
Options interface{} `json:"options,omitempty"` | ||
} | ||
|
||
// Validate validates this action | ||
func (m *Action) Validate(formats strfmt.Registry) error { | ||
var res []error | ||
|
||
if err := m.validateCommand(formats); err != nil { | ||
// prop | ||
res = append(res, err) | ||
} | ||
|
||
if len(res) > 0 { | ||
return errors.CompositeValidationError(res...) | ||
} | ||
return nil | ||
} | ||
|
||
var actionTypeCommandPropEnum []interface{} | ||
|
||
func init() { | ||
var res []string | ||
if err := json.Unmarshal([]byte(`["cancel"]`), &res); err != nil { | ||
panic(err) | ||
} | ||
for _, v := range res { | ||
actionTypeCommandPropEnum = append(actionTypeCommandPropEnum, v) | ||
} | ||
} | ||
|
||
const ( | ||
actionCommandCancel string = "cancel" | ||
) | ||
|
||
// prop value enum | ||
func (m *Action) validateCommandEnum(path, location string, value string) error { | ||
if err := validate.Enum(path, location, value, actionTypeCommandPropEnum); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func (m *Action) validateCommand(formats strfmt.Registry) error { | ||
|
||
if err := validate.Required("command", "body", m.Command); err != nil { | ||
return err | ||
} | ||
|
||
// value enum | ||
if err := m.validateCommandEnum("command", "body", *m.Command); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
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 ( | ||
strfmt "github.com/go-openapi/strfmt" | ||
"github.com/go-openapi/swag" | ||
|
||
"github.com/go-openapi/errors" | ||
"github.com/go-openapi/validate" | ||
) | ||
|
||
// ErrorResponse error response | ||
// swagger:model ErrorResponse | ||
type ErrorResponse struct { | ||
|
||
// errors | ||
Errors []string `json:"errors"` | ||
|
||
// message | ||
// Required: true | ||
Message *string `json:"message"` | ||
} | ||
|
||
// Validate validates this error response | ||
func (m *ErrorResponse) Validate(formats strfmt.Registry) error { | ||
var res []error | ||
|
||
if err := m.validateErrors(formats); err != nil { | ||
// prop | ||
res = append(res, err) | ||
} | ||
|
||
if err := m.validateMessage(formats); err != nil { | ||
// prop | ||
res = append(res, err) | ||
} | ||
|
||
if len(res) > 0 { | ||
return errors.CompositeValidationError(res...) | ||
} | ||
return nil | ||
} | ||
|
||
func (m *ErrorResponse) validateErrors(formats strfmt.Registry) error { | ||
|
||
if swag.IsZero(m.Errors) { // not required | ||
return nil | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (m *ErrorResponse) validateMessage(formats strfmt.Registry) error { | ||
|
||
if err := validate.Required("message", "body", m.Message); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
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 ( | ||
"encoding/json" | ||
|
||
strfmt "github.com/go-openapi/strfmt" | ||
"github.com/go-openapi/swag" | ||
|
||
"github.com/go-openapi/errors" | ||
"github.com/go-openapi/validate" | ||
) | ||
|
||
// Node20PartialNode Post a node in RackHD | ||
// swagger:model node.2.0_PartialNode | ||
type Node20PartialNode struct { | ||
|
||
// auto discover | ||
AutoDiscover string `json:"autoDiscover,omitempty"` | ||
|
||
// Name of the node | ||
Name string `json:"name,omitempty"` | ||
|
||
// Type of node | ||
Type string `json:"type,omitempty"` | ||
} | ||
|
||
// Validate validates this node 2 0 partial node | ||
func (m *Node20PartialNode) Validate(formats strfmt.Registry) error { | ||
var res []error | ||
|
||
if err := m.validateType(formats); err != nil { | ||
// prop | ||
res = append(res, err) | ||
} | ||
|
||
if len(res) > 0 { | ||
return errors.CompositeValidationError(res...) | ||
} | ||
return nil | ||
} | ||
|
||
var node20PartialNodeTypeTypePropEnum []interface{} | ||
|
||
func init() { | ||
var res []string | ||
if err := json.Unmarshal([]byte(`["compute","switch","dae","pdu","mgmt","enclosure","rack"]`), &res); err != nil { | ||
panic(err) | ||
} | ||
for _, v := range res { | ||
node20PartialNodeTypeTypePropEnum = append(node20PartialNodeTypeTypePropEnum, v) | ||
} | ||
} | ||
|
||
const ( | ||
node20PartialNodeTypeCompute string = "compute" | ||
node20PartialNodeTypeSwitch string = "switch" | ||
node20PartialNodeTypeDae string = "dae" | ||
node20PartialNodeTypePdu string = "pdu" | ||
node20PartialNodeTypeMgmt string = "mgmt" | ||
node20PartialNodeTypeEnclosure string = "enclosure" | ||
node20PartialNodeTypeRack string = "rack" | ||
) | ||
|
||
// prop value enum | ||
func (m *Node20PartialNode) validateTypeEnum(path, location string, value string) error { | ||
if err := validate.Enum(path, location, value, node20PartialNodeTypeTypePropEnum); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func (m *Node20PartialNode) validateType(formats strfmt.Registry) error { | ||
|
||
if swag.IsZero(m.Type) { // not required | ||
return nil | ||
} | ||
|
||
// value enum | ||
if err := m.validateTypeEnum("type", "body", m.Type); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
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 ( | ||
"encoding/json" | ||
|
||
strfmt "github.com/go-openapi/strfmt" | ||
"github.com/go-openapi/swag" | ||
|
||
"github.com/go-openapi/errors" | ||
"github.com/go-openapi/validate" | ||
) | ||
|
||
// Poller20PartialPoller A poller for periodic collection of telemetry data | ||
// swagger:model poller.2.0_PartialPoller | ||
type Poller20PartialPoller struct { | ||
|
||
// Poller configuration object | ||
Config interface{} `json:"config,omitempty"` | ||
|
||
// Asserted if poller is paused | ||
Paused bool `json:"paused,omitempty"` | ||
|
||
// Interval at which poller will run | ||
PollInterval float64 `json:"pollInterval,omitempty"` | ||
|
||
// Type of poller | ||
Type string `json:"type,omitempty"` | ||
} | ||
|
||
// Validate validates this poller 2 0 partial poller | ||
func (m *Poller20PartialPoller) Validate(formats strfmt.Registry) error { | ||
var res []error | ||
|
||
if err := m.validateType(formats); err != nil { | ||
// prop | ||
res = append(res, err) | ||
} | ||
|
||
if len(res) > 0 { | ||
return errors.CompositeValidationError(res...) | ||
} | ||
return nil | ||
} | ||
|
||
var poller20PartialPollerTypeTypePropEnum []interface{} | ||
|
||
func init() { | ||
var res []string | ||
if err := json.Unmarshal([]byte(`["ipmi","snmp","redfish"]`), &res); err != nil { | ||
panic(err) | ||
} | ||
for _, v := range res { | ||
poller20PartialPollerTypeTypePropEnum = append(poller20PartialPollerTypeTypePropEnum, v) | ||
} | ||
} | ||
|
||
const ( | ||
poller20PartialPollerTypeIPMI string = "ipmi" | ||
poller20PartialPollerTypeSnmp string = "snmp" | ||
poller20PartialPollerTypeRedfish string = "redfish" | ||
) | ||
|
||
// prop value enum | ||
func (m *Poller20PartialPoller) validateTypeEnum(path, location string, value string) error { | ||
if err := validate.Enum(path, location, value, poller20PartialPollerTypeTypePropEnum); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func (m *Poller20PartialPoller) validateType(formats strfmt.Registry) error { | ||
|
||
if swag.IsZero(m.Type) { // not required | ||
return nil | ||
} | ||
|
||
// value enum | ||
if err := m.validateTypeEnum("type", "body", m.Type); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.