models

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterCAData    ClusterResolverName = "upload-cluster-ca-data"
	ClusterLocalhost                     = "rewrite-cluster-localhost"
	ClientCertData                       = "upload-client-cert-data"
	ClientKeyData                        = "upload-client-key-data"
	OIDCIssuerData                       = "upload-oidc-idp-issuer-ca-data"
	TokenData                            = "upload-token-data"
	GCPKeyData                           = "upload-gcp-key-data"
	AWSData                              = "upload-aws-data"
)

Options for the cluster resolver names

View Source
const (
	RoleAdmin  string = "admin"
	RoleViewer string = "viewer"
)

The roles available for a project

Variables

View Source
var ClusterResolverInfos = map[ClusterResolverName]ClusterResolverInfo{
	ClusterCAData: ClusterResolverInfo{
		Docs:   "https://github.com/porter-dev/porter",
		Fields: "cluster_ca_data",
	},
	ClusterLocalhost: ClusterResolverInfo{
		Docs:   "https://github.com/porter-dev/porter",
		Fields: "cluster_hostname",
	},
	ClientCertData: ClusterResolverInfo{
		Docs:   "https://github.com/porter-dev/porter",
		Fields: "client_cert_data",
	},
	ClientKeyData: ClusterResolverInfo{
		Docs:   "https://github.com/porter-dev/porter",
		Fields: "client_key_data",
	},
	OIDCIssuerData: ClusterResolverInfo{
		Docs:   "https://github.com/porter-dev/porter",
		Fields: "oidc_idp_issuer_ca_data",
	},
	TokenData: ClusterResolverInfo{
		Docs:   "https://github.com/porter-dev/porter",
		Fields: "token_data",
	},
	GCPKeyData: ClusterResolverInfo{
		Docs:   "https://github.com/porter-dev/porter",
		Fields: "gcp_key_data",
	},
	AWSData: ClusterResolverInfo{
		Docs:   "https://github.com/porter-dev/porter",
		Fields: "aws_access_key_id,aws_secret_access_key,aws_cluster_id",
	},
}

ClusterResolverInfos is a map of the information for actions to be performed in order to initialize a cluster

Functions

func ParseUniqueName

func ParseUniqueName(workspaceID string) (string, uint, uint, error)

ParseUniqueName returns the (kind, projectID, infraID, suffix)

Types

type AuthCode

type AuthCode struct {
	gorm.Model

	Token             string `gorm:"unique"`
	AuthorizationCode string `gorm:"unique"`
	Expiry            *time.Time
}

AuthCode type that extends gorm.Model

func (*AuthCode) IsExpired

func (a *AuthCode) IsExpired() bool

type Cluster

type Cluster struct {
	gorm.Model

	// The auth mechanism that this cluster will use
	AuthMechanism ClusterAuth `json:"auth_mechanism"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// Name of the cluster
	Name string `json:"name"`

	// Server endpoint for the cluster
	Server string `json:"server"`

	// Additional fields optionally used by the kube client
	ClusterLocationOfOrigin string `json:"location_of_origin,omitempty"`
	TLSServerName           string `json:"tls-server-name,omitempty"`
	InsecureSkipTLSVerify   bool   `json:"insecure-skip-tls-verify,omitempty"`
	ProxyURL                string `json:"proxy-url,omitempty"`
	UserLocationOfOrigin    string
	UserImpersonate         string `json:"act-as,omitempty"`
	UserImpersonateGroups   string `json:"act-as-groups,omitempty"`

	InfraID uint `json:"infra_id"`

	// The various auth mechanisms available to the integration
	KubeIntegrationID uint
	OIDCIntegrationID uint
	GCPIntegrationID  uint
	AWSIntegrationID  uint
	DOIntegrationID   uint

	// A token cache that can be used by an auth mechanism, if desired
	TokenCache integrations.ClusterTokenCache `json:"token_cache"`

	// CertificateAuthorityData for the cluster, encrypted at rest
	CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"`
}

