forms

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartForm

type ChartForm struct {
	RepoURL string
	Name    string `json:"name"`
	Version string `json:"version"`
}

ChartForm is the base type for CRUD operations on charts

func (*ChartForm) PopulateRepoURLFromQueryParams

func (cf *ChartForm) PopulateRepoURLFromQueryParams(
	vals url.Values,
) error

PopulateRepoURLFromQueryParams populates the repo url in the ChartForm using the passed url.Values (the parsed query params)

type ChartTemplateForm

type ChartTemplateForm struct {
	TemplateName string                 `json:"templateName" form:"required"`
	ImageURL     string                 `json:"imageURL" form:"required"`
	FormValues   map[string]interface{} `json:"formValues"`
	Name         string                 `json:"name"`
}

ChartTemplateForm represents the accepted values for installing a new chart from a template.

type ConfigMapForm

type ConfigMapForm struct {
	Name               string            `json:"name" form:"required"`
	Namespace          string            `json:"namespace" form:"required"`
	EnvVariables       map[string]string `json:"variables"`
	SecretEnvVariables map[string]string `json:"secret_variables"`
}

type CreateAWSIntegrationForm

type CreateAWSIntegrationForm struct {
	UserID             uint   `json:"user_id" form:"required"`
	ProjectID          uint   `json:"project_id" form:"required"`
	AWSRegion          string `json:"aws_region"`
	AWSClusterID       string `json:"aws_cluster_id"`
	AWSAccessKeyID     string `json:"aws_access_key_id"`
	AWSSecretAccessKey string `json:"aws_secret_access_key"`
}

CreateAWSIntegrationForm represents the accepted values for creating an AWS Integration

func (*CreateAWSIntegrationForm) ToAWSIntegration

func (caf *CreateAWSIntegrationForm) ToAWSIntegration() (*ints.AWSIntegration, error)

ToAWSIntegration converts the project to a gorm project model

type CreateBasicAuthIntegrationForm

type CreateBasicAuthIntegrationForm struct {
	UserID    uint   `json:"user_id" form:"required"`
	ProjectID uint   `json:"project_id" form:"required"`
	Username  string `json:"username"`
	Password  string `json:"password"`
}

CreateBasicAuthIntegrationForm represents the accepted values for creating a basic auth integration

func (*CreateBasicAuthIntegrationForm) ToBasicIntegration

func (cbf *CreateBasicAuthIntegrationForm) ToBasicIntegration() (*ints.BasicIntegration, error)

ToBasicIntegration converts the project to a gorm project model

type CreateClusterCandidatesForm

type CreateClusterCandidatesForm struct {
	ProjectID  uint   `json:"project_id"`
	Kubeconfig string `json:"kubeconfig"`

	// Represents whether the auth mechanism should be designated as
	// "local": if so, the auth mechanism uses local plugins/mechanisms purely from the
	// kubeconfig.
	IsLocal bool `json:"is_local"`
}

CreateClusterCandidatesForm represents the accepted values for creating a list of ClusterCandidates from a kubeconfig

func (*CreateClusterCandidatesForm) ToClusterCandidates

func (csa *CreateClusterCandidatesForm) ToClusterCandidates(
	isServerLocal bool,
) ([]*models.ClusterCandidate, error)

ToClusterCandidates creates a ClusterCandidate from the kubeconfig and project id

type CreateClusterForm

type CreateClusterForm struct {
	Name      string `json:"name" form:"required"`
	ProjectID uint   `json:"project_id" form:"required"`
	Server    string `json:"server" form:"required"`

	GCPIntegrationID uint `json:"gcp_integration_id"`
	AWSIntegrationID uint `json:"aws_integration_id"`

	CertificateAuthorityData string `json:"certificate_authority_data,omitempty"`
}

CreateClusterForm represents the accepted values for creating a cluster through manual configuration (not through a kubeconfig)

func (*CreateClusterForm) ToCluster

func (ccf *CreateClusterForm) ToCluster() (*models.Cluster, error)

ToCluster converts the form to a cluster

type CreateDOCRInfra

type CreateDOCRInfra struct {
	DOCRName             string `json:"docr_name" form:"required"`
	DOCRSubscriptionTier string `json:"docr_subscription_tier" form:"required"`
	ProjectID            uint   `json:"project_id" form:"required"`
	DOIntegrationID      uint   `json:"do_integration_id" form:"required"`
}

CreateDOCRInfra represents the accepted values for creating an DOCR infra via the provisioning container

