-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpc.go
74 lines (53 loc) · 1.38 KB
/
vpc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package aliyun
import (
"github.com/gogap/config"
"github.com/gogap/context"
"github.com/gogap/flow"
)
func init() {
flow.RegisterHandler("devops.aliyun.vpc.vpc.create", CreateVPC)
flow.RegisterHandler("devops.aliyun.vpc.vpc.delete", DeleteVPC)
flow.RegisterHandler("devops.aliyun.vpc.vpc.running.wait", WaitForAllVpcRunning)
flow.RegisterHandler("devops.aliyun.vpc.vswitch.create", CreateVSwitch)
flow.RegisterHandler("devops.aliyun.vpc.vswitch.delete", DeleteVSwitch)
}
func CreateVPC(ctx context.Context, conf config.Configuration) (err error) {
aliyun := NewAliyun(ctx, conf)
err = aliyun.CreateVPCs()
if err != nil {
return
}
return
}
func DeleteVPC(ctx context.Context, conf config.Configuration) (err error) {
aliyun := NewAliyun(ctx, conf)
err = aliyun.DeleteVPC()
if err != nil {
return
}
return
}
func WaitForAllVpcRunning(ctx context.Context, conf config.Configuration) (err error) {
aliyun := NewAliyun(ctx, conf)
err = aliyun.WaitForAllVpcRunning(30)
if err != nil {
return
}
return
}
func CreateVSwitch(ctx context.Context, conf config.Configuration) (err error) {
aliyun := NewAliyun(ctx, conf)
err = aliyun.CreateVSwitch()
if err != nil {
return
}
return
}
func DeleteVSwitch(ctx context.Context, conf config.Configuration) (err error) {
aliyun := NewAliyun(ctx, conf)
err = aliyun.DeleteVSwitch()
if err != nil {
return
}
return
}