Cluster is an integration that can connect to a Kubernetes cluster via a specific auth mechanism

func (*Cluster) DetailedExternalize added in v0.3.2

func (c *Cluster) DetailedExternalize() *ClusterDetailedExternal

func (*Cluster) Externalize

func (c *Cluster) Externalize() *ClusterExternal

Externalize generates an external Cluster to be shared over REST

type ClusterAuth

type ClusterAuth string

ClusterAuth is an auth mechanism that a cluster candidate can resolve

const (
	X509   ClusterAuth = "x509"
	Basic  ClusterAuth = "basic"
	Bearer ClusterAuth = "bearerToken"
	OIDC   ClusterAuth = "oidc"
	GCP    ClusterAuth = "gcp-sa"
	AWS    ClusterAuth = "aws-sa"
	DO     ClusterAuth = "do-oauth"
	Local  ClusterAuth = "local"
)

The support cluster candidate auth mechanisms

type ClusterCandidate

type ClusterCandidate struct {
	gorm.Model

	// The auth mechanism that this candidate will parse for
	AuthMechanism ClusterAuth `json:"auth_mechanism"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// CreatedClusterID is the ID of the cluster that's eventually
	// created
	CreatedClusterID uint `json:"created_cluster_id"`

	// Resolvers are the list of resolvers: once all resolvers are "resolved," the
	// cluster will be created
	Resolvers []ClusterResolver `json:"resolvers"`

	// Name of the cluster
	Name string `json:"name"`

	// Server endpoint for the cluster
	Server string `json:"server"`

	// Name of the context that this was created from, if it exists
	ContextName string `json:"context_name"`

	// The best-guess for the AWSClusterID, which is required by aws auth mechanisms
	// See https://github.com/kubernetes-sigs/aws-iam-authenticator#what-is-a-cluster-id
	AWSClusterIDGuess []byte `json:"aws_cluster_id_guess"`

	// The raw kubeconfig
	Kubeconfig []byte `json:"kubeconfig"`
}

ClusterCandidate is a cluster integration that requires additional action from the user to set up.

func (*ClusterCandidate) Externalize

func (cc *ClusterCandidate) Externalize() *ClusterCandidateExternal

Externalize generates an external ClusterCandidateExternal to be shared over REST

type ClusterCandidateExternal

type ClusterCandidateExternal struct {
	ID uint `json:"id"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// CreatedClusterID is the ID of the cluster that's eventually
	// created
	CreatedClusterID uint `json:"created_cluster_id"`

	// Name of the cluster
	Name string `json:"name"`

	// Server endpoint for the cluster
	Server string `json:"server"`

	// Name of the context that this was created from, if it exists
	ContextName string `json:"context_name"`

	// Resolvers are the list of resolvers: once all resolvers are "resolved," the
	// cluster will be created
	Resolvers []ClusterResolverExternal `json:"resolvers"`

	// The best-guess for the AWSClusterID, which is required by aws auth mechanisms
	// See https://github.com/kubernetes-sigs/aws-iam-authenticator#what-is-a-cluster-id
	AWSClusterIDGuess string `json:"aws_cluster_id_guess"`
}

ClusterCandidateExternal represents the ClusterCandidate to be sent over REST

type ClusterDetailedExternal added in v0.3.2

type ClusterDetailedExternal struct {
	// Simple cluster external data
	ClusterExternal

	// The NGINX Ingress IP to access the cluster
	IngressIP string `json:"ingress_ip"`

	// Error displayed in case couldn't get the IP
	IngressError error `json:"ingress_error"`
}

type ClusterExternal

