users

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package users manages and retrieves users in the Enterprise Cloud Remote Console Access Service.

Example to List users

allPages, err := users.List(rcaClient).AllPages()
if err != nil {
	panic(err)
}

allUsers, err := users.ExtractUsers(allPages)
if err != nil {
	panic(err)
}

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

Example to Get a user

username := "02471b45-3de0-4fc8-8469-a7cc52c378df"

user, err := users.Get(rcaClient, username).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", user)

Example to Create a user

createOpts := users.CreateOpts{
	Password: "dummy_passw@rd",
}

result := users.Create(rcaClient, createOpts)
if result.Err != nil {
	panic(result.Err)
}

Example to Update a user

username := "02471b45-3de0-4fc8-8469-a7cc52c378df"
updateOpts := users.UpdateOpts{
	Password: "dummy_passw@rd",
}

result := users.Update(rcaClient, username, updateOpts)
if result.Err != nil {
	panic(result.Err)
}

Example to Delete a user

username := "02471b45-3de0-4fc8-8469-a7cc52c378df"

result := users.Delete(rcaClient, username)
if result.Err != nil {
	panic(result.Err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(client *eclcloud.ServiceClient) pagination.Pager

List retrieves a list of users.

Types

type CreateOpts

type CreateOpts struct {
	Password string `json:"password"`
}

CreateOpts provides options used to create a user.

func (CreateOpts) ToResourceCreateMap

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

ToResourceCreateMap formats a CreateOpts into a create request.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToResourceCreateMap() (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 user.

func Create

func Create(client *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create creates a new user.

func (CreateResult) Extract

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

Extract interprets any commonResult as a user.

type DeleteResult

type DeleteResult struct {
	eclcloud.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 *eclcloud.ServiceClient, name string) (r DeleteResult)

Delete deletes a user.

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

func Get

func Get(client *eclcloud.ServiceClient, name string) (r GetResult)

Get retrieves details of a user.

func (GetResult) Extract

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

Extract interprets any commonResult as a user.

type UpdateOpts

type UpdateOpts struct {
	Password string `json:"password"`
}

UpdateOpts represents parameters to update a user.

func (UpdateOpts) ToResourceUpdateMap

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

ToResourceUpdateCreateMap formats a UpdateOpts into an update request.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToResourceUpdateMap() (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 user.

func Update

func Update(client *eclcloud.ServiceClient, name string, opts UpdateOptsBuilder) (r UpdateResult)

Update modifies the attributes of a user.

func (UpdateResult) Extract

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

Extract interprets any commonResult as a user.

type User

type User struct {
	Name         string        `json:"name"`
	Password     string        `json:"password"`
	VPNEndpoints []VPNEndpoint `json:"vpn_endpoints"`
}

User represents VPN user.

func ExtractUsers

func ExtractUsers(r pagination.Page) ([]User, error)

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

type UserPage

type UserPage struct {
	pagination.LinkedPageBase
}

UserPage is a single page of user results.

func (UserPage) IsEmpty

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

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

type VPNEndpoint

type VPNEndpoint struct {
	Endpoint string `json:"endpoint"`
	Type     string `json:"type"`
}

VPNEndpoint represents VPN Endpoint.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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