Documentation ¶
Overview ¶
Package flavorprofiles provides information and interaction with FlavorProfiles for the OpenStack Load-balancing service.
Example to List FlavorProfiles
listOpts := flavorprofiles.ListOpts{} allPages, err := flavorprofiles.List(octaviaClient, listOpts).AllPages() if err != nil { panic(err) } allFlavorProfiles, err := flavorprofiles.ExtractFlavorProfiles(allPages) if err != nil { panic(err) } for _, flavorProfile := range allFlavorProfiles { fmt.Printf("%+v\n", flavorProfile) }
Example to Create a FlavorProfile
createOpts := flavorprofiles.CreateOpts{ Name: "amphora-single", ProviderName: "amphora", FlavorData: "{\"loadbalancer_topology\": \"SINGLE\"}", } flavorProfile, err := flavorprofiles.Create(octaviaClient, createOpts).Extract() if err != nil { panic(err) }
Example to Update a FlavorProfile
flavorProfileID := "dd6a26af-8085-4047-a62b-3080f4c76521" updateOpts := flavorprofiles.UpdateOpts{ Name: "amphora-single-updated", } flavorProfile, err := flavorprofiles.Update(octaviaClient, flavorProfileID, updateOpts).Extract() if err != nil { panic(err) }
Example to Delete a FlavorProfile
flavorProfileID := "dd6a26af-8085-4047-a62b-3080f4c76521" err := flavorprofiles.Delete(octaviaClient, flavorProfileID).ExtractErr() if err != nil { panic(err) }
Index ¶
- func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type FlavorProfile
- type FlavorProfilePage
- 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 FlavorProfiles. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.
Types ¶
type CreateOpts ¶
type CreateOpts struct { // Human-readable name for the Loadbalancer. Does not have to be unique. Name string `json:"name" required:"true"` // Providing the name of the provider supported by the Octavia installation. ProviderName string `json:"provider_name" required:"true"` // Providing the json string containing the flavor metadata. FlavorData string `json:"flavor_data" required:"true"` }
CreateOpts is the common options struct used in this package's Create operation.
func (CreateOpts) ToFlavorProfileCreateMap ¶
func (opts CreateOpts) ToFlavorProfileCreateMap() (map[string]interface{}, error)
ToFlavorProfileCreateMap builds a request body from CreateOpts.
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 a FlavorProfile.
func Create ¶
func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create is and operation which add a new FlavorProfile into the database. CreateResult will be returned.
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*FlavorProfile, error)
Extract is a function that accepts a result and extracts a flavor profile.
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult represents the result of a delete operation. Call its ExtractErr method to determine if the request succeeded or failed.
func Delete ¶
func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult)
Delete will permanently delete a particular FlavorProfile based on its unique ID.
type FlavorProfile ¶
type FlavorProfile struct { // The unique ID for the Flavor ID string `json:"id"` // Human-readable name for the Flavor. Does not have to be unique. Name string `json:"name"` // Name of the provider ProviderName string `json:"provider_name"` // Flavor data FlavorData string `json:"flavor_data"` }
FlavorProfile provide metadata such as provider, toplogy and instance flavor.
func ExtractFlavorProfiles ¶
func ExtractFlavorProfiles(r pagination.Page) ([]FlavorProfile, error)
ExtractFlavorProfiles accepts a Page struct, specifically a FlavorProfilePage struct, and extracts the elements into a slice of FlavorProfile structs. In other words, a generic collection is mapped into a relevant slice.
type FlavorProfilePage ¶
type FlavorProfilePage struct {
pagination.LinkedPageBase
}
FlavorProfilePage is the page returned by a pager when traversing over a collection of flavor profiles.
func (FlavorProfilePage) IsEmpty ¶
func (r FlavorProfilePage) IsEmpty() (bool, error)
IsEmpty checks whether a FlavorProfilePage struct is empty.
func (FlavorProfilePage) NextPageURL ¶
func (r FlavorProfilePage) NextPageURL() (string, error)
NextPageURL is invoked when a paginated collection of flavor profiles 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 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 FlavorProfile.
func Get ¶
func Get(c *gophercloud.ServiceClient, id string) (r GetResult)
Get retrieves a particular FlavorProfile based on its unique ID.
func (GetResult) Extract ¶
func (r GetResult) Extract() (*FlavorProfile, error)
Extract is a function that accepts a result and extracts a flavor profile.
type ListOpts ¶
type ListOpts struct { // The fields that you want the server to return Fields []string `q:"fields"` }
ListOpts allows to manage the output of the request.
func (ListOpts) ToFlavorProfileListQuery ¶
ToFlavorProfileListQuery 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 { // Human-readable name for the Loadbalancer. Does not have to be unique. Name string `json:"name,omitempty"` // Providing the name of the provider supported by the Octavia installation. ProviderName string `json:"provider_name,omitempty"` // Providing the json string containing the flavor metadata. FlavorData string `json:"flavor_data,omitempty"` }
UpdateOpts is the common options struct used in this package's Update operation.
func (UpdateOpts) ToFlavorProfileUpdateMap ¶
func (opts UpdateOpts) ToFlavorProfileUpdateMap() (map[string]interface{}, error)
ToFlavorProfileUpdateMap 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 FlavorProfile.
func Update ¶
func Update(c *gophercloud.ServiceClient, id string, opts UpdateOpts) (r UpdateResult)
Update is an operation which modifies the attributes of the specified FlavorProfile.
func (UpdateResult) Extract ¶
func (r UpdateResult) Extract() (*FlavorProfile, error)
Extract is a function that accepts a result and extracts a flavor profile.