type ClusterExternal struct {
	ID uint `json:"id"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// Name of the cluster
	Name string `json:"name"`

	// Server endpoint for the cluster
	Server string `json:"server"`

	// The integration service for this cluster
	Service integrations.IntegrationService `json:"service"`

	// The infra id, if cluster was provisioned with Porter
	InfraID uint `json:"infra_id"`

	// (optional) The aws integration id, if available
	AWSIntegrationID uint `json:"aws_integration_id"`
}

ClusterExternal is an external Cluster to be shared over REST

type ClusterResolver

type ClusterResolver struct {
	gorm.Model

	// The ClusterCandidate that this is resolving
	ClusterCandidateID uint `json:"cluster_candidate_id"`

	// One of the ClusterResolverNames
	Name ClusterResolverName `json:"name"`

	// Resolved is true if this has been resolved, false otherwise
	Resolved bool `json:"resolved"`

	// Data is additional data for resolving the action, for example a file name,
	// context name, etc
	Data []byte `json:"data,omitempty"`
}

ClusterResolver is an action that must be resolved to set up a Cluster

func (*ClusterResolver) Externalize

func (cr *ClusterResolver) Externalize() *ClusterResolverExternal

Externalize generates an external ClusterResolver to be shared over REST

type ClusterResolverAll

type ClusterResolverAll struct {
	ClusterCAData      string `json:"cluster_ca_data,omitempty"`
	ClusterHostname    string `json:"cluster_hostname,omitempty"`
	ClientCertData     string `json:"client_cert_data,omitempty"`
	ClientKeyData      string `json:"client_key_data,omitempty"`
	OIDCIssuerCAData   string `json:"oidc_idp_issuer_ca_data,omitempty"`
	TokenData          string `json:"token_data,omitempty"`
	GCPKeyData         string `json:"gcp_key_data,omitempty"`
	AWSAccessKeyID     string `json:"aws_access_key_id"`
	AWSSecretAccessKey string `json:"aws_secret_access_key"`
	AWSClusterID       string `json:"aws_cluster_id"`
}

ClusterResolverAll is a helper type that contains the fields for all possible resolvers, so that raw bytes can be unmarshaled in a single read

type ClusterResolverData

type ClusterResolverData map[string]string

ClusterResolverData is a map of key names to fields, which gets marshaled from the raw JSON bytes stored in the ClusterResolver

type ClusterResolverExternal

type ClusterResolverExternal struct {
	ID uint `json:"id"`

	// The ClusterCandidate that this is resolving
	ClusterCandidateID uint `json:"cluster_candidate_id"`

	// One of the ClusterResolverNames
	Name ClusterResolverName `json:"name"`

	// Resolved is true if this has been resolved, false otherwise
	Resolved bool `json:"resolved"`

	// Docs is a link to documentation that helps resolve this manually
	Docs string `json:"docs"`

	// Fields is a list of fields that must be sent with the resolving request
	Fields string `json:"fields"`

	// Data is additional data for resolving the action, for example a file name,
	// context name, etc
	Data ClusterResolverData `json:"data,omitempty"`
}

ClusterResolverExternal is an external ClusterResolver to be shared over REST

type ClusterResolverInfo

type ClusterResolverInfo struct {
	// Docs is a link to documentation that helps resolve this manually
	Docs string `json:"docs"`

	// a comma-separated list of required fields to send in an action request
	Fields string `json:"fields"`
}

ClusterResolverInfo contains the information for actions to be performed in order to initialize a cluster

type ClusterResolverName

type ClusterResolverName string

ClusterResolverName is the name for a cluster resolve

type DNSRecord

type DNSRecord struct {
	gorm.Model

	SubdomainPrefix string `json:"subdomain_prefix" gorm:"unique"`
	RootDomain      string `json:"root_domain"`

	Endpoint string `json:"endpoint"`
	Hostname string `json:"hostname"`

	ClusterID uint `json:"cluster_id"`
}

DNSRecord type that extends gorm.Model

func (*DNSRecord) Externalize

func (p *DNSRecord) Externalize() *DNSRecordExternal

Externalize generates an external Project to be shared over REST

type DNSRecordExternal

type DNSRecordExternal struct {
	ExternalURL string `json:"external_url"`

	Endpoint string `json:"endpoint"`
	Hostname string `json:"hostname"`

	ClusterID uint `json:"cluster_id"`
}

DNSRecordExternal represents the DNSRecord type that is sent over REST

type FormContent

type FormContent struct {
	Context     *FormContext `yaml:"context" json:"context"`
	Type        string       `yaml:"type" json:"type"`
	Label       string       `yaml:"label" json:"label"`
	Required    bool         `json:"required"`
	Name        string       `yaml:"name,omitempty" json:"name,omitempty"`
	Variable    string       `yaml:"variable,omitempty" json:"variable,omitempty"`
	Placeholder string       `yaml:"placeholder,omitempty" json:"placeholder,omitempty"`
	Value       interface{}  `yaml:"value,omitempty" json:"value,omitempty"`
	Settings    struct {
		Docs               string      `yaml:"docs,omitempty" json:"docs,omitempty"`
		Default            interface{} `yaml:"default,omitempty" json:"default,omitempty"`
		Unit               interface{} `yaml:"unit,omitempty" json:"unit,omitempty"`
		OmitUnitFromValue  bool        `yaml:"omitUnitFromValue,omitempty" json:"omitUnitFromValue,omitempty"`
		DisableAfterLaunch bool        `yaml:"disableAfterLaunch,omitempty" json:"disableAfterLaunch,omitempty"`
		Options            interface{} `yaml:"options,omitempty" json:"options,omitempty"`
		Placeholder        string      `yaml:"placeholder,omitempty" json:"placeholder,omitempty"`
	} `yaml:"settings,omitempty" json:"settings,omitempty"`
}

FormContent is a form's atomic unit

type FormContext

type FormContext struct {
	Type   string            `yaml:"type" json:"type"`
	Config map[string]string `yaml:"config" json:"config"`
}

FormContext is the target context

type FormSection

type FormSection struct {
	Context  *FormContext   `yaml:"context" json:"context"`
	Name     string         `yaml:"name" json:"name"`
	ShowIf   interface{}    `yaml:"show_if" json:"show_if"`
	Contents []*FormContent `yaml:"contents" json:"contents,omitempty"`
}

FormSection is a section of a form

type FormTab

type FormTab struct {
	Context  *FormContext   `yaml:"context" json:"context"`
	Name     string         `yaml:"name" json:"name"`
	Label    string         `yaml:"label" json:"label"`
	Sections []*FormSection `yaml:"sections" json:"sections,omitempty"`
	Settings struct {
		OmitFromLaunch bool `yaml:"omitFromLaunch,omitempty" json:"omitFromLaunch,omitempty"`
	} `yaml:"settings,omitempty" json:"settings,omitempty"`
}

FormTab is a tab rendered in a form

type FormYAML

type FormYAML struct {
	Name        string     `yaml:"name" json:"name"`
	Icon        string     `yaml:"icon" json:"icon"`
	HasSource   string     `yaml:"hasSource" json:"hasSource"`
	Description string     `yaml:"description" json:"description"`
	Tags        []string   `yaml:"tags" json:"tags"`
	Tabs        []*FormTab `yaml:"tabs" json:"tabs,omitempty"`
}

FormYAML represents a chart's values.yaml form abstraction

type GitActionConfig

type GitActionConfig struct {
	gorm.Model

	// The ID of the release that this is linked to
	ReleaseID uint `json:"release_id"`

	// The git repo in ${owner}/${repo} form
	GitRepo string `json:"git_repo"`

	// The git branch to use
	GitBranch string `json:"git_branch"`

	// The complete image repository uri to pull from
	ImageRepoURI string `json:"image_repo_uri"`

	// The git integration id
	GitRepoID uint `json:"git_repo_id"`

	// The path to the dockerfile in the git repo
	DockerfilePath string `json:"dockerfile_path"`

	// The build context
	FolderPath string `json:"folder_path"`
}

GitActionConfig is a configuration for release's CI integration via Github Actions

func (*GitActionConfig) Externalize

func (r *GitActionConfig) Externalize() *GitActionConfigExternal

Externalize generates an external GitActionConfig to be shared over REST

type GitActionConfigExternal

type GitActionConfigExternal struct {
	// The git repo in ${owner}/${repo} form
	GitRepo string `json:"git_repo"`

	// The git branch to use
	GitBranch string `json:"git_branch"`

	// The complete image repository uri to pull from
	ImageRepoURI string `json:"image_repo_uri"`

	// The git integration id
	GitRepoID uint `json:"git_repo_id"`

	// The path to the dockerfile in the git repo
	DockerfilePath string `json:"dockerfile_path" form:"required"`

	// The build context
	FolderPath string `json:"folder_path"`
}

GitActionConfigExternal is an external GitActionConfig to be shared over REST

type GitRepo

type GitRepo struct {
	gorm.Model

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// The username/organization that this repo integration is linked to
	RepoEntity string `json:"repo_entity"`

	// The various auth mechanisms available to the integration
	OAuthIntegrationID uint
}

GitRepo is an integration that can connect to a remote git repo via an auth mechanism (currently only oauth)

func (*GitRepo) Externalize

func (r *GitRepo) Externalize() *GitRepoExternal

Externalize generates an external Repo to be shared over REST

type GitRepoExternal

type GitRepoExternal struct {
	ID uint `json:"id"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// The username/organization that this repo integration is linked to
	RepoEntity string `json:"repo_entity"`

	// The integration service for this git repo
	Service integrations.IntegrationService `json:"service"`
}

