api

package
v0.0.0-...-283e1aa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogLevels                = map[string]log.Level{"DEBUG": log.DebugLevel, "INFO": log.InfoLevel, "WARN": log.WarnLevel}
	ListenAddress            string
	ListenPort               int
	TokenExpiryMinutes       int
	GitHookSecret            string
	GitHookUrl               string
	RabbitQueueUrl           string
	ApplicationId            string
	BaseApplicationDirectory string
	PostgresConnection       string
)
View Source
var (
	StandardHTTP = StandardJSONResponse{}
)

Functions

func ConfigureService

func ConfigureService()

Function used to configure service settings

func ConnectPersistence

func ConnectPersistence()

function used to connect postgres connection

func OverrideBoolVariable

func OverrideBoolVariable(key string, DefaultValue bool) bool

Function used to override configuration variables with some value by defaulting from environment variables

func OverrideFloatVariable

func OverrideFloatVariable(key string, DefaultValue float64) float64

Function used to override configuration variables with some value by defaulting from environment variables

func OverrideIntegerVariable

func OverrideIntegerVariable(key string, DefaultValue int) int

Function used to override configuration variables with some value by defaulting from environment variables

func OverrideStringVariable

func OverrideStringVariable(key string, DefaultValue string) string

Function used to override configuration variables with some value by defaulting from environment variables

Types

type GitEventHookResponse

type GitEventHookResponse struct {
	Ref string `json:"ref" binding:"required"`
}

type GitHookConfig

type GitHookConfig struct {
	Url         string `json:"url"`
	ContentType string `json:"content_type"`
	InsecureSSL int    `json:"insecure_ssl"`
	Secret      string `json:"secret"`
}

type GitHookEntry

type GitHookEntry struct {
	EntryId   uuid.UUID   `json:"entryId"`
	HookId    uuid.UUID   `json:"hookId"`
	CreatedAt time.Time   `json:"createdAt"`
	Meta      interface{} `json:"meta"`
}

type GitRepoEntry

type GitRepoEntry struct {
	EntryId     uuid.UUID `json:"entryId"`
	Uid         string    `json:"uid"`
	RepoUrl     string    `json:"repoUrl"`
	AccessToken string    `json:"accessToken"`
	CreatedAt   time.Time `json:"createdAt"`
}

type GoGetGitAPI

type GoGetGitAPI struct {
	// contains filtered or unexported fields
}

func New

func New() *GoGetGitAPI

function used to start new authentication service

func (GoGetGitAPI) CreateRegistryEntry

func (api GoGetGitAPI) CreateRegistryEntry(ctx *gin.Context)

API Handler used to create new registry entries

func (GoGetGitAPI) GetHookEntries

func (api GoGetGitAPI) GetHookEntries(ctx *gin.Context)

API Route used to retrieve all hook entries currently stored in database

func (GoGetGitAPI) GetHookEntriesById

func (api GoGetGitAPI) GetHookEntriesById(ctx *gin.Context)

API route used to retrieve all git hook entries that belong to a particular parent ID

func (GoGetGitAPI) GetHookEntry

func (api GoGetGitAPI) GetHookEntry(ctx *gin.Context)

API Route used to retrieve a particular hook entry by Hook ID

func (GoGetGitAPI) GetRegistryEntries

func (api GoGetGitAPI) GetRegistryEntries(ctx *gin.Context)

API Hander used to get user registry entries

func (GoGetGitAPI) GetRegistryEntry

func (api GoGetGitAPI) GetRegistryEntry(ctx *gin.Context)

API Handler used to get specific registry entry

func (GoGetGitAPI) HandleGitWebHook

func (api GoGetGitAPI) HandleGitWebHook(ctx *gin.Context)

API route used to handle git hooks. Note that only Git Hooks that contain pushes to the master repositrory are handled and sent over the message bus

func (GoGetGitAPI) HealthCheck

func (api GoGetGitAPI) HealthCheck(ctx *gin.Context)

function used as basic health check

func (GoGetGitAPI) RemoveRegistryEntry

func (api GoGetGitAPI) RemoveRegistryEntry(ctx *gin.Context)

API Handler used to remove registry entry

func (GoGetGitAPI) Run

func (api GoGetGitAPI) Run()

type NewGitHookRequest

type NewGitHookRequest struct {
	Name   string        `json:"name"`
	Active bool          `json:"active"`
	Events []string      `json:"events"`
	Config GitHookConfig `json:"config"`
}

type NewRegistryEntry

type NewRegistryEntry struct {
	RepoName        string `json:"repo_name" binding:"required"`
	RepoUrl         string `json:"repo_url" binding:"required"`
	RepoOwner       string `json:"repo_owner" binding:"required"`
	RepoAccessToken string `json:"repo_access_token" binding:"required"`
}

type Persistence

type Persistence struct {
	// contains filtered or unexported fields
}

type StandardHTTPResponse

type StandardHTTPResponse interface {
	Success(ctx *gin.Context)
	InvalidRequestBody(ctx *gin.Context)
	InvalidJSON(ctx *gin.Context)
	InvalidRequest(ctx *gin.Context)
	NotFound(ctx *gin.Context)
	Unauthorized(ctx *gin.Context)
	Forbidden(ctx *gin.Context)
	InternalServerError(ctx *gin.Context)
}

define interface used to store a collection of standard HTTP responses

type StandardJSONResponse

type StandardJSONResponse struct{}

define set of standard HTTP Responses in JSON format

func (StandardJSONResponse) FeatureNotSupported

func (response StandardJSONResponse) FeatureNotSupported(ctx *gin.Context)

func (StandardJSONResponse) Forbidden

func (response StandardJSONResponse) Forbidden(ctx *gin.Context)

func (StandardJSONResponse) InternalServerError

func (response StandardJSONResponse) InternalServerError(ctx *gin.Context)

func (StandardJSONResponse) InvalidJSON

func (response StandardJSONResponse) InvalidJSON(ctx *gin.Context)

func (StandardJSONResponse) InvalidRequest

func (response StandardJSONResponse) InvalidRequest(ctx *gin.Context)

func (StandardJSONResponse) InvalidRequestBody

func (response StandardJSONResponse) InvalidRequestBody(ctx *gin.Context)

func (StandardJSONResponse) NotFound

func (response StandardJSONResponse) NotFound(ctx *gin.Context)

func (StandardJSONResponse) Success

func (response StandardJSONResponse) Success(ctx *gin.Context)

func (StandardJSONResponse) Unauthorized

func (response StandardJSONResponse) Unauthorized(ctx *gin.Context)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL