github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/vpnaas/ipsecpolicies/doc.go (about)

     1  /*
     2  Package ipsecpolicies allows management and retrieval of IPSec Policies in the
     3  OpenStack Networking Service.
     4  
     5  Example to Create a Policy
     6  
     7  	createOpts := ipsecpolicies.CreateOpts{
     8  		Name:        "IPSecPolicy_1",
     9  	}
    10  
    11  	policy, err := policies.Create(networkClient, createOpts).Extract()
    12  	if err != nil {
    13  		panic(err)
    14  	}
    15  
    16  Example to Delete a Policy
    17  
    18  	err := ipsecpolicies.Delete(client, "5291b189-fd84-46e5-84bd-78f40c05d69c").ExtractErr()
    19  	if err != nil {
    20  		panic(err)
    21  	}
    22  
    23  Example to Show the details of a specific IPSec policy by ID
    24  
    25  	policy, err := ipsecpolicies.Get(client, "f2b08c1e-aa81-4668-8ae1-1401bcb0576c").Extract()
    26  	if err != nil {
    27  		panic(err)
    28  	}
    29  
    30  Example to Update an IPSec policy
    31  
    32  	name := "updatedname"
    33  	description := "updated policy"
    34  	updateOpts := ipsecpolicies.UpdateOpts{
    35  		Name:        &name,
    36  		Description: &description,
    37  	}
    38  	updatedPolicy, err := ipsecpolicies.Update(client, "5c561d9d-eaea-45f6-ae3e-08d1a7080828", updateOpts).Extract()
    39  	if err != nil {
    40  		panic(err)
    41  	}
    42  
    43  Example to List IPSec policies
    44  
    45  	allPages, err := ipsecpolicies.List(client, nil).AllPages()
    46  	if err != nil {
    47  		panic(err)
    48  	}
    49  
    50  	allPolicies, err := ipsecpolicies.ExtractPolicies(allPages)
    51  	if err != nil {
    52  		panic(err)
    53  	}
    54  
    55  */
    56  package ipsecpolicies