forms

package
v0.1.0-beta.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartTemplateForm

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

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

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 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 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"`
}

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 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 CreateProjectRoleForm

type CreateProjectRoleForm struct {
	WriteProjectForm
	ID    uint          `json:"project_id" form:"required"`
	Roles []models.Role `json:"roles"`
}

CreateProjectRoleForm represents the accepted values for creating a project role

func (*CreateProjectRoleForm) ToProject

ToProject converts the form to a gorm project model

type CreateRegistry

type CreateRegistry struct {
	Name             string `json:"name" form:"required"`
	ProjectID        uint   `json:"project_id" form:"required"`
	GCPIntegrationID uint   `json:"gcp_integration_id"`
	AWSIntegrationID uint   `json:"aws_integration_id"`
}

CreateRegistry represents the accepted values for creating a registry

func (*CreateRegistry) ToRegistry

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

ToRegistry converts the form to a gorm registry model

type CreateUserForm

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

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 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 InstallChartTemplateForm

type InstallChartTemplateForm struct {
	*ReleaseForm
	*ChartTemplateForm
}

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 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 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 UpgradeReleaseForm

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

UpgradeReleaseForm represents the accepted values for updating a Helm release

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