Documentation
¶
Overview ¶
Package projects provides interaction with Limes at the project hierarchical level.
Here is an example on how you would list all the projects in the current domain:
import ( "fmt" "log" "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens" "github.com/gophercloud/utils/openstack/clientconfig" "github.com/sapcc/gophercloud-sapcc/clients" "github.com/sapcc/gophercloud-sapcc/rates/v1/projects" ) func main() { provider, err := clientconfig.AuthenticatedClient(nil) if err != nil { log.Fatalf("could not initialize openstack client: %v", err) } ratesClient, err := clients.NewLimesRatesV1(provider, gophercloud.EndpointOpts{}) if err != nil { log.Fatalf("could not initialize Limes rates client: %v", err) } project, err := provider.GetAuthResult().(tokens.CreateResult).ExtractProject() if err != nil { log.Fatalf("could not get project from token: %v", err) } result := projects.List(ratesClient, project.Domain.ID, projects.ReadOpts{}) if result.Err != nil { log.Fatalf("could not get projects: %v", result.Err) } projectList, err := result.ExtractProjects() if err != nil { log.Fatalf("could not get projects: %v", err) } for _, project := range projectList { fmt.Printf("%+v\n", project.Services) } }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonResult ¶
type CommonResult struct {
gophercloud.Result
}
CommonResult is the result of a Get/List operation. Call its appropriate Extract method to interpret it as a Project or a slice of Projects.
func Get ¶
func Get(c *gophercloud.ServiceClient, domainID, projectID string, opts ReadOptsBuilder) (r CommonResult)
Get retrieves details on a single project, by ID.
func List ¶
func List(c *gophercloud.ServiceClient, domainID string, opts ReadOptsBuilder) (r CommonResult)
List enumerates the projects in a specific domain.
func (CommonResult) Extract ¶
func (r CommonResult) Extract() (*limesrates.ProjectReport, error)
Extract interprets a CommonResult as a Project.
func (CommonResult) ExtractProjects ¶
func (r CommonResult) ExtractProjects() ([]limesrates.ProjectReport, error)
ExtractProjects interprets a CommonResult as a slice of Projects.
type ReadOpts ¶
type ReadOpts struct { Services []limes.ServiceType `q:"service"` Areas []string `q:"area"` }
ReadOpts contains parameters for filtering a Get/List request.
Click to show internal directories.
Click to hide internal directories.