secgroups

package
v0.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2015 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddServerToGroup

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

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

func Delete

Delete will permanently delete a security group from the project.

func DeleteRule

func DeleteRule(client *gophercloud.ServiceClient, id string) 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 RemoveServerFromGroup

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

RemoveServerFromGroup 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

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 {
	// Required - the ID of the group that this rule will be added to.
	ParentGroupID string `json:"parent_group_id"`

	// Required - the lower bound of the port range that will be opened.
	FromPort int `json:"from_port"`

	// Required - the upper bound of the port range that will be opened.
	ToPort int `json:"to_port"`

	// Required - the protocol type that will be allowed, e.g. TCP.
	IPProtocol string `json:"ip_protocol"`

	// 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"`

	// 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"`
}

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) 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 `mapstructure:"tenant_id"`
	Name     string
}

Group represents a group.

type GroupOpts

type GroupOpts struct {
	// Required - the name of your security group.
	Name string `json:"name"`

	// Required - the description of your security group.
	Description string `json:"description"`
}

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 `mapstructure:"from_port"`

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

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

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

	// The security group ID to which this rule belongs
	ParentGroupID string `mapstructure:"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 `mapstructure:"tenant_id"`
}

SecurityGroup represents a security group.

func ExtractSecurityGroups

func ExtractSecurityGroups(page 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

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.

Jump to

Keyboard shortcuts

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