solarwinds

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeNetworkException uint32 = iota
	ErrCodeDeleteActiveUserException
)
View Source
const (
	EnvSolarwindsUser           = "SOLARWINDS_USER"
	EnvSolarwindsPassword       = "SOLARWINDS_PASSWD"
	EnvSolarwindsOrganizationId = "SOLARWINDS_ORG_ID"
)

Variables

This section is empty.

Functions

func Convert

func Convert(from interface{}, to interface{}) error

Convert is typically used to convert map[string]interface{} to a struct in the same json structure.

func NewErrorAttemptDeleteActiveUser

func NewErrorAttemptDeleteActiveUser(user string) error

func NewNetworkError

func NewNetworkError(cause error) error

func RandString

func RandString(n int) string

RandString returns random string at specified length.

func ToJsonNoEscape

func ToJsonNoEscape(t interface{}) ([]byte, error)

Note there will be a new line character at the end of the output.

Types

type ActiveUser

type ActiveUser struct {
	Id        string `json:"id"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Email     string `json:"email"`
	LastLogin string `json:"lastLogin"`
}

type ActiveUserList

type ActiveUserList struct {
	OwnerUserId  string                  `json:"id"`
	Organization OrganizationWithMembers `json:"currentOrganization"`
}

type ActiveUserService

type ActiveUserService struct {
	// contains filtered or unexported fields
}

func (*ActiveUserService) Get

func (us *ActiveUserService) Get(userId string) (*ActiveUserList, error)

func (*ActiveUserService) GetByEmail

func (us *ActiveUserService) GetByEmail(email string) (*OrganizationMember, error)

func (*ActiveUserService) List

func (us *ActiveUserService) List() (*ActiveUserList, error)

func (*ActiveUserService) Update

func (us *ActiveUserService) Update(update UpdateActiveUserRequest) error

type Client

type Client struct {
	InvitationService *InvitationService
	ActiveUserService *ActiveUserService
	UserService       *UserService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config ClientConfig) (*Client, error)

Does not involve any network interactions.

func (*Client) Init

func (c *Client) Init() error

func (*Client) MakeGraphQLRequest

func (c *Client) MakeGraphQLRequest(graphQLRequest *GraphQLRequest) (*GraphQLResponse, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method string, rsc string, params io.Reader) (*http.Request, error)

type ClientConfig

type ClientConfig struct {
	Username       string // Typically this is an email
	Password       string
	OrganizationId string
	BaseURL        string // For UT
}

type ClientError

type ClientError struct {
	StatusCode uint32 `json:"statusCode"`
	Err        error  `json:"err"`
}

func (*ClientError) Error

func (c *ClientError) Error() string

type GraphQLRequest

type GraphQLRequest struct {
	OperationName string      `json:"operationName"`
	Variables     interface{} `json:"variables"`
	Query         string      `json:"query"`
	ResponseType  string      `json:"-"` // Not required by GraphQL schema
}

type GraphQLResponse

type GraphQLResponse map[string]interface{}

func NewGraphQLResponse

func NewGraphQLResponse(body io.Reader, key string) (*GraphQLResponse, error)

type Invitation

type Invitation struct {
	Email    string    `json:"email"`
	Role     string    `json:"role"`
	Products []Product `json:"products"`
}

type InvitationList

type InvitationList struct {
	OwnerUserId  string                      `json:"id"`
	Organization OrganizationWithInvitations `json:"currentOrganization"`
}

type InvitationService

type InvitationService struct {
	// contains filtered or unexported fields
}

func (*InvitationService) Create

func (is *InvitationService) Create(user Invitation) error

func (*InvitationService) List

func (is *InvitationService) List() (*InvitationList, error)

func (*InvitationService) Resend

func (is *InvitationService) Resend(email string) error

func (*InvitationService) Revoke

func (is *InvitationService) Revoke(email string) error

type OrganizationMember

type OrganizationMember struct {
	User     ActiveUser `json:"user"`
	Role     string     `json:"role"`
	Products []Product  `json:"products"`
}

type OrganizationWithInvitations

type OrganizationWithInvitations struct {
	Id          string       `json:"id"`
	Invitations []Invitation `json:"invitations"`
}

type OrganizationWithMembers

type OrganizationWithMembers struct {
	Id      string               `json:"id"`
	Members []OrganizationMember `json:"members"`
}

type Product

type Product struct {
	Name string `json:"name"`
	Role string `json:"role"`
}

type UpdateActiveUserRequest

type UpdateActiveUserRequest struct {
	UserId   string    `json:"userId"`
	Role     string    `json:"role"`
	Products []Product `json:"products"`
	Email    string    `json:"-"`
}

type User

type User = Invitation

type UserService

type UserService struct {
	ActiveUserService *ActiveUserService
	InvitationService *InvitationService
}

func (*UserService) Create

func (us *UserService) Create(user User) error

Create will create a new invitation for the user. It is not possible to add user without going through invitation.

func (*UserService) Delete

func (us *UserService) Delete(email string) error

Delete will only be effective if it is an invitation. There is no way to delete an active user in Pingdom.

func (*UserService) Retrieve

func (us *UserService) Retrieve(email string) (*User, error)

Retrieve return the user information, either it is an invitation or an active user.

func (*UserService) Update

func (us *UserService) Update(update User) error

Update will first try to update an active user with the given email. If no such user exist, will see if there is an invitation with the email, if yes, will revoke the invitation and send a new one. Otherwise, error is returned.

Jump to

Keyboard shortcuts

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