@@ -27,6 +27,7 @@ type Plan struct {
2727type PlanCloud struct {
2828 Server * PlanCloudServer
2929 Template * PlanCloudTemplate
30+ Network * PlanCloudNetwork
3031}
3132
3233type PlanCloudServer struct {
@@ -38,6 +39,15 @@ type PlanCloudTemplate struct {
3839 Restore []CloudTemplateRestoreParams
3940}
4041
42+ type PlanCloudNetwork struct {
43+ Public * PlanCloudNetworkPublic
44+ }
45+
46+ type PlanCloudNetworkPublic struct {
47+ Add []CloudNetworkPublicAddParams
48+ Remove []CloudNetworkPublicRemoveParams
49+ }
50+
4151func (ci * Client ) ProcessPlan (plan * Plan ) error {
4252
4353 if plan .Cloud != nil {
@@ -69,6 +79,12 @@ func (ci *Client) processPlanCloud(cloud *PlanCloud) error {
6979 }
7080 }
7181
82+ if cloud .Network != nil {
83+ if err := ci .processPlanCloudNetwork (cloud .Network ); err != nil {
84+ return err
85+ }
86+ }
87+
7288 return nil
7389}
7490
@@ -136,6 +152,60 @@ func (ci *Client) processPlanCloudTemplate(template *PlanCloudTemplate) error {
136152 return nil
137153}
138154
155+ func (ci * Client ) processPlanCloudNetwork (network * PlanCloudNetwork ) error {
156+
157+ if network .Public != nil {
158+ if err := ci .processPlanCloudNetworkPublic (network .Public ); err != nil {
159+ return err
160+ }
161+ }
162+
163+ return nil
164+ }
165+
166+ func (ci * Client ) processPlanCloudNetworkPublic (public * PlanCloudNetworkPublic ) error {
167+
168+ if public .Add != nil {
169+ for _ , c := range public .Add {
170+ if err := ci .processPlanCloudNetworkPublicAdd (& c ); err != nil {
171+ return err
172+ }
173+ }
174+ }
175+
176+ if public .Remove != nil {
177+ for _ , c := range public .Remove {
178+ if err := ci .processPlanCloudNetworkPublicRemove (& c ); err != nil {
179+ return err
180+ }
181+ }
182+ }
183+
184+ return nil
185+ }
186+
187+ func (ci * Client ) processPlanCloudNetworkPublicAdd (params * CloudNetworkPublicAddParams ) error {
188+ result , err := ci .CloudNetworkPublicAdd (params )
189+ if err != nil {
190+ ci .Die (err )
191+ }
192+
193+ fmt .Print (result )
194+
195+ return nil
196+ }
197+
198+ func (ci * Client ) processPlanCloudNetworkPublicRemove (params * CloudNetworkPublicRemoveParams ) error {
199+ result , err := ci .CloudNetworkPublicRemove (params )
200+ if err != nil {
201+ ci .Die (err )
202+ }
203+
204+ fmt .Print (result )
205+
206+ return nil
207+ }
208+
139209func (ci * Client ) processPlanCloudTemplateRestore (params * CloudTemplateRestoreParams ) error {
140210
141211 result , err := ci .CloudTemplateRestore (params )
0 commit comments