Created
April 27, 2018 14:55
-
-
Save OddCN/4b4f7a42b13d11811900491e20011f93 to your computer and use it in GitHub Desktop.
when user use GoCloud
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 main | |
import ( | |
"test/test/testBuilderPattern/ecs" | |
"github.com/cloudlibz/gocloud/gocloud" | |
"fmt" | |
) | |
func main() { | |
alicloud, _ := gocloud.CloudProvider(gocloud.Aliprovider) | |
createNodeBuilder := ecs.NewCreateNodeBuilder(). | |
RegionID("cn-qingdao"). | |
ImageID("centos_7_04_64_20G_alibase_201701015.vhd"). | |
InstanceType("ecs.xn4.small"). | |
SecurityGroupID("sg-m5egbo9s5xb21kpu6nk2") | |
createNode, err := createNodeBuilder.Build() | |
if err != nil { | |
// May miss required parameters | |
} | |
resp, err := alicloud.Createnode(createNode) | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
response := resp.(map[string]interface{}) | |
fmt.Println(response["body"]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment