solarwinds

package
v1.3.2-0...-d08ffda Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 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 Client

type Client struct {
	InvitationService *InvitationService
	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
	BaseURL  string // For UT
}

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 []ProductUpdate `json:"products"`
}

type InvitationService

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

func (*InvitationService) InviteUser

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

func (*InvitationService) ResendInvitation

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

func (*InvitationService) RevokePendingInvitation

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

type Organization

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

type OrganizationMember

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

type Product

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

type ProductUpdate

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

Unfortunately Access is not required here.

type UpdateUserRequest

type UpdateUserRequest struct {
	UserId   string          `json:"userId"`
	Role     string          `json:"role"`
	Products []ProductUpdate `json:"products"`
}

type User

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

type UserList

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

type UserService

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

func (*UserService) Get

func (us *UserService) Get(userId string) (*UserList, error)

func (*UserService) List

func (us *UserService) List() (*UserList, error)

func (*UserService) Update

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

Jump to

Keyboard shortcuts

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