tenant

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: BSD-3-Clause Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Server implements the API router and handlers.

func New

func New(conf config.Config) (s *Server, err error)

func (*Server) APIKeyCreate added in v0.2.0

func (s *Server) APIKeyCreate(c *gin.Context)

TODO: Implement by factoring out common code from ProjectAPIKeyCreate

func (*Server) APIKeyDelete added in v0.2.0

func (s *Server) APIKeyDelete(c *gin.Context)

APIKeyDelete deletes an API key by forwarding the request to Quarterdeck.

Route: DELETE /v1/apikeys/:apiKeyID

func (*Server) APIKeyDetail added in v0.2.0

func (s *Server) APIKeyDetail(c *gin.Context)

APIKeyDetail returns details about a specific API key.

Route: GET /v1/apikeys/:apiKeyID

func (*Server) APIKeyList added in v0.2.0

func (s *Server) APIKeyList(c *gin.Context)

TODO: Implement by factoring out common code from ProjectAPIKeyCreate

func (*Server) APIKeyUpdate added in v0.2.0

func (s *Server) APIKeyUpdate(c *gin.Context)

APIKeyUpdate updates an API key by forwarding the request to Quarterdeck.

Route: PUT /v1/apikeys/:apiKeyID

func (*Server) AddContactToSendGrid added in v0.3.0

func (s *Server) AddContactToSendGrid(contact *sgContact) error

func (*Server) Available

func (s *Server) Available() gin.HandlerFunc

Available is middleware that uses healthy boolean to return a service unavailable http status code if the server is shutting down or in maintenance mode. This middleware must be fairly early on in the chain to ensure that complex handling does not slow the shutdown of the server.

func (*Server) Healthy

func (s *Server) Healthy() bool

func (*Server) Login added in v0.3.0

func (s *Server) Login(c *gin.Context)

Login is a publically accessible endpoint that allows users to login into their account via Quarterdeck and receive access and refresh tokens for future requests.

Route: POST /v1/login

func (*Server) MemberCreate added in v0.2.0

func (s *Server) MemberCreate(c *gin.Context)

MemberCreate adds a new member to an organization in the database and returns a 201 StatusCreated response.

Route: /member

func (*Server) MemberDelete added in v0.2.0

func (s *Server) MemberDelete(c *gin.Context)

MemberDelete deletes a member from a user's request with a given ID and returns a 200 OK response instead of an an error response.

Route: /member/:memberID

func (*Server) MemberDetail added in v0.2.0

func (s *Server) MemberDetail(c *gin.Context)

MemberDetail retrieves a summary detail of a member by its ID and returns a 200 OK response.

Route: /member/:memberID

func (*Server) MemberList added in v0.2.0

func (s *Server) MemberList(c *gin.Context)

MemberList retrieves all members assigned to an organization and returns a 200 OK response.

Route: /member

func (*Server) MemberUpdate added in v0.2.0

func (s *Server) MemberUpdate(c *gin.Context)

MemberUpdate updates the record of a member with a given ID and returns a 200 OK response.

route: /member/:memberID

func (*Server) ProjectAPIKeyCreate added in v0.2.0

func (s *Server) ProjectAPIKeyCreate(c *gin.Context)

ProjectAPIKeyCreate creates a new API key in a project by forwarding the request to Quarterdeck.

Route: POST /v1/projects/:projectID/apikeys

func (*Server) ProjectAPIKeyList added in v0.2.0

func (s *Server) ProjectAPIKeyList(c *gin.Context)

ProjectAPIKeyList lists API keys in the specified project by forwarding the request to Quarterdeck.

Route: GET /v1/projects/:projectID/apikeys

func (*Server) ProjectCreate added in v0.2.0

func (s *Server) ProjectCreate(c *gin.Context)

ProjectCreate adds a new project to an organization in the database and returns a 201 StatusCreated response.

Route: /project

func (*Server) ProjectDelete added in v0.2.0

func (s *Server) ProjectDelete(c *gin.Context)

ProjectDelete deletes a project from a user's request with a given ID and returns a 200 OK response instead of an error response.

Route: /project/:projectID

func (*Server) ProjectDetail added in v0.2.0

func (s *Server) ProjectDetail(c *gin.Context)

ProjectDetail retrieves a summary detail of a project by its ID and returns a 200 OK response.

Route: /project/:projectID

func (*Server) ProjectList added in v0.2.0

func (s *Server) ProjectList(c *gin.Context)

ProjectList retrieves all projects assigned to an organization and returns a 200 OK response.

Route: /projects

func (*Server) ProjectTopicCreate added in v0.2.0

func (s *Server) ProjectTopicCreate(c *gin.Context)

ProjectTopicCreate adds a topic to a project in the database and returns a 201 StatusCreated response.

Route: /projects/:projectID/topics

func (*Server) ProjectTopicList added in v0.2.0

func (s *Server) ProjectTopicList(c *gin.Context)

ProjectTopicList retrieves all topics assigned to a project and returns a 200 OK response.

Route: /projects/:projectID/topics

func (*Server) ProjectUpdate added in v0.2.0

func (s *Server) ProjectUpdate(c *gin.Context)

ProjectUpdate updates the record of a project with a given ID and returns a 200 OK response.

Route: /project/:projectID

