1
0
Fork 0

Migrate to go-acme/lego.

This commit is contained in:
Ludovic Fernandez 2019-03-14 11:04:04 +01:00 committed by Traefiker Bot
parent 4a68d29ce2
commit 87da7520de
286 changed files with 14021 additions and 2501 deletions

View file

@ -1,9 +1,5 @@
package egoscale
import (
"fmt"
)
// Volume represents a volume linked to a VM
type Volume struct {
Account string `json:"account,omitempty" doc:"the account associated with the disk volume"`
@ -22,8 +18,6 @@ type Volume struct {
DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"ID of the disk offering"`
DiskOfferingName string `json:"diskofferingname,omitempty" doc:"name of the disk offering"`
DisplayVolume bool `json:"displayvolume,omitempty" doc:"an optional field whether to the display the volume to the end user or not."`
Domain string `json:"domain,omitempty" doc:"the domain associated with the disk volume"`
DomainID *UUID `json:"domainid,omitempty" doc:"the ID of the domain associated with the disk volume"`
Hypervisor string `json:"hypervisor,omitempty" doc:"Hypervisor the volume belongs to"`
ID *UUID `json:"id,omitempty" doc:"ID of the disk volume"`
IsExtractable *bool `json:"isextractable,omitempty" doc:"true if the volume is extractable, false otherwise"`
@ -49,7 +43,7 @@ type Volume struct {
StorageType string `json:"storagetype,omitempty" doc:"shared or local storage"`
Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with volume"`
TemplateDisplayText string `json:"templatedisplaytext,omitempty" doc:"an alternate display text of the template for the virtual machine"`
TemplateID string `json:"templateid,omitempty" doc:"the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file."` // no *UUID because of the -1 thingy...
TemplateID *UUID `json:"templateid,omitempty" doc:"the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file."` // no *UUID because of the -1 thingy...
TemplateName string `json:"templatename,omitempty" doc:"the name of the template for the virtual machine"`
Type string `json:"type,omitempty" doc:"type of the disk volume (ROOT or DATADISK)"`
VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"id of the virtual machine"`
@ -68,8 +62,6 @@ func (Volume) ResourceType() string {
// ListRequest builds the ListVolumes request
func (vol Volume) ListRequest() (ListCommand, error) {
req := &ListVolumes{
Account: vol.Account,
DomainID: vol.DomainID,
Name: vol.Name,
Type: vol.Type,
VirtualMachineID: vol.VirtualMachineID,
@ -83,39 +75,34 @@ func (vol Volume) ListRequest() (ListCommand, error) {
type ResizeVolume struct {
ID *UUID `json:"id" doc:"the ID of the disk volume"`
DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"new disk offering id"`
ShrinkOk *bool `json:"shrinkok,omitempty" doc:"Verify OK to Shrink"`
Size int64 `json:"size,omitempty" doc:"New volume size in G"`
Size int64 `json:"size,omitempty" doc:"New volume size in G (must be larger than current size since shrinking the disk is not supported)"`
_ bool `name:"resizeVolume" description:"Resizes a volume"`
}
func (ResizeVolume) response() interface{} {
// Response returns the struct to unmarshal
func (ResizeVolume) Response() interface{} {
return new(AsyncJobResult)
}
func (ResizeVolume) asyncResponse() interface{} {
// AsyncResponse returns the struct to unmarshal the async job
func (ResizeVolume) AsyncResponse() interface{} {
return new(Volume)
}
//go:generate go run generate/main.go -interface=Listable ListVolumes
// ListVolumes represents a query listing volumes
type ListVolumes struct {
Account string `json:"account,omitempty" doc:"list resources by account. Must be used with the domainId parameter."`
DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"list volumes by disk offering"`
DisplayVolume *bool `json:"displayvolume,omitempty" doc:"list resources by display flag; only ROOT admin is eligible to pass this parameter"`
DomainID *UUID `json:"domainid,omitempty" doc:"list only resources belonging to the domain specified"`
HostID *UUID `json:"hostid,omitempty" doc:"list volumes on specified host"`
ID *UUID `json:"id,omitempty" doc:"the ID of the disk volume"`
IsRecursive *bool `json:"isrecursive,omitempty" doc:"defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves."`
DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"List volumes by disk offering"`
ID *UUID `json:"id,omitempty" doc:"The ID of the disk volume"`
Keyword string `json:"keyword,omitempty" doc:"List by keyword"`
ListAll *bool `json:"listall,omitempty" doc:"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"`
Name string `json:"name,omitempty" doc:"the name of the disk volume"`
Name string `json:"name,omitempty" doc:"The name of the disk volume"`
Page int `json:"page,omitempty"`
PageSize int `json:"pagesize,omitempty"`
PodID *UUID `json:"podid,omitempty" doc:"the pod id the disk volume belongs to"`
StorageID *UUID `json:"storageid,omitempty" doc:"the ID of the storage pool, available to ROOT admin only"`
Tags []ResourceTag `json:"tags,omitempty" doc:"List resources by tags (key/value pairs)"`
Type string `json:"type,omitempty" doc:"the type of disk volume"`
VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"the ID of the virtual machine"`
ZoneID *UUID `json:"zoneid,omitempty" doc:"the ID of the availability zone"`
Type string `json:"type,omitempty" doc:"The type of disk volume"`
VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"The ID of the virtual machine"`
ZoneID *UUID `json:"zoneid,omitempty" doc:"The ID of the availability zone"`
_ bool `name:"listVolumes" description:"Lists all volumes."`
}
@ -124,31 +111,3 @@ type ListVolumesResponse struct {
Count int `json:"count"`
Volume []Volume `json:"volume"`
}
func (ListVolumes) response() interface{} {
return new(ListVolumesResponse)
}
// SetPage sets the current page
func (ls *ListVolumes) SetPage(page int) {
ls.Page = page
}
// SetPageSize sets the page size
func (ls *ListVolumes) SetPageSize(pageSize int) {
ls.PageSize = pageSize
}
func (ListVolumes) each(resp interface{}, callback IterateItemFunc) {
volumes, ok := resp.(*ListVolumesResponse)
if !ok {
callback(nil, fmt.Errorf("wrong type. ListVolumesResponse expected, got %T", resp))
return
}
for i := range volumes.Volume {
if !callback(&volumes.Volume[i], nil) {
break
}
}
}