github.com/gophercloud/gophercloud@v1.11.0/openstack/networking/v2/extensions/vpnaas/siteconnections/doc.go (about)

     1  /*
     2  Package siteconnections allows management and retrieval of IPSec site connections in the
     3  OpenStack Networking Service.
     4  
     5  # Example to create an IPSec site connection
     6  
     7  	createOpts := siteconnections.CreateOpts{
     8  			Name:           "Connection1",
     9  			PSK:            "secret",
    10  			Initiator:      siteconnections.InitiatorBiDirectional,
    11  			AdminStateUp:   gophercloud.Enabled,
    12  			IPSecPolicyID:  "4ab0a72e-64ef-4809-be43-c3f7e0e5239b",
    13  			PeerEPGroupID:  "5f5801b1-b383-4cf0-bf61-9e85d4044b2d",
    14  			IKEPolicyID:    "47a880f9-1da9-468c-b289-219c9eca78f0",
    15  			VPNServiceID:   "692c1ec8-a7cd-44d9-972b-8ed3fe4cc476",
    16  			LocalEPGroupID: "498bb96a-1517-47ea-b1eb-c4a53db46a16",
    17  			PeerAddress:    "172.24.4.233",
    18  			PeerID:         "172.24.4.233",
    19  			MTU:            1500,
    20  		}
    21  		connection, err := siteconnections.Create(client, createOpts).Extract()
    22  		if err != nil {
    23  			panic(err)
    24  		}
    25  
    26  Example to Show the details of a specific IPSec site connection by ID
    27  
    28  	conn, err := siteconnections.Get(client, "f2b08c1e-aa81-4668-8ae1-1401bcb0576c").Extract()
    29  	if err != nil {
    30  		panic(err)
    31  	}
    32  
    33  Example to Delete a site connection
    34  
    35  	connID := "38aee955-6283-4279-b091-8b9c828000ec"
    36  	err := siteconnections.Delete(networkClient, connID).ExtractErr()
    37  	if err != nil {
    38  		panic(err)
    39  	}
    40  
    41  Example to List site connections
    42  
    43  	allPages, err := siteconnections.List(client, nil).AllPages()
    44  	if err != nil {
    45  		panic(err)
    46  	}
    47  
    48  	allConnections, err := siteconnections.ExtractConnections(allPages)
    49  	if err != nil {
    50  		panic(err)
    51  	}
    52  
    53  Example to Update an IPSec site connection
    54  
    55  	description := "updated connection"
    56  	name := "updatedname"
    57  	updateOpts := siteconnections.UpdateOpts{
    58  		Name:        &name,
    59  		Description: &description,
    60  	}
    61  	updatedConnection, err := siteconnections.Update(client, "5c561d9d-eaea-45f6-ae3e-08d1a7080828", updateOpts).Extract()
    62  	if err != nil {
    63  		panic(err)
    64  	}
    65  */
    66  package siteconnections