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 rule.
result, err := securitygrouprules.Create(client, securitygrouprules.CreateOpts{
SecurityGroupRule: securitygrouprules.CreateSecurityGroupRule {
Description: "Test SecurityGroup",
TenantId: tenantID,
SecurityGroupId: "7af80d49-0a43-462d-aed8-a1e12ac91af6",
Direction: "egress",
Protocol: "tcp",
RemoteIpPrefix: "10.10.0.0/24",
},
}).Extract()
if err != nil {
panic(err)
}
Sample Code, This interface is used to query details about a security group rule.
result, err := securitygrouprules.Get(client, "26243298-ae79-46a3-bad9-34395762e033").Extract()
if err != nil {
panic(err)
}
Sample Code, This interface is used to query security group rules using search criteria and to display the security group rules in a list.
allPages, err := securitygrouprules.List(client, securitygrouprules.ListOpts{
Limit: 2,
Protocol: "tcp",
}).AllPages()
result, err := securitygrouprules.ExtractList(allPages.(securitygrouprules.ListPage))
if err != nil {
panic(err)
}
Sample Code, This interface is used to delete a security group rule.
result = securitygrouprules.Delete(client, "26243298-ae79-46a3-bad9-34395762e033")
Index ¶
- func CreateURL(c *gophercloud.ServiceClient) string
- func DeleteURL(c *gophercloud.ServiceClient, securityGroupsRulesId string) string
- func GetURL(c *gophercloud.ServiceClient, securityGroupsRulesId string) string
- func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func ListURL(c *gophercloud.ServiceClient) string
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type ListPage
- type SecurityGroupRule
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, securityGroupsRulesId string) string
func GetURL ¶
func GetURL(c *gophercloud.ServiceClient, securityGroupsRulesId string) string
func List ¶
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
This interface is used to query security group rules using search criteria and to display the security group rules in a list.
func ListURL ¶
func ListURL(c *gophercloud.ServiceClient) string
Types ¶
type CreateOpts ¶
type CreateOpts struct {
// Default Value:None. Provides supplementary information about
// the security group rule.
Description string `json:"description,omitempty"`
// Default Value:None. Specifies the ID of the belonged security
// group.
SecurityGroupId string `json:"security_group_id" required:"true"`
// Default Value:None. Specifies the peer ID of the belonged
// security group.
RemoteGroupId string `json:"remote_group_id,omitempty"`
// Default Value:None. Specifies the direction of the traffic for
// which the security group rule takes effect.
Direction string `json:"direction" required:"true"`
// Default Value:None. Specifies the peer IP address segment.
RemoteIpPrefix string `json:"remote_ip_prefix,omitempty"`
// Default Value:None. Specifies the protocol type or the IP
// protocol number.
Protocol string `json:"protocol,omitempty"`
// Default Value:None. Specifies the maximum port number. When
// ICMP is used, the value is the ICMP code.
PortRangeMax *int `json:"port_range_max,omitempty"`
// Default Value:None. Specifies the minimum port number. If the
// ICMP protocol is used, this parameter indicates the ICMP type. When the TCP or UDP
// protocol is used, both?port_range_max?and?port_range_min?must be specified, and
// the?port_range_max?value must be greater than the?port_range_minvalue. When the ICMP
// protocol is used, if you specify the ICMP code (port_range_max), you must also
// specify the ICMP type (port_range_min).
PortRangeMin *int `json:"port_range_min,omitempty"`
// Default Value:IPv4. Specifies the network type. Only IPv4 is
// supported.
Ethertype string `json:"ethertype,omitempty"`
}
func (CreateOpts) ToSecuritygrouprulesCreateMap ¶
func (opts CreateOpts) ToSecuritygrouprulesCreateMap() (map[string]interface{}, error)
type CreateOptsBuilder ¶
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() (*SecurityGroupRule, error)
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
func Delete ¶
func Delete(client *gophercloud.ServiceClient, securityGroupsRulesId string) (r DeleteResult)
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
func Get ¶
func Get(client *gophercloud.ServiceClient, securityGroupsRulesId string) (r GetResult)
func (GetResult) Extract ¶
func (r GetResult) Extract() (*SecurityGroupRule, 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. The
// value ranges from 0 to intmax.
Limit int `q:"limit"`
// Default Value:None. Specifies the ID of the belonged security
// group.
SecurityGroupId string `q:"security_group_id,omitempty"`
}
func (ListOpts) ToListQuery ¶
type ListOptsBuilder ¶
type SecurityGroupRule ¶
type SecurityGroupRule struct {
// Default Value:None. Specifies the security group rule ID.
ID string `json:"id"`
// Default Value:None. Provides supplementary information about
// the security group rule.
Description string `json:"description"`
// Default Value:None. Specifies the ID of the belonged security
// group.
SecurityGroupId string `json:"security_group_id"`
// Default Value:None. Specifies the peer ID of the belonged
// security group.
RemoteGroupId string `json:"remote_group_id"`
// Default Value:None. Specifies the direction of the traffic for
// which the security group rule takes effect.
Direction string `json:"direction"`
// Default Value:None. Specifies the peer IP address segment.
RemoteIpPrefix string `json:"remote_ip_prefix"`
// Default Value:None. Specifies the protocol type or the IP
// protocol number.
Protocol string `json:"protocol"`
// Default Value:None. Specifies the maximum port number. When
// ICMP is used, the value is the ICMP code.
PortRangeMax *int `json:"port_range_max"`
// Default Value:None. Specifies the minimum port number. If the
// ICMP protocol is used, this parameter indicates the ICMP type. When the TCP or UDP
// protocol is used, both?port_range_max?and?port_range_min?must be specified, and
// the?port_range_max?value must be greater than the?port_range_minvalue. When the ICMP
// protocol is used, if you specify the ICMP code (port_range_max), you must also
// specify the ICMP type (port_range_min).
PortRangeMin *int `json:"port_range_min"`
// Default Value:IPv4. Specifies the network type. Only IPv4 is
// supported.
Ethertype string `json:"ethertype"`
}
func ExtractSecurityGroupRules ¶
func ExtractSecurityGroupRules(r pagination.Page) ([]SecurityGroupRule, error)