-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from kthcloud/dev
snapshot support, typo fixes and bug fixes
- Loading branch information
Showing
26 changed files
with
658 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package models | ||
|
||
import ( | ||
"go-deploy/pkg/imp/cloudstack" | ||
"time" | ||
) | ||
|
||
type SnapshotPublic struct { | ||
ID string `json:"id"` | ||
VmID string `json:"vmId"` | ||
Name string `json:"displayname"` | ||
ParentName *string `json:"parentName"` | ||
CreatedAt time.Time `json:"created"` | ||
State string `json:"state"` | ||
Current bool `json:"current"` | ||
} | ||
|
||
func CreateSnapshotPublicFromGet(snapshot *cloudstack.VMSnapshot) *SnapshotPublic { | ||
createdAt, err := time.Parse(time.RFC3339, snapshot.Created) | ||
if err != nil { | ||
createdAt = time.Now() | ||
} | ||
|
||
var parentName *string | ||
if snapshot.ParentName != "" { | ||
parentName = &snapshot.ParentName | ||
} | ||
|
||
return &SnapshotPublic{ | ||
ID: snapshot.Id, | ||
VmID: snapshot.Virtualmachineid, | ||
Name: snapshot.Displayname, | ||
ParentName: parentName, | ||
CreatedAt: createdAt, | ||
State: snapshot.State, | ||
Current: snapshot.Current, | ||
} | ||
} |
Oops, something went wrong.