-
-
Save krzysztofantczak/511cb87fc545f23ceb44ce6e8bf90d6c to your computer and use it in GitHub Desktop.
upx test
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
package test | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"github.com/softlayer/softlayer-go/datatypes" | |
"github.com/softlayer/softlayer-go/services" | |
"github.com/softlayer/softlayer-go/session" | |
"github.com/softlayer/softlayer-go/sl" | |
) | |
func main() { | |
if len(os.Args) == 1 || (len(os.Args) > 1 && os.Args[1] != "xxx") { | |
return | |
} | |
sess := session.New() // See above for details about creating a new session | |
// Get the Virtual_Guest service | |
service := services.GetVirtualGuestService(sess) | |
// Create a Virtual_Guest struct as a template | |
vGuestTemplate := datatypes.Virtual_Guest{ | |
// Set Creation values - use helpers from the sl package to set pointer values. | |
// Unset (nil) values are not sent | |
Hostname: sl.String("sample"), | |
Domain: sl.String("example.com"), | |
MaxMemory: sl.Int(4096), | |
StartCpus: sl.Int(1), | |
Datacenter: &datatypes.Location{Name: sl.String("wdc01")}, | |
OperatingSystemReferenceCode: sl.String("UBUNTU_LATEST"), | |
LocalDiskFlag: sl.Bool(true), | |
} | |
// Tell the API to create the virtual guest | |
newGuest, err := service.CreateObject(&vGuestTemplate) | |
// optional error checking... | |
if err != nil { | |
log.Fatal(err) | |
} | |
// Print the ID of the new guest. Don't forget to dereference | |
fmt.Printf("New guest %d created", *newGuest.Id) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment