Documentation ¶
Overview ¶
Package resourceproviders creates and lists all resource providers from the OpenStack Placement service.
Example to list resource providers
allPages, err := resourceproviders.List(placementClient, resourceproviders.ListOpts{}).AllPages() if err != nil { panic(err) } allResourceProviders, err := resourceproviders.ExtractResourceProviders(allPages) if err != nil { panic(err) } for _, r := range allResourceProviders { fmt.Printf("%+v\n", r) }
Example to create resource providers
createOpts := resourceproviders.CreateOpts{ Name: "new-rp", UUID: "b99b3ab4-3aa6-4fba-b827-69b88b9c544a", } rp, err := resourceproviders.Create(placementClient, createOpts).Extract() if err != nil { panic(err) }
Example to get resource providers usages
rp, err := resourceproviders.GetUsages(placementClient, resourceProviderID).Extract() if err != nil { panic(err) }
Example to get resource providers inventories
rp, err := resourceproviders.GetInventories(placementClient, resourceProviderID).Extract() if err != nil { panic(err) }
Example to get resource providers traits
rp, err := resourceproviders.GetTraits(placementClient, resourceProviderID).Extract() if err != nil { panic(err) }
Example to get resource providers allocations
rp, err := resourceproviders.GetAllocations(placementClient, resourceProviderID).Extract() if err != nil { panic(err) }
Index ¶
- func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type Allocation
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type GetAllocationsResult
- type GetInventoriesResult
- type GetTraitsResult
- type GetUsagesResult
- type Inventory
- type ListOpts
- type ListOptsBuilder
- type ResourceProvider
- type ResourceProviderAllocations
- type ResourceProviderInventories
- type ResourceProviderLinks
- type ResourceProviderTraits
- type ResourceProviderUsage
- type ResourceProvidersPage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List makes a request against the API to list resource providers.
Types ¶
type Allocation ¶
type CreateOpts ¶
CreateOpts represents options used to create a resource provider.
func (CreateOpts) ToResourceProviderCreateMap ¶
func (opts CreateOpts) ToResourceProviderCreateMap() (map[string]interface{}, error)
ToResourceProviderCreateMap constructs 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 is the result of a Create operation. Call its Extract method to interpret it as a ResourceProvider.
func Create ¶
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create makes a request against the API to create a resource provider
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*ResourceProvider, error)
Extract interpets any resourceProviderResult-base result as a ResourceProvider.
type GetAllocationsResult ¶
type GetAllocationsResult struct {
gophercloud.Result
}
GetAllocationsResult is the response of a Get allocations operations. Call its Extract method to interpret it as a ResourceProviderAllocations.
func GetAllocations ¶
func GetAllocations(client *gophercloud.ServiceClient, resourceProviderID string) (r GetAllocationsResult)
func (GetAllocationsResult) Extract ¶
func (r GetAllocationsResult) Extract() (*ResourceProviderAllocations, error)
Extract interprets a GetAllocationsResult as a ResourceProviderAllocations.
type GetInventoriesResult ¶
type GetInventoriesResult struct {
gophercloud.Result
}
GetInventoriesResult is the response of a Get inventories operations. Call its Extract method to interpret it as a ResourceProviderInventories.
func GetInventories ¶
func GetInventories(client *gophercloud.ServiceClient, resourceProviderID string) (r GetInventoriesResult)
func (GetInventoriesResult) Extract ¶
func (r GetInventoriesResult) Extract() (*ResourceProviderInventories, error)
Extract interprets a GetInventoriesResult as a ResourceProviderInventories.
type GetTraitsResult ¶
type GetTraitsResult struct {
gophercloud.Result
}
GetTraitsResult is the response of a Get traits operations. Call its Extract method to interpret it as a ResourceProviderTraits.
func GetTraits ¶
func GetTraits(client *gophercloud.ServiceClient, resourceProviderID string) (r GetTraitsResult)
func (GetTraitsResult) Extract ¶
func (r GetTraitsResult) Extract() (*ResourceProviderTraits, error)
Extract interprets a GetTraitsResult as a ResourceProviderTraits.
type GetUsagesResult ¶
type GetUsagesResult struct {
gophercloud.Result
}
GetUsagesResult is the response of a Get usage operations. Call its Extract method to interpret it as a ResourceProviderUsage.
func GetUsages ¶
func GetUsages(client *gophercloud.ServiceClient, resourceProviderID string) (r GetUsagesResult)
func (GetUsagesResult) Extract ¶
func (r GetUsagesResult) Extract() (*ResourceProviderUsage, error)
Extract interprets a GetUsagesResult as a ResourceProviderUsage.
type ListOpts ¶
type ListOpts struct { // Name is the name of the resource provider to filter the list Name string `q:"name"` // UUID is the uuid of the resource provider to filter the list UUID string `q:"uuid"` // MemberOf is a string representing aggregate uuids to filter or exclude from the list MemberOf string `q:"member_of"` // Resources is a comma-separated list of string indicating an amount of resource // of a specified class that a provider must have the capacity and availability to serve Resources string `q:"resources"` // InTree is a string that represents a resource provider UUID. The returned resource // providers will be in the same provider tree as the specified provider. InTree string `q:"in_tree"` // Required is comma-delimited list of string trait names. Required string `q:"required"` }
ListOpts allows the filtering resource providers. Filtering is achieved by passing in struct field values that map to the resource provider attributes you want to see returned.
func (ListOpts) ToResourceProviderListQuery ¶
ToResourceProviderListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type ResourceProvider ¶
type ResourceProvider struct { // Generation is a consistent view marker that assists with the management of concurrent resource provider updates. Generation int `json:"generation"` // UUID of a resource provider. UUID string `json:"uuid"` // Links is a list of links associated with one resource provider. Links []ResourceProviderLinks `json:"links"` // Name of one resource provider. Name string `json:"name"` // The ParentProviderUUID contains the UUID of the immediate parent of the resource provider. // Requires microversion 1.14 or above ParentProviderUUID string `json:"parent_provider_uuid"` // The RootProviderUUID contains the read-only UUID of the top-most provider in this provider tree. // Requires microversion 1.14 or above RootProviderUUID string `json:"root_provider_uuid"` }
ResourceProvider are entities which provider consumable inventory of one or more classes of resource
func ExtractResourceProviders ¶
func ExtractResourceProviders(r pagination.Page) ([]ResourceProvider, error)
ExtractResourceProviders returns a slice of ResourceProvider from a List operation.
type ResourceProviderAllocations ¶
type ResourceProviderAllocations struct { ResourceProviderGeneration int `json:"resource_provider_generation"` Allocations map[string]Allocation `json:"allocations"` }
type ResourceProviderLinks ¶
type ResourceProviderTraits ¶
type ResourceProviderUsage ¶
type ResourceProvidersPage ¶
type ResourceProvidersPage struct {
pagination.SinglePageBase
}
ResourceProvidersPage contains a single page of all resource providers from a List call.
func (ResourceProvidersPage) IsEmpty ¶
func (page ResourceProvidersPage) IsEmpty() (bool, error)
IsEmpty determines if a ResourceProvidersPage contains any results.