Documentation
¶
Index ¶
- func Delete(client *golangsdk.ServiceClient, groupId string) error
- type CreateOpts
- type ListQueryParams
- type ListResponse
- type PageInfo
- type SecurityGroup
- type SecurityGroupListObject
- type SecurityGroupOptions
- type SecurityGroupResponse
- type SecurityGroupRule
- type SecurityGroupUpdateOptions
- type UpdateOpts
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 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 will be created.
DryRun bool `json:"dry_run,omitempty"`
// Request body for creating a security group.
SecurityGroup SecurityGroupOptions `json:"security_group" 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 ID.
Id []string `q:"id"`
// Specifies the Security group name.
Name []string `q:"name"`
// Specifies the supplementary information about the security group.
// This field can be used to filter security groups. Multiple descriptions can be specified for filtering.
Description []string `q:"description"`
// Project ID
ProjectId []string `q:"project_id"`
// Specifies the Enterprise project ID. This field can be used to filter the security groups associated with an enterprise project.
// The project ID can be 0 or a string that contains a maximum of 36 characters in UUID format with hyphens (-). 0 indicates the default enterprise project.
// To obtain the security groups associated with all enterprise projects, specify all_granted_eps.
EnterpriseProjectId []string `q:"enterprise_project_id"`
}
type ListResponse ¶
type ListResponse struct {
// Specifies the response body for querying security groups.
SecurityGroups []SecurityGroupListObject `json:"security_groups"`
// 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 groups of a tenant.
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 SecurityGroup ¶
type SecurityGroup struct {
// Security group ID, which uniquely identifies the security group.
// The value is in UUID format with hyphens (-).
ID string `json:"id"`
// Security group name.
// The value can contain 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).
Name string `json:"name"`
// Description about the security group.
// The value can contain up to 255 characters and cannot contain angle brackets (< or >).
Description string `json:"description"`
// ID of the project to which the security group belongs.
ProjectID string `json:"project_id"`
// Time when the security group was created.
// The value is a UTC time in the format of yyyy-MM-ddTHH:mm:ssZ.
CreatedAt string `json:"created_at"`
// Time when the security group was updated.
// The value is a UTC time in the format of yyyy-MM-ddTHH:mm:ssZ.
UpdatedAt string `json:"updated_at"`
// ID of the enterprise project to which the security group belongs.
// The project ID can be 0 or a string that contains a maximum of 36 characters in UUID format with hyphens (-). 0 indicates the default enterprise project.
EnterpriseProjectID string `json:"enterprise_project_id"`
// Security group tags. For details, see the tag objects.
// Value range: 0 to 20 key-value pairs.
Tags []tags.ResourceTag `json:"tags"`
// Security group rules.
SecurityGroupRules []SecurityGroupRule `json:"security_group_rules"`
}
func Create ¶
func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*SecurityGroup, error)
This function is used to create a security group.
func Get ¶
func Get(client *golangsdk.ServiceClient, groupId string) (*SecurityGroup, error)
This function is used to obtain details about a security group.
func Update ¶
func Update(client *golangsdk.ServiceClient, groupId string, opts UpdateOpts) (*SecurityGroup, error)
This function is used to update a security group.
type SecurityGroupListObject ¶
type SecurityGroupListObject struct {
// Security group ID, which uniquely identifies the security group.
// The value is in UUID format with hyphens (-).
ID string `json:"id"`
// Security group name.
// The value can contain 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).
Name string `json:"name"`
// Description about the security group.
// The value can contain up to 255 characters and cannot contain angle brackets (< or >).
Description string `json:"description"`
// ID of the project to which the security group belongs.
ProjectID string `json:"project_id"`
// Time when the security group was created.
// The value is a UTC time in the format of yyyy-MM-ddTHH:mm:ssZ.
CreatedAt string `json:"created_at"`
// Time when the security group was updated.
// The value is a UTC time in the format of yyyy-MM-ddTHH:mm:ssZ.
UpdatedAt string `json:"updated_at"`
// ID of the enterprise project to which the security group belongs.
// The project ID can be 0 or a string that contains a maximum of 36 characters in UUID format with hyphens (-). 0 indicates the default enterprise project.
EnterpriseProjectID string `json:"enterprise_project_id"`
// Security group tags. For details, see the tag objects.
// Value range: 0 to 20 key-value pairs.
Tags []tags.ResourceTag `json:"tags"`
}
type SecurityGroupOptions ¶
type SecurityGroupOptions struct {
// Security group name.
// The value can contain 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).
Name string `json:"name" required:"true"`
// Description about the security group.
// The value can contain up to 255 characters and cannot contain angle brackets (< or >).
Description string `json:"description,omitempty"`
// Enterprise project ID.
// When creating a security group, associate an enterprise project ID with the security group.
// The project ID can be 0 or a string that contains a maximum of 36 characters in UUID format with hyphens (-).
// 0 indicates the default enterprise project.
EnterpriseProjectId string `json:"enterprise_project_id,omitempty"`
// Security group tags. Value range: 0 to 20 key-value pairs.
Tags []tags.ResourceTag `json:"tags,omitempty"`
}
type SecurityGroupResponse ¶
type SecurityGroupResponse struct {
// Request ID.
RequestID string `json:"request_id"`
// Response body for creating a security group.
SecurityGroup SecurityGroup `json:"security_group"`
}
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"`
}
type SecurityGroupUpdateOptions ¶
type SecurityGroupUpdateOptions struct {
// Security group name.
// The value can contain 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).
Name string `json:"name,omitempty"`
// Description about the security group.
// The value can contain up to 255 characters and cannot contain angle brackets (< or >).
Description string `json:"description,omitempty"`
}
type UpdateOpts ¶
type UpdateOpts struct {
// Whether to only send the check request.
// The value can be:
// - true: The request will be checked and the security group 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 will be created.
DryRun bool `json:"dry_run,omitempty"`
// Request body for creating a security group.
SecurityGroup SecurityGroupUpdateOptions `json:"security_group" required:"true"`
}
Click to show internal directories.
Click to hide internal directories.