github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/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 GetMachineInfoRequest struct {
    29  	Hostname string
    30  }
    31  
    32  type GetMachineInfoResponse struct {
    33  	Error    string          `json:",omitempty"`
    34  	Location string          `json:",omitempty"`
    35  	Machine  Machine         `json:",omitempty"`
    36  	Subnets  []*proto.Subnet `json:",omitempty"`
    37  }
    38  
    39  // The GetUpdates() RPC is fully streamed.
    40  // The client sends a single GetUpdatesRequest message.
    41  // The server sends a stream of Update messages.
    42  
    43  type GetUpdatesRequest struct {
    44  	Location   string
    45  	MaxUpdates uint64 // Zero means infinite.
    46  }
    47  
    48  type Update struct {
    49  	ChangedMachines []*Machine               `json:",omitempty"`
    50  	ChangedVMs      map[string]*proto.VmInfo `json:",omitempty"` // Key: IPaddr
    51  	DeletedMachines []string                 `json:",omitempty"` // Hostname
    52  	DeletedVMs      []string                 `json:",omitempty"` // IPaddr
    53  	Error           string                   `json:",omitempty"`
    54  }
    55  
    56  type HardwareAddr net.HardwareAddr
    57  
    58  type ListHypervisorLocationsRequest struct {
    59  	TopLocation string
    60  }
    61  
    62  type ListHypervisorLocationsResponse struct {
    63  	Locations []string
    64  	Error     string
    65  }
    66  
    67  type ListHypervisorsInLocationRequest struct {
    68  	IncludeUnhealthy bool
    69  	Location         string
    70  	SubnetId         string
    71  }
    72  
    73  type ListHypervisorsInLocationResponse struct {
    74  	HypervisorAddresses []string // host:port
    75  	Error               string
    76  }
    77  
    78  type ListVMsInLocationRequest struct {
    79  	Location string
    80  }
    81  
    82  // A stream of ListVMsInLocationResponse messages is sent, until either the
    83  // length of the IpAddresses field is zero, or the Error field != "".
    84  type ListVMsInLocationResponse struct {
    85  	IpAddresses []net.IP
    86  	Error       string
    87  }
    88  
    89  type Machine struct {
    90  	GatewaySubnetId         string `json:",omitempty"`
    91  	NetworkEntry            `json:",omitempty"`
    92  	IPMI                    NetworkEntry   `json:",omitempty"`
    93  	OwnerGroups             []string       `json:",omitempty"`
    94  	OwnerUsers              []string       `json:",omitempty"`
    95  	SecondaryNetworkEntries []NetworkEntry `json:",omitempty"`
    96  	Tags                    tags.Tags      `json:",omitempty"`
    97  }
    98  
    99  type MoveIpAddressesRequest struct {
   100  	HypervisorHostname string
   101  	IpAddresses        []net.IP
   102  }
   103  
   104  type MoveIpAddressesResponse struct {
   105  	Error string
   106  }
   107  
   108  type NetworkEntry struct {
   109  	Hostname       string       `json:",omitempty"`
   110  	HostIpAddress  net.IP       `json:",omitempty"`
   111  	HostMacAddress HardwareAddr `json:",omitempty"`
   112  	SubnetId       string       `json:",omitempty"`
   113  	VlanTrunk      bool         `json:",omitempty"`
   114  }
   115  
   116  type PowerOnMachineRequest struct {
   117  	Hostname string
   118  }
   119  
   120  type PowerOnMachineResponse struct {
   121  	Error string
   122  }