-
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 #4 from tecbiz-ch/dev
Add Example
- Loading branch information
Showing
7 changed files
with
87 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package schema | ||
|
||
import ( | ||
"encoding/base64" | ||
"encoding/json" | ||
|
||
"github.com/google/uuid" | ||
) | ||
|
||
type VMRevertRequest struct { | ||
VMRecoveryPointUUID *string `json:"vm_recovery_point_uuid"` | ||
} | ||
|
||
type MetaData struct { | ||
SSHAuthorizedKeyMap map[string]string `json:"public_keys,omitempty"` | ||
Hostname string `json:"hostname"` | ||
UUID string `json:"uuid"` | ||
AvailabilityZone string `json:"availability_zone,omitempty"` | ||
Project string `json:"project_id,omitempty"` | ||
} | ||
|
||
func (m *MetaData) ToBase64() (string, error) { | ||
if m.UUID == "" { | ||
uuid, _ := uuid.NewRandom() | ||
m.UUID = uuid.String() | ||
} | ||
j, err := json.Marshal(m) | ||
if err != nil { | ||
return "", err | ||
} | ||
return base64.StdEncoding.EncodeToString(j), nil | ||
} |
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