users

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: MIT Imports: 5 Imported by: 2

README

Users

Compatible with Logz.io's manage users API.

To create a new user, on a specific account or sub-account. you'll need your account Id.

client, _ := users.New(apiToken, apiServerAddress)
createUser := users.CreateUpdateUser{
                UserName:  "some_test@test.test",
                FullName:  "user test",
                AccountId: 0,
                Role:      users.UserRoleReadOnly,
            }
resp, err := client.CreateUser(createUser)
function func name
create user func (c *UsersClient) CreateUser(createUser CreateUpdateUser) (*ResponseId, error)
update user func (c *UsersClient) UpdateUser(userId int32, updateUser CreateUpdateUser) (*ResponseId, error)
delete user func (c *UsersClient) DeleteUser(userId int32) error
get user func (c *UsersClient) GetUser(userId int32) (*User, error)
list users func (c *UsersClient) ListUsers() ([]User, error)
suspend user func (c *UsersClient) SuspendUser(userId int32) error
unsuspend user func (c *UsersClient) UnSuspendUser(userId int32) error

Documentation

Index

Constants

View Source
const (
	UserRoleReadOnly     = "USER_ROLE_READONLY"
	UserRoleRegular      = "USER_ROLE_REGULAR"
	UserRoleAccountAdmin = "USER_ROLE_ACCOUNT_ADMIN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateUpdateUser added in v1.12.0

type CreateUpdateUser struct {
	UserName  string `json:"username"`
	FullName  string `json:"fullName"`
	AccountId int32  `json:"accountID"`
	Role      string `json:"role"`
}

type ResponseId added in v1.12.0

type ResponseId struct {
	Id int32 `json:"id"`
}

type User

type User struct {
	Id        int32  `json:"id"`
	UserName  string `json:"username"`
	FullName  string `json:"fullName"`
	AccountId int32  `json:"accountID"`
	Role      string `json:"role"`
	Active    bool   `json:"active"`
}

type UsersClient

type UsersClient struct {
	*client.Client
}

func New

func New(apiToken string, baseUrl string) (*UsersClient, error)

New Creates a new entry point into the users functions, accepts the user's logz.io API token and base url

func (*UsersClient) CreateUser

func (c *UsersClient) CreateUser(createUser CreateUpdateUser) (*ResponseId, error)

func (*UsersClient) DeleteUser

func (c *UsersClient) DeleteUser(userId int32) error

func (*UsersClient) GetUser

func (c *UsersClient) GetUser(userId int32) (*User, error)

func (*UsersClient) ListUsers

func (c *UsersClient) ListUsers() ([]User, error)

func (*UsersClient) SuspendUser

func (c *UsersClient) SuspendUser(userId int32) error

func (*UsersClient) UnSuspendUser

func (c *UsersClient) UnSuspendUser(userId int32) error

func (*UsersClient) UpdateUser

func (c *UsersClient) UpdateUser(userId int32, updateUser CreateUpdateUser) (*ResponseId, error)

NOTE: The logz.io API user update API function will not update the username field

Jump to

Keyboard shortcuts

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