Documentation ¶
Index ¶
- func ExtractSecurityGroupInstances(r pagination.Page) ([]instances.Instance, error)
- func ExtractSecurityGroupInstancesInto(r pagination.Page, v interface{}) error
- func ExtractSecurityGroupsInto(r pagination.Page, v interface{}) error
- func IDFromName(client *gcorecloud.ServiceClient, name string) (string, error)
- func List(c *gcorecloud.ServiceClient) pagination.Pager
- func ListAllInstances(c *gcorecloud.ServiceClient, securityGroupID string) ([]instances.Instance, error)
- func ListInstances(c *gcorecloud.ServiceClient, securityGroupID string) pagination.Pager
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type CreateRuleOptsBuilder
- type CreateRuleResult
- type CreateSecurityGroupOpts
- type CreateSecurityGroupRuleOpts
- type DeleteResult
- type GetResult
- type SecurityGroup
- type SecurityGroupInstancesPage
- type SecurityGroupPage
- type SecurityGroupRule
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractSecurityGroupInstances ¶
func ExtractSecurityGroupInstances(r pagination.Page) ([]instances.Instance, error)
ExtractSecurityGroupInstances accepts a Page struct, specifically a SecurityGroupInstancesPage struct, and extracts the elements into a slice of Instance structs. In other words, a generic collection is mapped into a relevant slice.
func ExtractSecurityGroupInstancesInto ¶
func ExtractSecurityGroupInstancesInto(r pagination.Page, v interface{}) error
func ExtractSecurityGroupsInto ¶
func ExtractSecurityGroupsInto(r pagination.Page, v interface{}) error
func IDFromName ¶
func IDFromName(client *gcorecloud.ServiceClient, name string) (string, error)
IDFromName is a convenience function that returns a security group's ID, given its name.
func List ¶
func List(c *gcorecloud.ServiceClient) pagination.Pager
func ListAllInstances ¶
func ListAllInstances(c *gcorecloud.ServiceClient, securityGroupID string) ([]instances.Instance, error)
ListAllInstances returns all instances for SG
func ListInstances ¶
func ListInstances(c *gcorecloud.ServiceClient, securityGroupID string) pagination.Pager
ListInstances returns page of instances for SG
Types ¶
type CreateOpts ¶
type CreateOpts struct { SecurityGroup CreateSecurityGroupOpts `json:"security_group" required:"true"` Instances []string `json:"instances"` }
CreateOpts represents options used to create a security group.
func (CreateOpts) ToFloatingIPCreateMap ¶
func (opts CreateOpts) ToFloatingIPCreateMap() (map[string]interface{}, error)
ToFloatingIPCreateMap builds a request body from CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult represents the result of a create operation. Call its Extract method to interpret it as a SecurityGroup.
func Create ¶
func Create(c *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and creates a new security group using the values provided.
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*SecurityGroup, error)
Extract is a function that accepts a result and extracts a security group resource.
func (CreateResult) ExtractInto ¶
func (r CreateResult) ExtractInto(v interface{}) error
type CreateRuleOptsBuilder ¶
CreateRuleOptsBuilder allows extensions to add additional parameters to the request.
type CreateRuleResult ¶
type CreateRuleResult struct {
// contains filtered or unexported fields
}
CreateRuleResult represents the result of a create operation. Call its Extract method to interpret it as a SecurityGroupRule.
func AddRule ¶
func AddRule(c *gcorecloud.ServiceClient, securityGroupID string, opts CreateRuleOptsBuilder) (r CreateRuleResult)
AddRule accepts a CreateSecurityGroupRuleOpts struct and add rule to existed group.
func (CreateRuleResult) Extract ¶
func (r CreateRuleResult) Extract() (*SecurityGroupRule, error)
Extract is a function that accepts a result and extracts a security group rule resource.
func (CreateRuleResult) ExtractInto ¶
func (r CreateRuleResult) ExtractInto(v interface{}) error
type CreateSecurityGroupOpts ¶
type CreateSecurityGroupOpts struct { Name string `json:"name" required:"true"` Description *string `json:"description,omitempty"` SecurityGroupRules []CreateSecurityGroupRuleOpts `json:"security_group_rules"` }
CreateSecurityGroupOpts represents options used to create a security group.
type CreateSecurityGroupRuleOpts ¶
type CreateSecurityGroupRuleOpts struct { Direction types.RuleDirection `json:"direction" required:"true"` EtherType types.EtherType `json:"ethertype,omitempty" required:"true"` Protocol types.Protocol `json:"protocol,omitempty" required:"true"` SecurityGroupID *string `json:"security_group_id,omitempty"` RemoteGroupID *string `json:"remote_group_id,omitempty"` PortRangeMax *int `json:"port_range_max,omitempty"` PortRangeMin *int `json:"port_range_min,omitempty"` Description *string `json:"description,omitempty"` RemoteIPPrefix *string `json:"remote_ip_prefix,omitempty"` }
CreateSecurityGroupRuleOpts represents options used to create a security group rule.
func (CreateSecurityGroupRuleOpts) ToFloatingIPCreateMap ¶
func (opts CreateSecurityGroupRuleOpts) ToFloatingIPCreateMap() (map[string]interface{}, error)
ToFloatingIPCreateMap builds a request body from CreateSecurityGroupRuleOpts.
type DeleteResult ¶
type DeleteResult struct {
gcorecloud.ErrResult
}
DeleteResult represents the result of a delete operation
func Delete ¶
func Delete(c *gcorecloud.ServiceClient, securityGroupID string) (r DeleteResult)
Delete accepts a unique ID and deletes the security group associated with it.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a get operation. Call its Extract method to interpret it as a SecurityGroup.
func Get ¶
func Get(c *gcorecloud.ServiceClient, id string) (r GetResult)
Get retrieves a specific security group based on its unique ID.
func (GetResult) Extract ¶
func (r GetResult) Extract() (*SecurityGroup, error)
Extract is a function that accepts a result and extracts a security group resource.
func (GetResult) ExtractInto ¶
func (r GetResult) ExtractInto(v interface{}) error
type SecurityGroup ¶
type SecurityGroup struct { Name string `json:"name"` Description string `json:"description"` ID string `json:"id"` CreatedAt gcorecloud.JSONRFC3339Z `json:"created_at"` UpdatedAt *gcorecloud.JSONRFC3339Z `json:"updated_at"` RevisionNumber int `json:"revision_number"` SecurityGroupRules []SecurityGroupRule `json:"security_group_rules"` ProjectID int `json:"project_id"` RegionID int `json:"region_id"` Region string `json:"region"` }
SecurityGroup represents a security group.
func ExtractSecurityGroups ¶
func ExtractSecurityGroups(r pagination.Page) ([]SecurityGroup, error)
ExtractSecurityGroup accepts a Page struct, specifically a SecurityGroupPage struct, and extracts the elements into a slice of SecurityGroup structs. In other words, a generic collection is mapped into a relevant slice.
func ListAll ¶
func ListAll(c *gcorecloud.ServiceClient) ([]SecurityGroup, error)
ListAll returns all SGs
type SecurityGroupInstancesPage ¶
type SecurityGroupInstancesPage struct {
pagination.LinkedPageBase
}
SecurityGroupInstancesPage is the page returned by a pager when traversing over a collection of security group instances.
func (SecurityGroupInstancesPage) IsEmpty ¶
func (r SecurityGroupInstancesPage) IsEmpty() (bool, error)
IsEmpty checks whether a SecurityGroupInstancesPage struct is empty.
func (SecurityGroupInstancesPage) NextPageURL ¶
func (r SecurityGroupInstancesPage) NextPageURL() (string, error)
NextPageURL is invoked when a paginated collection of security group instances has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.
type SecurityGroupPage ¶
type SecurityGroupPage struct {
pagination.LinkedPageBase
}
SecurityGroupPage is the page returned by a pager when traversing over a collection of security groups.
func (SecurityGroupPage) IsEmpty ¶
func (r SecurityGroupPage) IsEmpty() (bool, error)
IsEmpty checks whether a SecurityGroupPage struct is empty.
func (SecurityGroupPage) NextPageURL ¶
func (r SecurityGroupPage) NextPageURL() (string, error)
NextPageURL is invoked when a paginated collection of security groups has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.
type SecurityGroupRule ¶
type SecurityGroupRule struct { ID string `json:"id"` SecurityGroupID string `json:"security_group_id"` RemoteGroupID *string `json:"remote_group_id"` Direction types.RuleDirection `json:"direction"` EtherType *types.EtherType `json:"ethertype"` Protocol *types.Protocol `json:"protocol"` PortRangeMax *int `json:"port_range_max"` PortRangeMin *int `json:"port_range_min"` Description *string `json:"description"` RemoteIPPrefix *string `json:"remote_ip_prefix"` CreatedAt gcorecloud.JSONRFC3339Z `json:"created_at"` UpdatedAt *gcorecloud.JSONRFC3339Z `json:"updated_at"` RevisionNumber int `json:"revision_number"` }
SecurityGroupRule represents a security group rule.
type UpdateOpts ¶
type UpdateOpts struct {
Name string `json:"name" required:"true"`
}
UpdateOpts represents options used to update a security group.
func (UpdateOpts) ToFloatingIPUpdateMap ¶
func (opts UpdateOpts) ToFloatingIPUpdateMap() (map[string]interface{}, error)
ToFloatingIPUpdateMap builds a request body from UpdateOpts.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a SecurityGroup.
func Update ¶
func Update(c *gcorecloud.ServiceClient, securityGroupID string, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts a UpdateOpts struct and updates an existing security group using the values provided. For more information, see the Create function.
func (UpdateResult) Extract ¶
func (r UpdateResult) Extract() (*SecurityGroup, error)
Extract is a function that accepts a result and extracts a security group resource.
func (UpdateResult) ExtractInto ¶
func (r UpdateResult) ExtractInto(v interface{}) error