rules

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(c *golangsdk.ServiceClient, securityGroupRuleId string) *golangsdk.ErrResult

Delete is a method to delete an existing security group rule.

Types

type CreateOpts

type CreateOpts struct {
	// Specifies the security group ID.
	SecurityGroupId string `json:"security_group_id" required:"true"`
	// Provides supplementary information about the security group rule.
	// The value can contain no more than 255 characters, including letters and digits.
	Description string `json:"description,omitempty"`
	// Specifies the direction of access control.
	// Possible values are as follows:
	//   egress
	//   ingress
	Direction string `json:"direction" required:"true"`
	// Specifies the IP protocol version. The value can be IPv4 or IPv6. The default value is IPv4.
	Ethertype string `json:"ethertype,omitempty"`
	// Specifies the protocol type. The value can be icmp, tcp, or udp.
	// If the parameter is left blank, all protocols are supported.
	Protocol string `json:"protocol,omitempty"`
	// Specifies the port value range, which supports single port (80), continuous port (1-30) and discontinuous
	// port (22, 3389, 80). The range of port values is range form 1 to 65,535.
	MultiPort string `json:"multiport,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 value can be in the CIDR format or IP addresses.
	// The parameter is exclusive with parameter remote_group_id.
	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"`
	// Specifies the ID of the peer security group.
	// The value is exclusive with parameter remote_ip_prefix.
	RemoteAddressGroupId string `json:"remote_address_group_id,omitempty"`
	// Specifies the ID of the peer security group.
	// The value is exclusive with parameter remote_ip_prefix.
	Action string `json:"action,omitempty"`
	// Specifies the ID of the peer security group.
	// The value is exclusive with parameter remote_ip_prefix.
	Priority int `json:"priority,omitempty"`
}

CreateOpts is a struct which will be used to create a new security group rule.

type ListOpts

type ListOpts struct {
	// Specifies a resource ID for pagination query, indicating that the query starts from the next record of the
	// specified resource ID. This parameter can work together with the parameter limit.
	//   1. If parameters marker and limit are not passed, all resource records will be returned.
	//   2. If the parameter marker is not passed and the value of parameter limit is set to 10, the first 10 resource
	//     records will be returned.
	//   3. If the value of the parameter marker is set to the resource ID of the 10th record and the value of parameter
	//     limit is set to 10, the 11th to 20th resource records will be returned.
	//   4. If the value of the parameter marker is set to the resource ID of the 10th record and the parameter limit is
	//     not passed, resource records starting from the 11th records (including 11th) will be returned.
	Marker string `q:"marker"`
	// Specifies the number of records that will be returned on each page. The value is from 0 to intmax.
	// limit can be used together with marker. For details, see the parameter description of marker.
	Limit int `q:"limit"`
	// Specifies the security group ID.
	SecurityGroupId string `q:"security_group_id"`
	// Security group rule protocol, support multiple filtering
	Protocol string `q:"protocol"`
	// Security group description added. You can use this field to filter security groups precisely, and support
	// multiple descriptions for filtering.
	Description string `q:"description"`
	// Remote security group ID, support multiple ID filtering.
	RemoteGroupId string `q:"remote_group_id"`
	// Security group rule direction.
	Direction string `q:"direction"`
	// Security group rules take effect policy.
	Action string `q:"action"`
}

ListOpts allows to filter list data using given parameters.

type SecurityGroupRule

type SecurityGroupRule struct {
	// Specifies the security group rule ID, which uniquely identifies the security group rule.
	ID string `json:"id"`
	// Provides supplementary information about the security group rule.
	// The value can contain no more than 255 characters, including letters and digits.
	Description string `json:"description"`
	// Specifies the security group ID, which uniquely identifies the security group.
	SecurityGroupId string `json:"security_group_id"`
	// Specifies the direction of access control.
	// Possible values are as follows:
	//   egress
	//   ingress
	Direction string `json:"direction"`
	// Specifies the protocol type. The value can be icmp, tcp, udp, icmpv6 or protocol number.
	// If the parameter is left blank, all protocols are supported.
	// When the protocol is icmpv6, the network type should be IPv6.
	// when the protocol is icmp, the network type should be IPv4.
	Protocol string `json:"protocol"`
	// Specifies the IP protocol version. The value can be IPv4 or IPv6.
	Ethertype string `json:"ethertype"`
	// Port value range.
	// Value range: support and single port (80), contiguous port (1-30) and discontinuous port (22, 3389, 80).
	MultiPort string `json:"multiport"`
	// Security group rules take effect policy.
	//   allow
	//   deny
	// Default is deny.
	Action string `json:"action"`
	// Priority
	// Value range: 1~100, 1 represents the highest priority.
	Priority int `json:"priority"`
	// 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 value can be in the CIDR format or IP addresses.
	// The parameter is exclusive with parameter remote_group_id.
	RemoteIpPrefix string `json:"remote_ip_prefix"`
	// Specifies the ID of the peer security group.
	// The value is exclusive with parameter remote_ip_prefix.
	RemoteGroupId string `json:"remote_group_id"`
	// Remote address group ID. Mutually exclusive with remote_ip_prefix, remote_group_id parameters.
	RemoteAddressGroupId string `json:"remote_address_group_id"`
	// Security group rule creation time, in UTC format: yyyy-MM-ddTHH:mm:ss.
	CreateAt string `json:"created_at"`
	// Security group rule udpate time, in UTC format: yyyy-MM-ddTHH:mm:ss.
	UpdateAt string `json:"updated_at"`
	// ID of the project to which the security group rule belongs.
	ProjectId string `json:"project_id"`
}

SecurityGroupRule is a struct that represents the detail of the security group rule.

func Create

func Create(c *golangsdk.ServiceClient, opts CreateOpts) (*SecurityGroupRule, error)

Create is a method to create a new security group rule.

func ExtractSecurityGroupRules

func ExtractSecurityGroupRules(r pagination.Page) ([]SecurityGroupRule, error)

ExtractSecurityGroupRules is a method to extract the list of security group rule details.

func Get

func Get(c *golangsdk.ServiceClient, ruleId string) (*SecurityGroupRule, error)

Get is a method to obtain the security group rule detail.

func List

func List(c *golangsdk.ServiceClient, opts ListOpts) ([]SecurityGroupRule, error)

List is a method to obtain the list of the security group rules.

type SecurityGroupRulePage

type SecurityGroupRulePage struct {
	pagination.MarkerPageBase
}

func (SecurityGroupRulePage) IsEmpty

func (p SecurityGroupRulePage) IsEmpty() (bool, error)

IsEmpty method checks whether the current SecurityGroupRulePage is empty.

func (SecurityGroupRulePage) LastMarker

func (p SecurityGroupRulePage) LastMarker() (string, error)

LastMarker method returns the last security group rule ID in a SecurityGroupRulePage.

Jump to

Keyboard shortcuts

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