GitRepoExternal is a repository to be shared over REST

type HelmRepo

type HelmRepo struct {
	gorm.Model

	// Name given to the Helm repository
	Name string `json:"name"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// RepoURL is the URL to the helm repo. This varies based on the integration
	// type. For example, for AWS S3 this may be prefixed with s3://, or for
	// GCS it may be gs://
	RepoURL string `json:"repo_url"`

	// ------------------------------------------------------------------
	// All fields below this line are encrypted before storage
	// ------------------------------------------------------------------
	BasicAuthIntegrationID uint
	GCPIntegrationID       uint
	AWSIntegrationID       uint

	// A token cache that can be used by an auth mechanism (integration), if desired
	TokenCache integrations.HelmRepoTokenCache
}

HelmRepo is an integration that can connect to a Helm repository via a set of auth mechanisms

func (*HelmRepo) Externalize

func (hr *HelmRepo) Externalize() *HelmRepoExternal

Externalize generates an external Registry to be shared over REST

type HelmRepoExternal

type HelmRepoExternal struct {
	ID uint `json:"id"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// Name of the repo
	Name string `json:"name"`

	RepoURL string `json:"repo_name"`

	// The integration service for this registry
	Service integrations.IntegrationService `json:"service"`
}

HelmRepoExternal is an external HelmRepo to be shared over REST

