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", ParentProvider: "c7f50b40-6f32-4d7a-9f32-9384057be83b" } rp, err := resourceproviders.Create(placementClient, createOpts).Extract() if err != nil { panic(err) }
Example to Delete a resource provider
resourceProviderID := "b99b3ab4-3aa6-4fba-b827-69b88b9c544a" err := resourceproviders.Delete(placementClient, resourceProviderID).ExtractErr() if err != nil { panic(err) }
Example to Get a resource provider
resourceProviderID := "b99b3ab4-3aa6-4fba-b827-69b88b9c544a" resourceProvider, err := resourceproviders.Get(placementClient, resourceProviderID).Extract() if err != nil { panic(err) }
Example to Update a resource provider
resourceProviderID := "b99b3ab4-3aa6-4fba-b827-69b88b9c544a" updateOpts := resourceproviders.UpdateOpts{ Name: "new-rp", ParentProvider: "c7f50b40-6f32-4d7a-9f32-9384057be83b" } placementClient.Microversion = "1.37" resourceProvider, err := resourceproviders.Update(placementClient, resourceProviderID).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 DeleteResult
- type GetAllocationsResult
- type GetInventoriesResult
- type GetResult
- type GetTraitsResult
- type GetUsagesResult
- type Inventory
- type ListOpts
- type ListOptsBuilder
- type ResourceProvider
- type ResourceProviderAllocations
- type ResourceProviderInventories
- type ResourceProviderLinks
- type ResourceProviderTraits
- type ResourceProviderUsage
- type ResourceProvidersPage
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
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 ¶
type CreateOpts struct { Name string `json:"name"` UUID string `json:"uuid,omitempty"` // The UUID of the immediate parent of the resource provider. // Available in version >= 1.14 ParentProviderUUID string `json:"parent_provider_uuid,omitempty"` }
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 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, resourceProviderID string) (r DeleteResult)
Delete accepts a unique ID and deletes the resource provider associated with it.
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 GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a create operation. Call its Extract method to interpret it as a ResourceProvider.
func Get ¶
func Get(c *gophercloud.ServiceClient, resourceProviderID string) (r GetResult)
Get retrieves a specific resource provider based on its unique ID.
func (GetResult) Extract ¶
func (r GetResult) Extract() (*ResourceProvider, error)
Extract interpets any resourceProviderResult-base result as a ResourceProvider.
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.
type UpdateOpts ¶
type UpdateOpts struct { Name *string `json:"name,omitempty"` // Available in version >= 1.37. It can be set to any existing provider UUID // except to providers that would cause a loop. Also it can be set to null // to transform the provider to a new root provider. This operation needs to // be used carefully. Moving providers can mean that the original rules used // to create the existing resource allocations may be invalidated by that move. ParentProviderUUID *string `json:"parent_provider_uuid,omitempty"` }
UpdateOpts represents options used to update a resource provider.
func (UpdateOpts) ToResourceProviderUpdateMap ¶
func (opts UpdateOpts) ToResourceProviderUpdateMap() (map[string]interface{}, error)
ToResourceProviderUpdateMap constructs 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 a update operation. Call its Extract method to interpret it as a ResourceProvider.
func Update ¶
func Update(client *gophercloud.ServiceClient, resourceProviderID string, opts UpdateOptsBuilder) (r UpdateResult)
Update makes a request against the API to create a resource provider
func (UpdateResult) Extract ¶
func (r UpdateResult) Extract() (*ResourceProvider, error)
Extract interpets any resourceProviderResult-base result as a ResourceProvider.