github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/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  
     9  		peerings,err:=peerings.ExtractPeerings(peering)
    10  
    11  
    12  		if err != nil{
    13  			fmt.Println(err)
    14  		}
    15  
    16  Example to Get a Vpc Peering Connection
    17  
    18         	peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"
    19  
    20  
    21  		peering,err :=peerings.Get(client,peeringID).Extract()
    22  
    23  
    24  		if err != nil{
    25  			fmt.Println(err)
    26  		}
    27  
    28  
    29  
    30  Example to Accept a Vpc Peering Connection Request
    31   // Note:- The TenantId should be of accepter
    32  
    33      peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"
    34  
    35      peering,err:=peerings.Accept(client,peeringID).ExtractResult()
    36  
    37  	if err != nil{
    38  		fmt.Println(err)
    39  	}
    40  
    41  
    42  Example to Reject a Vpc Peering Connection Request
    43   // Note:- The TenantId should be of accepter
    44      peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"
    45  
    46      peering,err:=peerings.Reject(client,peeringID).ExtractResult()
    47  
    48  	if err != nil{
    49  		fmt.Println(err)
    50  	}
    51  
    52  Example to Create a Vpc Peering Connection
    53  
    54  	RequestVpcInfo:=peerings.VpcInfo{VpcId:"3127e30b-5f8e-42d1-a3cc-fdadf412c5bf"}
    55  	AcceptVpcInfo:=peerings.VpcInfo{"c6efbdb7-dca4-4178-b3ec-692f125c1e25","17fbda95add24720a4038ba4b1c705ed"}
    56  
    57  	opt:=peerings.CreateOpts{"C2C_test",RequestVpcInfo,AcceptVpcInfo}
    58  
    59  	peering,err:=peerings.Create(client,opt).Extract()
    60  
    61  	if err != nil{
    62  		fmt.Println(err)
    63  	}
    64  
    65  
    66  Example to Update a VpcPeeringConnection
    67  
    68  	peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"
    69  
    70  	updateOpts:=peerings.UpdateOpts{"C2C_tes1"}
    71  
    72  	peering,err:=peerings.Update(client,peeringID,updateOpts).Extract()
    73  
    74  	if err != nil{
    75  		fmt.Println(err)
    76  	}
    77  
    78  
    79  Example to Delete a VpcPeeringConnection
    80  
    81  	peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"
    82  	err := peerings.Delete(client,"6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3")
    83  	if err != nil {
    84  		panic(err)
    85  	}
    86  */
    87  package peerings