type Infra

type Infra struct {
	gorm.Model

	// The type of infra that was provisioned
	Kind InfraKind `json:"kind"`

	// A random 6-byte suffix to ensure workspace/stream ids are unique
	Suffix string

	// The project that this infra belongs to
	ProjectID uint `json:"project_id"`

	// Status is the status of the infra
	Status InfraStatus `json:"status"`

	// The AWS integration that was used to create the infra
	AWSIntegrationID uint

	// The GCP integration that was used to create the infra
	GCPIntegrationID uint

	// The DO integration that was used to create the infra:
	// this points to an OAuthIntegrationID
	DOIntegrationID uint

	// The last-applied input variables to the provisioner
	LastApplied []byte
}

Infra represents the metadata for an infrastructure type provisioned on Porter

func (*Infra) Externalize

func (i *Infra) Externalize() *InfraExternal

Externalize generates an external Infra to be shared over REST

func (*Infra) GetUniqueName

func (i *Infra) GetUniqueName() string

GetID returns the unique id for this infra

type InfraExternal

type InfraExternal struct {
	ID uint `json:"id"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// The type of infra that was provisioned
	Kind InfraKind `json:"kind"`

	// Status is the status of the infra
	Status InfraStatus `json:"status"`
}

InfraExternal is an external Infra to be shared over REST

type InfraKind

type InfraKind string

InfraKind is the kind that infra can be

const (
	InfraTest InfraKind = "test"
	InfraECR  InfraKind = "ecr"
	InfraEKS  InfraKind = "eks"
	InfraGCR  InfraKind = "gcr"
	InfraGKE  InfraKind = "gke"
	InfraDOCR InfraKind = "docr"
	InfraDOKS InfraKind = "doks"
)

The supported infra kinds

type InfraStatus

type InfraStatus string

InfraStatus is the status that an infrastructure can take

const (
	StatusCreating   InfraStatus = "creating"
	StatusCreated    InfraStatus = "created"
	StatusError      InfraStatus = "error"
	StatusDestroying InfraStatus = "destroying"
	StatusDestroyed  InfraStatus = "destroyed"
)

The allowed statuses

type Invite

type Invite struct {
	gorm.Model

	Token  string `gorm:"unique"`
	Expiry *time.Time
	Email  string

	ProjectID uint
	UserID    uint
}

Invite type that extends gorm.Model

func (*Invite) Externalize

func (i *Invite) Externalize() *InviteExternal

Externalize generates an external Invite to be shared over REST

func (*Invite) IsAccepted

func (i *Invite) IsAccepted() bool

func (*Invite) IsExpired

func (i *Invite) IsExpired() bool

type InviteExternal

type InviteExternal struct {
	ID       uint   `json:"id"`
	Token    string `json:"token"`
	Expired  bool   `json:"expired"`
	Email    string `json:"email"`
	Accepted bool   `json:"accepted"`
}

InviteExternal represents the Invite type that is sent over REST

type PWResetToken

type PWResetToken struct {
	gorm.Model

	Email   string
	IsValid bool
	Expiry  *time.Time

	// Token is hashed like a password before storage
	Token string
}

PWResetToken type that extends gorm.Model

func (*PWResetToken) IsExpired

func (p *PWResetToken) IsExpired() bool

type PorterChartList

type PorterChartList struct {
	Name        string   `json:"name"`
	Versions    []string `json:"versions"`
	Description string   `json:"description"`
	Icon        string   `json:"icon"`
}

PorterChartList is how a chart gets displayed when listed

type PorterChartRead

type PorterChartRead struct {
	Markdown string                 `json:"markdown"`
	Metadata *chart.Metadata        `json:"metadata"`
	Values   map[string]interface{} `json:"values"`
	Form     *FormYAML              `json:"form"`
}

PorterChartRead is a chart with detailed information and a form for reading

type Project

type Project struct {
	gorm.Model

	Name  string `json:"name"`
	Roles []Role `json:"roles"`

	// linked repos
	GitRepos []GitRepo `json:"git_repos,omitempty"`

	// linked registries
	Registries []Registry `json:"registries,omitempty"`

	// linked clusters
	Clusters          []Cluster          `json:"clusters"`
	ClusterCandidates []ClusterCandidate `json:"cluster_candidates"`

	// linked helm repos
	HelmRepos []HelmRepo `json:"helm_repos"`

	// invitations to the project
	Invites []Invite `json:"invites"`

	// provisioned aws infra
	Infras []Infra `json:"infras"`

	// auth mechanisms
	KubeIntegrations  []ints.KubeIntegration  `json:"kube_integrations"`
	BasicIntegrations []ints.BasicIntegration `json:"basic_integrations"`
	OIDCIntegrations  []ints.OIDCIntegration  `json:"oidc_integrations"`
	OAuthIntegrations []ints.OAuthIntegration `json:"oauth_integrations"`
	AWSIntegrations   []ints.AWSIntegration   `json:"aws_integrations"`
	GCPIntegrations   []ints.GCPIntegration   `json:"gcp_integrations"`
}

Project type that extends gorm.Model

func (*Project) Externalize

func (p *Project) Externalize() *ProjectExternal

Externalize generates an external Project to be shared over REST

type ProjectExternal

type ProjectExternal struct {
	ID       uint              `json:"id"`
	Name     string            `json:"name"`
	Roles    []RoleExternal    `json:"roles"`
	GitRepos []GitRepoExternal `json:"git_repos,omitempty"`
}

ProjectExternal represents the Project type that is sent over REST

type Registry

type Registry struct {
	gorm.Model

	// Name of the registry
	Name string `json:"name"`

	// URL of the registry
	URL string `json:"url"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// The infra id, if registry was provisioned with Porter
	InfraID uint `json:"infra_id"`

	GCPIntegrationID   uint
	AWSIntegrationID   uint
	DOIntegrationID    uint
	BasicIntegrationID uint

	// A token cache that can be used by an auth mechanism (integration), if desired
	TokenCache integrations.RegTokenCache
}

