github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/peerings/doc.go (about) 1 /* 2 Package peerings enables management and retrieval of vpc peering connections 3 4 Example to List a Vpc Peering Connections 5 listOpts:=peerings.ListOpts{} 6 7 peering,err :=peerings.List(client,sub).AllPages() 8 if err != nil{ 9 fmt.Println(err) 10 } 11 12 peerings,err:=peerings.ExtractPeerings(peering) 13 if err != nil{ 14 fmt.Println(err) 15 } 16 17 Example to Get a Vpc Peering Connection 18 peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3" 19 peering,err :=peerings.Get(client,peeringID).Extract() 20 if err != nil{ 21 fmt.Println(err) 22 } 23 24 Example to Accept a Vpc Peering Connection Request 25 // Note:- The TenantId should be of accepter 26 27 peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3" 28 29 peering,err:=peerings.Accept(client,peeringID).ExtractResult() 30 31 if err != nil{ 32 fmt.Println(err) 33 } 34 35 36 Example to Reject a Vpc Peering Connection Request 37 // Note:- The TenantId should be of accepter 38 peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3" 39 40 peering,err:=peerings.Reject(client,peeringID).ExtractResult() 41 42 if err != nil{ 43 fmt.Println(err) 44 } 45 46 Example to Create a Vpc Peering Connection 47 48 RequestVpcInfo:=peerings.VpcInfo{VpcId:"3127e30b-5f8e-42d1-a3cc-fdadf412c5bf"} 49 AcceptVpcInfo:=peerings.VpcInfo{"c6efbdb7-dca4-4178-b3ec-692f125c1e25","17fbda95add24720a4038ba4b1c705ed"} 50 51 opt:=peerings.CreateOpts{"C2C_test",RequestVpcInfo,AcceptVpcInfo} 52 53 peering,err:=peerings.Create(client,opt).Extract() 54 55 if err != nil{ 56 fmt.Println(err) 57 } 58 59 60 Example to Update a VpcPeeringConnection 61 62 peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3" 63 64 updateOpts:=peerings.UpdateOpts{"C2C_tes1"} 65 66 peering,err:=peerings.Update(client,peeringID,updateOpts).Extract() 67 68 if err != nil{ 69 fmt.Println(err) 70 } 71 72 73 Example to Delete a VpcPeeringConnection 74 75 peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3" 76 err := peerings.Delete(client,"6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3") 77 if err != nil { 78 panic(err) 79 } 80 */ 81 package peerings