func (*CreateDOCRInfra) ToInfra

func (de *CreateDOCRInfra) ToInfra() (*models.Infra, error)

ToInfra converts the form to a gorm infra model

type CreateDOKSInfra

type CreateDOKSInfra struct {
	DORegion        string `json:"do_region" form:"required"`
	DOKSName        string `json:"doks_name" form:"required"`
	ProjectID       uint   `json:"project_id" form:"required"`
	DOIntegrationID uint   `json:"do_integration_id" form:"required"`
}

CreateDOKSInfra represents the accepted values for creating a DOKS infra via the provisioning container

func (*CreateDOKSInfra) ToInfra

func (de *CreateDOKSInfra) ToInfra() (*models.Infra, error)

ToInfra converts the form to a gorm infra model

type CreateDomainForm

type CreateDomainForm struct {
	*K8sForm

	ReleaseName string `json:"release_name" form:"required"`
}

CreateDomainForm represents the accepted values for creating a DNS record

type CreateECRInfra

type CreateECRInfra struct {
	ECRName          string `json:"ecr_name" form:"required"`
	ProjectID        uint   `json:"project_id" form:"required"`
	AWSIntegrationID uint   `json:"aws_integration_id" form:"required"`
}

CreateECRInfra represents the accepted values for creating an ECR infra via the provisioning container

func (*CreateECRInfra) ToInfra

func (ce *CreateECRInfra) ToInfra() (*models.Infra, error)

ToInfra converts the form to a gorm aws infra model

type CreateEKSInfra

type CreateEKSInfra struct {
	EKSName          string `json:"eks_name" form:"required"`
	MachineType      string `json:"machine_type"`
	ProjectID        uint   `json:"project_id" form:"required"`
	AWSIntegrationID uint   `json:"aws_integration_id" form:"required"`
}

CreateEKSInfra represents the accepted values for creating an EKS infra via the provisioning container

func (*CreateEKSInfra) ToInfra

func (ce *CreateEKSInfra) ToInfra() (*models.Infra, error)

ToInfra converts the form to a gorm aws infra model

type CreateGCPIntegrationForm

type CreateGCPIntegrationForm struct {
	UserID       uint   `json:"user_id" form:"required"`
	ProjectID    uint   `json:"project_id" form:"required"`
	GCPKeyData   string `json:"gcp_key_data" form:"required"`
	GCPProjectID string `json:"gcp_project_id"`
	GCPRegion    string `json:"gcp_region"`
}

CreateGCPIntegrationForm represents the accepted values for creating a GCP Integration

func (*CreateGCPIntegrationForm) ToGCPIntegration

func (cgf *CreateGCPIntegrationForm) ToGCPIntegration() (*ints.GCPIntegration, error)

ToGCPIntegration converts the project to a gorm project model

type CreateGCRInfra

type CreateGCRInfra struct {
	ProjectID        uint `json:"project_id" form:"required"`
	GCPIntegrationID uint `json:"gcp_integration_id" form:"required"`
}

CreateGCRInfra represents the accepted values for creating an GCR infra via the provisioning container

func (*CreateGCRInfra) ToInfra

func (ce *CreateGCRInfra) ToInfra() (*models.Infra, error)

ToInfra converts the form to a gorm aws infra model

type CreateGKEInfra

type CreateGKEInfra struct {
	GKEName          string `json:"gke_name" form:"required"`
	ProjectID        uint   `json:"project_id" form:"required"`
	GCPIntegrationID uint   `json:"gcp_integration_id" form:"required"`
}

CreateGKEInfra represents the accepted values for creating a GKE infra via the provisioning container

func (*CreateGKEInfra) ToInfra

func (ce *CreateGKEInfra) ToInfra() (*models.Infra, error)

ToInfra converts the form to a gorm aws infra model

type CreateGitAction

type CreateGitAction struct {
	Release *models.Release

	GitRepo        string `json:"git_repo" form:"required"`
	GitBranch      string `json:"branch"`
	ImageRepoURI   string `json:"image_repo_uri" form:"required"`
	DockerfilePath string `json:"dockerfile_path"`
	FolderPath     string `json:"folder_path"`
	GitRepoID      uint   `json:"git_repo_id" form:"required"`
	RegistryID     uint   `json:"registry_id"`

	ShouldCreateWorkflow bool `json:"should_create_workflow"`
	ShouldGenerateOnly   bool
}

