Documentation ¶
Index ¶
- Constants
- Variables
- func EncodePluginData(data PluginData) map[string]string
- type App
- type Config
- type Details
- type ErrorResult
- type Extension
- type ExtensionBody
- type ExtensionBodyWrap
- type ExtensionResult
- type ExtensionSchema
- type Incident
- type IncidentAssignment
- type IncidentBody
- type IncidentBodyWrap
- type IncidentNote
- type IncidentNoteBody
- type IncidentNoteBodyWrap
- type IncidentNoteResult
- type IncidentResult
- type ListAbilitiesResult
- type ListExtensionSchemasResult
- type ListExtensionsResult
- type ListIncidentsResult
- type ListOnCallsQuery
- type ListOnCallsResult
- type ListServicesQuery
- type ListServicesResult
- type ListUsersQuery
- type ListUsersResult
- type OnCall
- type Pagerduty
- func (p Pagerduty) CreateIncident(ctx context.Context, serviceID, reqID string, reqData RequestData) (PagerdutyData, error)
- func (p *Pagerduty) FilterOnCallPolicies(ctx context.Context, userID string, escalationPolicyIDs []string) ([]string, error)
- func (p *Pagerduty) FindServiceByName(ctx context.Context, serviceName string) (Service, error)
- func (p Pagerduty) FindServicesByNames(ctx context.Context, serviceNames []string) ([]Service, error)
- func (p *Pagerduty) FindUserByEmail(ctx context.Context, userEmail string) (User, error)
- func (p Pagerduty) GetUserInfo(ctx context.Context, userID string) (User, error)
- func (p Pagerduty) HealthCheck(ctx context.Context) error
- func (p Pagerduty) PostReviewNote(ctx context.Context, incidentID string, review types.AccessReview) error
- func (p Pagerduty) ResolveIncident(ctx context.Context, incidentID string, resolution Resolution) error
- type PagerdutyConfig
- type PagerdutyData
- type PaginationQuery
- type PaginationResult
- type PluginData
- type Reference
- type RequestData
- type Resolution
- type ResolutionTag
- type Service
- type ServiceResult
- type User
- type UserResult
Constants ¶
const ( APIEndpointDefaultURL = "https://api.pagerduty.com" NotifyServiceDefaultAnnotation = "pagerduty_notify_service" ServicesDefaultAnnotation = "pagerduty_services" )
const ( Unresolved = ResolutionTag("") ResolvedApproved = ResolutionTag("approved") ResolvedDenied = ResolutionTag("denied") ResolvedExpired = ResolutionTag("expired") ResolvedPromoted = ResolutionTag("promoted") )
Variables ¶
var ( // Version package version, specified in Makefile using ldflags Version = `Not specified, use --ldflags "-X main.Version "1.0.0""` // Gitref variable is specified in Makefile using ldflags Gitref string )
Functions ¶
func EncodePluginData ¶
func EncodePluginData(data PluginData) map[string]string
EncodePluginData serializes a PluginData struct into a string map.
Types ¶
type App ¶
App contains global application state of the PagerDuty plugin.
type Config ¶
type Config struct { Teleport lib.TeleportConfig `toml:"teleport"` Pagerduty PagerdutyConfig `toml:"pagerduty"` Log logger.Config `toml:"log"` // Teleport is a handle to the client to use when communicating with // the Teleport auth server. The PagerDuty app will create a gRPC- // based client on startup if this is not set. Client teleport.Client // StatusSink receives any status updates from the plugin for // further processing. Status updates will be ignored if not set. StatusSink common.StatusSink // TeleportUser is the name of the Teleport user that will act // as the access request approver TeleportUser string }
func (*Config) CheckAndSetDefaults ¶
type ErrorResult ¶
type ExtensionBody ¶
type ExtensionBodyWrap ¶
type ExtensionBodyWrap struct {
Extension ExtensionBody `json:"extension"`
}
type ExtensionResult ¶
type ExtensionResult struct {
Extension Extension `json:"extension"`
}
type ExtensionSchema ¶
type IncidentAssignment ¶
type IncidentBody ¶
type IncidentBody struct { ID string `json:"id,omitempty"` Title string `json:"title,omitempty"` IncidentKey string `json:"incident_key,omitempty"` Service Reference `json:"service,omitempty"` Body Details `json:"body,omitempty"` Type string `json:"type,omitempty"` Status string `json:"status,omitempty"` }
type IncidentBodyWrap ¶
type IncidentBodyWrap struct {
Incident IncidentBody `json:"incident"`
}
type IncidentNote ¶
type IncidentNoteBody ¶
type IncidentNoteBody struct {
Content string `json:"content,omitempty"`
}
type IncidentNoteBodyWrap ¶
type IncidentNoteBodyWrap struct {
Note IncidentNoteBody `json:"note"`
}
type IncidentNoteResult ¶
type IncidentNoteResult struct {
Note IncidentNote `json:"note"`
}
type IncidentResult ¶
type IncidentResult struct {
Incident Incident `json:"incident"`
}
type ListAbilitiesResult ¶
type ListAbilitiesResult struct {
Abilities []string `json:"abilities"`
}
ListAbilitiesResult describes the output of the PagerDuty /abilities API call.
type ListExtensionSchemasResult ¶
type ListExtensionSchemasResult struct { PaginationResult ExtensionSchemas []ExtensionSchema `json:"extension_schemas"` }
type ListExtensionsResult ¶
type ListExtensionsResult struct { PaginationResult Extensions []Extension `json:"extensions"` }
type ListIncidentsResult ¶
type ListIncidentsResult struct { PaginationResult Incidents []Incident `json:"incidents"` }
type ListOnCallsQuery ¶
type ListOnCallsQuery struct { PaginationQuery UserIDs []string `url:"user_ids,omitempty,brackets"` EscalationPolicyIDs []string `url:"escalation_policy_ids,omitempty,brackets"` }
type ListOnCallsResult ¶
type ListOnCallsResult struct { PaginationResult OnCalls []OnCall `json:"oncalls"` }
type ListServicesQuery ¶
type ListServicesQuery struct { PaginationQuery Query string `url:"query,omitempty"` }
type ListServicesResult ¶
type ListServicesResult struct { PaginationResult Services []Service `json:"services"` }
type ListUsersQuery ¶
type ListUsersQuery struct { PaginationQuery Query string `url:"query,omitempty"` }
type ListUsersResult ¶
type ListUsersResult struct { PaginationResult Users []User `json:"users"` }
type Pagerduty ¶
type Pagerduty struct {
// contains filtered or unexported fields
}
Pagerduty is a wrapper around resty.Client.
func NewPagerdutyClient ¶
func NewPagerdutyClient(conf PagerdutyConfig, clusterName, webProxyAddr string, statusSink common.StatusSink) (Pagerduty, error)
func (Pagerduty) CreateIncident ¶
func (p Pagerduty) CreateIncident(ctx context.Context, serviceID, reqID string, reqData RequestData) (PagerdutyData, error)
CreateIncident creates a notification incident.
func (*Pagerduty) FilterOnCallPolicies ¶
func (p *Pagerduty) FilterOnCallPolicies(ctx context.Context, userID string, escalationPolicyIDs []string) ([]string, error)
RangeOnCallPolicies iterates over the escalation policy IDs for which a given user is currently on-call.
func (*Pagerduty) FindServiceByName ¶
FindServiceByName finds a service by its name (case-insensitive).
func (Pagerduty) FindServicesByNames ¶
func (p Pagerduty) FindServicesByNames(ctx context.Context, serviceNames []string) ([]Service, error)
FindServicesByNames finds a bunch of services by its names making a query for each service.
func (*Pagerduty) FindUserByEmail ¶
GetUserByEmail finds a user by email.
func (Pagerduty) GetUserInfo ¶
GetUserInfo loads a user profile by id.
func (Pagerduty) PostReviewNote ¶
func (p Pagerduty) PostReviewNote(ctx context.Context, incidentID string, review types.AccessReview) error
PostReviewNote posts a note once a new request review appears.
func (Pagerduty) ResolveIncident ¶
func (p Pagerduty) ResolveIncident(ctx context.Context, incidentID string, resolution Resolution) error
ResolveIncident resolves an incident and posts a note with resolution details.
type PagerdutyConfig ¶
type PagerdutyData ¶
PagerdutyData stores the notification incident info.
type PaginationQuery ¶
type PaginationResult ¶
type PluginData ¶
type PluginData struct { RequestData PagerdutyData }
PluginData is a data associated with access request that we store in Teleport using UpdatePluginData API.
func DecodePluginData ¶
func DecodePluginData(dataMap map[string]string) (data PluginData)
DecodePluginData deserializes a string map to PluginData struct.
type RequestData ¶
type RequestData struct { User string Roles []string Created time.Time RequestReason string ReviewsCount int Resolution Resolution }
RequestData stores a slice of some request fields in a convenient format.
type Resolution ¶
type Resolution struct { Tag ResolutionTag Reason string }
Resolution stores the resolution (approved, denied or expired) and its reason.
type ResolutionTag ¶
type ResolutionTag string
type ServiceResult ¶
type ServiceResult struct {
Service Service `json:"service"`
}
type UserResult ¶
type UserResult struct {
User User `json:"user"`
}