Documentation
¶
Overview ¶
Package client is a client library for accessing the Rollbar API.
Index ¶
- Constants
- Variables
- type EmailIntegration
- type ErrorResult
- type Invitation
- type Notification
- type PagerDutyIntegration
- type Project
- type ProjectAccessToken
- type ProjectAccessTokenCreateArgs
- type ProjectAccessTokenUpdateArgs
- type RollbarAPIClient
- func (c *RollbarAPIClient) AssignTeamToProject(teamID, projectID int) error
- func (c *RollbarAPIClient) AssignUserToTeam(teamID, userID int) error
- func (c *RollbarAPIClient) CancelInvitation(id int) (err error)
- func (c *RollbarAPIClient) CreateInvitation(teamID int, email string) (Invitation, error)
- func (c *RollbarAPIClient) CreateNotification(channel string, filters, trigger, config interface{}, status string) (*Notification, error)
- func (c *RollbarAPIClient) CreateProject(name string) (*Project, error)
- func (c *RollbarAPIClient) CreateProjectAccessToken(args ProjectAccessTokenCreateArgs) (ProjectAccessToken, error)
- func (c *RollbarAPIClient) CreateServiceLink(name, template string) (*ServiceLink, error)
- func (c *RollbarAPIClient) CreateTeam(name, level string) (Team, error)
- func (c *RollbarAPIClient) DeleteInvitation(id int) (err error)
- func (c *RollbarAPIClient) DeleteNotification(notificationID int, channel string) error
- func (c *RollbarAPIClient) DeleteProject(projectID int) error
- func (c *RollbarAPIClient) DeleteProjectAccessToken(projectID int, token string) error
- func (c *RollbarAPIClient) DeleteServiceLink(id int) error
- func (c *RollbarAPIClient) DeleteTeam(id int) error
- func (c *RollbarAPIClient) FindInvitations(email string) (invs []Invitation, err error)
- func (c *RollbarAPIClient) FindPendingInvitations(email string) ([]Invitation, error)
- func (c *RollbarAPIClient) FindProjectTeamIDs(projectID int) ([]int, error)
- func (c *RollbarAPIClient) FindTeamID(name string) (int, error)
- func (c *RollbarAPIClient) FindUserID(email string) (int, error)
- func (c *RollbarAPIClient) IsUserAssignedToTeam(teamID, userID int) (bool, error)
- func (c *RollbarAPIClient) ListAllInvitationsPerEmail(email string) (invs []Invitation, err error)
- func (c *RollbarAPIClient) ListCustomTeams() ([]Team, error)
- func (c *RollbarAPIClient) ListInvitations(teamID int) (invs []Invitation, err error)
- func (c *RollbarAPIClient) ListNotifications(channel string) ([]Notification, error)
- func (c *RollbarAPIClient) ListPendingInvitations(teamID int) ([]Invitation, error)
- func (c *RollbarAPIClient) ListProjectAccessTokens(projectID int) ([]ProjectAccessToken, error)
- func (c *RollbarAPIClient) ListProjects() ([]Project, error)
- func (c *RollbarAPIClient) ListSerivceLinks() ([]ServiceLink, error)
- func (c *RollbarAPIClient) ListTeams() ([]Team, error)
- func (c *RollbarAPIClient) ListTestUsers() (users []User, err error)
- func (c *RollbarAPIClient) ListUserCustomTeams(userID int) (teams []Team, err error)
- func (c *RollbarAPIClient) ListUserTeams(userID int) (teams []Team, err error)
- func (c *RollbarAPIClient) ListUsers(email string) (users []User, err error)
- func (c *RollbarAPIClient) ReadIntegration(integration string) (interface{}, error)
- func (c *RollbarAPIClient) ReadInvitation(inviteID int) (inv Invitation, err error)
- func (c *RollbarAPIClient) ReadNotification(notificationID int, channel string) (*Notification, error)
- func (c *RollbarAPIClient) ReadProject(projectID int) (*Project, error)
- func (c *RollbarAPIClient) ReadProjectAccessToken(projectID int, token string) (ProjectAccessToken, error)
- func (c *RollbarAPIClient) ReadProjectAccessTokenByName(projectID int, name string) (ProjectAccessToken, error)
- func (c *RollbarAPIClient) ReadServiceLink(id int) (*ServiceLink, error)
- func (c *RollbarAPIClient) ReadTeam(id int) (Team, error)
- func (c *RollbarAPIClient) ReadUser(id int) (user User, err error)
- func (c *RollbarAPIClient) RemoveTeamFromProject(teamID, projectID int) error
- func (c *RollbarAPIClient) RemoveUserFromTeam(userID, teamID int) error
- func (c *RollbarAPIClient) SetHeaderDataSource(header string)
- func (c *RollbarAPIClient) SetHeaderResource(header string)
- func (c *RollbarAPIClient) UpdateIntegration(integration string, bodyMap map[string]interface{}) (interface{}, error)
- func (c *RollbarAPIClient) UpdateNotification(notificationID int, channel string, filters, trigger, config interface{}, ...) (*Notification, error)
- func (c *RollbarAPIClient) UpdateProjectAccessToken(args ProjectAccessTokenUpdateArgs) error
- func (c *RollbarAPIClient) UpdateProjectTeams(projectID int, teamIDs []int) error
- func (c *RollbarAPIClient) UpdateServiceLink(id int, name, template string) (*ServiceLink, error)
- type Scope
- type ServiceLink
- type SlackIntegration
- type Status
- type Team
- type User
- type WebhookIntegration
Constants ¶
const ( StatusEnabled = Status("enabled") StatusDisabled = Status("disabled") )
Possible values for status
const ( SLACK string = "slack" WEBHOOK string = "webhook" EMAIL string = "email" PAGERDUTY string = "pagerduty" )
const ( ScopeWrite = Scope("write") ScopeRead = Scope("read") ScopePostServerItem = Scope("post_server_item") ScopePostClientItem = Scope("post_client_item") )
Possible values for project access token scope
const DefaultBaseURL = "https://api.rollbar.com"
DefaultBaseURL is the default base URL for the Rollbar API.
const Version = "v1.15.1"
Variables ¶
var ErrNotFound = fmt.Errorf("not found")
ErrNotFound is returned when the API returns a '404 Not Found' error.
ErrUnauthorized is returned when the API returns a '401 Unauthorized' error.
Functions ¶
This section is empty.
Types ¶
type EmailIntegration ¶ added in v1.10.0
type EmailIntegration struct { ProjectID int64 `model:"project_id" mapstructure:"project_id" json:"project_id"` Settings struct { Enabled bool `model:"enabled" mapstructure:"enabled" json:"enabled"` ScrubParams bool `model:"scrub_params" mapstructure:"scrub_params" json:"scrub_params"` } `model:"settings" mapstructure:"settings"` }
type ErrorResult ¶
ErrorResult represents an error result returned by Rollbar API.
func (ErrorResult) Error ¶
func (er ErrorResult) Error() string
type Invitation ¶
type Invitation struct { ID int `json:"id"` FromUserID int `json:"from_user_id"` TeamID int `json:"team_id"` ToEmail string `json:"to_email"` Status string `json:"status"` DateCreated int `json:"date_created"` DateRedeemed int `json:"date_redeemed"` }
Invitation represents an invitation for a user to join a Rollbar team.
type Notification ¶ added in v1.2.0
type Notification struct { ID int `model:"id" mapstructure:"id"` Status string `model:"status" mapstructure:"status"` Action string `model:"action" mapstructure:"action"` Trigger string `model:"trigger" mapstructure:"trigger"` Channel string `model:"channel" mapstructure:"channel"` Filters []interface{} `model:"filters" mapstructure:"filters"` Config map[string]interface{} `model:"config" mapstructure:"config"` }
type PagerDutyIntegration ¶ added in v1.10.0
type PagerDutyIntegration struct { ProjectID int64 `model:"project_id" mapstructure:"project_id" json:"project_id"` Settings struct { Enabled bool `model:"enabled" mapstructure:"enabled" json:"enabled"` ServiceKey string `model:"service_key" mapstructure:"service_key" json:"service_key"` } `model:"settings" mapstructure:"settings"` }
type Project ¶
type Project struct { ID int `model:"id" mapstructure:"id"` Name string `model:"name" mapstructure:"name"` AccountID int `json:"account_id" model:"account_id" mapstructure:"account_id"` DateCreated int `json:"date_created" model:"date_created" mapstructure:"date_created"` DateModified int `json:"date_modified" model:"date_modified" mapstructure:"date_modified"` Status string `model:"status" mapstructure:"status"` }
Project represents a Rollbar project.
type ProjectAccessToken ¶
type ProjectAccessToken struct { Name string `mapstructure:"name"` ProjectID int `json:"project_id" mapstructure:"project_id"` AccessToken string `json:"access_token" mapstructure:"access_token"` Scopes []Scope `mapstructure:"scopes"` Status Status `mapstructure:"status"` RateLimitWindowSize int `json:"rate_limit_window_size" mapstructure:"rate_limit_window_size"` RateLimitWindowCount int `json:"rate_limit_window_count" mapstructure:"rate_limit_window_count"` DateCreated int `json:"date_created" mapstructure:"date_created"` DateModified int `json:"date_modified" mapstructure:"date_modified"` CurRateLimitWindowCount int `json:"cur_rate_limit_window_count" mapstructure:"cur_rate_limit_window_count"` CurRateLimitWindowStart int `json:"cur_rate_limit_window_start" mapstructure:"cur_rate_limit_window_start"` }
ProjectAccessToken represents a Rollbar project access token.
type ProjectAccessTokenCreateArgs ¶
type ProjectAccessTokenCreateArgs struct { ProjectID int `json:"-"` Name string `json:"name"` Scopes []Scope `json:"scopes"` Status Status `json:"status"` RateLimitWindowSize int `json:"rate_limit_window_size"` RateLimitWindowCount int `json:"rate_limit_window_count"` }
ProjectAccessTokenCreateArgs encapsulates arguments for creating a Rollbar project access token.
type ProjectAccessTokenUpdateArgs ¶
type ProjectAccessTokenUpdateArgs struct { ProjectID int `json:"-"` AccessToken string `json:"-"` RateLimitWindowSize int `json:"rate_limit_window_size"` RateLimitWindowCount int `json:"rate_limit_window_count"` }
ProjectAccessTokenUpdateArgs encapsulates the required and optional arguments for creating a Rollbar project access token.
Curently not all attributes can be updated. https://github.com/rollbar/terraform-provider-rollbar/issues/41
type RollbarAPIClient ¶
type RollbarAPIClient struct { BaseURL string // Base URL for Rollbar API Resty *resty.Client // contains filtered or unexported fields }
RollbarAPIClient is a client for the Rollbar API.
func NewClient ¶
func NewClient(baseURL, token string) *RollbarAPIClient
NewClient sets up a new Rollbar API client.
func NewTestClient ¶ added in v1.14.0
func NewTestClient(baseURL, token string) *RollbarAPIClient
NewTestClient sets up a new Rollbar API test client.
func (*RollbarAPIClient) AssignTeamToProject ¶
func (c *RollbarAPIClient) AssignTeamToProject(teamID, projectID int) error
AssignTeamToProject assigns a Rollbar team to a project.
func (*RollbarAPIClient) AssignUserToTeam ¶
func (c *RollbarAPIClient) AssignUserToTeam(teamID, userID int) error
AssignUserToTeam assigns a user to a Rollbar team.
func (*RollbarAPIClient) CancelInvitation ¶
func (c *RollbarAPIClient) CancelInvitation(id int) (err error)
CancelInvitation cancels a Rollbar team invitation.
func (*RollbarAPIClient) CreateInvitation ¶
func (c *RollbarAPIClient) CreateInvitation(teamID int, email string) (Invitation, error)
CreateInvitation sends a Rollbar team invitation to a user.
func (*RollbarAPIClient) CreateNotification ¶ added in v1.2.0
func (c *RollbarAPIClient) CreateNotification(channel string, filters, trigger, config interface{}, status string) (*Notification, error)
CreateNotification creates a new Rollbar notification.
func (*RollbarAPIClient) CreateProject ¶
func (c *RollbarAPIClient) CreateProject(name string) (*Project, error)
CreateProject creates a new Rollbar project.
func (*RollbarAPIClient) CreateProjectAccessToken ¶
func (c *RollbarAPIClient) CreateProjectAccessToken(args ProjectAccessTokenCreateArgs) (ProjectAccessToken, error)
CreateProjectAccessToken creates a Rollbar project access token.
func (*RollbarAPIClient) CreateServiceLink ¶ added in v1.6.0
func (c *RollbarAPIClient) CreateServiceLink(name, template string) (*ServiceLink, error)
CreateServiceLink creates a new Rollbar service_link.
func (*RollbarAPIClient) CreateTeam ¶
func (c *RollbarAPIClient) CreateTeam(name, level string) (Team, error)
CreateTeam creates a new Rollbar team.
func (*RollbarAPIClient) DeleteInvitation ¶
func (c *RollbarAPIClient) DeleteInvitation(id int) (err error)
DeleteInvitation is an alias for CancelInvitation.
func (*RollbarAPIClient) DeleteNotification ¶ added in v1.2.0
func (c *RollbarAPIClient) DeleteNotification(notificationID int, channel string) error
DeleteNotification deletes a Rollbar notification. If no matching notification is found, returns error ErrNotFound.
func (*RollbarAPIClient) DeleteProject ¶
func (c *RollbarAPIClient) DeleteProject(projectID int) error
DeleteProject deletes a Rollbar project. If no matching project is found, returns error ErrNotFound.
func (*RollbarAPIClient) DeleteProjectAccessToken ¶
func (c *RollbarAPIClient) DeleteProjectAccessToken(projectID int, token string) error
DeleteProjectAccessToken deletes a Rollbar project access token.
func (*RollbarAPIClient) DeleteServiceLink ¶ added in v1.6.0
func (c *RollbarAPIClient) DeleteServiceLink(id int) error
DeleteServiceLink deletes a Rollbar service_link. If no matching service link is found, returns error ErrNotFound.
func (*RollbarAPIClient) DeleteTeam ¶
func (c *RollbarAPIClient) DeleteTeam(id int) error
DeleteTeam deletes a Rollbar team. If no matching team is found, returns error ErrNotFound.
func (*RollbarAPIClient) FindInvitations ¶
func (c *RollbarAPIClient) FindInvitations(email string) (invs []Invitation, err error)
FindInvitations finds all Rollbar team invitations for a given email.
func (*RollbarAPIClient) FindPendingInvitations ¶
func (c *RollbarAPIClient) FindPendingInvitations(email string) ([]Invitation, error)
FindPendingInvitations finds pending Rollbar team invitations for the given email.
func (*RollbarAPIClient) FindProjectTeamIDs ¶
func (c *RollbarAPIClient) FindProjectTeamIDs(projectID int) ([]int, error)
FindProjectTeamIDs finds IDs of all teams assigned to the project. Caution: this is a potentially slow operation that makes multiple calls to the API. https://github.com/rollbar/terraform-provider-rollbar/issues/104
func (*RollbarAPIClient) FindTeamID ¶
func (c *RollbarAPIClient) FindTeamID(name string) (int, error)
FindTeamID finds the ID for a team.
func (*RollbarAPIClient) FindUserID ¶
func (c *RollbarAPIClient) FindUserID(email string) (int, error)
FindUserID finds the user ID for a given email.
func (*RollbarAPIClient) IsUserAssignedToTeam ¶ added in v1.5.0
func (c *RollbarAPIClient) IsUserAssignedToTeam(teamID, userID int) (bool, error)
IsUserAssignedToTeam checks if a user is assigned to a Rollbar team.
func (*RollbarAPIClient) ListAllInvitationsPerEmail ¶ added in v1.13.0
func (c *RollbarAPIClient) ListAllInvitationsPerEmail(email string) (invs []Invitation, err error)
ListAllInvitationsPerEmail lists all invitations for all Rollbar teams.
func (*RollbarAPIClient) ListCustomTeams ¶
func (c *RollbarAPIClient) ListCustomTeams() ([]Team, error)
ListCustomTeams lists all custom defined teams, excluding system teams "Everyone" and "Owners". FIXME: This function needs a better name.
func (*RollbarAPIClient) ListInvitations ¶
func (c *RollbarAPIClient) ListInvitations(teamID int) (invs []Invitation, err error)
ListInvitations lists all invitations for a Rollbar team.
func (*RollbarAPIClient) ListNotifications ¶ added in v1.8.0
func (c *RollbarAPIClient) ListNotifications(channel string) ([]Notification, error)
func (*RollbarAPIClient) ListPendingInvitations ¶
func (c *RollbarAPIClient) ListPendingInvitations(teamID int) ([]Invitation, error)
ListPendingInvitations lists a Rollbar team's pending invitations.
func (*RollbarAPIClient) ListProjectAccessTokens ¶
func (c *RollbarAPIClient) ListProjectAccessTokens(projectID int) ([]ProjectAccessToken, error)
ListProjectAccessTokens lists the Rollbar project access tokens for the specified Rollbar project.
func (*RollbarAPIClient) ListProjects ¶
func (c *RollbarAPIClient) ListProjects() ([]Project, error)
ListProjects lists all Rollbar projects.
func (*RollbarAPIClient) ListSerivceLinks ¶ added in v1.8.0
func (c *RollbarAPIClient) ListSerivceLinks() ([]ServiceLink, error)
func (*RollbarAPIClient) ListTeams ¶
func (c *RollbarAPIClient) ListTeams() ([]Team, error)
ListTeams lists all Rollbar teams.
func (*RollbarAPIClient) ListTestUsers ¶ added in v1.13.0
func (c *RollbarAPIClient) ListTestUsers() (users []User, err error)
ListTestUsers is used only for testing purposes
func (*RollbarAPIClient) ListUserCustomTeams ¶
func (c *RollbarAPIClient) ListUserCustomTeams(userID int) (teams []Team, err error)
ListUserCustomTeams lists a Rollbar user's custom defined teams, excluding system teams "Everyone" and "Owners".
func (*RollbarAPIClient) ListUserTeams ¶
func (c *RollbarAPIClient) ListUserTeams(userID int) (teams []Team, err error)
ListUserTeams lists a Rollbar user's teams.
func (*RollbarAPIClient) ListUsers ¶
func (c *RollbarAPIClient) ListUsers(email string) (users []User, err error)
ListUsers lists all Rollbar users.
func (*RollbarAPIClient) ReadIntegration ¶ added in v1.6.0
func (c *RollbarAPIClient) ReadIntegration(integration string) (interface{}, error)
ReadIntegration reads a Rollbar integration from the API. If no matching integration is found, returns error ErrNotFound.
func (*RollbarAPIClient) ReadInvitation ¶
func (c *RollbarAPIClient) ReadInvitation(inviteID int) (inv Invitation, err error)
ReadInvitation reads a Rollbar team invitation from the API.
func (*RollbarAPIClient) ReadNotification ¶ added in v1.2.0
func (c *RollbarAPIClient) ReadNotification(notificationID int, channel string) (*Notification, error)
ReadNotification reads a Rollbar notification from the API. If no matching notification is found, returns error ErrNotFound.
func (*RollbarAPIClient) ReadProject ¶
func (c *RollbarAPIClient) ReadProject(projectID int) (*Project, error)
ReadProject a Rollbar project from the API. If no matching project is found, returns error ErrNotFound.
func (*RollbarAPIClient) ReadProjectAccessToken ¶
func (c *RollbarAPIClient) ReadProjectAccessToken(projectID int, token string) (ProjectAccessToken, error)
ReadProjectAccessToken reads a Rollbar project access token from the API. It returns the first token that matches `name`. If no matching token is found, returns error ErrNotFound.
func (*RollbarAPIClient) ReadProjectAccessTokenByName ¶
func (c *RollbarAPIClient) ReadProjectAccessTokenByName(projectID int, name string) (ProjectAccessToken, error)
ReadProjectAccessTokenByName reads a Rollbar project access token from the API. It returns the first token that matches `name`. If no matching token is found, returns error ErrNotFound.
func (*RollbarAPIClient) ReadServiceLink ¶ added in v1.6.0
func (c *RollbarAPIClient) ReadServiceLink(id int) (*ServiceLink, error)
ReadServiceLink reads a Rollbar service link from the API. If no matching service link is found, returns error ErrNotFound.
func (*RollbarAPIClient) ReadTeam ¶
func (c *RollbarAPIClient) ReadTeam(id int) (Team, error)
ReadTeam reads a Rollbar team from the API. If no matching team is found, returns error ErrNotFound.
func (*RollbarAPIClient) ReadUser ¶
func (c *RollbarAPIClient) ReadUser(id int) (user User, err error)
ReadUser reads a Rollbar user from the API.
func (*RollbarAPIClient) RemoveTeamFromProject ¶
func (c *RollbarAPIClient) RemoveTeamFromProject(teamID, projectID int) error
RemoveTeamFromProject removes a Rollbar team from a project.
func (*RollbarAPIClient) RemoveUserFromTeam ¶
func (c *RollbarAPIClient) RemoveUserFromTeam(userID, teamID int) error
RemoveUserFromTeam removes a user from a Rollbar team.
func (*RollbarAPIClient) SetHeaderDataSource ¶ added in v1.14.0
func (c *RollbarAPIClient) SetHeaderDataSource(header string)
func (*RollbarAPIClient) SetHeaderResource ¶ added in v1.14.0
func (c *RollbarAPIClient) SetHeaderResource(header string)
func (*RollbarAPIClient) UpdateIntegration ¶ added in v1.6.0
func (c *RollbarAPIClient) UpdateIntegration(integration string, bodyMap map[string]interface{}) (interface{}, error)
UpdateIntegration updates a new Rollbar integration.
func (*RollbarAPIClient) UpdateNotification ¶ added in v1.2.0
func (c *RollbarAPIClient) UpdateNotification(notificationID int, channel string, filters, trigger, config interface{}, status string) (*Notification, error)
UpdateNotification updates a Rollbar notification.
func (*RollbarAPIClient) UpdateProjectAccessToken ¶
func (c *RollbarAPIClient) UpdateProjectAccessToken(args ProjectAccessTokenUpdateArgs) error
UpdateProjectAccessToken updates a Rollbar project access token.
func (*RollbarAPIClient) UpdateProjectTeams ¶
func (c *RollbarAPIClient) UpdateProjectTeams(projectID int, teamIDs []int) error
UpdateProjectTeams updates the Rollbar teams assigned to a project, assigning and removing teams as necessary. Caution: this is a potentially slow operation that makes multiple calls to the API. https://github.com/rollbar/terraform-provider-rollbar/issues/104
func (*RollbarAPIClient) UpdateServiceLink ¶ added in v1.6.0
func (c *RollbarAPIClient) UpdateServiceLink(id int, name, template string) (*ServiceLink, error)
UpdateServiceLink updates a Rollbar service link.
type ServiceLink ¶ added in v1.6.0
type SlackIntegration ¶ added in v1.6.0
type SlackIntegration struct { ProjectID int64 `model:"project_id" mapstructure:"project_id" json:"project_id"` Settings struct { Channel string `model:"channel" mapstructure:"channel" json:"channel"` Enabled bool `model:"enabled" mapstructure:"enabled" json:"enabled"` ShowMessageButtons bool `model:"show_message_buttons" mapstructure:"show_message_buttons" json:"show_message_buttons"` ServiceAccountID string `model:"service_account_id" mapstructure:"service_account_id" json:"service_account_id"` } `model:"settings" mapstructure:"settings"` }
type Team ¶
type Team struct { ID int AccountID int `json:"account_id"` Name string AccessLevel string `json:"access_level"` }
Team represents a Rollbar team.
type User ¶
type User struct { Username string `json:"username"` ID int `json:"id"` Email string `json:"email"` }
User represents a Rollbar user.
type WebhookIntegration ¶ added in v1.7.0
type WebhookIntegration struct { ProjectID int64 `model:"project_id" mapstructure:"project_id" json:"project_id"` Settings struct { Enabled bool `model:"enabled" mapstructure:"enabled" json:"enabled"` URL string `model:"url" mapstructure:"url" json:"url"` } `model:"settings" mapstructure:"settings"` }