CreateGitAction represents the accepted values for creating a github action integration

func (*CreateGitAction) ToGitActionConfig

func (ca *CreateGitAction) ToGitActionConfig(version string) (*models.GitActionConfig, error)

ToGitActionConfig converts the form to a gorm git action config model

type CreateGitActionOptional

type CreateGitActionOptional struct {
	GitRepo              string `json:"git_repo"`
	GitBranch            string `json:"branch"`
	ImageRepoURI         string `json:"image_repo_uri"`
	DockerfilePath       string `json:"dockerfile_path"`
	FolderPath           string `json:"folder_path"`
	GitRepoID            uint   `json:"git_repo_id"`
	RegistryID           uint   `json:"registry_id"`
	ShouldCreateWorkflow bool   `json:"should_create_workflow"`
}

type CreateHelmRepo

type CreateHelmRepo struct {
	Name      string `json:"name" form:"required"`
	RepoURL   string `json:"repo_url" form:"required"`
	ProjectID uint   `json:"project_id" form:"required"`

	BasicIntegrationID uint `json:"basic_integration_id"`
	GCPIntegrationID   uint `json:"gcp_integration_id"`
	AWSIntegrationID   uint `json:"aws_integration_id"`
}

CreateHelmRepo represents the accepted values for creating a helm repo

func (*CreateHelmRepo) ToHelmRepo

func (ch *CreateHelmRepo) ToHelmRepo() (*models.HelmRepo, error)

ToHelmRepo converts the form to a gorm helm repo model

type CreateInvite

type CreateInvite struct {
	Email     string `json:"email" form:"required"`
	Kind      string `json:"kind" form:"required"`
	ProjectID uint   `form:"required"`
}

CreateInvite represents the accepted values for creating an invite to a project

func (*CreateInvite) ToInvite

func (ci *CreateInvite) ToInvite() (*models.Invite, error)

ToInvite converts the project to a gorm project model

type CreateProjectForm

type CreateProjectForm struct {
	WriteProjectForm
	Name string `json:"name" form:"required"`
}

CreateProjectForm represents the accepted values for creating a project

func (*CreateProjectForm) ToProject

ToProject converts the project to a gorm project model

type CreateRegistry

type CreateRegistry struct {
	Name               string `json:"name" form:"required"`
	ProjectID          uint   `json:"project_id" form:"required"`
	URL                string `json:"url"`
	GCPIntegrationID   uint   `json:"gcp_integration_id"`
	AWSIntegrationID   uint   `json:"aws_integration_id"`
	DOIntegrationID    uint   `json:"do_integration_id"`
	BasicIntegrationID uint   `json:"basic_integration_id"`
}

CreateRegistry represents the accepted values for creating a registry

func (*CreateRegistry) ToRegistry

func (cr *CreateRegistry) ToRegistry(repo repository.Repository) (*models.Registry, error)

ToRegistry converts the form to a gorm registry model

type CreateRepository added in v0.4.0

type CreateRepository struct {
	ImageRepoURI string `json:"image_repo_uri" form:"required"`
}

CreateRepository represents the accepted values for creating an image repository within a registry

type CreateTestInfra

type CreateTestInfra struct {
	ProjectID uint `json:"project_id" form:"required"`
}

CreateTestInfra represents the accepted values for creating test infra via the provisioning container

func (*CreateTestInfra) ToInfra

func (ce *CreateTestInfra) ToInfra() (*models.Infra, error)

ToInfra converts the form to a gorm aws infra model

type CreateUserForm

type CreateUserForm struct {
	WriteUserForm
	Email    string `json:"email" form:"required,max=255,email"`
	Password string `json:"password" form:"required,max=255"`

	// ignore this field from the json
	EmailVerified bool `json:"-"`
}

CreateUserForm represents the accepted values for creating a user

func (*CreateUserForm) ToUser

ToUser converts a CreateUserForm to models.User

type DeleteUserForm

type DeleteUserForm struct {
	WriteUserForm
	ID       uint   `form:"required"`
	Password string `json:"password" form:"required,max=255"`
}

DeleteUserForm represents the accepted values for deleting a user

func (*DeleteUserForm) ToUser

ToUser converts a DeleteUserForm to models.User using the user ID

type DestroyDOCRInfra

type DestroyDOCRInfra struct {
	DOCRName string `json:"docr_name" form:"required"`
}

DestroyDOCRInfra represents the accepted values for destroying an DOCR infra via the provisioning container

