Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateOpts ¶
type CreateOpts struct {
// Whether to only send the check request.
// The value can be:
// - true: The request will be checked and the security group rule will not be created.
// Check items include mandatory parameters, request format, and constraints.
// If the check fails, the system returns an error.
// If the check succeeds, response code 202 will be returned.
// - false (default): A request will be sent and a security group rule will be created.
DryRun bool `json:"dry_run,omitempty"`
// Request body for creating a security group rule.
SecurityGroupRule SecurityGroupRuleOptions `json:"security_group_rule" required:"true"`
}
type ListQueryParams ¶
type ListQueryParams struct {
// Specifies the number of records displayed on each page.
// The value ranges from 1 to 2000.
Limit int `q:"limit"`
// Specifies the start resource ID of pagination query. If the parameter is left blank, only resources on the first page are queried.
// The value is obtained from next_marker or previous_marker in PageInfo queried last time.
Marker string `q:"marker"`
// Specifies the Security group rule ID.
Id []string `q:"id"`
// Specifies the ID of the security group to which the security group rule belongs. Multiple IDs can be specified for filtering.
SecurityGroupId []string `q:"security_group_id"`
// Protocol specified in the security group rule. Multiple protocols can be specified for filtering.
Protocol []string `q:"protocol"`
// Specifies the supplementary information about the security group rule.
// This field can be used to filter security groups. Multiple descriptions can be specified for filtering.
Description []string `q:"description"`
// Specifies the ID of the remote security group. Multiple IDs can be specified for filtering.
RemoteGroupId []string `q:"remote_group_id"`
// Inbound or outbound direction of a security group rule.
// The value can be: ingress or egress
Direction string `q:"direction"`
// Action of the security group rule.
Action string `q:"action"`
// Remote IP address or CIDR block.
RemoteIpPrefix string `q:"remote_ip_prefix"`
// Security group rule priority. Multiple priorities can be specified for filtering.
Priority []int `q:"priority"`
// Type of the security group rule. Value range: IPv4, ipv4, IPv6, or ipv6.
EtherType []string `q:"ethertype"`
// Project ID
ProjectId []string `q:"project_id"`
// ID of the remote IP address group. Multiple IDs can be specified for filtering.
RemoteAddressGroupId []string `q:"remote_address_group_id"`
}
type ListResponse ¶
type ListResponse struct {
// Specifies the response body for querying security group rules.
SecurityGroupRules []SecurityGroupRule `json:"security_group_rules"`
// Request ID
RequestID string `json:"request_id"`
// Specifies the pagination information.
PageInfo PageInfo `json:"page_info"`
}
func List ¶
func List(client *golangsdk.ServiceClient, opts ListQueryParams) (*ListResponse, error)
This function is used to query all security group rules.
type PageInfo ¶
type PageInfo struct {
// Specifies the ID of the last record in this query, which can be used in the next query.
NextMarker string `json:"next_marker"`
// Specifies the ID of the first record in the pagination query result.
// When page_reverse is set to true, this parameter is used together to query resources on the previous page.
PreviousMarker string `json:"previous_marker"`
// Specifies the ID of the last record in the pagination query result. It is usually used to query resources on the next page. Value range: 1-200
CurrentCount int `json:"current_count"`
}
type SecurityGroupRule ¶
type SecurityGroupRule struct {
// Security group rule ID, which uniquely identifies the security group rule.
// The value is in UUID format with hyphens (-).
ID string `json:"id"`
// Provides supplementary information about the security group rule.
// The value can contain no more than 255 characters and cannot contain angle brackets (< or >).
Description string `json:"description"`
// ID of the security group to which the security group rule belongs.
SecurityGroupID string `json:"security_group_id"`
// Inbound or outbound direction of a security group rule.
// The value can be: ingress or egress.
Direction string `json:"direction"`
// Protocol type.
// The value can be icmp, tcp, udp, icmpv6, or an IP number.
// If protocol is left blank, all protocols are supported.
Protocol string `json:"protocol"`
// IP version.
// The value can be IPv4 or IPv6.
// If you do not set this parameter, IPv4 is used by default.
Ethertype string `json:"ethertype"`
// Port or port range. Can be a single port (80), a port range (1-30), or non-consecutive ports separated by commas (22,3389,80).
Multiport string `json:"multiport"`
// Action of the security group rule.
// The value can be: allow or deny.
// The default value is deny.
Action string `json:"action"`
// Rule priority.
// The value is from 1 to 100. The value 1 indicates the highest priority.
Priority int `json:"priority"`
// Time when the security group rule is created.
// UTC time in the format of yyyy-MM-ddTHH:mm:ssZ.
CreatedAt string `json:"created_at"`
// Time when the security group rule is updated.
// UTC time in the format of yyyy-MM-ddTHH:mm:ssZ.
UpdatedAt string `json:"updated_at"`
// ID of the project to which the security group rule belongs.
ProjectID string `json:"project_id"`
// ID of the remote security group, which allows or denies traffic to and from the security group.
// Value range: ID of an existing security group.
// Mutually exclusive with remote_ip_prefix and remote_address_group_id.
RemoteGroupID string `json:"remote_group_id"`
// Remote IP address or CIDR block.
// If direction is egress: source IP; if ingress: destination IP.
// Mutually exclusive with remote_group_id and remote_address_group_id.
RemoteIPPrefix string `json:"remote_ip_prefix"`
// ID of the remote IP address group.
// Mutually exclusive with remote_ip_prefix and remote_group_id.
RemoteAddressGroupID string `json:"remote_address_group_id"`
}
func Create ¶
func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*SecurityGroupRule, error)
This function is used to create a security group rule.
func Get ¶
func Get(client *golangsdk.ServiceClient, ruleId string) (*SecurityGroupRule, error)
This function is used to obtain details about a security group rule.
type SecurityGroupRuleOptions ¶
type SecurityGroupRuleOptions struct {
// ID of the security group to which the security group rule belongs.
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 and cannot contain angle brackets (< or >).
Description string `json:"description,omitempty"`
// Inbound or outbound direction of a security group rule.
// The value can be: ingress (inbound) or egress (outbound).
Direction string `json:"direction" required:"true"`
// IP version.
// The value can be IPv4 or IPv6.
// If you do not set this parameter, IPv4 is used by default.
Ethertype string `json:"ethertype,omitempty"`
// Protocol type.
// The value can be icmp, tcp, udp, icmpv6, or an IP number.
// If protocol is left blank, all protocols are supported.
Protocol string `json:"protocol,omitempty"`
// Port or port range. Can be a single port (80), a port range (1-30), or non-consecutive ports separated by commas (22,3389,80).
Multiport string `json:"multiport,omitempty"`
// Remote IP address or CIDR block.
// If direction is egress: source IP; if ingress: destination IP.
// Mutually exclusive with remote_group_id and remote_address_group_id.
RemoteIPPrefix string `json:"remote_ip_prefix,omitempty"`
// ID of the remote security group, which allows or denies traffic to and from the security group.
// Value range: ID of an existing security group.
// Mutually exclusive with remote_ip_prefix and remote_address_group_id.
RemoteGroupID string `json:"remote_group_id,omitempty"`
// Action of the security group rule.
// The value can be: allow or deny.
// The default value is deny.
Action string `json:"action,omitempty"`
// Rule priority.
// The value is from 1 to 100. The value 1 indicates the highest priority.
Priority int `json:"priority,omitempty"`
}
type SecurityGroupRuleResponse ¶
type SecurityGroupRuleResponse struct {
// Request ID.
RequestID string `json:"request_id"`
// Response body for creating a security group.
SecurityGroupRule SecurityGroupRule `json:"security_group_rule"`
}
Click to show internal directories.
Click to hide internal directories.