func (*Server) ProtectLogin added in v0.2.0

func (s *Server) ProtectLogin(c *gin.Context)

ProtectLogin prepares the front-end for login by setting the double cookie tokens for CSRF protection.

func (*Server) Refresh added in v0.3.0

func (s *Server) Refresh(c *gin.Context)

Refresh is a publically accessible endpoint that allows users to refresh their access token using their refresh token. This enables frontend clients to provide a seamless login experience for the user.

Route: POST /v1/refresh

func (*Server) Register added in v0.3.0

func (s *Server) Register(c *gin.Context)

Register is a publically accessible endpoint that allows new users to create an account via Quarterdeck by providing an email address and password.

Route: POST /v1/register

func (*Server) Serve

func (s *Server) Serve() (err error)

Serves API requests while listening on the specified bind address.

func (*Server) SetHealth

func (s *Server) SetHealth(health bool)

func (*Server) SetURL

func (s *Server) SetURL(url string)

func (*Server) Shutdown

func (s *Server) Shutdown() (err error)

Shuts down the server gracefully

func (*Server) SignUp

func (s *Server) SignUp(c *gin.Context)

Signs up a contact to receive notifications from SendGrid by making a request to the SendGrid add contacts marketing API. The SendGrid API is asynchronous, which means that it doesn't return success if the user is registered. Instead a job ID is returned and the endpoint has to check if the registration was actually successful or not. To not block this endpoint, sign up doesn't check success but returns ok if the registration was correctly submitted.

TODO: check for when the user is successfully signed up then send a welcome email. TODO: move all sendgrid-specific functionality into its own helper package. TODO: search for ensign list ID rather than configuring it externally.

func (*Server) Status

func (s *Server) Status(c *gin.Context)

Status handler returns the current health status of the server

func (*Server) TenantCreate added in v0.2.0

func (s *Server) TenantCreate(c *gin.Context)

TenantCreate adds a new tenant to the database and returns a 201 StatusCreated response.

Route: /tenant

func (*Server) TenantDelete added in v0.2.0

func (s *Server) TenantDelete(c *gin.Context)

TenantDelete deletes a tenant from a user's request with a given ID and returns a 200 OK response instead of an an error response.

Route: /tenant/:tenantID

func (*Server) TenantDetail added in v0.2.0

func (s *Server) TenantDetail(c *gin.Context)

TenantDetail retrieves a summary detail of a tenant by its ID and returns a 200 OK response.

Route: /tenant/:tenantID

func (*Server) TenantList added in v0.2.0

func (s *Server) TenantList(c *gin.Context)

TenantList retrieves all tenants assigned to an organization and returns a 200 OK response.

Route: /tenant

func (*Server) TenantMemberCreate added in v0.2.0

func (s *Server) TenantMemberCreate(c *gin.Context)

/ TenantMemberCreate adds a new member to a tenant in the database and returns a 201 StatusCreated response.

Route: /tenant/:tenantID/members

func (*Server) TenantMemberList added in v0.2.0

func (s *Server) TenantMemberList(c *gin.Context)

TenantMemberList retrieves all members assigned to a tenant and returns a 200 OK response.

Route: tenant/:tenantID/member

func (*Server) TenantProjectCreate added in v0.2.0

func (s *Server) TenantProjectCreate(c *gin.Context)

TenantProjectCreate adds a new tenant project to the database and returns a 201 StatusCreated response.

Route: /tenant/:tenantID/projects

func (*Server) TenantProjectList added in v0.2.0

func (s *Server) TenantProjectList(c *gin.Context)

TenantProjectList retrieves all projects assigned to a tenant and returns a 200 OK response.

Route: //tenant/:tenantID/projects

func (*Server) TenantStats added in v0.3.0

func (s *Server) TenantStats(c *gin.Context)

TenantStats is a statistical view endpoint which returns high level counts of resources associated with a single Tenant.

Route: /tenant/:tenantID/stats

func (*Server) TenantUpdate added in v0.2.0

func (s *Server) TenantUpdate(c *gin.Context)

TenantUpdate will update a tenants record and returns a 200 OK response.

Route: /tenant/:tenantID

func (*Server) TopicCreate added in v0.2.0

func (s *Server) TopicCreate(c *gin.Context)

Route: /topics

func (*Server) TopicDelete added in v0.2.0

func (s *Server) TopicDelete(c *gin.Context)

TopicDelete deletes a topic from a user's request with a given ID and returns a 200 OK response instead of an error response.

Route: /topic/:topicID

func (*Server) TopicDetail

func (s *Server) TopicDetail(c *gin.Context)

TopicDetail retrieves a summary detail of a topic with a given ID and returns a 200 OK response.

Route: /topic/:topicID

func (*Server) TopicList

func (s *Server) TopicList(c *gin.Context)

TopicList retrieves all topics assigned to an organization and returns a 200 OK response.

Route: /topics

func (*Server) TopicUpdate added in v0.2.0

func (s *Server) TopicUpdate(c *gin.Context)

TopicUpdate updates the record of a topic with a given ID and returns a 200 OK response.

Route: /topic/:topicID

func (*Server) URL

func (s *Server) URL() string

Directories

Path Synopsis
api
v1

Jump to

Keyboard shortcuts

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