Documentation ¶
Overview ¶
Package ikepolicies allows management and retrieval of IKE policies in the OpenStack Networking Service.
Example to Create an IKE policy
createOpts := ikepolicies.CreateOpts{ Name: "ikepolicy1", Description: "Description of ikepolicy1", EncryptionAlgorithm: ikepolicies.EncryptionAlgorithm3DES, PFS: ikepolicies.PFSGroup5, } policy, err := ikepolicies.Create(networkClient, createOpts).Extract() if err != nil { panic(err) }
Example to Show the details of a specific IKE policy by ID
policy, err := ikepolicies.Get(client, "f2b08c1e-aa81-4668-8ae1-1401bcb0576c").Extract() if err != nil { panic(err) }
Example to Delete a Policy
err := ikepolicies.Delete(client, "5291b189-fd84-46e5-84bd-78f40c05d69c").ExtractErr() if err != nil { panic(err)
Example to Update an IKE policy
name := "updatedname" description := "updated policy" updateOpts := ikepolicies.UpdateOpts{ Name: &name, Description: &description, Lifetime: &ikepolicies.LifetimeUpdateOpts{ Value: 7000, }, } updatedPolicy, err := ikepolicies.Update(client, "5c561d9d-eaea-45f6-ae3e-08d1a7080828", updateOpts).Extract() if err != nil { panic(err) }
Example to List IKE policies
allPages, err := ikepolicies.List(client, nil).AllPages() if err != nil { panic(err) } allPolicies, err := ikepolicies.ExtractPolicies(allPages) if err != nil { panic(err) }
Index ¶
- Constants
- func List(c *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type AuthAlgorithm
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type EncryptionAlgorithm
- type GetResult
- type IKEVersion
- type Lifetime
- type LifetimeCreateOpts
- type LifetimeUpdateOpts
- type ListOpts
- type ListOptsBuilder
- type PFS
- type Phase1NegotiationMode
- type Policy
- type PolicyPage
- type Unit
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
const ( AuthAlgorithmMD5 AuthAlgorithm = "md5" AuthAlgorithmSHA1 AuthAlgorithm = "sha1" AuthAlgorithmSHA256 AuthAlgorithm = "sha2-256" AuthAlgorithmSHA384 AuthAlgorithm = "sha2-384" AuthAlgorithmSHA512 AuthAlgorithm = "sha2-512" EncryptionAlgorithm3DES EncryptionAlgorithm = "3des" EncryptionAlgorithmAES128 EncryptionAlgorithm = "aes-128" EncryptionAlgorithmAES256 EncryptionAlgorithm = "aes-256" EncryptionAlgorithmAES192 EncryptionAlgorithm = "aes-192" UnitSeconds Unit = "seconds" UnitKilobytes Unit = "kilobytes" PFSGroup2 PFS = "group2" PFSGroup5 PFS = "group5" PFSGroup14 PFS = "group14" IKEVersionv1 IKEVersion = "v1" IKEVersionv2 IKEVersion = "v2" Phase1NegotiationModeMain Phase1NegotiationMode = "main" )
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(c *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns a Pager which allows you to iterate over a collection of IKE 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 IKE 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"` // 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"` // The IKE mode. // A valid value is main, which is the default. Phase1NegotiationMode Phase1NegotiationMode `json:"phase1_negotiation_mode,omitempty"` // The IKE version. // A valid value is v1 or v2. // Default is v1. IKEVersion IKEVersion `json:"ike_version,omitempty"` //Lifetime is the lifetime of the security association Lifetime *LifetimeCreateOpts `json:"lifetime,omitempty"` }
CreateOpts contains all the values needed to create a new IKE 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 *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and uses the values to create a new IKE policy
type DeleteResult ¶
type DeleteResult struct {
golangsdk.ErrResult
}
DeleteResult represents the results of a Delete operation. Call its ExtractErr method to determine whether the operation succeeded or failed.
func Delete ¶
func Delete(c *golangsdk.ServiceClient, id string) (r DeleteResult)
Delete will permanently delete a particular IKE policy based on its unique ID.
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.
type IKEVersion ¶
type IKEVersion string
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"` Phase1NegotiationMode string `q:"phase_1_negotiation_mode"` IKEVersion string `q:"ike_version"` }
ListOpts allows the filtering of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the IKE 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 Phase1NegotiationMode ¶
type Phase1NegotiationMode string
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"` // EncryptionAlgorithm is the encryption algorithm EncryptionAlgorithm string `json:"encryption_algorithm"` // PFS is the Perfect forward secrecy (PFS) mode PFS string `json:"pfs"` // Lifetime is the lifetime of the security association Lifetime Lifetime `json:"lifetime"` // ID is the ID of the policy ID string `json:"id"` // Phase1NegotiationMode is the IKE mode Phase1NegotiationMode string `json:"phase1_negotiation_mode"` // IKEVersion is the IKE version. IKEVersion string `json:"ike_version"` }
Policy is an IKE 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 IKE 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 UpdateOpts ¶
type UpdateOpts struct { Description *string `json:"description,omitempty"` Name *string `json:"name,omitempty"` AuthAlgorithm AuthAlgorithm `json:"auth_algorithm,omitempty"` EncryptionAlgorithm EncryptionAlgorithm `json:"encryption_algorithm,omitempty"` PFS PFS `json:"pfs,omitempty"` Lifetime *LifetimeUpdateOpts `json:"lifetime,omitempty"` Phase1NegotiationMode Phase1NegotiationMode `json:"phase_1_negotiation_mode,omitempty"` IKEVersion IKEVersion `json:"ike_version,omitempty"` }
UpdateOpts contains the values used when updating an IKE 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 *golangsdk.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update allows IKE policies to be updated.