secgroups

package
v0.0.0-...-d5be3fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddServer

func AddServer(client *gophercloud.ServiceClient, serverID, groupName string) (r gophercloud.ErrResult)

AddServer will associate a server and a security group, enforcing the rules of the group on the server.

func Delete

func Delete(client *gophercloud.ServiceClient, id string) (r gophercloud.ErrResult)

Delete will permanently delete a security group from the project.

func DeleteRule

func DeleteRule(client *gophercloud.ServiceClient, id string) (r gophercloud.ErrResult)

DeleteRule will permanently delete a rule from a security group.

func List

List will return a collection of all the security groups for a particular tenant.

func ListByServer

func ListByServer(client *gophercloud.ServiceClient, serverID string) pagination.Pager

ListByServer will return a collection of all the security groups which are associated with a particular server.

func RemoveServer

func RemoveServer(client *gophercloud.ServiceClient, serverID, groupName string) (r gophercloud.ErrResult)

RemoveServer will disassociate a server from a security group.

Types

type CreateOpts

type CreateOpts GroupOpts

CreateOpts is the struct responsible for creating a security group.

func (CreateOpts) ToSecGroupCreateMap

func (opts CreateOpts) ToSecGroupCreateMap() (map[string]interface{}, error)

ToSecGroupCreateMap builds the create options into a serializable format.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToSecGroupCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder builds the create options into a serializable format.

type CreateResult

type CreateResult struct {
	// contains filtered or unexported fields
}

CreateResult represents the result of a create operation.

func Create

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create will create a new security group.

func (CreateResult) Extract

func (r CreateResult) Extract() (*SecurityGroup, error)

Extract will extract a SecurityGroup struct from most responses.

type CreateRuleOpts

type CreateRuleOpts struct {
	// the ID of the group that this rule will be added to.
	ParentGroupID string `json:"parent_group_id" required:"true"`
	// the lower bound of the port range that will be opened.
	FromPort int `json:"from_port"`
	// the upper bound of the port range that will be opened.
	ToPort int `json:"to_port"`
	// the protocol type that will be allowed, e.g. TCP.
	IPProtocol string `json:"ip_protocol" required:"true"`
	// ONLY required if FromGroupID is blank. This represents the IP range that
	// will be the source of network traffic to your security group. Use
	// 0.0.0.0/0 to allow all IP addresses.
	CIDR string `json:"cidr,omitempty" or:"FromGroupID"`
	// ONLY required if CIDR is blank. This value represents the ID of a group
	// that forwards traffic to the parent group. So, instead of accepting
	// network traffic from an entire IP range, you can instead refine the
	// inbound source by an existing security group.
	FromGroupID string `json:"group_id,omitempty" or:"CIDR"`
}

CreateRuleOpts represents the configuration for adding a new rule to an existing security group.

func (CreateRuleOpts) ToRuleCreateMap

func (opts CreateRuleOpts) ToRuleCreateMap() (map[string]interface{}, error)

ToRuleCreateMap builds the create rule options into a serializable format.

type CreateRuleOptsBuilder

type CreateRuleOptsBuilder interface {
	ToRuleCreateMap() (map[string]interface{}, error)
}

CreateRuleOptsBuilder builds the create rule options into a serializable format.

type CreateRuleResult

type CreateRuleResult struct {
	gophercloud.Result
}

CreateRuleResult represents the result when adding rules to a security group.

func CreateRule

CreateRule will add a new rule to an existing security group (whose ID is specified in CreateRuleOpts). You have the option of controlling inbound traffic from either an IP range (CIDR) or from another security group.

func (CreateRuleResult) Extract

func (r CreateRuleResult) Extract() (*Rule, error)

Extract will extract a Rule struct from a CreateRuleResult.

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

GetResult represents the result of a get operation.

func Get

func Get(client *gophercloud.ServiceClient, id string) (r GetResult)

Get will return details for a particular security group.

func (GetResult) Extract

func (r GetResult) Extract() (*SecurityGroup, error)

Extract will extract a SecurityGroup struct from most responses.

type Group

type Group struct {
	TenantID string `json:"tenant_id"`
	Name     string
}

Group represents a group.

type GroupOpts

type GroupOpts struct {
	// the name of your security group.
	Name string `json:"name" required:"true"`
	// the description of your security group.
	Description string `json:"description" required:"true"`
}

GroupOpts is the underlying struct responsible for creating or updating security groups. It therefore represents the mutable attributes of a security group.

type IPRange

type IPRange struct {
	CIDR string
}

IPRange represents the IP range whose traffic will be accepted by the security group.

type Rule

type Rule struct {
	// The unique ID. If Neutron is installed, this ID will be
	// represented as a string UUID; if Neutron is not installed, it will be a
	// numeric ID. For the sake of consistency, we always cast it to a string.
	ID string

	// The lower bound of the port range which this security group should open up
	FromPort int `json:"from_port"`

	// The upper bound of the port range which this security group should open up
	ToPort int `json:"to_port"`

	// The IP protocol (e.g. TCP) which the security group accepts
	IPProtocol string `json:"ip_protocol"`

	// The CIDR IP range whose traffic can be received
	IPRange IPRange `json:"ip_range"`

	// The security group ID to which this rule belongs
	ParentGroupID string `json:"parent_group_id"`

	// Not documented.
	Group Group
}

Rule represents a security group rule, a policy which determines how a security group operates and what inbound traffic it allows in.

type SecurityGroup

type SecurityGroup struct {
	// The unique ID of the group. If Neutron is installed, this ID will be
	// represented as a string UUID; if Neutron is not installed, it will be a
	// numeric ID. For the sake of consistency, we always cast it to a string.
	ID string

	// The human-readable name of the group, which needs to be unique.
	Name string

	// The human-readable description of the group.
	Description string

	// The rules which determine how this security group operates.
	Rules []Rule

	// The ID of the tenant to which this security group belongs.
	TenantID string `json:"tenant_id"`
}

SecurityGroup represents a security group.

func ExtractSecurityGroups

func ExtractSecurityGroups(r pagination.Page) ([]SecurityGroup, error)

ExtractSecurityGroups returns a slice of SecurityGroups contained in a single page of results.

type SecurityGroupPage

type SecurityGroupPage struct {
	pagination.SinglePageBase
}

SecurityGroupPage is a single page of a SecurityGroup collection.

func (SecurityGroupPage) IsEmpty

func (page SecurityGroupPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a page of Security Groups contains any results.

type UpdateOpts

type UpdateOpts GroupOpts

UpdateOpts is the struct responsible for updating an existing security group.

func (UpdateOpts) ToSecGroupUpdateMap

func (opts UpdateOpts) ToSecGroupUpdateMap() (map[string]interface{}, error)

ToSecGroupUpdateMap builds the update options into a serializable format.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToSecGroupUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder builds the update options into a serializable format.

type UpdateResult

type UpdateResult struct {
	// contains filtered or unexported fields
}

UpdateResult represents the result of an update operation.

func Update

func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update will modify the mutable properties of a security group, notably its name and description.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*SecurityGroup, error)

Extract will extract a SecurityGroup struct from most responses.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL