Documentation ¶
Index ¶
- Constants
- Variables
- func BraintreeNotificationToBillingEventData(notification *braintree.WebhookNotification) (*domain.BillingPlanSubscriptionChanged, error)
- func CurrentUser(c *config.Config, tx *sqlx.Tx, sessionUuid string) (*domain.User, error)
- func HandlerFunc(ctxt ServerContext, h Handler) http.Handler
- func ListenAndServe(l zerolog.Logger, db *sqlx.DB, bus activity.Sink, kv stores.KeyValueStore, ...)
- func MountActivitiesHandler(r *mux.Router, ctxt ServerContext)
- func MountBillingPlanHandler(r *mux.Router, ctxt ServerContext)
- func MountCapistranoHandler(r *mux.Router, ctxt ServerContext)
- func MountDeliveryHandler(r *mux.Router, ctxt ServerContext)
- func MountEmailNotifierHandler(r *mux.Router, ctxt ServerContext)
- func MountEnvironmentHandler(r *mux.Router, ctxt ServerContext)
- func MountFeaturesHandler(r *mux.Router, ctxt ServerContext)
- func MountGitTriggerHandler(r *mux.Router, ctxt ServerContext)
- func MountIndexHandler(r *mux.Router, ctxt ServerContext)
- func MountInvitationHandler(r *mux.Router, ctxt ServerContext)
- func MountJobHandler(r *mux.Router, ctxt ServerContext)
- func MountJobNotifierHandler(r *mux.Router, ctxt ServerContext)
- func MountLogHandler(r *mux.Router, ctxt ServerContext)
- func MountNotificationRuleHandler(r *mux.Router, ctxt ServerContext)
- func MountOAuthHandler(r *mux.Router, ctxt ServerContext)
- func MountOperationHandler(r *mux.Router, ctxt ServerContext)
- func MountOrganizationHandler(r *mux.Router, ctxt ServerContext)
- func MountPasswordResetHandler(r *mux.Router, ctxt ServerContext)
- func MountProjectHandler(r *mux.Router, ctxt ServerContext)
- func MountProjectMemberHandler(r *mux.Router, ctxt ServerContext)
- func MountPromptHandler(r *mux.Router, ctxt ServerContext)
- func MountRepoHandler(r *mux.Router, ctxt ServerContext)
- func MountRepoPreflightHandler(r *mux.Router, ctxt ServerContext)
- func MountScheduleHandler(r *mux.Router, ctxt ServerContext)
- func MountScriptEditorHandler(r *mux.Router, ctxt ServerContext)
- func MountSecretHandler(r *mux.Router, ctxt ServerContext)
- func MountSessionHandler(r *mux.Router, ctxt ServerContext)
- func MountSlackNotifierHandler(r *mux.Router, ctxt ServerContext)
- func MountStencilHandler(r *mux.Router, ctxt ServerContext)
- func MountTaskHandler(r *mux.Router, ctxt ServerContext)
- func MountUserHandler(r *mux.Router, ctxt ServerContext)
- func MountUserVerificationHandler(r *mux.Router, ctxt ServerContext)
- func MountWebhookHandler(r *mux.Router, ctxt ServerContext)
- func NewLimitsFromContext(ctxt RequestContext) *limits.Client
- func NewScriptEditParamsFromJSON(in io.Reader) (*scriptEditParams, error)
- func NewSubscribeParams(src io.Reader) (*subscribeParams, error)
- func ReadCreateUserParams(r io.Reader) (*createUserParams, error)
- func ReadEnvParams(r io.Reader) (*envParams, error)
- func ReadJobParams(r io.Reader) (*jobParams, error)
- func ReadPatchUserParams(r io.Reader) (*patchUserParams, error)
- func ReadRepoParams(r io.Reader) (*repoParams, error)
- func ReadSchedParams(r io.Reader) (*schedParams, error)
- func ReadSecretParams(r io.Reader) (*secretParams, error)
- func ReadSessionCreateParams(r io.Reader) (*createSessionParams, error)
- func ReadSessionPatchParams(r io.Reader) (*patchSessionParams, error)
- func ReadTaskParams(r io.Reader) (*taskParams, error)
- type ActivitySink
- type AddCreditCardRequest
- type BraintreePurchaseRequest
- type BusActivitySink
- type BusSink
- type CapistranoSignUpParameters
- type CapistranoSignUpResponse
- type CardsByProjectUuid
- type ClientTokenResponse
- type CollectionPage
- type CreateInvitationParams
- type EmailNotifierHandler
- type Error
- func NewCapabilityMissingError(haveCapabilities map[string]bool, missingCapability string) *Error
- func NewError(status int, code, msg string) *Error
- func NewInternalError(err error) *Error
- func NewMalformedParameters(param string, err error) *Error
- func NewOAuthError(provider string, reason string, err error) *Error
- func NewValidationError(src *domain.ValidationError) *Error
- type ErrorJSON
- type Getter
- type GitTriggerHandler
- type Handler
- type JobNotifierHandler
- type Links
- type NotificationRuleHandler
- type NullSink
- type OrgParams
- type OrgParamsWrapper
- type PatchInvitationParams
- type ProjectParams
- type ProjectPararamsWrapper
- type RequestContext
- type ScheduledExecutionsParams
- type SecretChanges
- type ServerContext
- type SlackNotifierHandler
Constants ¶
const (
ErrorMessageFromBraintreeAboutCanceledSubscription = "Subscription has already been canceled."
)
const (
StatusUnprocessableEntity = 422 // from WebDAV
)
Variables ¶
var ( ErrRecoveredFromPanic = NewError(500, "recovered_from_panic", "Recovered from panic") ErrNotFound = NewError(404, "not_found", "Not found") ErrUnexpectedEOF = NewError(400, "unexpected_eof", "Unexpected EOF") ErrSessionExpired = NewError(403, "session_expired", "Session expired") ErrSessionNotFound = NewError(403, "session_not_found", "Session not found") ErrSessionNotValid = NewError(403, "session_not_valid", "Session not valid (validated)") ErrSessionInvalidated = NewError(403, "session_invalidated", "Session invalidated") ErrRateLimitExceeded = NewError(403, "rate_limit_exceeded", "Rate limit exceeded") ErrLimitsExceeded = NewError(403, "limits_exceeded", "Billing plan limits exceeded") ErrSessionUserNotFound = NewError(403, "session_user_not_found", "Session user not found") ErrSessionUuidMalformed = NewError(400, "session_uuid_malformed", "Session UUID malformed") ErrLoginRequired = NewError(403, "login_required", "Login required") ErrUserBlocked = NewError(403, "user_blocked", "User blocked") )
var (
AllowedWithInvalidatedSession = regexp.MustCompile(`/(sessions/|api-features)`)
)
var OS git.System
Functions ¶
func BraintreeNotificationToBillingEventData ¶
func BraintreeNotificationToBillingEventData(notification *braintree.WebhookNotification) (*domain.BillingPlanSubscriptionChanged, error)
func CurrentUser ¶
returns either - User, nil when the Session is valid - nil, error when an error occured - nil, nil when the Session is invalid, or the sessionId is empty
func HandlerFunc ¶
func HandlerFunc(ctxt ServerContext, h Handler) http.Handler
func ListenAndServe ¶
func MountActivitiesHandler ¶
func MountActivitiesHandler(r *mux.Router, ctxt ServerContext)
func MountBillingPlanHandler ¶
func MountBillingPlanHandler(r *mux.Router, ctxt ServerContext)
func MountCapistranoHandler ¶
func MountCapistranoHandler(r *mux.Router, ctxt ServerContext)
func MountDeliveryHandler ¶
func MountDeliveryHandler(r *mux.Router, ctxt ServerContext)
func MountEmailNotifierHandler ¶
func MountEmailNotifierHandler(r *mux.Router, ctxt ServerContext)
func MountEnvironmentHandler ¶
func MountEnvironmentHandler(r *mux.Router, ctxt ServerContext)
func MountFeaturesHandler ¶
func MountFeaturesHandler(r *mux.Router, ctxt ServerContext)
func MountGitTriggerHandler ¶
func MountGitTriggerHandler(r *mux.Router, ctxt ServerContext)
func MountIndexHandler ¶
func MountIndexHandler(r *mux.Router, ctxt ServerContext)
func MountInvitationHandler ¶
func MountInvitationHandler(r *mux.Router, ctxt ServerContext)
func MountJobHandler ¶
func MountJobHandler(r *mux.Router, ctxt ServerContext)
func MountJobNotifierHandler ¶
func MountJobNotifierHandler(r *mux.Router, ctxt ServerContext)
func MountLogHandler ¶
func MountLogHandler(r *mux.Router, ctxt ServerContext)
func MountNotificationRuleHandler ¶
func MountNotificationRuleHandler(r *mux.Router, ctxt ServerContext)
func MountOAuthHandler ¶
func MountOAuthHandler(r *mux.Router, ctxt ServerContext)
func MountOperationHandler ¶
func MountOperationHandler(r *mux.Router, ctxt ServerContext)
func MountOrganizationHandler ¶
func MountOrganizationHandler(r *mux.Router, ctxt ServerContext)
func MountPasswordResetHandler ¶
func MountPasswordResetHandler(r *mux.Router, ctxt ServerContext)
func MountProjectHandler ¶
func MountProjectHandler(r *mux.Router, ctxt ServerContext)
func MountProjectMemberHandler ¶
func MountProjectMemberHandler(r *mux.Router, ctxt ServerContext)
func MountPromptHandler ¶
func MountPromptHandler(r *mux.Router, ctxt ServerContext)
func MountRepoHandler ¶
func MountRepoHandler(r *mux.Router, ctxt ServerContext)
func MountRepoPreflightHandler ¶
func MountRepoPreflightHandler(r *mux.Router, ctxt ServerContext)
func MountScheduleHandler ¶
func MountScheduleHandler(r *mux.Router, ctxt ServerContext)
func MountScriptEditorHandler ¶
func MountScriptEditorHandler(r *mux.Router, ctxt ServerContext)
func MountSecretHandler ¶
func MountSecretHandler(r *mux.Router, ctxt ServerContext)
func MountSessionHandler ¶
func MountSessionHandler(r *mux.Router, ctxt ServerContext)
func MountSlackNotifierHandler ¶
func MountSlackNotifierHandler(r *mux.Router, ctxt ServerContext)
func MountStencilHandler ¶
func MountStencilHandler(r *mux.Router, ctxt ServerContext)
func MountTaskHandler ¶
func MountTaskHandler(r *mux.Router, ctxt ServerContext)
func MountUserHandler ¶
func MountUserHandler(r *mux.Router, ctxt ServerContext)
func MountUserVerificationHandler ¶
func MountUserVerificationHandler(r *mux.Router, ctxt ServerContext)
func MountWebhookHandler ¶
func MountWebhookHandler(r *mux.Router, ctxt ServerContext)
func NewLimitsFromContext ¶
func NewLimitsFromContext(ctxt RequestContext) *limits.Client
func NewSubscribeParams ¶
func ReadCreateUserParams ¶
func ReadEnvParams ¶
func ReadJobParams ¶
func ReadPatchUserParams ¶
func ReadRepoParams ¶
func ReadSchedParams ¶
func ReadSecretParams ¶
func ReadSessionCreateParams ¶
func ReadSessionPatchParams ¶
func ReadTaskParams ¶
Types ¶
type ActivitySink ¶
An ActivitySink is used for emitting activities over some form of messaging system.
type AddCreditCardRequest ¶
type BusActivitySink ¶
type BusActivitySink struct {
// contains filtered or unexported fields
}
func NewBusActivitySink ¶
func NewBusActivitySink(bus activity.Sink) *BusActivitySink
func (*BusActivitySink) EmitActivity ¶
func (self *BusActivitySink) EmitActivity(activity *domain.Activity)
type BusSink ¶
type BusSink struct {
// contains filtered or unexported fields
}
BusSink sends activities over an activity bus
func NewBusSink ¶
func (*BusSink) EmitActivity ¶
type CapistranoSignUpParameters ¶
type CapistranoSignUpParameters struct { Name string `json:"name"` Password string `json:"password"` Email string `json:"email"` RepositoryURL string `json:"repository_url"` }
func (*CapistranoSignUpParameters) OrganizationName ¶
func (params *CapistranoSignUpParameters) OrganizationName() string
func (*CapistranoSignUpParameters) ProjectName ¶
func (params *CapistranoSignUpParameters) ProjectName() string
type CardsByProjectUuid ¶
type CardsByProjectUuid struct { Cards map[string]*domain.ProjectCard Order []string }
func (*CardsByProjectUuid) Len ¶
func (self *CardsByProjectUuid) Len() int
func (*CardsByProjectUuid) ProjectCards ¶
func (self *CardsByProjectUuid) ProjectCards() []*domain.ProjectCard
func (*CardsByProjectUuid) Swap ¶
func (self *CardsByProjectUuid) Swap(i int, j int)
func (*CardsByProjectUuid) UnmarshalJSON ¶
func (self *CardsByProjectUuid) UnmarshalJSON(data []byte) error
type ClientTokenResponse ¶
type CollectionPage ¶
type CreateInvitationParams ¶
type EmailNotifierHandler ¶
type EmailNotifierHandler struct {
// contains filtered or unexported fields
}
func (*EmailNotifierHandler) Archive ¶
func (h *EmailNotifierHandler) Archive(ctxt RequestContext) error
func (*EmailNotifierHandler) Create ¶
func (h *EmailNotifierHandler) Create(ctxt RequestContext) error
func (*EmailNotifierHandler) Show ¶
func (h *EmailNotifierHandler) Show(ctxt RequestContext) error
func (*EmailNotifierHandler) Update ¶
func (h *EmailNotifierHandler) Update(ctxt RequestContext) error
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents an error response from the API. Its responsibility is to ensure that all errors returned by the API have are properly structured.
func NewInternalError ¶
func NewMalformedParameters ¶
func NewValidationError ¶
func NewValidationError(src *domain.ValidationError) *Error
func (*Error) MarshalJSON ¶
type ErrorJSON ¶
type ErrorJSON struct { // Reason is a machine readable identifier for the error. // Use this identifier for translating error messages. Reason string `json:"reason"` // Message is a human readable string describing this instance // of the error, such as the location at which a parse error // occurred. Message string `json:"message"` // Errors maps input parameter names to error identifiers // pertaining to that parameter: // // { "field": ["parse_error"] } Errors map[string][]string `json:"errors,omitempty"` }
ErrorJSON is the serialized form of an API error ("wire format").
type GitTriggerHandler ¶
type GitTriggerHandler struct {
// contains filtered or unexported fields
}
func (*GitTriggerHandler) Archive ¶
func (h *GitTriggerHandler) Archive(ctxt RequestContext) error
func (*GitTriggerHandler) Create ¶
func (h *GitTriggerHandler) Create(ctxt RequestContext) error
func (*GitTriggerHandler) Show ¶
func (h *GitTriggerHandler) Show(ctxt RequestContext) error
func (*GitTriggerHandler) Update ¶
func (h *GitTriggerHandler) Update(ctxt RequestContext) error
type Handler ¶
type Handler func(RequestContext) error
type JobNotifierHandler ¶
type JobNotifierHandler struct {
// contains filtered or unexported fields
}
func (*JobNotifierHandler) Archive ¶
func (h *JobNotifierHandler) Archive(ctxt RequestContext) error
func (*JobNotifierHandler) Create ¶
func (h *JobNotifierHandler) Create(ctxt RequestContext) error
func (*JobNotifierHandler) Show ¶
func (h *JobNotifierHandler) Show(ctxt RequestContext) error
type NotificationRuleHandler ¶
type NotificationRuleHandler struct {
// contains filtered or unexported fields
}
func (*NotificationRuleHandler) Archive ¶
func (h *NotificationRuleHandler) Archive(ctxt RequestContext) error
func (*NotificationRuleHandler) Create ¶
func (h *NotificationRuleHandler) Create(ctxt RequestContext) error
func (*NotificationRuleHandler) Show ¶
func (h *NotificationRuleHandler) Show(ctxt RequestContext) error
func (*NotificationRuleHandler) Update ¶
func (h *NotificationRuleHandler) Update(ctxt RequestContext) error
type NullSink ¶
type NullSink struct{}
NullSink is the default activity sink which does nothing
func NewNullSink ¶
func NewNullSink() *NullSink
func (*NullSink) EmitActivity ¶
type OrgParamsWrapper ¶
type OrgParamsWrapper struct {
Subject OrgParams
}
func ReadOrgParams ¶
func ReadOrgParams(r io.Reader) (*OrgParamsWrapper, error)
type PatchInvitationParams ¶
type PatchInvitationParams struct {
Accept string `json:"accept"`
}
func (*PatchInvitationParams) AcceptsInvitation ¶
func (p *PatchInvitationParams) AcceptsInvitation() bool
func (*PatchInvitationParams) RefusesInvitation ¶
func (p *PatchInvitationParams) RefusesInvitation() bool
type ProjectParams ¶
type ProjectParams struct { Uuid string `json:"uuid"` Name string `json:"name"` OrganizationUuid string `json:"organizationUuid"` Public bool `json:"public"` }
func ReadProjectParams ¶
func ReadProjectParams(r io.Reader) (*ProjectParams, error)
type ProjectPararamsWrapper ¶
type ProjectPararamsWrapper struct {
Subject ProjectParams
}
type RequestContext ¶
type RequestContext interface { ServerContext // R returns the current HTTP request. R() *http.Request // W return the http.ResponseWriter of the current HTTP request. W() http.ResponseWriter // User returns the user who is currently logged in. User() *domain.User // Auth provides access to the authorization logic. Auth() authz.Service // Tx returns the request-scoped database transaction. // Multiple calls to Tx have to return the same transaction. Tx() *sqlx.Tx // CommitTx commits the current transaction, as returned by Tx. // This method exists for testing purposes. CommitTx() error // Rollback the Tx() in case of an error RollbackTx() // PathParameter returns the path parameter identified by key // for the current request. PathParameter(key string) string // EnqueueActivity records enqueues an activity for emitting it // when the request's database transaction has succeeded. // // If userUuid is non-nil, its value is used as id of the user // triggering the activity. EnqueueActivity(activity *domain.Activity, userUuid *string) // Activities returns all activities that have been enqueued // for later emittal. Activities() []*domain.Activity }
A RequestContext extends ServerContext by providing access to request specific variables.
type ScheduledExecutionsParams ¶
type ScheduledExecutionsParams struct {
// contains filtered or unexported fields
}
func NewScheduledExecutionsParams ¶
func NewScheduledExecutionsParams(params Getter) (*ScheduledExecutionsParams, error)
type SecretChanges ¶
type SecretChanges struct { Added []domain.OperationSecret `json:"added"` Removed []domain.OperationSecret `json:"removed"` Changed []domain.OperationSecret `json:"changed"` }
type ServerContext ¶
type ServerContext interface { // Config returns the server-wide configuration Config() config.Config // Returns a stores.KeyValueStore to be used for non-sensitive data. KeyValueStore() stores.KeyValueStore // Returns a stores.KeyValueStore to be used for secret data. SecretKeyValueStore() stores.SecretKeyValueStore Log() logger.Logger SetLogger(logger.Logger) // RequestContext returns a new context with valid values for // all request specific variables RequestContext(w http.ResponseWriter, req *http.Request) (RequestContext, error) }
ServerContext provides access to objects that are needed for fulfilling HTTP requests. Objects exposed are expected to be accessed by multiple goroutines.
func NewStandardContext ¶
func NewStandardContext(db *sqlx.DB, c *config.Config, kv stores.KeyValueStore, ss stores.SecretKeyValueStore) ServerContext
NewContext returns a new context with some sane defaults, over write them if you like
func NewStandardContextTx ¶
func NewStandardContextTx(db *sqlx.DB, tx *sqlx.Tx, c *config.Config, kv stores.KeyValueStore, ss stores.SecretKeyValueStore) ServerContext
NewStandardContextTx returns a new context initialized with the given DB connection, transaction and configuration.
type SlackNotifierHandler ¶
type SlackNotifierHandler struct {
// contains filtered or unexported fields
}
func (*SlackNotifierHandler) Archive ¶
func (h *SlackNotifierHandler) Archive(ctxt RequestContext) error
func (*SlackNotifierHandler) Create ¶
func (h *SlackNotifierHandler) Create(ctxt RequestContext) error
func (*SlackNotifierHandler) Show ¶
func (h *SlackNotifierHandler) Show(ctxt RequestContext) error
func (*SlackNotifierHandler) Update ¶
func (h *SlackNotifierHandler) Update(ctxt RequestContext) error
Source Files ¶
- activities_handler.go
- activity_sink.go
- billing_plan_handler.go
- bus_activity_sink.go
- capistrano_handler.go
- cards_by_project_uuid.go
- context_interface.go
- delivery_handler.go
- email_notifier_handler.go
- environment_handler.go
- errors.go
- features_handler.go
- getter.go
- git_trigger_handler.go
- hal.go
- handler.go
- helpers.go
- http.go
- index_handler.go
- invitation_handler.go
- job_handler.go
- job_notifier_handler.go
- log_handler.go
- login.go
- notification_rule_handler.go
- oauth_handler.go
- operation_handler.go
- organization_handler.go
- password_reset_handler.go
- project_handler.go
- project_member_handler.go
- prompt_handler.go
- repo_preflight_handler.go
- repos_handler.go
- schedule_handler.go
- scheduled_executions_params.go
- script_editor_handler.go
- secret_handler.go
- session_handler.go
- slack_notifier_handler.go
- standard_context.go
- stencil_handler.go
- task_handler.go
- user_handler.go
- user_verification_handler.go
- webhook_handler.go