type DestroyDOKSInfra

type DestroyDOKSInfra struct {
	DOKSName string `json:"doks_name" form:"required"`
}

DestroyDOKSInfra represents the accepted values for destroying an DOKS infra via the provisioning container

type DestroyECRInfra

type DestroyECRInfra struct {
	ECRName string `json:"ecr_name" form:"required"`
}

DestroyECRInfra represents the accepted values for destroying an ECR infra via the provisioning container

type DestroyEKSInfra

type DestroyEKSInfra struct {
	EKSName string `json:"eks_name" form:"required"`
}

DestroyEKSInfra represents the accepted values for destroying an EKS infra via the provisioning container

type DestroyGKEInfra

type DestroyGKEInfra struct {
	GKEName string `json:"gke_name" form:"required"`
}

DestroyGKEInfra represents the accepted values for destroying an GKE infra via the provisioning container

type FinalizeResetUserPasswordForm

type FinalizeResetUserPasswordForm struct {
	Email          string `json:"email" form:"required,max=255,email"`
	PWResetTokenID uint   `json:"token_id" form:"required"`
	Token          string `json:"token" form:"required"`
	NewPassword    string `json:"new_password" form:"required,max=255"`
}

type FinalizeVerifyEmailForm

type FinalizeVerifyEmailForm struct {
	TokenID uint   `json:"token_id" form:"required"`
	Token   string `json:"token" form:"required"`
}

type GetReleaseForm

type GetReleaseForm struct {
	*ReleaseForm
	Name     string `json:"name" form:"required"`
	Revision int    `json:"revision"`
}

GetReleaseForm represents the accepted values for getting a single Helm release

type InitiateResetUserPasswordForm

type InitiateResetUserPasswordForm struct {
	Email string `json:"email" form:"required"`
}

InitiateResetUserPasswordForm represents the accepted values for resetting a user's password

func (*InitiateResetUserPasswordForm) ToPWResetToken

func (ruf *InitiateResetUserPasswordForm) ToPWResetToken() (*models.PWResetToken, string, error)

type InstallChartTemplateForm

type InstallChartTemplateForm struct {
	*ReleaseForm
	*ChartTemplateForm

	// optional git action config
	GithubActionConfig *CreateGitActionOptional `json:"githubActionConfig,omitempty"`
}

InstallChartTemplateForm represents the accepted values for installing a new chart from a template.

type K8sForm

type K8sForm struct {
	*kubernetes.OutOfClusterConfig
}

K8sForm is the generic base type for CRUD operations on k8s objects

func (*K8sForm) PopulateK8sOptionsFromQueryParams

func (kf *K8sForm) PopulateK8sOptionsFromQueryParams(
	vals url.Values,
	repo repository.ClusterRepository,
) error

PopulateK8sOptionsFromQueryParams populates fields in the ReleaseForm using the passed url.Values (the parsed query params)

type ListReleaseForm

type ListReleaseForm struct {
	*ReleaseForm
	*helm.ListFilter
}

ListReleaseForm represents the accepted values for listing Helm releases

func (*ListReleaseForm) PopulateListFromQueryParams

func (lrf *ListReleaseForm) PopulateListFromQueryParams(
	vals url.Values,
	_ repository.ClusterRepository,
) error

PopulateListFromQueryParams populates fields in the ListReleaseForm using the passed url.Values (the parsed query params)

type ListReleaseHistoryForm

type ListReleaseHistoryForm struct {
	*ReleaseForm
	Name string `json:"name" form:"required"`
}

ListReleaseHistoryForm represents the accepted values for getting a single Helm release

type LoginUserForm

type LoginUserForm struct {
	WriteUserForm
	ID       uint   `form:"required"`
	Email    string `json:"email" form:"required,max=255,email"`
	Password string `json:"password" form:"required,max=255"`
}

LoginUserForm represents the accepted values for logging a user in

func (*LoginUserForm) ToUser

ToUser converts a LoginUserForm to models.User

type MetricsQueryForm

type MetricsQueryForm struct {
	*K8sForm

	*prometheus.QueryOpts
}

MetricsQueryForm is the form for querying pod usage metrics (cpu, memory)

type NamespaceForm added in v0.3.2

type NamespaceForm struct {
	Name string `json:"name" form:"required"`
}

type OverwriteAWSIntegrationForm added in v0.4.0

