userv2

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: Apache-2.0, GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OwnerRoleId is the text value of standard role "owner"
	OwnerRoleId = "Owner"
	// AdminRole is the text value of standard role "admin"
	AdminRoleId = "Admin"
	// UserRoleId is the text value of standard role "user"
	UserRoleId = "User"
	// StakeHolderRoleId is the text value of standard role "user"
	StakeHolderRoleId = "Stakeholder"
	// ObserverRoleId is the text value of standard role "user"
	ObserverRoleId = "Observer"
)
View Source
const (
	// ContactExpandableField is the query parameter, which is needed to load fully contact data of user.
	ContactExpandableField = "contact"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionResult

type ActionResult struct {
	Result Result `json:"result"`
}

ActionResult contains result of action with notification rule.

type ContactMethod

type ContactMethod string

ContactMethod is a type of user contact method.

const (
	// The list of notification methods.
	SMSContactMethod    ContactMethod = "sms"
	EmailContactMethod  ContactMethod = "email"
	VoiceContactMethod  ContactMethod = "voice"
	MobileContactMethod ContactMethod = "mobile"
)

type CreateUserRequest

type CreateUserRequest struct {
	UserName          string              `json:"username,omitempty"`
	FullName          string              `json:"fullName,omitempty"`
	Role              *UserRole           `json:"role,omitempty"`
	SkypeUsername     string              `json:"skypeUsername,omitempty"`
	UserAddress       UserAddress         `json:"userAddress,omitempty"`
	Tags              []string            `json:"tags,omitempty"`
	Details           map[string][]string `json:"details,omitempty"`
	Timezone          string              `json:"timezone,omitempty"`
	Locale            string              `json:"locale,omitempty"`
	DisableInvitation bool                `json:"invitationDisabled,omitempty"`
	ApiKey            string              `json:"-"`
}

CreateUserRequest is a request for creating new user.

func (*CreateUserRequest) GenerateUrl

func (r *CreateUserRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*CreateUserRequest) GetApiKey

func (r *CreateUserRequest) GetApiKey() string

GetApiKey returns api key.

type CreateUserResponse

type CreateUserResponse struct {
	User UserMeta `json:"data"`
	ResponseMeta
}

CreateUserResponse is a response of creating user result.

type Delay

type Delay struct {
	TimeAmount int    `json:"timeAmount,omitempty"`
	TimeUnit   string `json:"timeUnit,omitempty"`
}

Delay contains info about delaying alerts.

type DeleteUserRequest

type DeleteUserRequest struct {
	*Identifier
	ApiKey string
}

DeleteUserRequest is a request for deleting user.

func (*DeleteUserRequest) GenerateUrl

func (r *DeleteUserRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*DeleteUserRequest) GetApiKey

func (r *DeleteUserRequest) GetApiKey() string

GetApiKey returns api key.

type DeleteUserResponse

type DeleteUserResponse struct {
	ResponseMeta
	ActionResult
}

DeleteUserResponse is a response of deleting user result.

type Escalation

type Escalation struct {
	ID          string    `json:"id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	OwnerTeam   OwnerTeam `json:"ownerTeam,omitempty"`
	Rules       []Rule    `json:"rules,omitempty"`
}

Escalation is a struct of escalation.

type Expand

type Expand string

Expand is a type of expand user data, which is used for loading fully data of user.

type ForwardingRule

type ForwardingRule struct {
	ID        string    `json:"id,omitempty"`
	Alias     string    `json:"alias,omitempty"`
	FromUser  UserMeta  `json:"fromUser,omitempty"`
	ToUser    UserMeta  `json:"toUser,omitempty"`
	StartDate time.Time `json:"startDate,omitempty"`
	EndDate   time.Time `json:"endDate,omitempty"`
}

ForwardingRule contains data of forwarding rule.

type GetUserRequest

type GetUserRequest struct {
	*Identifier
	ApiKey        string
	ExpandContact bool
}

GetUserRequest is a request for getting user.

func (*GetUserRequest) GenerateUrl

func (request *GetUserRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates API url using specified attributes of identifier.

func (*GetUserRequest) GetApiKey

func (r *GetUserRequest) GetApiKey() string

GetApiKey returns api key.

type GetUserResponse

type GetUserResponse struct {
	User User `json:"data"`
	ResponseMeta
}

GetUserResponse is a response of getting user result.

type Identifier

type Identifier struct {
	ID       string `json:"-"`
	Username string `json:"-"`
}

Identifier defined the set of attributes for identification user.

func (*Identifier) GenerateUrl

func (request *Identifier) GenerateUrl() (string, url.Values, error)

GenerateUrl generates API url using specified attributes of identifier.

type ListUserEscalationsRequest

type ListUserEscalationsRequest struct {
	*Identifier
	ApiKey string
}

ListUserEscalationsRequest is a request for getting user escalation list.

func (*ListUserEscalationsRequest) GenerateUrl

func (r *ListUserEscalationsRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates API url using specified attributes of identifier.

func (*ListUserEscalationsRequest) GetApiKey

func (r *ListUserEscalationsRequest) GetApiKey() string

GetApiKey returns api key.

type ListUserEscalationsResponse

type ListUserEscalationsResponse struct {
	Escalations []Escalation `json:"data,omitempty"`
	ResponseMeta
}

ListUserEscalationsResponse is a response with list of user escalations.

type ListUserForwardingRulesRequest

type ListUserForwardingRulesRequest struct {
	*Identifier
	ApiKey string
}

ListUserForwardingRulesRequest is a request for getting list of forwarding rules.

func (*ListUserForwardingRulesRequest) GenerateUrl

func (r *ListUserForwardingRulesRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates API url using specified attributes of identifier.

func (*ListUserForwardingRulesRequest) GetApiKey

func (r *ListUserForwardingRulesRequest) GetApiKey() string

GetApiKey returns api key.

type ListUserForwardingRulesResponse

type ListUserForwardingRulesResponse struct {
	ForwardingRules []ForwardingRule `json:"data,omitempty"`
	ResponseMeta
}

ListUserForwardingRulesResponse is a response with list of forwarding rules.

type ListUserSchedulesRequest

type ListUserSchedulesRequest struct {
	*Identifier
	ApiKey string
}

ListUserSchedulesRequest is a request for getting list of user schedules.

func (*ListUserSchedulesRequest) GenerateUrl

func (r *ListUserSchedulesRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates API url using specified attributes of identifier.

func (*ListUserSchedulesRequest) GetApiKey

func (r *ListUserSchedulesRequest) GetApiKey() string

GetApiKey returns api key.

type ListUserSchedulesResponse

type ListUserSchedulesResponse struct {
	Schedules []Schedule `json:"data,omitempty"`
	ResponseMeta
}

ListUserSchedulesResponse is a response with list of user schedules.

type ListUserTeamsRequest

type ListUserTeamsRequest struct {
	*Identifier
	ApiKey string
}

ListUserTeamsRequest is a request for getting list of user teams.

func (*ListUserTeamsRequest) GenerateUrl

func (r *ListUserTeamsRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates API url using specified attributes of identifier.

func (*ListUserTeamsRequest) GetApiKey

func (r *ListUserTeamsRequest) GetApiKey() string

GetApiKey returns api key.

type ListUserTeamsResponse

type ListUserTeamsResponse struct {
	Teams []Team `json:"data"`
	ResponseMeta
}

ListUserTeamsResponse is a response with list of user teams.

type ListUsersRequest

type ListUsersRequest struct {
	Limit  int
	Offset int
	Sort   Sort
	Order  Order
	Query  string
	ApiKey string
}

ListUsersRequest is a request for getting user list.

func (*ListUsersRequest) GenerateUrl

func (r *ListUsersRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates API url for getting user list.

func (*ListUsersRequest) GetApiKey

func (r *ListUsersRequest) GetApiKey() string

GetApiKey returns api key.

type ListUsersResponse

type ListUsersResponse struct {
	Users []User `json:"data"`
	*ResponseMeta
}

ListUsersResponse is a response with list of users.

type Order

type Order string

Order is a type of sort.

const (
	AscSortType  Order = "asc"
	DescSortType Order = "desc"
)

func (Order) IsValid

func (o Order) IsValid() bool

type OwnerTeam

type OwnerTeam struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

OwnerTeam contains info about owner team of escalation.

type Recipient

type Recipient struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
}

Recipient contains info about recipient of alerts.

type ResponseMeta

type ResponseMeta struct {
	RequestID      string
	ResponseTime   float32
	RateLimitState string
}

ResponseMeta is a struct of meta data.

func (*ResponseMeta) SetRateLimitState

func (rm *ResponseMeta) SetRateLimitState(state string)

SetRateLimitState sets state of rate limit.

func (*ResponseMeta) SetRequestID

func (rm *ResponseMeta) SetRequestID(requestID string)

SetRequestID sets identifier of request.

func (*ResponseMeta) SetResponseTime

func (rm *ResponseMeta) SetResponseTime(responseTime float32)

SetResponseTime sets response time.

type Result

type Result string

Result contains string status of notification action result.

const (
	// The list of action results.
	EnabledResult Result = "Enabled"
	DisableResult Result = "Disabled"
	DeletedResult Result = "Deleted"
)

type Rule

type Rule struct {
	Condition  string    `json:"condition,omitempty"`
	NotifyType string    `json:"notifyType,omitempty"`
	Delay      Delay     `json:"delay,omitempty"`
	Recipient  Recipient `json:"recipient,omitempty"`
}

Rule is a rule of escalation.

type Schedule

type Schedule struct {
	ID      string `json:"id,omitempty"`
	Name    string `json:"name,omitempty"`
	Enabled bool   `json:"enabled,omitempty"`
}

Schedule contains data of schedule.

type Sort

type Sort string

Sort is a name of user field, which is used for sort users.

const (
	UsernameSortField   Sort = "username"
	FullNameSortField   Sort = "fullName"
	InsertedAtSortField Sort = "insertedAt"
)

func (Sort) IsValid

func (s Sort) IsValid() bool

type Team

type Team struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

Team contains data of team.

type UpdateUserRequest

type UpdateUserRequest struct {
	*Identifier
	Username          string              `json:"username,omitempty"`
	FullName          string              `json:"fullName,omitempty"`
	Role              UserRole            `json:"role,omitempty"`
	SkypeUsername     string              `json:"skypeUsername,omitempty"`
	UserAddress       UserAddress         `json:"userAddress,omitempty"`
	Tags              []string            `json:"tags,omitempty"`
	Details           map[string][]string `json:"details,omitempty"`
	Timezone          string              `json:"timezone,omitempty"`
	Locale            string              `json:"locale,omitempty"`
	DisableInvitation bool                `json:"invitationDisabled,omitempty"`
	ApiKey            string              `json:"-"`
}

UpdateUserRequest is a request for updating user.

func (*UpdateUserRequest) GenerateUrl

func (r *UpdateUserRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*UpdateUserRequest) GetApiKey

func (r *UpdateUserRequest) GetApiKey() string

GetApiKey returns api key.

type UpdateUserResponse

type UpdateUserResponse struct {
	ResponseMeta
}

UpdateUserResponse is response with status of updating user.

type User

type User struct {
	ID           string              `json:"id,omitempty"`
	Blocked      bool                `json:"blocked,omitempty"`
	Verified     bool                `json:"verified,omitempty"`
	Username     string              `json:"username,omitempty"`
	FullName     string              `json:"fullName,omitempty"`
	Role         UserRole            `json:"role,omitempty"`
	TimeZone     string              `json:"timeZone,omitempty"`
	Locale       string              `json:"locale,omitempty"`
	UserAddress  UserAddress         `json:"userAddress,omitempty"`
	CreatedAt    time.Time           `json:"createdAt,omitempty"`
	MutedUntil   time.Time           `json:"mutedUntil,omitempty"`
	Details      map[string][]string `json:"details,omitempty"`
	Tags         []string            `json:"tags,omitempty"`
	UserContacts []UserContact       `json:"userContacts,omitempty"`
}

User contains user data.

type UserAddress

type UserAddress struct {
	Country string `json:"country"`
	State   string `json:"state"`
	City    string `json:"city"`
	Line    string `json:"line"`
	ZipCode string `json:"zipCode"`
}

UserAddress contains data user user address.

type UserContact

type UserContact struct {
	ID             string        `json:"id"`
	To             string        `json:"to"`
	ContactMethod  ContactMethod `json:"contactMethod"`
	DisabledReason string        `json:"disabledReason"`
	Enabled        bool          `json:"enabled"`
}

UserContact contains data of user contact.

type UserMeta

type UserMeta struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

UserMeta contains id and name of created user.

type UserRole

type UserRole struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

UserRole contains data of role.

Jump to

Keyboard shortcuts

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