groups

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package groups manages and retrieves Groups in the OpenStack Identity Service.

Example to List Groups

listOpts := groups.ListOpts{
	DomainID: "default",
}

allPages, err := groups.List(identityClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allGroups, err := groups.ExtractGroups(allPages)
if err != nil {
	panic(err)
}

for _, group := range allGroups {
	fmt.Printf("%+v\n", group)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager

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

Types

type CreateOpts

type CreateOpts struct {
	// Name is the name of the new group.
	Name string `json:"name" required:"true"`

	// Description is a description of the group.
	Description string `json:"description,omitempty"`

	// DomainID is the ID of the domain the group belongs to.
	DomainID string `json:"domain_id,omitempty"`

	Extra map[string]interface{} `json:"-"`
}

CreateOpts provides options used to create a group.

func (CreateOpts) ToGroupCreateMap

func (opts CreateOpts) ToGroupCreateMap() (map[string]interface{}, error)

ToGroupCreateMap formats a CreateOpts into a create request.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToGroupCreateMap() (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 Group.

func (CreateResult) Extract

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

Extract interprets any group results as a Group.

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

DeleteResult is the response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.

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 Group.

func Get

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

Get retrieves details on a single group, by ID.

func (GetResult) Extract

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

Extract interprets any group results as a Group.

type Group

type Group struct {
	// Description describes the group purpose.
	Description string `json:"description"`

	// DomainID is the domain ID the group belongs to.
	DomainID string `json:"domain_id"`

	// ID is the unique ID of the group.
	ID string `json:"id"`

	// Extra is a collection of miscellaneous key/values.
	Extra map[string]interface{} `json:"-"`

	// Links contains referencing links to the group.
	Links map[string]interface{} `json:"links"`

	// Name is the name of the group.
	Name string `json:"name"`
}

Group helps manage related users.

func ExtractGroups

func ExtractGroups(r pagination.Page) ([]Group, error)

ExtractGroups returns a slice of Groups contained in a single page of results.

func (*Group) UnmarshalJSON

func (r *Group) UnmarshalJSON(b []byte) error

type GroupPage

type GroupPage struct {
	pagination.LinkedPageBase
}

GroupPage is a single page of Group results.

func (GroupPage) IsEmpty

func (r GroupPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a page of Groups contains any results.

func (GroupPage) NextPageURL

func (r GroupPage) NextPageURL() (string, error)

NextPageURL extracts the "next" link from the links section of the result.

type ListOpts

type ListOpts struct {
	// DomainID filters the response by a domain ID.
	DomainID string `q:"domain_id"`

	// Name filters the response by group name.
	Name string `q:"name"`
}

ListOpts provides options to filter the List results.

func (ListOpts) ToGroupListQuery

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

ToGroupListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

ListOptsBuilder allows extensions to add additional parameters to the List request

type UpdateOpts

type UpdateOpts struct {
	// Name is the name of the new group.
	Name string `json:"name,omitempty"`

	// Description is a description of the group.
	Description string `json:"description,omitempty"`

	// DomainID is the ID of the domain the group belongs to.
	DomainID string `json:"domain_id,omitempty"`

	// Extra is free-form extra key/value pairs to describe the group.
	Extra map[string]interface{} `json:"-"`
}

UpdateOpts provides options for updating a group.

func (UpdateOpts) ToGroupUpdateMap

func (opts UpdateOpts) ToGroupUpdateMap() (map[string]interface{}, error)

ToGroupUpdateMap formats a UpdateOpts into an update request.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToGroupUpdateMap() (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 response from an Update operation. Call its Extract method to interpret it as a Group.

func (UpdateResult) Extract

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

Extract interprets any group results as a Group.

type User

type User struct {
	// IAM user name.
	Name string `json:"name"`

	// Links contains referencing links to the User.
	Links map[string]interface{} `json:"links"`

	// DomainID is the domain ID the user belongs to.
	DomainId string `json:"domain_id"`

	// Enabling status of the IAM user.
	Enabled bool `json:"enabled"`

	// ID is the unique ID of the User.
	Id string `json:"id"`

	// Time when the password will expire. null indicates that the password has unlimited validity.
	PasswordExpiresAt string `json:"password_expires_at"`

	// Description of the IAM user.
	Description string `json:"description"`

	// Password status. true means that the password needs to be changed, and false means that the password is normal.
	PwdStatus bool `json:"pwd_status"`

	// ID of the project that the IAM user lastly accessed before exiting the system.
	LastProjectId string `json:"last_project_id"`

	// Password strength. The value can be high, mid, or low.
	PwdStrength string `json:"pwd_strength"`

	// Other information about the IAM user.
	Extra map[string]interface{} `json:"-"`
}

type UserResult

type UserResult struct {
	golangsdk.Result
}

func (UserResult) Extract

func (r UserResult) Extract() ([]User, error)

ExtractUsers returns a slice of users contained in a single page of results.

Jump to

Keyboard shortcuts

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