domains

package
v1.0.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2019 License: Apache-2.0 Imports: 2 Imported by: 2

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()
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(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(identityClient, domainID, updateOpts).Extract()
if err != nil {
	panic(err)
}

Example to Delete a Domain

domainID := "0fe36e73809d46aeae6705c39077b1b3"
err := domains.Delete(identityClient, domainID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List enumerates the domains to which the current token has access.

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]interface{}, error)

ToDomainCreateMap formats a CreateOpts into a create request.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToDomainCreateMap() (map[string]interface{}, error)
}

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(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create creates a new Domain.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Domain, error)

Extract interprets any domainResults as a 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.

func Delete

func Delete(client *gophercloud.ServiceClient, domainID string) (r DeleteResult)

Delete deletes a domain.

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]interface{} `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.

func Get

func Get(client *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves details on a single domain, by ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Domain, error)

Extract interprets any domainResults 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

func (opts ListOpts) ToDomainListQuery() (string, error)

ToDomainListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToDomainListQuery() (string, error)
}

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]interface{}, error)

ToUpdateCreateMap formats a UpdateOpts into an update request.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToDomainUpdateMap() (map[string]interface{}, error)
}

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(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update modifies the attributes of a domain.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Domain, error)

Extract interprets any domainResults as a Domain.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL