Documentation ¶
Overview ¶
Package domains manages and retrieves Domains in the OpenStack Identity Service.
Example to List Domains
var iTrue bool = true listOpts := domains.ListOpts{ Enabled: &iTrue, } allPages, err := domains.List(identityClient, listOpts).AllPages(context.TODO()) if err != nil { panic(err) } allDomains, err := domains.ExtractDomains(allPages) if err != nil { panic(err) } for _, domain := range allDomains { fmt.Printf("%+v\n", domain) }
Example to Create a Domain
createOpts := domains.CreateOpts{ Name: "domain name", Description: "Test domain", } domain, err := domains.Create(context.TODO(), identityClient, createOpts).Extract() if err != nil { panic(err) }
Example to Update a Domain
domainID := "0fe36e73809d46aeae6705c39077b1b3" var iFalse bool = false updateOpts := domains.UpdateOpts{ Enabled: &iFalse, } domain, err := domains.Update(context.TODO(), identityClient, domainID, updateOpts).Extract() if err != nil { panic(err) }
Example to Delete a Domain
domainID := "0fe36e73809d46aeae6705c39077b1b3" err := domains.Delete(context.TODO(), identityClient, domainID).ExtractErr() if err != nil { panic(err) }
Index ¶
- func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func ListAvailable(client *gophercloud.ServiceClient) pagination.Pager
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type Domain
- type DomainPage
- 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(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List enumerates the domains to which the current token has access.
func ListAvailable ¶
func ListAvailable(client *gophercloud.ServiceClient) pagination.Pager
ListAvailable enumerates the domains which are available to a specific user.
Types ¶
type CreateOpts ¶
type CreateOpts struct { // Name is the name of the new domain. Name string `json:"name" required:"true"` // Description is a description of the domain. Description string `json:"description,omitempty"` // Enabled sets the domain status to enabled or disabled. Enabled *bool `json:"enabled,omitempty"` }
CreateOpts provides options used to create a domain.
func (CreateOpts) ToDomainCreateMap ¶
func (opts CreateOpts) ToDomainCreateMap() (map[string]any, error)
ToDomainCreateMap formats a CreateOpts into a create request.
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 response from a Create operation. Call its Extract method to interpret it as a Domain.
func Create ¶
func Create(ctx context.Context, client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create creates a new Domain.
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult is the response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.
type Domain ¶
type Domain struct { // Description is the description of the Domain. Description string `json:"description"` // Enabled is whether or not the domain is enabled. Enabled bool `json:"enabled"` // ID is the unique ID of the domain. ID string `json:"id"` // Links contains referencing links to the domain. Links map[string]any `json:"links"` // Name is the name of the domain. Name string `json:"name"` }
A Domain is a collection of projects, users, and roles.
func ExtractDomains ¶
func ExtractDomains(r pagination.Page) ([]Domain, error)
ExtractDomains returns a slice of Domains contained in a single page of results.
type DomainPage ¶
type DomainPage struct {
pagination.LinkedPageBase
}
DomainPage is a single page of Domain results.
func (DomainPage) IsEmpty ¶
func (r DomainPage) IsEmpty() (bool, error)
IsEmpty determines whether or not a page of Domains contains any results.
func (DomainPage) NextPageURL ¶
func (r DomainPage) NextPageURL() (string, error)
NextPageURL extracts the "next" link from the links section of the result.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the response from a Get operation. Call its Extract method to interpret it as a Domain.
type ListOpts ¶
type ListOpts struct { // Enabled filters the response by enabled domains. Enabled *bool `q:"enabled"` // Name filters the response by domain name. Name string `q:"name"` }
ListOpts provides options to filter the List results.
func (ListOpts) ToDomainListQuery ¶
ToDomainListQuery 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 { // Name is the name of the domain. Name string `json:"name,omitempty"` // Description is the description of the domain. Description *string `json:"description,omitempty"` // Enabled sets the domain status to enabled or disabled. Enabled *bool `json:"enabled,omitempty"` }
UpdateOpts represents parameters to update a domain.
func (UpdateOpts) ToDomainUpdateMap ¶
func (opts UpdateOpts) ToDomainUpdateMap() (map[string]any, error)
ToUpdateCreateMap formats a UpdateOpts into an update request.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult is the result of an Update request. Call its Extract method to interpret it as a Domain.
func Update ¶
func Update(ctx context.Context, client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update modifies the attributes of a domain.