Documentation ¶
Overview ¶
Package endpointgroups allows management of endpoint groups in the Openstack Network Service
Example to create an Endpoint Group
createOpts := endpointgroups.CreateOpts{ Name: groupName, Type: endpointgroups.TypeCIDR, Endpoints: []string{ "10.2.0.0/24", "10.3.0.0/24", }, } group, err := endpointgroups.Create(client, createOpts).Extract() if err != nil { return group, err }
Example to retrieve an Endpoint Group
group, err := endpointgroups.Get(client, "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a").Extract() if err != nil { panic(err) }
Example to Delete an Endpoint Group
err := endpointgroups.Delete(client, "5291b189-fd84-46e5-84bd-78f40c05d69c").ExtractErr() if err != nil { panic(err) }
Example to List Endpoint groups
allPages, err := endpointgroups.List(client, nil).AllPages() if err != nil { panic(err) } allGroups, err := endpointgroups.ExtractEndpointGroups(allPages) if err != nil { panic(err) }
Example to Update an endpoint group
name := "updatedname" description := "updated description" updateOpts := endpointgroups.UpdateOpts{ Name: &name, Description: &description, } updatedPolicy, err := endpointgroups.Update(client, "5c561d9d-eaea-45f6-ae3e-08d1a7080828", updateOpts).Extract() if err != nil { panic(err) }
Index ¶
- func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type EndpointGroup
- type EndpointGroupPage
- type EndpointType
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns a Pager which allows you to iterate over a collection of Endpoint groups. It accepts a ListOpts struct, which allows you to filter the returned collection for greater efficiency.
Types ¶
type CreateOpts ¶
type CreateOpts struct { // TenantID specifies a tenant to own the endpoint group. The caller must have // an admin role in order to set this. Otherwise, this field is left unset // and the caller will be the owner. TenantID string `json:"tenant_id,omitempty"` // Description is the human readable description of the endpoint group. Description string `json:"description,omitempty"` // Name is the human readable name of the endpoint group. Name string `json:"name,omitempty"` // The type of the endpoints in the group. // A valid value is subnet, cidr, network, router, or vlan. Type EndpointType `json:"type,omitempty"` // List of endpoints of the same type, for the endpoint group. // The values will depend on the type. Endpoints []string `json:"endpoints"` }
CreateOpts contains all the values needed to create a new endpoint group
func (CreateOpts) ToEndpointGroupCreateMap ¶
func (opts CreateOpts) ToEndpointGroupCreateMap() (map[string]interface{}, error)
ToEndpointGroupCreateMap casts a CreateOpts struct to a map.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create 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 an endpoint group.
func Create ¶
func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and uses the values to create a new endpoint group.
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*EndpointGroup, error)
Extract is a function that accepts a result and extracts an endpoint group.
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult represents the results of a Delete operation. Call its ExtractErr method to determine whether the operation succeeded or failed.
func Delete ¶
func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult)
Delete will permanently delete a particular endpoint group based on its unique ID.
type EndpointGroup ¶
type EndpointGroup struct { // TenantID specifies a tenant to own the endpoint group. TenantID string `json:"tenant_id"` // TenantID specifies a tenant to own the endpoint group. ProjectID string `json:"project_id"` // Description is the human readable description of the endpoint group. Description string `json:"description"` // Name is the human readable name of the endpoint group. Name string `json:"name"` // Type is the type of the endpoints in the group. Type string `json:"type"` // Endpoints is a list of endpoints. Endpoints []string `json:"endpoints"` // ID is the id of the endpoint group ID string `json:"id"` }
EndpointGroup is an endpoint group.
func ExtractEndpointGroups ¶
func ExtractEndpointGroups(r pagination.Page) ([]EndpointGroup, error)
ExtractEndpointGroups accepts a Page struct, specifically an EndpointGroupPage struct, and extracts the elements into a slice of Endpoint group structs. In other words, a generic collection is mapped into a relevant slice.
type EndpointGroupPage ¶
type EndpointGroupPage struct {
pagination.LinkedPageBase
}
EndpointGroupPage is the page returned by a pager when traversing over a collection of Policies.
func (EndpointGroupPage) IsEmpty ¶
func (r EndpointGroupPage) IsEmpty() (bool, error)
IsEmpty checks whether an EndpointGroupPage struct is empty.
func (EndpointGroupPage) NextPageURL ¶
func (r EndpointGroupPage) NextPageURL() (string, error)
NextPageURL is invoked when a paginated collection of Endpoint 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 EndpointType ¶
type EndpointType string
const ( TypeSubnet EndpointType = "subnet" TypeCIDR EndpointType = "cidr" TypeVLAN EndpointType = "vlan" TypeNetwork EndpointType = "network" TypeRouter EndpointType = "router" )
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 an EndpointGroup.
func (GetResult) Extract ¶
func (r GetResult) Extract() (*EndpointGroup, error)
Extract is a function that accepts a result and extracts an endpoint group.
type ListOpts ¶
type ListOpts struct { TenantID string `q:"tenant_id"` ProjectID string `q:"project_id"` Description string `q:"description"` Name string `q:"name"` Type string `q:"type"` }
ListOpts allows the filtering of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the Endpoint group attributes you want to see returned.
func (ListOpts) ToEndpointGroupListQuery ¶
ToEndpointGroupListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type UpdateOpts ¶
type UpdateOpts struct { Description *string `json:"description,omitempty"` Name *string `json:"name,omitempty"` }
UpdateOpts contains the values used when updating an endpoint group.
func (UpdateOpts) ToEndpointGroupUpdateMap ¶
func (opts UpdateOpts) ToEndpointGroupUpdateMap() (map[string]interface{}, error)
ToEndpointGroupUpdateMap casts an UpdateOpts struct to a map.
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 an EndpointGroup.
func Update ¶
func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update allows endpoint groups to be updated.
func (UpdateResult) Extract ¶
func (r UpdateResult) Extract() (*EndpointGroup, error)
Extract is a function that accepts a result and extracts an endpoint group.