integrations

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

README

Integrations Service

This service handles connections and communication with all the third-party platforms like Github and Vercel with whom we want to sync our secrets with.

Note: Always abide by clean code architecture and implement proper abstractions between different layers of business logic.

Style Guide

Mandatory files:

  • routes.go contains API routes.
  • handler.go contains handlers for every route.
  • default.go sets and gets the default initialized service.
  • init.go initializes the default service at startup.

Contribution Guide

To add a new integration:

  1. Register it's unique Type constant in commons.go. For example:
    const Github IntegrationType = "github"
    
  2. Create an independent package in /internal directory for all operations of that integration. This package cannot be referenced outside the service level definitions. Take inspiration from github package.
  3. Call your new integration's functions from the service by adding it to all the relevant switch cases in service.go file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AllowedIntegrations = []Type{Github, Gitlab, Vercel, ASM, CircleCI, GSM, Supabase, Netlify, Railway, Hasura, Nhost}
)

Functions

func SetService

func SetService(svc Service)

Types

type DefaultService added in v1.1.5

type DefaultService struct{}

func (*DefaultService) Get added in v1.1.5

func (*DefaultService) List added in v1.1.5

func (*DefaultService) ListEntities added in v1.1.5

func (*DefaultService) ListEntities(ctx context.ServiceContext, client *clients.GQLClient, integrationType Type, integrationID string, options map[string]interface{}) (interface{}, error)

func (*DefaultService) ListSubEntities added in v1.1.5

func (*DefaultService) ListSubEntities(ctx context.ServiceContext, client *clients.GQLClient, integrationType Type, integrationID string, params url.Values) (interface{}, error)

func (*DefaultService) Setup added in v1.1.5

func (*DefaultService) Setup(ctx context.ServiceContext, client *clients.GQLClient, integrationType Type, options *SetupOptions) (*Integration, error)

func (*DefaultService) Sync added in v1.1.5

func (d *DefaultService) Sync(ctx context.ServiceContext, client *clients.GQLClient, options *SyncOptions) error

type Entities added in v1.1.5

type Entities []Entity

type Entity added in v1.1.5

type Entity struct {
	ID             string `json:"id"`
	Slug           string `json:"slug"`
	ParentName     string `json:"parent_name"`
	Name           string `json:"name"`
	URL            string `json:"url"`
	InstallationID string `json:"installation_id"`
	Type           Type   `json:"type"`
}

type Integration added in v1.1.5

type Integration struct {
	ID             string    `json:"id,omitempty"`
	CreatedAt      time.Time `json:"created_at,omitempty"`
	UpdatedAt      time.Time `json:"updated_at,omitempty"`
	UserID         string    `json:"user_id,omitempty"`
	OrgID          string    `json:"org_id"`
	InstallationID string    `json:"installation_id"`
	Type           Type      `json:"type"`
	Credentials    string    `json:"credentials,omitempty"`
}

func (*Integration) GetDescription added in v1.1.5

func (i *Integration) GetDescription() string

Get the description of the integration by it's type.

func (*Integration) GetSubtitle added in v1.1.5

func (i *Integration) GetSubtitle() string

Get the subtitle of the integration by it's type.

func (*Integration) GetTitle added in v1.1.5

func (i *Integration) GetTitle() string

Get the title of the integration by it's type.

type Integrations added in v1.1.5

type Integrations []Integration

type ListEntitiesRequest added in v1.1.5

type ListEntitiesRequest struct {
	OrgID string `json:"org_id"`
	Type  Type   `json:"type"`
}

type ListEntitiesRequestOptions added in v1.1.5

type ListEntitiesRequestOptions struct {
	OrgID          string `json:"org_id"`
	Type           Type   `json:"type"`
	InstallationID string `json:"installation_id"`
}

type ListIntegrationFilters added in v1.1.5

type ListIntegrationFilters struct {
	OrgID string `json:"org_id"`
	Type  Type   `json:"type"`
}

type SetupOptions added in v1.1.5

type SetupOptions struct {
	Options map[string]interface{} `json:"options"`
	OrgID   string                 `json:"org_id"`
}

type SyncOptions added in v1.1.5

type SyncOptions struct {
	EventID       string                 `json:"event_id"`
	IntegrationID string                 `json:"integration_id"`
	EntityDetails map[string]interface{} `json:"entity_details"`
	Data          *keypayload.KPMap      `json:"data"`
}

type Type added in v1.1.5

type Type string
const (
	Github   Type = "github"
	Gitlab   Type = "gitlab"
	Vercel   Type = "vercel"
	ASM      Type = "asm"
	GSM      Type = "gsm"
	CircleCI Type = "circleci"
	Supabase Type = "supabase"
	Netlify  Type = "netlify"
	Railway  Type = "railway"
	Hasura   Type = "hasura"
	Nhost    Type = "nhost"
)

func (*Type) IsValid added in v1.1.5

func (t *Type) IsValid() bool

Directories

Path Synopsis
internal
asm
gsm

Jump to

Keyboard shortcuts

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