github.com/Cloud-Foundations/Dominator@v0.3.4/proto/fleetmanager/messages.go (about)

     1  package fleetmanager
     2  
     3  import (
     4  	"net"
     5  
     6  	"github.com/Cloud-Foundations/Dominator/lib/tags"
     7  	proto "github.com/Cloud-Foundations/Dominator/proto/hypervisor"
     8  )
     9  
    10  type ChangeMachineTagsRequest struct {
    11  	Hostname string
    12  	Tags     tags.Tags
    13  }
    14  
    15  type ChangeMachineTagsResponse struct {
    16  	Error string
    17  }
    18  
    19  type GetHypervisorForVMRequest struct {
    20  	IpAddress net.IP
    21  }
    22  
    23  type GetHypervisorForVMResponse struct {
    24  	HypervisorAddress string // host:port
    25  	Error             string
    26  }
    27  
    28  type GetHypervisorsInLocationRequest struct {
    29  	HypervisorTagsToMatch tags.MatchTags // Empty: match all tags.
    30  	IncludeUnhealthy      bool
    31  	IncludeVMs            bool
    32  	Location              string
    33  	SubnetId              string
    34  }
    35  
    36  type GetHypervisorsInLocationResponse struct {
    37  	Error       string
    38  	Hypervisors []Hypervisor `json:",omitempty"`
    39  }
    40  
    41  type Hypervisor struct {
    42  	AllocatedMilliCPUs   uint64 `json:",omitempty"`
    43  	AllocatedMemory      uint64 `json:",omitempty"`
    44  	AllocatedVolumeBytes uint64 `json:",omitempty"`
    45  	Machine
    46  	VMs []proto.VmInfo `json:",omitempty"`
    47  }
    48  
    49  type GetMachineInfoRequest struct {
    50  	Hostname               string
    51  	IgnoreMissingLocalTags bool
    52  }
    53  
    54  type GetMachineInfoResponse struct {
    55  	Error    string          `json:",omitempty"`
    56  	Location string          `json:",omitempty"`
    57  	Machine  Machine         `json:",omitempty"`
    58  	Subnets  []*proto.Subnet `json:",omitempty"`
    59  }
    60  
    61  // The GetUpdates() RPC is fully streamed.
    62  // The client sends a single GetUpdatesRequest message.
    63  // The server sends a stream of Update messages.
    64  
    65  type GetUpdatesRequest struct {
    66  	IgnoreMissingLocalTags bool
    67  	Location               string
    68  	MaxUpdates             uint64 // Zero means infinite.
    69  }
    70  
    71  type Update struct {
    72  	ChangedMachines []*Machine               `json:",omitempty"`
    73  	ChangedVMs      map[string]*proto.VmInfo `json:",omitempty"` // Key: IPaddr
    74  	DeletedMachines []string                 `json:",omitempty"` // Hostname
    75  	DeletedVMs      []string                 `json:",omitempty"` // IPaddr
    76  	Error           string                   `json:",omitempty"`
    77  	VmToHypervisor  map[string]string        `json:",omitempty"` // IP:hostname
    78  }
    79  
    80  type HardwareAddr net.HardwareAddr
    81  
    82  type ListHypervisorLocationsRequest struct {
    83  	TopLocation string
    84  }
    85  
    86  type ListHypervisorLocationsResponse struct {
    87  	Locations []string
    88  	Error     string
    89  }
    90  
    91  type ListHypervisorsInLocationRequest struct {
    92  	HypervisorTagsToMatch tags.MatchTags // Empty: match all tags.
    93  	IncludeUnhealthy      bool
    94  	Location              string
    95  	SubnetId              string
    96  	TagsToInclude         []string
    97  }
    98  
    99  type ListHypervisorsInLocationResponse struct {
   100  	Error               string
   101  	HypervisorAddresses []string    // host:port
   102  	TagsForHypervisors  []tags.Tags `json:",omitempty"`
   103  }
   104  
   105  type ListVMsInLocationRequest struct {
   106  	HypervisorTagsToMatch tags.MatchTags // Empty: match all tags.
   107  	Location              string
   108  	OwnerGroups           []string
   109  	OwnerUsers            []string
   110  	VmTagsToMatch         tags.MatchTags // Empty: match all tags.
   111  }
   112  
   113  // A stream of ListVMsInLocationResponse messages is sent, until either the
   114  // length of the IpAddresses field is zero, or the Error field != "".
   115  type ListVMsInLocationResponse struct {
   116  	IpAddresses []net.IP
   117  	Error       string
   118  }
   119  
   120  type Machine struct {
   121  	GatewaySubnetId         string `json:",omitempty"`
   122  	Location                string `json:",omitempty"`
   123  	MemoryInMiB             uint64 `json:",omitempty"`
   124  	NetworkEntry            `json:",omitempty"`
   125  	NumCPUs                 uint           `json:",omitempty"`
   126  	IPMI                    NetworkEntry   `json:",omitempty"`
   127  	OwnerGroups             []string       `json:",omitempty"`
   128  	OwnerUsers              []string       `json:",omitempty"`
   129  	SecondaryNetworkEntries []NetworkEntry `json:",omitempty"`
   130  	Tags                    tags.Tags      `json:",omitempty"`
   131  	TotalVolumeBytes        uint64         `json:",omitempty"`
   132  }
   133  
   134  type MoveIpAddressesRequest struct {
   135  	HypervisorHostname string
   136  	IpAddresses        []net.IP
   137  }
   138  
   139  type MoveIpAddressesResponse struct {
   140  	Error string
   141  }
   142  
   143  type NetworkEntry struct {
   144  	Hostname       string       `json:",omitempty"`
   145  	HostIpAddress  net.IP       `json:",omitempty"`
   146  	HostMacAddress HardwareAddr `json:",omitempty"`
   147  	SubnetId       string       `json:",omitempty"`
   148  	VlanTrunk      bool         `json:",omitempty"`
   149  }
   150  
   151  type PowerOnMachineRequest struct {
   152  	Hostname string
   153  }
   154  
   155  type PowerOnMachineResponse struct {
   156  	Error string
   157  }