Update Lego
This commit is contained in:
parent
36966da701
commit
253060b4f3
185 changed files with 16653 additions and 3210 deletions
184
vendor/github.com/exoscale/egoscale/nics.go
generated
vendored
184
vendor/github.com/exoscale/egoscale/nics.go
generated
vendored
|
@ -1,57 +1,69 @@
|
|||
package egoscale
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
"net"
|
||||
)
|
||||
|
||||
// Nic represents a Network Interface Controller (NIC)
|
||||
//
|
||||
// See: http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/latest/networking_and_traffic.html#configuring-multiple-ip-addresses-on-a-single-nic
|
||||
type Nic struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
BroadcastURI string `json:"broadcasturi,omitempty"`
|
||||
Gateway net.IP `json:"gateway,omitempty"`
|
||||
IP6Address net.IP `json:"ip6address,omitempty"`
|
||||
IP6Cidr string `json:"ip6cidr,omitempty"`
|
||||
IP6Gateway net.IP `json:"ip6gateway,omitempty"`
|
||||
IPAddress net.IP `json:"ipaddress,omitempty"`
|
||||
IsDefault bool `json:"isdefault,omitempty"`
|
||||
IsolationURI string `json:"isolationuri,omitempty"`
|
||||
MacAddress string `json:"macaddress,omitempty"`
|
||||
Netmask net.IP `json:"netmask,omitempty"`
|
||||
NetworkID string `json:"networkid,omitempty"`
|
||||
NetworkName string `json:"networkname,omitempty"`
|
||||
SecondaryIP []NicSecondaryIP `json:"secondaryip,omitempty"`
|
||||
Traffictype string `json:"traffictype,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
VirtualMachineID string `json:"virtualmachineid,omitempty"`
|
||||
BroadcastURI string `json:"broadcasturi,omitempty" doc:"the broadcast uri of the nic"`
|
||||
DeviceID *UUID `json:"deviceid,omitempty" doc:"device id for the network when plugged into the virtual machine"`
|
||||
Gateway net.IP `json:"gateway,omitempty" doc:"the gateway of the nic"`
|
||||
ID *UUID `json:"id,omitempty" doc:"the ID of the nic"`
|
||||
IP6Address net.IP `json:"ip6address,omitempty" doc:"the IPv6 address of network"`
|
||||
IP6CIDR *CIDR `json:"ip6cidr,omitempty" doc:"the cidr of IPv6 network"`
|
||||
IP6Gateway net.IP `json:"ip6gateway,omitempty" doc:"the gateway of IPv6 network"`
|
||||
IPAddress net.IP `json:"ipaddress,omitempty" doc:"the ip address of the nic"`
|
||||
IsDefault bool `json:"isdefault,omitempty" doc:"true if nic is default, false otherwise"`
|
||||
IsolationURI string `json:"isolationuri,omitempty" doc:"the isolation uri of the nic"`
|
||||
MACAddress MACAddress `json:"macaddress,omitempty" doc:"true if nic is default, false otherwise"`
|
||||
Netmask net.IP `json:"netmask,omitempty" doc:"the netmask of the nic"`
|
||||
NetworkID *UUID `json:"networkid,omitempty" doc:"the ID of the corresponding network"`
|
||||
NetworkName string `json:"networkname,omitempty" doc:"the name of the corresponding network"`
|
||||
ReverseDNS []ReverseDNS `json:"reversedns,omitempty" doc:"the list of PTR record(s) associated with the virtual machine"`
|
||||
SecondaryIP []NicSecondaryIP `json:"secondaryip,omitempty" doc:"the Secondary ipv4 addr of nic"`
|
||||
TrafficType string `json:"traffictype,omitempty" doc:"the traffic type of the nic"`
|
||||
Type string `json:"type,omitempty" doc:"the type of the nic"`
|
||||
VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"Id of the vm to which the nic belongs"`
|
||||
}
|
||||
|
||||
// ListRequest build a ListNics request from the given Nic
|
||||
func (nic Nic) ListRequest() (ListCommand, error) {
|
||||
if nic.VirtualMachineID == nil {
|
||||
return nil, errors.New("command ListNics requires the VirtualMachineID field to be set")
|
||||
}
|
||||
|
||||
req := &ListNics{
|
||||
VirtualMachineID: nic.VirtualMachineID,
|
||||
NicID: nic.ID,
|
||||
NetworkID: nic.NetworkID,
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NicSecondaryIP represents a link between NicID and IPAddress
|
||||
type NicSecondaryIP struct {
|
||||
ID string `json:"id"`
|
||||
IPAddress net.IP `json:"ipaddress"`
|
||||
NetworkID string `json:"networkid"`
|
||||
NicID string `json:"nicid"`
|
||||
VirtualMachineID string `json:"virtualmachineid,omitempty"`
|
||||
ID *UUID `json:"id,omitempty" doc:"the ID of the secondary private IP addr"`
|
||||
IPAddress net.IP `json:"ipaddress,omitempty" doc:"Secondary IP address"`
|
||||
NetworkID *UUID `json:"networkid,omitempty" doc:"the ID of the network"`
|
||||
NicID *UUID `json:"nicid,omitempty" doc:"the ID of the nic"`
|
||||
VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"the ID of the vm"`
|
||||
}
|
||||
|
||||
// ListNics represents the NIC search
|
||||
type ListNics struct {
|
||||
VirtualMachineID string `json:"virtualmachineid"`
|
||||
ForDisplay bool `json:"fordisplay,omitempty"`
|
||||
Keyword string `json:"keyword,omitempty"`
|
||||
NetworkID string `json:"networkid,omitempty"`
|
||||
NicID string `json:"nicid,omitempty"`
|
||||
ForDisplay bool `json:"fordisplay,omitempty" doc:"list resources by display flag; only ROOT admin is eligible to pass this parameter"`
|
||||
Keyword string `json:"keyword,omitempty" doc:"List by keyword"`
|
||||
NetworkID *UUID `json:"networkid,omitempty" doc:"list nic of the specific vm's network"`
|
||||
NicID *UUID `json:"nicid,omitempty" doc:"the ID of the nic to to list IPs"`
|
||||
Page int `json:"page,omitempty"`
|
||||
PageSize int `json:"pagesize,omitempty"`
|
||||
}
|
||||
|
||||
func (*ListNics) name() string {
|
||||
return "listNics"
|
||||
}
|
||||
|
||||
func (*ListNics) response() interface{} {
|
||||
return new(ListNicsResponse)
|
||||
VirtualMachineID *UUID `json:"virtualmachineid" doc:"the ID of the vm"`
|
||||
_ bool `name:"listNics" description:"list the vm nics IP to NIC"`
|
||||
}
|
||||
|
||||
// ListNicsResponse represents a list of templates
|
||||
|
@ -60,76 +72,70 @@ type ListNicsResponse struct {
|
|||
Nic []Nic `json:"nic"`
|
||||
}
|
||||
|
||||
// AddIPToNic represents the assignation of a secondary IP
|
||||
func (ListNics) response() interface{} {
|
||||
return new(ListNicsResponse)
|
||||
}
|
||||
|
||||
// SetPage sets the current page
|
||||
func (ls *ListNics) SetPage(page int) {
|
||||
ls.Page = page
|
||||
}
|
||||
|
||||
// SetPageSize sets the page size
|
||||
func (ls *ListNics) SetPageSize(pageSize int) {
|
||||
ls.PageSize = pageSize
|
||||
}
|
||||
|
||||
func (ListNics) each(resp interface{}, callback IterateItemFunc) {
|
||||
nics := resp.(*ListNicsResponse)
|
||||
for i := range nics.Nic {
|
||||
if !callback(&(nics.Nic[i]), nil) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddIPToNic (Async) represents the assignation of a secondary IP
|
||||
type AddIPToNic struct {
|
||||
NicID string `json:"nicid"`
|
||||
IPAddress net.IP `json:"ipaddress"`
|
||||
NicID *UUID `json:"nicid" doc:"the ID of the nic to which you want to assign private IP"`
|
||||
IPAddress net.IP `json:"ipaddress,omitempty" doc:"Secondary IP Address"`
|
||||
_ bool `name:"addIpToNic" description:"Assigns secondary IP to NIC"`
|
||||
}
|
||||
|
||||
func (*AddIPToNic) name() string {
|
||||
return "addIpToNic"
|
||||
}
|
||||
func (*AddIPToNic) asyncResponse() interface{} {
|
||||
return new(AddIPToNicResponse)
|
||||
func (AddIPToNic) response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
// AddIPToNicResponse represents the addition of an IP to a NIC
|
||||
type AddIPToNicResponse struct {
|
||||
NicSecondaryIP NicSecondaryIP `json:"nicsecondaryip"`
|
||||
func (AddIPToNic) asyncResponse() interface{} {
|
||||
return new(NicSecondaryIP)
|
||||
}
|
||||
|
||||
// RemoveIPFromNic represents a deletion request
|
||||
// RemoveIPFromNic (Async) represents a deletion request
|
||||
type RemoveIPFromNic struct {
|
||||
ID string `json:"id"`
|
||||
ID *UUID `json:"id" doc:"the ID of the secondary ip address to nic"`
|
||||
_ bool `name:"removeIpFromNic" description:"Removes secondary IP from the NIC."`
|
||||
}
|
||||
|
||||
func (*RemoveIPFromNic) name() string {
|
||||
return "removeIpFromNic"
|
||||
func (RemoveIPFromNic) response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (*RemoveIPFromNic) asyncResponse() interface{} {
|
||||
return new(booleanAsyncResponse)
|
||||
func (RemoveIPFromNic) asyncResponse() interface{} {
|
||||
return new(booleanResponse)
|
||||
}
|
||||
|
||||
// ListNics lists the NIC of a VM
|
||||
// ActivateIP6 (Async) activates the IP6 on the given NIC
|
||||
//
|
||||
// Deprecated: use the API directly
|
||||
func (exo *Client) ListNics(req *ListNics) ([]Nic, error) {
|
||||
resp, err := exo.Request(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.(*ListNicsResponse).Nic, nil
|
||||
// Exoscale specific API: https://community.exoscale.ch/api/compute/#activateip6_GET
|
||||
type ActivateIP6 struct {
|
||||
NicID *UUID `json:"nicid" doc:"the ID of the nic to which you want to assign the IPv6"`
|
||||
_ bool `name:"activateIp6" description:"Activate the IPv6 on the VM's nic"`
|
||||
}
|
||||
|
||||
// AddIPToNic adds an IP to a NIC
|
||||
//
|
||||
// Deprecated: use the API directly
|
||||
func (exo *Client) AddIPToNic(nicID string, ipAddress string, async AsyncInfo) (*NicSecondaryIP, error) {
|
||||
ip := net.ParseIP(ipAddress)
|
||||
if ip == nil {
|
||||
return nil, fmt.Errorf("%s is not a valid IP address", ipAddress)
|
||||
}
|
||||
req := &AddIPToNic{
|
||||
NicID: nicID,
|
||||
IPAddress: ip,
|
||||
}
|
||||
resp, err := exo.AsyncRequest(req, async)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nic := resp.(AddIPToNicResponse).NicSecondaryIP
|
||||
return &nic, nil
|
||||
func (ActivateIP6) response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
// RemoveIPFromNic removes an IP from a NIC
|
||||
//
|
||||
// Deprecated: use the API directly
|
||||
func (exo *Client) RemoveIPFromNic(secondaryNicID string, async AsyncInfo) error {
|
||||
req := &RemoveIPFromNic{
|
||||
ID: secondaryNicID,
|
||||
}
|
||||
return exo.BooleanAsyncRequest(req, async)
|
||||
func (ActivateIP6) asyncResponse() interface{} {
|
||||
return new(Nic)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue