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

@ -3,28 +3,27 @@ package egoscale
// SnapshotState represents the Snapshot.State enum
//
// See: https://github.com/apache/cloudstack/blob/master/api/src/main/java/com/cloud/storage/Snapshot.java
type SnapshotState int
type SnapshotState string
//go:generate stringer -type SnapshotState
const (
// Allocated ... (TODO)
Allocated SnapshotState = iota
Allocated SnapshotState = "Allocated"
// Creating ... (TODO)
Creating
Creating SnapshotState = "Creating"
// CreatedOnPrimary ... (TODO)
CreatedOnPrimary
CreatedOnPrimary SnapshotState = "CreatedOnPrimary"
// BackingUp ... (TODO)
BackingUp
BackingUp SnapshotState = "BackingUp"
// BackedUp ... (TODO)
BackedUp
BackedUp SnapshotState = "BackedUp"
// Copying ... (TODO)
Copying
Copying SnapshotState = "Copying"
// Destroying ... (TODO)
Destroying
Destroying SnapshotState = "Destroying"
// Destroyed ... (TODO)
Destroyed
Destroyed SnapshotState = "Destroyed"
// Error is a state where the user can't see the snapshot while the snapshot may still exist on the storage
Error
Error SnapshotState = "Error"
)
// Snapshot represents a volume snapshot
@ -32,8 +31,6 @@ type Snapshot struct {
Account string `json:"account,omitempty" doc:"the account associated with the snapshot"`
AccountID *UUID `json:"accountid,omitempty" doc:"the account ID associated with the snapshot"`
Created string `json:"created,omitempty" doc:"the date the snapshot was created"`
Domain string `json:"domain,omitempty" doc:"the domain name of the snapshot's account"`
DomainID *UUID `json:"domainid,omitempty" doc:"the domain ID of the snapshot's account"`
ID *UUID `json:"id,omitempty" doc:"ID of the snapshot"`
IntervalType string `json:"intervaltype,omitempty" doc:"valid types are hourly, daily, weekly, monthy, template, and none."`
Name string `json:"name,omitempty" doc:"name of the snapshot"`
@ -41,7 +38,7 @@ type Snapshot struct {
Revertable *bool `json:"revertable,omitempty" doc:"indicates whether the underlying storage supports reverting the volume to this snapshot"`
Size int64 `json:"size,omitempty" doc:"the size of original volume"`
SnapshotType string `json:"snapshottype,omitempty" doc:"the type of the snapshot"`
State SnapshotState `json:"state,omitempty" doc:"the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage"`
State string `json:"state,omitempty" doc:"the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage"`
Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with snapshot"`
VolumeID *UUID `json:"volumeid,omitempty" doc:"ID of the disk volume"`
VolumeName string `json:"volumename,omitempty" doc:"name of the disk volume"`
@ -56,30 +53,43 @@ func (Snapshot) ResourceType() string {
// CreateSnapshot (Async) creates an instant snapshot of a volume
type CreateSnapshot struct {
VolumeID *UUID `json:"volumeid" doc:"The ID of the disk volume"`
Account string `json:"account,omitempty" doc:"The account of the snapshot. The account parameter must be used with the domainId parameter."`
DomainID *UUID `json:"domainid,omitempty" doc:"The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume."`
QuiesceVM *bool `json:"quiescevm,omitempty" doc:"quiesce vm if true"`
_ bool `name:"createSnapshot" description:"Creates an instant snapshot of a volume."`
VolumeID *UUID `json:"volumeid" doc:"The ID of the disk volume"`
QuiesceVM *bool `json:"quiescevm,omitempty" doc:"quiesce vm if true"`
_ bool `name:"createSnapshot" description:"Creates an instant snapshot of a volume."`
}
func (CreateSnapshot) response() interface{} {
// Response returns the struct to unmarshal
func (CreateSnapshot) Response() interface{} {
return new(AsyncJobResult)
}
func (CreateSnapshot) asyncResponse() interface{} {
// AsyncResponse returns the struct to unmarshal the async job
func (CreateSnapshot) AsyncResponse() interface{} {
return new(Snapshot)
}
// ListRequest builds the ListSnapshot request
func (ss Snapshot) ListRequest() (ListCommand, error) {
// Restricted cannot be applied here because it really has three states
req := &ListSnapshots{
ID: ss.ID,
Name: ss.Name,
VolumeID: ss.VolumeID,
SnapshotType: ss.SnapshotType,
ZoneID: ss.ZoneID,
// TODO: tags
}
return req, nil
}
//go:generate go run generate/main.go -interface=Listable ListSnapshots
// ListSnapshots lists the volume snapshots
type ListSnapshots struct {
Account string `json:"account,omitempty" doc:"list resources by account. Must be used with the domainId parameter."`
DomainID *UUID `json:"domainid,omitempty" doc:"list only resources belonging to the domain specified"`
ID *UUID `json:"id,omitempty" doc:"lists snapshot by snapshot ID"`
IntervalType string `json:"intervaltype,omitempty" doc:"valid values are HOURLY, DAILY, WEEKLY, and MONTHLY."`
IsRecursive *bool `json:"isrecursive,omitempty" doc:"defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves."`
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:"lists snapshot by snapshot name"`
Page int `json:"page,omitempty"`
PageSize int `json:"pagesize,omitempty"`
@ -96,22 +106,20 @@ type ListSnapshotsResponse struct {
Snapshot []Snapshot `json:"snapshot"`
}
func (ListSnapshots) response() interface{} {
return new(ListSnapshotsResponse)
}
// DeleteSnapshot (Async) deletes a snapshot of a disk volume
type DeleteSnapshot struct {
ID *UUID `json:"id" doc:"The ID of the snapshot"`
_ bool `name:"deleteSnapshot" description:"Deletes a snapshot of a disk volume."`
}
func (DeleteSnapshot) response() interface{} {
// Response returns the struct to unmarshal
func (DeleteSnapshot) Response() interface{} {
return new(AsyncJobResult)
}
func (DeleteSnapshot) asyncResponse() interface{} {
return new(booleanResponse)
// AsyncResponse returns the struct to unmarshal the async job
func (DeleteSnapshot) AsyncResponse() interface{} {
return new(BooleanResponse)
}
// RevertSnapshot (Async) reverts a volume snapshot
@ -120,10 +128,12 @@ type RevertSnapshot struct {
_ bool `name:"revertSnapshot" description:"revert a volume snapshot."`
}
func (RevertSnapshot) response() interface{} {
// Response returns the struct to unmarshal
func (RevertSnapshot) Response() interface{} {
return new(AsyncJobResult)
}
func (RevertSnapshot) asyncResponse() interface{} {
return new(booleanResponse)
// AsyncResponse returns the struct to unmarshal the async job
func (RevertSnapshot) AsyncResponse() interface{} {
return new(BooleanResponse)
}