Registry is an integration that can connect to a Docker image registry via a specific auth mechanism

func (*Registry) Externalize

func (r *Registry) Externalize() *RegistryExternal

Externalize generates an external Registry to be shared over REST

type RegistryExternal

type RegistryExternal struct {
	ID uint `json:"id"`

	// The project that this integration belongs to
	ProjectID uint `json:"project_id"`

	// Name of the registry
	Name string `json:"name"`

	// URL of the registry
	URL string `json:"url"`

	// The integration service for this registry
	Service integrations.IntegrationService `json:"service"`

	// The infra id, if registry was provisioned with Porter
	InfraID uint `json:"infra_id"`
}

RegistryExternal is an external Registry to be shared over REST

type Release

type Release struct {
	gorm.Model

	WebhookToken string `json:"webhook_token" gorm:"unique"`
	ClusterID    uint   `json:"cluster_id"`
	ProjectID    uint   `json:"project_id"`
	Name         string `json:"name"`
	Namespace    string `json:"namespace"`

	// The complete image repository uri to pull from. This is also stored in GitActionConfig,
	// but this should be used for the source of truth going forward.
	ImageRepoURI string `json:"image_repo_uri,omitempty"`

	GitActionConfig GitActionConfig `json:"git_action_config"`
}

Release type that extends gorm.Model

