securitygroups

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

This interface is used to query network resource quotas for the VPC service of a tenant. The network resources include VPCs, subnets, security groups, security group rules, elastic IP addresses, and VPNs.

Sample Code, This interface is used to create a security group.

tenantID := "57e98940a77f4bb988a21a7d0603a626"
result, err := securitygroups.Create(client, tenantID, securitygroups.CreateOpts{
    SecurityGroup: securitygroups.CreateSecurityGroup{
        Name:        "EricSG",
        Description: "Test SecurityGroup",
    },
}).Extract()

if err != nil {
    panic(err)
}

Sample Code, This interface is used to query details about a security group.

tenantID := "57e98940a77f4bb988a21a7d0603a626"
result, err := securitygroups.Get(client, tenantID, "f7616338-fa30-42b8-bf6b-754c0701aab8").Extract()

if err != nil {
  panic(err)
}

Sample Code, This interface is used to query security groups using search criteria and to display the security groups in a list.

tenantID := "57e98940a77f4bb988a21a7d0603a626"
result, err := securitygroups.List(client, tenantID, securitygroups.ListOpts{
    Limit: 2,
}).Extract()

if err != nil {
    panic(err)
}

Sample Code, This interface is used to delete a security group.

tenantID := "57e98940a77f4bb988a21a7d0603a626"
result := securitygroups.Delete(client, tenantID, "2465d913-1084-4a6a-91e7-2fd6f490ecb3")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateURL

func CreateURL(c *gophercloud.ServiceClient) string

func DeleteURL

func DeleteURL(c *gophercloud.ServiceClient, securityGroupId string) string

func GetURL

func GetURL(c *gophercloud.ServiceClient, securityGroupId string) string

func ListURL

func ListURL(c *gophercloud.ServiceClient) string

Types

type CreateOpts

type CreateOpts struct {

	// Specifies the security group name.
	Name string `json:"name" required:"true"`

	// Specifies the enterprise project ID. This field can be used to
	// filter out the VPCs associated with a specified enterprise project.
	EnterpriseProjectId string `json:"enterprise_project_id,omitempty"`

	// Specifies the resource ID of the VPC to which the security
	// group belongs.
	VpcId string `json:"vpc_id,omitempty"`
}

func (CreateOpts) ToSecuritygroupsCreateMap

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

type CreateOptsBuilder

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

type CreateResult

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

func Create

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

func (CreateResult) Extract

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

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

func Delete

func Delete(client *gophercloud.ServiceClient, securityGroupId string) (r DeleteResult)

type GetResult

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

func Get

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

func (GetResult) Extract

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

type ListOpts

type ListOpts struct {

	// Specifies the resource ID of pagination query. If the parameter
	// is left blank, only resources on the first page are queried.
	Marker string `q:"marker"`

	// Specifies the number of records returned on each page.
	Limit int `q:"limit"`

	// Specifies the VPC ID used as the query filter.
	VpcId string `q:"vpc_id"`

	// enterprise_project_id
	// Specifies the enterprise_project_id used as the query filter.
	EnterpriseProjectId string `q:"enterprise_project_id"`
}

func (ListOpts) ToListQuery

func (opts ListOpts) ToListQuery() (string, error)

type ListOptsBuilder

type ListOptsBuilder interface {
	ToListQuery() (string, error)
}

type ListResult

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

func (ListResult) Extract

func (r ListResult) Extract() (*[]SecurityGroup, error)

type SecurityGroup

type SecurityGroup struct {
	// Specifies the security group name.
	Name string `json:"name"`

	// Provides supplementary information about the security group.
	Description string `json:"description"`

	// Specifies the security group ID, which uniquely identifies the
	// security group.
	ID string `json:"id"`

	// Specifies the resource ID of the VPC to which the security
	// group belongs.
	VpcId string `json:"vpc_id"`

	// Specifies the default security group rule, which ensures that
	// hosts in the security group can communicate with one another.
	SecurityGroupRules []SecurityGroupRule `json:"security_group_rules"`

	EnterpriseProjectId string `json:"enterprise_project_id,omitempty"`
}

func ExtractSecurityGroups

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

type SecurityGroupPage

type SecurityGroupPage struct {
	pagination.LinkedPageBase
}

func (SecurityGroupPage) IsEmpty

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

func (SecurityGroupPage) NextPageURL

func (r SecurityGroupPage) NextPageURL() (string, error)

type SecurityGroupRule

type SecurityGroupRule struct {
	// Specifies the security group rule ID.
	ID string `json:"id,omitempty"`

	// Specifies the description.
	Description string `json:"description,omitempty"`

	// Specifies the security group ID.
	SecurityGroupId string `json:"security_group_id,omitempty"`

	// Specifies the direction of access control. The value can
	// be?egress?or?ingress.
	Direction string `json:"direction,omitempty"`

	// Specifies the version of the Internet Protocol. The value can
	// be?IPv4?or?IPv6.
	Ethertype string `json:"ethertype,omitempty"`

	// Specifies the protocol type. If the parameter is left blank,
	// the security group supports all types of protocols. The value can be?icmp,?tcp,
	// or?udp.
	Protocol string `json:"protocol,omitempty"`

	// Specifies the start port. The value ranges from 1 to 65,535.
	// The value must be less than or equal to the value of?port_range_max. An empty value
	// indicates all ports. If?protocol?is?icmp, the value range is determined by the
	// ICMP-port range relationship table provided in Appendix A.2.
	PortRangeMin *int `json:"port_range_min,omitempty"`

	// Specifies the end port. The value ranges from 1 to 65,535. The
	// value must be greater than or equal to the value of?port_range_min. An empty value
	// indicates all ports. If?protocol?is?icmp, the value range is determined by the
	// ICMP-port range relationship table provided in Appendix A.2.
	PortRangeMax *int `json:"port_range_max,omitempty"`

	// Specifies the remote IP address. If the access control
	// direction is set to?egress, the parameter specifies the source IP address. If the
	// access control direction is set to?ingress, the parameter specifies the destination
	// IP address. The parameter is exclusive with parameter?remote_group_id. The value can
	// be in the CIDR format or IP addresses.
	RemoteIpPrefix string `json:"remote_ip_prefix,omitempty"`

	// Specifies the ID of the peer security group. The value is
	// exclusive with parameter?remote_ip_prefix.
	RemoteGroupId string `json:"remote_group_id,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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