Documentation ¶
Index ¶
- type Admin
- type AllContactResponse
- type ApiEscalationPolicy
- type ApiEscalationPolicySchedule
- type ApiOnCallEntry
- type ApiOnCallNow
- type ApiOnCallOverride
- type ApiOnCallRoll
- type ApiOnCallUser
- type ApiTeam
- type ApiTeamOnCall
- type ApiTeamSchedule
- type ApiTeamsOnCall
- type ApiUser
- type ApiUserSchedule
- type Client
- func (c Client) AckIncidents(userName string, incidents []int, message string) (*IncidentActionResponse, *RequestDetails, error)
- func (c Client) AckIncidentsByUser(userName string, message string) (*IncidentActionResponse, *RequestDetails, error)
- func (c Client) AddTeamMember(teamID string, username string) (*RequestDetails, error)
- func (c Client) CreateContact(username string, contact *Contact) (*Contact, *RequestDetails, error)
- func (c Client) CreateEscalationPolicy(escalationPolicy *EscalationPolicy) (*EscalationPolicy, *RequestDetails, error)
- func (c Client) CreateRoutingKey(routingKey *RoutingKey) (*RoutingKey, *RequestDetails, error)
- func (c Client) CreateTeam(team *Team) (*Team, *RequestDetails, error)
- func (c Client) CreateUser(user *User) (*User, *RequestDetails, error)
- func (c Client) DeleteContact(username string, contactExtID string, contactType ContactType) (*RequestDetails, error)
- func (c Client) DeleteEscalationPolicy(escalationPolicyID string) (*RequestDetails, error)
- func (c Client) DeleteTeam(teamID string) (*RequestDetails, error)
- func (c Client) DeleteUser(username string, replacementUser string) (*RequestDetails, error)
- func (c Client) GetAllContacts(username string) (*AllContactResponse, *RequestDetails, error)
- func (c Client) GetAllEscalationPolicies() (*EscalationPolicyList, *RequestDetails, error)
- func (c Client) GetAllRoutingKeys() (*RoutingKeyResponseList, *RequestDetails, error)
- func (c Client) GetAllTeams() (*[]Team, *RequestDetails, error)
- func (c Client) GetAllUserV2() (*UserListV2, *RequestDetails, error)
- func (c Client) GetAllUsers() (*UserList, *RequestDetails, error)
- func (c Client) GetApiTeamSchedule(teamSlug string, daysForward int, daysSkip int, step int) (*ApiTeamSchedule, *RequestDetails, error)
- func (c Client) GetContact(username string, contactExtID string, contactType ContactType) (*Contact, *RequestDetails, error)
- func (c Client) GetContactByID(username string, id int, contactType ContactType) (*Contact, *RequestDetails, error)
- func (c Client) GetEscalationPolicy(escalationPolicyID string) (*EscalationPolicy, *RequestDetails, error)
- func (c Client) GetHTTPClient() *http.Client
- func (c Client) GetIncident(incidentID int) (*Incident, *RequestDetails, error)
- func (c Client) GetIncidents() (*IncidentResponse, *RequestDetails, error)
- func (c Client) GetOnCallCurrent() (*ApiTeamsOnCall, *RequestDetails, error)
- func (c Client) GetRoutingKey(keyname string) (*RoutingKeyResponse, *RequestDetails, error)
- func (c Client) GetTeam(teamID string) (*Team, *RequestDetails, error)
- func (c Client) GetTeamAdmins(teamID string) (*TeamAdmins, *RequestDetails, error)
- func (c Client) GetTeamMembers(teamID string) (*TeamMembers, *RequestDetails, error)
- func (c Client) GetUser(username string) (*User, *RequestDetails, error)
- func (c Client) GetUserByEmail(email string) (*UserListV2, *RequestDetails, error)
- func (c Client) GetUserDefaultEmailContactID(username string) (float64, *RequestDetails, error)
- func (c Client) GetUserOnCallSchedule(userName string, daysForward int, daysSkip int, step int) (*ApiUserSchedule, *RequestDetails, error)
- func (c Client) IsTeamMember(teamID string, username string) (bool, *RequestDetails, error)
- func (c Client) RemoveTeamMember(teamID string, username string, replacement string) (*RequestDetails, error)
- func (c Client) ResolveIncidents(userName string, incidents []int, message string) (*IncidentActionResponse, *RequestDetails, error)
- func (c Client) ResolveIncidentsByUser(userName string, message string) (*IncidentActionResponse, *RequestDetails, error)
- func (c Client) String() string
- func (c Client) TakeOnCallForPolicy(policySlug string, req *TakeRequest) (*TakeResponse, *RequestDetails, error)
- func (c Client) TakeOnCallForTeam(teamSlug string, req *TakeRequest) (*TakeResponse, *RequestDetails, error)
- func (c Client) UpdateTeam(team *Team) (*Team, *RequestDetails, error)
- func (c Client) UpdateUser(user *User) (*User, *RequestDetails, error)
- type ClientArgs
- type Contact
- type ContactGroup
- type ContactType
- type ContactTypes
- type EscalationPolicy
- type EscalationPolicyList
- type EscalationPolicyListDetail
- type EscalationPolicyListElement
- type EscalationPolicyStepEntry
- type EscalationPolicySteps
- type GetAllContactResponse
- type Incident
- type IncidentAction
- type IncidentActionByUserRequest
- type IncidentActionRequest
- type IncidentActionResponse
- type IncidentResponse
- type PagedEntity
- type PagedPolicy
- type RequestDetails
- type RoutingKey
- type RoutingKeyResponse
- type RoutingKeyResponseList
- type RoutingKeyResponseTargets
- type TakeRequest
- type TakeResponse
- type Team
- type TeamAdmins
- type TeamMembers
- type Transition
- type User
- type UserList
- type UserListV2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct { Username string `json:"username,omitempty"` FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` SelfUrl string `json:"_selfUrl,omitempty"` }
User is a user in the VictorOps org.
type AllContactResponse ¶
type AllContactResponse struct { Phones ContactGroup `json:"phones,omitempty"` Emails ContactGroup `json:"emails,omitempty"` Devices ContactGroup `json:"devices,omitempty"` }
type ApiEscalationPolicy ¶
type ApiEscalationPolicySchedule ¶
type ApiEscalationPolicySchedule struct { Policy ApiEscalationPolicy `json:"policy,omitempty"` Schedule []ApiOnCallEntry `json:"schedule,omitempty"` Overrides []ApiOnCallOverride `json:"overrides,omitempty"` }
type ApiOnCallEntry ¶
type ApiOnCallEntry struct { OnCallUser ApiUser `json:"onCallUser,omitempty"` OverrideOnCallUser ApiUser `json:"overrideOnCallUser,omitempty"` OnCallType string `json:"onCallType,omitempty"` RotationName string `json:"rotationName,omitempty"` ShiftName string `json:"shiftName,omitempty"` ShiftRoll time.Time `json:"shiftRoll,omitempty"` Rolls []ApiOnCallRoll `json:"rolls,omitempty"` }
type ApiOnCallNow ¶
type ApiOnCallNow struct { EscalationPolicy ApiEscalationPolicy `json:"escalationPolicy,omitempty"` Users []ApiOnCallUser `json:"users,omitempty"` }
type ApiOnCallOverride ¶
type ApiOnCallRoll ¶
type ApiOnCallUser ¶
type ApiOnCallUser struct {
OnCallUser ApiUser `json:"onCallUser,omitempty"`
}
type ApiTeamOnCall ¶
type ApiTeamOnCall struct { Team ApiTeam `json:"team,omitempty"` OnCallNow []ApiOnCallNow `json:"onCallNow,omitempty"` }
type ApiTeamSchedule ¶
type ApiTeamSchedule struct { Team ApiTeam `json:"team,omitempty"` Schedules []ApiEscalationPolicySchedule `json:"schedules,omitempty"` }
type ApiTeamsOnCall ¶
type ApiTeamsOnCall struct {
TeamsOnCall []ApiTeamOnCall `json:"teamsOnCall,omitempty"`
}
type ApiUserSchedule ¶
type ApiUserSchedule struct {
Schedules []ApiTeamSchedule `json:"teamSchedules,omitempty"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main client for interacting with victorops
func NewConfigurableClient ¶
func NewConfigurableClient(apiID string, apiKey string, publicBaseURL string, httpClient http.Client) *Client
NewConfigurableClient creates a new VictorOps client with ClientArgs struct
func (Client) AckIncidents ¶
func (c Client) AckIncidents(userName string, incidents []int, message string) (*IncidentActionResponse, *RequestDetails, error)
AckIncidents acknowledges a list of incidents
func (Client) AckIncidentsByUser ¶
func (c Client) AckIncidentsByUser(userName string, message string) (*IncidentActionResponse, *RequestDetails, error)
AckIncidentsByUser acknowledges all incidents for the given user
func (Client) AddTeamMember ¶
func (c Client) AddTeamMember(teamID string, username string) (*RequestDetails, error)
AddTeamMember adds a member to a victorops team.
func (Client) CreateContact ¶
CreateContact creates a new contact for a user
func (Client) CreateEscalationPolicy ¶
func (c Client) CreateEscalationPolicy(escalationPolicy *EscalationPolicy) (*EscalationPolicy, *RequestDetails, error)
CreateEscalationPolicy creates a new eslacation policy
func (Client) CreateRoutingKey ¶
func (c Client) CreateRoutingKey(routingKey *RoutingKey) (*RoutingKey, *RequestDetails, error)
CreateRoutingKey creates a routingkey in the victorops organization
func (Client) CreateTeam ¶
func (c Client) CreateTeam(team *Team) (*Team, *RequestDetails, error)
CreateTeam creates a team in the victorops organization
func (Client) CreateUser ¶
func (c Client) CreateUser(user *User) (*User, *RequestDetails, error)
CreateUser creates a user in the victorops organization
func (Client) DeleteContact ¶
func (c Client) DeleteContact(username string, contactExtID string, contactType ContactType) (*RequestDetails, error)
DeleteContact deletes a contact
func (Client) DeleteEscalationPolicy ¶
func (c Client) DeleteEscalationPolicy(escalationPolicyID string) (*RequestDetails, error)
DeleteEscalationPolicy deletes an escalation policy by ID
func (Client) DeleteTeam ¶
func (c Client) DeleteTeam(teamID string) (*RequestDetails, error)
DeleteTeam deletes a team from this victorops org
func (Client) DeleteUser ¶
func (c Client) DeleteUser(username string, replacementUser string) (*RequestDetails, error)
DeleteUser deletes a user from the victorops org
func (Client) GetAllContacts ¶
func (c Client) GetAllContacts(username string) (*AllContactResponse, *RequestDetails, error)
GetAllContacts returns a list of all of the contacts for a user in the victorops org
func (Client) GetAllEscalationPolicies ¶
func (c Client) GetAllEscalationPolicies() (*EscalationPolicyList, *RequestDetails, error)
GetAllEscalationPolicies lists all escalation policies for the org
func (Client) GetAllRoutingKeys ¶
func (c Client) GetAllRoutingKeys() (*RoutingKeyResponseList, *RequestDetails, error)
GetAllRoutingKeys returns a list of all of the routing keys for an account
func (Client) GetAllTeams ¶
func (c Client) GetAllTeams() (*[]Team, *RequestDetails, error)
GetAllTeams returns a list of all team within this victorops organization
func (Client) GetAllUserV2 ¶
func (c Client) GetAllUserV2() (*UserListV2, *RequestDetails, error)
GetAllUserV2 returns a list of all of the users in the victorops org
func (Client) GetAllUsers ¶
func (c Client) GetAllUsers() (*UserList, *RequestDetails, error)
GetAllUsers returns a list of all of the users in the victorops org
func (Client) GetApiTeamSchedule ¶
func (c Client) GetApiTeamSchedule(teamSlug string, daysForward int, daysSkip int, step int) (*ApiTeamSchedule, *RequestDetails, error)
func (Client) GetContact ¶
func (c Client) GetContact(username string, contactExtID string, contactType ContactType) (*Contact, *RequestDetails, error)
GetContact gets a contact for a user
func (Client) GetContactByID ¶
func (c Client) GetContactByID(username string, id int, contactType ContactType) (*Contact, *RequestDetails, error)
func (Client) GetEscalationPolicy ¶
func (c Client) GetEscalationPolicy(escalationPolicyID string) (*EscalationPolicy, *RequestDetails, error)
GetEscalationPolicy gets an escalation policy by ID
func (Client) GetHTTPClient ¶
GetHTTPClient returns http client for the purpose of test
func (Client) GetIncident ¶
func (c Client) GetIncident(incidentID int) (*Incident, *RequestDetails, error)
GetIncident returns the details of a specific incident
func (Client) GetIncidents ¶
func (c Client) GetIncidents() (*IncidentResponse, *RequestDetails, error)
GetIncidents gets a list of the currently open, acknowledged and recently resolved incidents
func (Client) GetOnCallCurrent ¶
func (c Client) GetOnCallCurrent() (*ApiTeamsOnCall, *RequestDetails, error)
Get all current on-call personnel
func (Client) GetRoutingKey ¶
func (c Client) GetRoutingKey(keyname string) (*RoutingKeyResponse, *RequestDetails, error)
GetRoutingKey returns a specific routingkey within this victorops organization
func (Client) GetTeam ¶
func (c Client) GetTeam(teamID string) (*Team, *RequestDetails, error)
GetTeam returns a specific team within this victorops organization
func (Client) GetTeamAdmins ¶
func (c Client) GetTeamAdmins(teamID string) (*TeamAdmins, *RequestDetails, error)
GetTeamAdmins returns a list of admins for this team
func (Client) GetTeamMembers ¶
func (c Client) GetTeamMembers(teamID string) (*TeamMembers, *RequestDetails, error)
GetTeamMembers returns a members on a team within this victorops organization
func (Client) GetUser ¶
func (c Client) GetUser(username string) (*User, *RequestDetails, error)
GetUser returns a specific user within this victorops organization
func (Client) GetUserByEmail ¶
func (c Client) GetUserByEmail(email string) (*UserListV2, *RequestDetails, error)
GetUserByEmail returns a list of all of the user(s) in the victorops org that matches the given email
func (Client) GetUserDefaultEmailContactID ¶
func (c Client) GetUserDefaultEmailContactID(username string) (float64, *RequestDetails, error)
GetUserDefaultEmailContactID returns the id of the default email contact for a user TODO: Utilize the contact method methods for this
func (Client) GetUserOnCallSchedule ¶
func (c Client) GetUserOnCallSchedule(userName string, daysForward int, daysSkip int, step int) (*ApiUserSchedule, *RequestDetails, error)
func (Client) IsTeamMember ¶
IsTeamMember Returns wether or not a user is in a specific victorops team TODO: Maybe we should do this using the v1/user/{username}/teams endpoint instead
func (Client) RemoveTeamMember ¶
func (c Client) RemoveTeamMember(teamID string, username string, replacement string) (*RequestDetails, error)
RemoveTeamMember Removes a member from a victorops team
func (Client) ResolveIncidents ¶
func (c Client) ResolveIncidents(userName string, incidents []int, message string) (*IncidentActionResponse, *RequestDetails, error)
ResolveIncidents resolves a list of incidents
func (Client) ResolveIncidentsByUser ¶
func (c Client) ResolveIncidentsByUser(userName string, message string) (*IncidentActionResponse, *RequestDetails, error)
ResolveIncidentsByUser solves all incidents for the given user
func (Client) TakeOnCallForPolicy ¶
func (c Client) TakeOnCallForPolicy(policySlug string, req *TakeRequest) (*TakeResponse, *RequestDetails, error)
func (Client) TakeOnCallForTeam ¶
func (c Client) TakeOnCallForTeam(teamSlug string, req *TakeRequest) (*TakeResponse, *RequestDetails, error)
func (Client) UpdateTeam ¶
func (c Client) UpdateTeam(team *Team) (*Team, *RequestDetails, error)
UpdateTeam updates a victorops user
func (Client) UpdateUser ¶
func (c Client) UpdateUser(user *User) (*User, *RequestDetails, error)
UpdateUser updates a victorops user
type ClientArgs ¶
type ClientArgs struct {
// contains filtered or unexported fields
}
Client args is used to dynamically pass in parameters when instantiating the Client
type Contact ¶
type Contact struct { PhoneNumber string `json:"phone,omitempty"` Email string `json:"email,omitempty"` Label string `json:"label,omitempty"` Rank int `json:"rank,omitempty"` ExtID string `json:"extId,omitempty"` ID int `json:"id,omitempty"` Value string `json:"value,omitempty"` Verified string `json:"verified,omitempty"` }
Contact is a struct to hold the data for a victorops phone or email contact. This has Email and PhoneNumber fields for when making a create request But on querying later, those values are always returned as "value"
func (Contact) Type ¶
func (c Contact) Type() ContactType
type ContactGroup ¶
type ContactGroup struct {
ContactMethods []Contact `json:"contactMethods"`
}
type ContactType ¶
type ContactType struct {
// contains filtered or unexported fields
}
func GetContactTypeFromNotificationType ¶
func GetContactTypeFromNotificationType(notificationType string) ContactType
GetContactTypeFromNotificationType returns a ContactType based on the notificationType string returned in notification steps.
type ContactTypes ¶
type ContactTypes struct { Phone ContactType Email ContactType Device ContactType }
Define a ContactType enum that is used internally for endpoint generation Golang doesn't have real enums, so this is a way to mimic it
func GetContactTypes ¶
func GetContactTypes() ContactTypes
type EscalationPolicy ¶
type EscalationPolicy struct { Name string `json:"name"` TeamID string `json:"teamSlug"` IgnoreCustomPagingPolicies bool `json:"ignoreCustomPagingPolicies"` Steps []EscalationPolicySteps `json:"steps"` ID string `json:"slug"` }
EscalationPolicy is a struct to hold an escalation policy
type EscalationPolicyList ¶
type EscalationPolicyList struct {
Policies []EscalationPolicyListElement `json:"policies"`
}
EscalationPolicyList is a struct to hold the response from the list all escalation policies API call
type EscalationPolicyListDetail ¶
EscalationPolicyListDetail is a struct to hold the details of a team or policy returned in the list all escalation policies API call
type EscalationPolicyListElement ¶
type EscalationPolicyListElement struct { Policy EscalationPolicyListDetail `json:"policy"` Team EscalationPolicyListDetail `json:"team"` }
EscalationPolicyListElement is a struct to hold a single policy/team combination element returned in the list all escalation policies API call
type EscalationPolicyStepEntry ¶
type EscalationPolicyStepEntry struct { ExecutionType string `json:"executionType"` User map[string]string `json:"user"` RotationGroup map[string]string `json:"rotationGroup"` Webhook map[string]string `json:"webhook"` Email map[string]string `json:"email"` TargetPolicy map[string]string `json:"targetPolicy"` }
EscalationPolicyStepEntry is a struct to store escalation policy step entries
type EscalationPolicySteps ¶
type EscalationPolicySteps struct { Timeout int `json:"timeout"` Entries []EscalationPolicyStepEntry `json:"entries"` }
EscalationPolicySteps is a struct to store escalation policy steps
type GetAllContactResponse ¶
type GetAllContactResponse struct {
ContactMethods []Contact `json:"contactMethods,omitempty"`
}
Get a contact via it's internal api ID, but using the public API
type Incident ¶
type Incident struct { AlertCount int `json:"alertCount,omitempty"` CurrentPhase string `json:"currentPhase,omitempty"` EntityDisplayName string `json:"entityDisplayName,omitempty"` EntityID string `json:"entityId,omitempty"` EntityState string `json:"entityState,omitempty"` EntityType string `json:"entityType,omitempty"` Host string `json:"host,omitempty"` IncidentNumber string `json:"incidentNumber,omitempty"` LastAlertID string `json:"lastAlertId,omitempty"` LastAlertTime time.Time `json:"lastAlertTime,omitempty"` Service string `json:"service,omitempty"` StartTime time.Time `json:"startTime,omitempty"` PagedTeams []string `json:"pagedTeams,omitempty"` PagedUsers []string `json:"pagedUsers,omitempty"` PagedPolicies []PagedPolicy `json:"pagedPolicies,omitempty"` Transitions []Transition `json:",omitempty"` }
Incident represents an incident on victorops
type IncidentAction ¶
type IncidentAction struct { IncidentNumber string `json:"incidentNumber,omitempty"` EntityID string `json:"entityId,omitempty"` CmdAccepted bool `json:"cmdAccepted,omitempty"` Message string `json:"message,omitempty"` }
IncidentAction is the result of the single action on an incident.
type IncidentActionRequest ¶
type IncidentActionRequest struct { UserName string `json:"userName,omitempty"` IncidentNames []string `json:"incidentNames,omitempty"` Message string `json:"message,omitempty"` }
IncidentActionRequest represents the payload for a request to modify the state of an incident
type IncidentActionResponse ¶
type IncidentActionResponse struct {
Results []IncidentAction `json:"results,omitempty"`
}
IncidentActionResponse represents the payload for a response to a request to modify the state of an incident.
type IncidentResponse ¶
type IncidentResponse struct {
Incidents []Incident `json:"incidents,omitempty"`
}
IncidentResponse holds just the list of incidents from the api response
type PagedEntity ¶
PagedEntity holds references for a parsed paged policy or team for an incident
type PagedPolicy ¶
type PagedPolicy struct { Policy PagedEntity `json:"policy,omitempty"` Team PagedEntity `json:"team,omitempty"` }
PagedPolicy to hold references for parsing an incident
type RequestDetails ¶
type RequestDetails struct { StatusCode int ResponseBody string RequestBody string RawResponse *http.Response RawRequest *http.Request }
RequestDetails contains details from the API response
type RoutingKey ¶
type RoutingKey struct { RoutingKey string `json:"routingKey,omitempty"` Targets []string `json:"targets,omitempty"` }
RoutingKey is a struct to hold the data for a victorops routing key.
type RoutingKeyResponse ¶
type RoutingKeyResponse struct { RoutingKey string `json:"routingKey,omitempty"` Targets []RoutingKeyResponseTargets `json:"targets,omitempty"` }
In the request to create a routing key, we supply a list of strings which are target escalaption policy slugs In the response while getting routing keys, we get a different type of result which is a map of values like so: {"policyName":"Moderate Severity","policySlug":"pol-tq09wTVkG7BzuMY0","_teamUrl":"/api-public/v1/team/team-Iei67wjVsD14Pe4O"} So these structs exist to represent read responses rather that create requests.
type RoutingKeyResponseList ¶
type RoutingKeyResponseList struct {
RoutingKeys []RoutingKeyResponse `json:"routingKeys,omitempty"`
}
type RoutingKeyResponseTargets ¶
type RoutingKeyResponseTargets struct {
PolicySlug string `json:"policySlug,omitempty"`
}
type TakeRequest ¶
type TakeResponse ¶
type TakeResponse struct {
Result string `json:"result,omitempty"`
}
type Team ¶
type Team struct { Name string `json:"name,omitempty"` Slug string `json:"slug,omitempty"` MemberCount int `json:"memberCount,omitempty"` Version int `json:"version,omitempty"` IsDefaultTeam bool `json:"isDefaultTeam,omitempty"` Description string `json:"description,omitempty"` }
Team is a struct to hold the data for a victorops Team
type TeamAdmins ¶
type TeamAdmins struct {
TeamAdmins []Admin `json:"admin,omitempty"`
}
TeamAdmins contains administrators for a team
type TeamMembers ¶
type TeamMembers struct {
Members []User `json:"members,omitempty"`
}
TeamMembers contains membership details for a team
type Transition ¶
type Transition struct { Name string `json:",omitempty"` At time.Time `json:",omitempty"` Message string `json:",omitempty"` By string `json:",omitempty"` Manually bool AlertID string `json:"alertId,omitempty"` AlertURL string `json:"alertUrl,omitempty"` }
Transition represents a state changes of an incident
type User ¶
type User struct { FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` Admin bool `json:"admin,omitempty"` ExpirationHours int `json:"expirationHours,omitempty"` CreatedAt string `json:"createdAt,omitempty"` PasswordLastUpdated string `json:"passwordLastUpdated,omitempty"` Verified bool `json:"verified,omitempty"` }
User is a user in the VictorOps org.
type UserListV2 ¶
type UserListV2 struct {
Users []User `json:"users"`
}
UserListV2 is a list of Users for Version 2