go-selvpcclient: github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/users Index | Files | Directories

package users

import "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/users"

Package users provides the ability to retrieve and manage users through the Resell v2 API.

Example of getting a single user referenced by its id

user, _, err := users.Get(context, resellClient, userID)
if err != nil {

Example of getting all users

allUsers, _, err := users.List(ctx, resellClient)
if err != nil {
for _, user := range allUsers {

Example of creating a single user

userCreateOpts := users.UserOpts{
  Name:     "user0",
  Password: "verysecret",
createdUser, _, err := users.Create(ctx, resellClient, userCreateOpts)
if err != nil {

Example of updating a single user

userEnabled := false
userUpdateOpts := users.UserOpts{
  Name:     "user1",
  Password: "moresecret",
  Enabled:  &userEnabled,
updatedUser, _, err := users.Update(ctx, resellClient, createdUser.ID, userUpdateOpts)
if err != nil {

Example of deleting a single user

_, err = users.Delete(context, resellClient, createdUser.ID)
if err != nil {


Package Files

doc.go requests.go requests_opts.go schemas.go

func Delete Uses

func Delete(ctx context.Context, client *selvpcclient.ServiceClient, id string) (*selvpcclient.ResponseResult, error)

Delete deletes a single user by its id.

type User Uses

type User struct {
    // ID is a unique id of a user.
    ID  string `json:"id"`

    // Name represents the human-readable name of a user.
    Name string `json:"name"`

    // Enabled shows if user is active or it was disabled.
    Enabled bool `json:"enabled"`

User represents a single user of the Identity service project.

func Create Uses

func Create(ctx context.Context, client *selvpcclient.ServiceClient, createOpts UserOpts) (*User, *selvpcclient.ResponseResult, error)

Create requests a creation of the user.

func Get Uses

func Get(ctx context.Context, client *selvpcclient.ServiceClient, id string) (*User, *selvpcclient.ResponseResult, error)

Get returns a single user by its id.

func List Uses

func List(ctx context.Context, client *selvpcclient.ServiceClient) ([]*User, *selvpcclient.ResponseResult, error)

List gets a list of users in the current domain.

func Update Uses

func Update(ctx context.Context, client *selvpcclient.ServiceClient, id string, updateOpts UserOpts) (*User, *selvpcclient.ResponseResult, error)

Update requests an update of the user referenced by its id.

type UserOpts Uses

type UserOpts struct {
    // Name represents the name of a user.
    Name string `json:"name,omitempty"`

    // Password represents a user's password.
    Password string `json:"password,omitempty"`

    // Enabled shows if user is active or it needs to be disabled.
    Enabled *bool `json:"enabled,omitempty"`

UserOpts represents options for the user Create and Update requests.



Package users imports 6 packages (graph) and is imported by 1 packages. Updated 2019-10-05. Refresh now. Tools for package owners.