forms

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSDataAction

type AWSDataAction struct {
	*ServiceAccountActionResolver
	AWSAccessKeyID     string `json:"aws_access_key_id" form:"required"`
	AWSSecretAccessKey string `json:"aws_secret_access_key" form:"required"`
	AWSClusterID       string `json:"aws_cluster_id" form:"required"`
}

AWSDataAction contains the AWS data (access id, key)

func (*AWSDataAction) PopulateServiceAccount

func (akda *AWSDataAction) PopulateServiceAccount(
	repo repository.ServiceAccountRepository,
) error

PopulateServiceAccount will add GCP key data to a ServiceAccount

type ActionResolver

type ActionResolver interface {
	PopulateServiceAccount(repo repository.ServiceAccountRepository) error
}

ActionResolver exposes an interface for resolving an action as a ServiceAccount. So that actions can be chained together, a pointer to a serviceAccount can be used -- if this points to nil, a new service account is created

type ClientCertDataAction

type ClientCertDataAction struct {
	*ServiceAccountActionResolver
	ClientCertData string `json:"client_cert_data" form:"required"`
}

ClientCertDataAction contains the base64 encoded cluster cert data

func (*ClientCertDataAction) PopulateServiceAccount

func (ccda *ClientCertDataAction) PopulateServiceAccount(
	repo repository.ServiceAccountRepository,
) error

PopulateServiceAccount will add client CA data to a ServiceAccount

type ClientKeyDataAction

type ClientKeyDataAction struct {
	*ServiceAccountActionResolver
	ClientKeyData string `json:"client_key_data" form:"required"`
}

ClientKeyDataAction contains the base64 encoded cluster key data

func (*ClientKeyDataAction) PopulateServiceAccount

func (ckda *ClientKeyDataAction) PopulateServiceAccount(
	repo repository.ServiceAccountRepository,
) error

PopulateServiceAccount will add client CA data to a ServiceAccount

type ClusterCADataAction

type ClusterCADataAction struct {
	*ServiceAccountActionResolver
	ClusterCAData string `json:"cluster_ca_data" form:"required"`
}

ClusterCADataAction contains the base64 encoded cluster CA data

func (*ClusterCADataAction) PopulateServiceAccount

func (cda *ClusterCADataAction) PopulateServiceAccount(
	repo repository.ServiceAccountRepository,
) error

PopulateServiceAccount will add cluster ca data to a cluster in the ServiceAccount's list of clusters

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 CreateServiceAccountCandidatesForm

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

CreateServiceAccountCandidatesForm represents the accepted values for creating a list of ServiceAccountCandidates from a kubeconfig

func (*CreateServiceAccountCandidatesForm) ToServiceAccountCandidates

func (csa *CreateServiceAccountCandidatesForm) ToServiceAccountCandidates() ([]*models.ServiceAccountCandidate, error)

ToServiceAccountCandidates creates a ServiceAccountCandidate from the kubeconfig and project id

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 GCPKeyDataAction

type GCPKeyDataAction struct {
	*ServiceAccountActionResolver
	GCPKeyData string `json:"gcp_key_data" form:"required"`
}

GCPKeyDataAction contains the GCP key data

func (*GCPKeyDataAction) PopulateServiceAccount

func (gkda *GCPKeyDataAction) PopulateServiceAccount(
	repo repository.ServiceAccountRepository,
) error

PopulateServiceAccount will add GCP key data to a ServiceAccount

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 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.ServiceAccountRepository,
) 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.ServiceAccountRepository,
) 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 OIDCIssuerDataAction

type OIDCIssuerDataAction struct {
	*ServiceAccountActionResolver
	OIDCIssuerCAData string `json:"oidc_idp_issuer_ca_data" form:"required"`
}

OIDCIssuerDataAction contains the base64 encoded IDP issuer CA data

func (*OIDCIssuerDataAction) PopulateServiceAccount

func (oida *OIDCIssuerDataAction) PopulateServiceAccount(
	repo repository.ServiceAccountRepository,
) error

PopulateServiceAccount will add OIDC issuer CA data to a ServiceAccount

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.ServiceAccountRepository,
) error

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

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 ServiceAccountActionResolver

type ServiceAccountActionResolver struct {
	ServiceAccountCandidateID uint `json:"sa_candidate_id" form:"required"`
	SA                        *models.ServiceAccount
	SACandidate               *models.ServiceAccountCandidate
}

ServiceAccountActionResolver is the base type for resolving a ServiceAccountAction that belongs to a given ServiceAccountCandidate

func (*ServiceAccountActionResolver) PopulateServiceAccount

func (sar *ServiceAccountActionResolver) PopulateServiceAccount(
	repo repository.ServiceAccountRepository,
) error

PopulateServiceAccount will create a service account if it does not exist, or will append a new cluster given by a ServiceAccountCandidate to the ServiceAccount

type TokenDataAction

type TokenDataAction struct {
	*ServiceAccountActionResolver
	TokenData string `json:"token_data" form:"required"`
}

TokenDataAction contains the token data to use

func (*TokenDataAction) PopulateServiceAccount

func (tda *TokenDataAction) PopulateServiceAccount(
	repo repository.ServiceAccountRepository,
) error

PopulateServiceAccount will add bearer token data to a ServiceAccount

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