type OverwriteAWSIntegrationForm struct {
	UserID             uint   `json:"user_id" form:"required"`
	ProjectID          uint   `json:"project_id" form:"required"`
	AWSAccessKeyID     string `json:"aws_access_key_id"`
	AWSSecretAccessKey string `json:"aws_secret_access_key"`
}

OverwriteAWSIntegrationForm represents the accepted values for overwriting an AWS Integration

type ReleaseForm

type ReleaseForm struct {
	*helm.Form
}

ReleaseForm is the generic base type for CRUD operations on releases

func (*ReleaseForm) PopulateHelmOptionsFromQueryParams

func (rf *ReleaseForm) PopulateHelmOptionsFromQueryParams(
	vals url.Values,
	repo repository.ClusterRepository,
) error

PopulateHelmOptionsFromQueryParams populates fields in the ReleaseForm using the passed url.Values (the parsed query params)

type RenameConfigMapForm added in v0.7.2

type RenameConfigMapForm struct {
	Name      string `json:"name" form:"required"`
	Namespace string `json:"namespace" form:"required"`
	NewName   string `json:"new_name" form:"required"`
}

type ResolveClusterForm

type ResolveClusterForm struct {
	Resolver *models.ClusterResolverAll `form:"required"`

	ClusterCandidateID uint `json:"cluster_candidate_id" form:"required"`
	ProjectID          uint `json:"project_id" form:"required"`
	UserID             uint `json:"user_id" form:"required"`

	// populated during the ResolveIntegration step
	IntegrationID    uint
	ClusterCandidate *models.ClusterCandidate
	RawConf          *api.Config
}

ResolveClusterForm will resolve a cluster candidate and create a new cluster

func (*ResolveClusterForm) ResolveCluster

func (rcf *ResolveClusterForm) ResolveCluster(
	repo repository.Repository,
) (*models.Cluster, error)

ResolveCluster writes a new cluster to the DB -- this must be called after rcf.ResolveIntegration, since it relies on the previously created integration.

func (*ResolveClusterForm) ResolveIntegration

func (rcf *ResolveClusterForm) ResolveIntegration(
	repo repository.Repository,
) error

ResolveIntegration creates an integration in the DB

type RollbackReleaseForm

type RollbackReleaseForm struct {
	*ReleaseForm
	Name     string `json:"name" form:"required"`
	Revision int    `json:"revision" form:"required"`
}

RollbackReleaseForm represents the accepted values for getting a single Helm release

type UpdateClusterForm

type UpdateClusterForm struct {
	ID uint

	Name string `json:"name" form:"required"`
}

UpdateClusterForm represents the accepted values for updating a cluster (only name for now)

func (*UpdateClusterForm) ToCluster

ToCluster converts the form to a cluster

type UpdateImageForm added in v0.4.0

type UpdateImageForm struct {
	*ReleaseForm
	ImageRepoURI string `json:"image_repo_uri" form:"required"`
	Tag          string `json:"tag" form:"required"`
}

UpdateImageForm represents the accepted values for updating a Helm release's image

type UpdateProjectRoleForm added in v0.5.0

type UpdateProjectRoleForm struct {
	Kind string `json:"kind"`
}

UpdateProjectRoleForm represents the accepted values for updating a project role

type UpdateRegistryForm

type UpdateRegistryForm struct {
	ID uint

	Name string `json:"name" form:"required"`
}

UpdateRegistryForm represents the accepted values for updating a registry (only name for now)

func (*UpdateRegistryForm) ToRegistry

ToRegistry converts the form to a cluster

type UpgradeReleaseForm

type UpgradeReleaseForm struct {
	*ReleaseForm
	Name         string `json:"name" form:"required"`
	Values       string `json:"values" form:"required"`
	ChartVersion string `json:"version"`
}

UpgradeReleaseForm represents the accepted values for updating a Helm release

type VerifyResetUserPasswordForm

type VerifyResetUserPasswordForm struct {
	Email          string `json:"email" form:"required,max=255,email"`
	PWResetTokenID uint   `json:"token_id" form:"required"`
	Token          string `json:"token" form:"required"`
}

type WriteProjectForm

type WriteProjectForm interface {
	ToProject(repo repository.ProjectRepository) (*models.Project, error)
}

WriteProjectForm is a generic form for write operations to the Project model

type WriteUserForm

type WriteUserForm interface {
	ToUser(repo repository.UserRepository) (*models.User, error)
}

WriteUserForm is a generic form for write operations to the User model

Jump to

Keyboard shortcuts

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