func (*Release) Externalize

func (r *Release) Externalize() *ReleaseExternal

Externalize generates an external User to be shared over REST

type ReleaseExternal

type ReleaseExternal struct {
	ID uint `json:"id"`

	WebhookToken    string                   `json:"webhook_token"`
	GitActionConfig *GitActionConfigExternal `json:"git_action_config,omitempty"`
}

ReleaseExternal represents the Release type that is sent over REST

type Role

type Role struct {
	gorm.Model

	Kind      string `json:"kind"`
	UserID    uint   `json:"user_id"`
	ProjectID uint   `json:"project_id"`
}

Role type that extends gorm.Model

func (*Role) Externalize

func (r *Role) Externalize() *RoleExternal

Externalize generates an external Role to be shared over REST

type RoleExternal

type RoleExternal struct {
	ID        uint   `json:"id"`
	Kind      string `json:"kind"`
	UserID    uint   `json:"user_id"`
	ProjectID uint   `json:"project_id"`
}

RoleExternal represents the Role type that is sent over REST

type Session

type Session struct {
	gorm.Model
	// Session ID
	Key string `gorm:"unique"`
	// encrypted cookie
	Data []byte
	// Time the session will expire
	ExpiresAt time.Time
}

Session type that extends gorm.Model.

type User

type User struct {
	gorm.Model

	Email         string `json:"email" gorm:"unique"`
	Password      string `json:"password"`
	EmailVerified bool   `json:"email_verified"`

	// The github user id used for login (optional)
	GithubUserID int64
	GoogleUserID string
}

User type that extends gorm.Model

func (*User) Externalize

func (u *User) Externalize() *UserExternal

Externalize generates an external User to be shared over REST

type UserExternal

type UserExternal struct {
	ID            uint   `json:"id"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
}

UserExternal represents the User type that is sent over REST

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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