Documentation ¶
Overview ¶
Package ipsecpolicies allows management and retrieval of IPSec Policies in the OpenStack Networking Service.
Example to Create a Policy
createOpts := ipsecpolicies.CreateOpts{ Name: "IPSecPolicy_1", } policy, err := policies.Create(networkClient, createOpts).Extract() if err != nil { panic(err) }
Example to Delete a Policy
err := ipsecpolicies.Delete(client, "5291b189-fd84-46e5-84bd-78f40c05d69c").ExtractErr() if err != nil { panic(err) }
Example to Show the details of a specific IPSec policy by ID
policy, err := ipsecpolicies.Get(client, "f2b08c1e-aa81-4668-8ae1-1401bcb0576c").Extract() if err != nil { panic(err) }
Example to Update an IPSec policy
name := "updatedname" description := "updated policy" updateOpts := ipsecpolicies.UpdateOpts{ Name: &name, Description: &description, } updatedPolicy, err := ipsecpolicies.Update(client, "5c561d9d-eaea-45f6-ae3e-08d1a7080828", updateOpts).Extract() if err != nil { panic(err) }
Example to List IPSec policies
allPages, err := ipsecpolicies.List(client, nil).AllPages() if err != nil { panic(err) } allPolicies, err := ipsecpolicies.ExtractPolicies(allPages) if err != nil { panic(err) }
Index ¶
- Constants
- func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type AuthAlgorithm
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type EncapsulationMode
- type EncryptionAlgorithm
- type GetResult
- type Lifetime
- type LifetimeCreateOpts
- type LifetimeUpdateOpts
- type ListOpts
- type ListOptsBuilder
- type PFS
- type Policy
- type PolicyPage
- type TransformProtocol
- type Unit
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
const ( TransformProtocolESP TransformProtocol = "esp" TransformProtocolAH TransformProtocol = "ah" TransformProtocolAHESP TransformProtocol = "ah-esp" AuthAlgorithmSHA1 AuthAlgorithm = "sha1" AuthAlgorithmSHA256 AuthAlgorithm = "sha256" AuthAlgorithmSHA384 AuthAlgorithm = "sha384" AuthAlgorithmSHA512 AuthAlgorithm = "sha512" EncryptionAlgorithm3DES EncryptionAlgorithm = "3des" EncryptionAlgorithmAES128 EncryptionAlgorithm = "aes-128" EncryptionAlgorithmAES256 EncryptionAlgorithm = "aes-256" EncryptionAlgorithmAES192 EncryptionAlgorithm = "aes-192" EncapsulationModeTunnel EncapsulationMode = "tunnel" EncapsulationModeTransport EncapsulationMode = "transport" UnitSeconds Unit = "seconds" UnitKilobytes Unit = "kilobytes" PFSGroup2 PFS = "group2" PFSGroup5 PFS = "group5" PFSGroup14 PFS = "group14" )
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns a Pager which allows you to iterate over a collection of IPSec policies. It accepts a ListOpts struct, which allows you to filter the returned collection for greater efficiency.
Types ¶
type AuthAlgorithm ¶
type AuthAlgorithm string
type CreateOpts ¶
type CreateOpts struct { // TenantID specifies a tenant to own the IPSec policy. The caller must have // an admin role in order to set this. Otherwise, this field is left unset // and the caller will be the owner. TenantID string `json:"tenant_id,omitempty"` // Description is the human readable description of the policy. Description string `json:"description,omitempty"` // Name is the human readable name of the policy. // Does not have to be unique. Name string `json:"name,omitempty"` // AuthAlgorithm is the authentication hash algorithm. // Valid values are sha1, sha256, sha384, sha512. // The default is sha1. AuthAlgorithm AuthAlgorithm `json:"auth_algorithm,omitempty"` // EncapsulationMode is the encapsulation mode. // A valid value is tunnel or transport. // Default is tunnel. EncapsulationMode EncapsulationMode `json:"encapsulation_mode,omitempty"` // EncryptionAlgorithm is the encryption algorithm. // A valid value is 3des, aes-128, aes-192, aes-256, and so on. // Default is aes-128. EncryptionAlgorithm EncryptionAlgorithm `json:"encryption_algorithm,omitempty"` // PFS is the Perfect forward secrecy mode. // A valid value is Group2, Group5, Group14, and so on. // Default is Group5. PFS PFS `json:"pfs,omitempty"` // TransformProtocol is the transform protocol. // A valid value is ESP, AH, or AH- ESP. // Default is ESP. TransformProtocol TransformProtocol `json:"transform_protocol,omitempty"` //Lifetime is the lifetime of the security association Lifetime *LifetimeCreateOpts `json:"lifetime,omitempty"` }
CreateOpts contains all the values needed to create a new IPSec policy
func (CreateOpts) ToPolicyCreateMap ¶
func (opts CreateOpts) ToPolicyCreateMap() (map[string]interface{}, error)
ToPolicyCreateMap casts a CreateOpts struct to a map.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult represents the result of a create operation. Call its Extract method to interpret it as a Policy.
func Create ¶
func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and uses the values to create a new IPSec policy
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
CreateResult represents the result of a delete operation. Call its ExtractErr method to determine if the operation succeeded or failed.
func Delete ¶
func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult)
Delete will permanently delete a particular IPSec policy based on its unique ID.
type EncapsulationMode ¶
type EncapsulationMode string
type EncryptionAlgorithm ¶
type EncryptionAlgorithm string
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a get operation. Call its Extract method to interpret it as a Policy.
func Get ¶
func Get(c *gophercloud.ServiceClient, id string) (r GetResult)
Get retrieves a particular IPSec policy based on its unique ID.
type LifetimeCreateOpts ¶
type LifetimeCreateOpts struct { // Units is the units for the lifetime of the security association // Default unit is seconds Units Unit `json:"units,omitempty"` // The lifetime value. // Must be a positive integer. // Default value is 3600. Value int `json:"value,omitempty"` }
The lifetime consists of a unit and integer value You can omit either the unit or value portion of the lifetime
type LifetimeUpdateOpts ¶
type ListOpts ¶
type ListOpts struct { TenantID string `q:"tenant_id"` Name string `q:"name"` Description string `q:"description"` ProjectID string `q:"project_id"` AuthAlgorithm string `q:"auth_algorithm"` EncapsulationMode string `q:"encapsulation_mode"` EncryptionAlgorithm string `q:"encryption_algorithm"` PFS string `q:"pfs"` TransformProtocol string `q:"transform_protocol"` }
ListOpts allows the filtering of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the IPSec policy attributes you want to see returned.
func (ListOpts) ToPolicyListQuery ¶
ToPolicyListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type Policy ¶
type Policy struct { // TenantID is the ID of the project TenantID string `json:"tenant_id"` // ProjectID is the ID of the project ProjectID string `json:"project_id"` // Description is the human readable description of the policy Description string `json:"description"` // Name is the human readable name of the policy Name string `json:"name"` // AuthAlgorithm is the authentication hash algorithm AuthAlgorithm string `json:"auth_algorithm"` // EncapsulationMode is the encapsulation mode EncapsulationMode string `json:"encapsulation_mode"` // EncryptionAlgorithm is the encryption algorithm EncryptionAlgorithm string `json:"encryption_algorithm"` // PFS is the Perfect forward secrecy (PFS) mode PFS string `json:"pfs"` // TransformProtocol is the transform protocol TransformProtocol string `json:"transform_protocol"` // Lifetime is the lifetime of the security association Lifetime Lifetime `json:"lifetime"` // ID is the ID of the policy ID string `json:"id"` }
Policy is an IPSec Policy
func ExtractPolicies ¶
func ExtractPolicies(r pagination.Page) ([]Policy, error)
ExtractPolicies accepts a Page struct, specifically a Policy struct, and extracts the elements into a slice of Policy structs. In other words, a generic collection is mapped into a relevant slice.
type PolicyPage ¶
type PolicyPage struct {
pagination.LinkedPageBase
}
PolicyPage is the page returned by a pager when traversing over a collection of Policies.
func (PolicyPage) IsEmpty ¶
func (r PolicyPage) IsEmpty() (bool, error)
IsEmpty checks whether a PolicyPage struct is empty.
func (PolicyPage) NextPageURL ¶
func (r PolicyPage) NextPageURL() (string, error)
NextPageURL is invoked when a paginated collection of IPSec policies has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.
type TransformProtocol ¶
type TransformProtocol string
type UpdateOpts ¶
type UpdateOpts struct { Description *string `json:"description,omitempty"` Name *string `json:"name,omitempty"` AuthAlgorithm AuthAlgorithm `json:"auth_algorithm,omitempty"` EncapsulationMode EncapsulationMode `json:"encapsulation_mode,omitempty"` EncryptionAlgorithm EncryptionAlgorithm `json:"encryption_algorithm,omitempty"` PFS PFS `json:"pfs,omitempty"` TransformProtocol TransformProtocol `json:"transform_protocol,omitempty"` Lifetime *LifetimeUpdateOpts `json:"lifetime,omitempty"` }
UpdateOpts contains the values used when updating an IPSec policy
func (UpdateOpts) ToPolicyUpdateMap ¶
func (opts UpdateOpts) ToPolicyUpdateMap() (map[string]interface{}, error)
ToPolicyUpdateMap casts an UpdateOpts struct to a map.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a Policy.
func Update ¶
func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update allows IPSec policies to be updated.