Documentation
¶
Overview ¶
Package client is a client library for accessing the Rollbar API.
Index ¶
- Constants
- Variables
- type ErrorResult
- type Invitation
- 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) CreateProject(name string) (*Project, error)
- func (c *RollbarAPIClient) CreateProjectAccessToken(args ProjectAccessTokenCreateArgs) (ProjectAccessToken, error)
- func (c *RollbarAPIClient) CreateTeam(name string, level string) (Team, error)
- func (c *RollbarAPIClient) DeleteInvitation(id int) (err error)
- func (c *RollbarAPIClient) DeleteProject(projectID int) error
- func (c *RollbarAPIClient) DeleteProjectAccessToken(projectID int, token string) 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) FindProject(name string) (*Project, 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) ListCustomTeams() ([]Team, error)
- func (c *RollbarAPIClient) ListInvitations(teamID int) (invs []Invitation, err 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) ListTeamProjectIDs(teamID int) ([]int, error)
- func (c *RollbarAPIClient) ListTeams() ([]Team, 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() (users []User, err error)
- func (c *RollbarAPIClient) ReadInvitation(inviteID int) (inv Invitation, err 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) 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) UpdateProjectAccessToken(args ProjectAccessTokenUpdateArgs) error
- func (c *RollbarAPIClient) UpdateProjectTeams(projectID int, teamIDs []int) error
- type Scope
- type Status
- type Team
- type User
Constants ¶
const ( StatusEnabled = Status("enabled") StatusDisabled = Status("disabled") )
Possible values for status
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.
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 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 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.
Currently 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 }
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 (*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) 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) CreateTeam ¶
func (c *RollbarAPIClient) CreateTeam(name string, 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) 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) 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. Note this method is quite inefficient, as it must read all invitations for all teams.
func (*RollbarAPIClient) FindPendingInvitations ¶
func (c *RollbarAPIClient) FindPendingInvitations(email string) ([]Invitation, error)
FindPendingInvitations finds pending Rollbar team invitations for the given email.
func (*RollbarAPIClient) FindProject ¶ added in v1.1.0
func (c *RollbarAPIClient) FindProject(name string) (*Project, error)
FindProject finds the Rollbar project with a given name.
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. WARNING: this is a potentially slow call. Don't repeat it unnecessarily.
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) 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) ListTeamProjectIDs ¶
func (c *RollbarAPIClient) ListTeamProjectIDs(teamID int) ([]int, error)
ListTeamProjectIDs lists IDs of all Rollbar projects to which a given team is assigned.
func (*RollbarAPIClient) ListTeams ¶
func (c *RollbarAPIClient) ListTeams() ([]Team, error)
ListTeams lists all Rollbar teams.
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() (users []User, err error)
ListUsers lists all Rollbar users.
func (*RollbarAPIClient) ReadInvitation ¶
func (c *RollbarAPIClient) ReadInvitation(inviteID int) (inv Invitation, err error)
ReadInvitation reads a Rollbar team invitation from the API.
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) 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) 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