package api

import "github.com/oslokommune/okctl/pkg/api"

Package api provides the domain model for okctl

Index

Constants

const (
	// BackendTypeSecretsManager for AWS SecretsManager
	BackendTypeSecretsManager = "secretsManager"
	// BackendTypeParameterStore for AWS Parameter Store
	BackendTypeParameterStore = "systemManager"
)
const (

	// RuleTypeIngress represents an inbound rule
	RuleTypeIngress RuleType = "Ingress"
	// RuleTypeEgress represents an outbound rule
	RuleTypeEgress RuleType = "Egress"
	// RuleProtocolAll configures a rule to represent all types of traffic
	RuleProtocolAll = "-1"
	// RuleProtocolTCP configures a rule to represent TCP based traffic
	RuleProtocolTCP = "tcp"
	// RuleProtocolUDP configures a rule to represent UDP based traffic
	RuleProtocolUDP = "udp"
)

Variables

var ErrObjectStorageBucketNotExist = errors.New("bucket does not exist")

ErrObjectStorageBucketNotExist indicates that a specified bucket does not exist

Types

type AddRuleOpts

type AddRuleOpts struct {
	ClusterName               string
	SecurityGroupStackName    string
	SecurityGroupResourceName string
	RuleType                  RuleType
	Rule                      Rule
}

AddRuleOpts defines required data for adding a rule to an existing security group

func (AddRuleOpts) Validate

func (a AddRuleOpts) Validate() error

Validate ensures the required data is existent and correct

type Bucketer

type Bucketer interface {
	// CreateBucket knows how to create a bucket
	CreateBucket(CreateBucketOpts) (bucketID string, err error)
	// DeleteBucket knows how to delete a bucket
	DeleteBucket(DeleteBucketOpts) error
	// EmptyBucket knows how to remove all content from a bucket
	EmptyBucket(EmptyBucketOpts) error
}

Bucketer defines functionality related to buckets

type Certificate

type Certificate struct {
	ID                     ID
	FQDN                   string
	Domain                 string
	HostedZoneID           string
	CertificateARN         string
	StackName              string
	CloudFormationTemplate []byte
}

Certificate contains the state for a certificate

type CertificateCloudProvider

type CertificateCloudProvider interface {
	CreateCertificate(opts CreateCertificateOpts) (*Certificate, error)
	DeleteCertificate(opts DeleteCertificateOpts) error
	DeleteCognitoCertificate(opts DeleteCognitoCertificateOpts) error
}

CertificateCloudProvider defines the cloud interaction

type CertificateService

type CertificateService interface {
	CreateCertificate(ctx context.Context, opts CreateCertificateOpts) (*Certificate, error)
	DeleteCertificate(ctx context.Context, opts DeleteCertificateOpts) error
	DeleteCognitoCertificate(ctx context.Context, opts DeleteCognitoCertificateOpts) error
}

CertificateService defines the service layer operations

type Cluster

type Cluster struct {
	ID     ID
	Config *v1alpha5.ClusterConfig
}

Cluster contains the core state for a cluster

type ClusterCreateOpts

type ClusterCreateOpts struct {
	ID                ID
	Cidr              string
	Version           string
	VpcID             string
	VpcPrivateSubnets []VpcSubnet
	VpcPublicSubnets  []VpcSubnet
}

ClusterCreateOpts specifies the required inputs for creating a cluster

func (*ClusterCreateOpts) Validate

func (o *ClusterCreateOpts) Validate() error

Validate the create inputs

type ClusterCruder

type ClusterCruder interface {
	CreateCluster(context.Context, ClusterCreateOpts) (*Cluster, error)
	DeleteCluster(context.Context, ClusterDeleteOpts) error
}

ClusterCruder knows how to create and delete clusters

type ClusterDeleteOpts

type ClusterDeleteOpts struct {
	ID                 ID
	FargateProfileName string
}

ClusterDeleteOpts specifies the required inputs for deleting a cluster

func (*ClusterDeleteOpts) Validate

func (o *ClusterDeleteOpts) Validate() error

Validate the delete inputs

type ClusterDetailer

type ClusterDetailer interface {
	GetClusterSecurityGroupID(context.Context, *ClusterSecurityGroupIDGetOpts) (*ClusterSecurityGroupID, error)
}

ClusterDetailer knows how to get details about a cluster

type ClusterRun

type ClusterRun interface {
	CreateCluster(opts ClusterCreateOpts) (*Cluster, error)
	DeleteCluster(opts ClusterDeleteOpts) error
}

ClusterRun provides an interface for running CLIs

type ClusterSecurityGroupID

type ClusterSecurityGroupID struct {
	Value string
}

ClusterSecurityGroupID contains an EKS cluster's cluster security group ID See https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html

type ClusterSecurityGroupIDGetOpts

type ClusterSecurityGroupIDGetOpts struct {
	ID ID
}

ClusterSecurityGroupIDGetOpts specifies the required inputs for getting the cluster's security group

func (*ClusterSecurityGroupIDGetOpts) Validate

func (o *ClusterSecurityGroupIDGetOpts) Validate() error

Validate the delete inputs

type ClusterService

type ClusterService interface {
	ClusterCruder
	ClusterDetailer
}

ClusterService provides an interface for the business logic when working with clusters

type ComponentCloudProvider

type ComponentCloudProvider interface {
	CreatePostgresDatabase(opts *CreatePostgresDatabaseOpts) (*PostgresDatabase, error)
	DeletePostgresDatabase(opts *DeletePostgresDatabaseOpts) error
	CreateS3Bucket(opts *CreateS3BucketOpts) (*S3Bucket, error)
	DeleteS3Bucket(opts *DeleteS3BucketOpts) error
}

ComponentCloudProvider defines the required cloud operations for the components

type ComponentService

type ComponentService interface {
	CreatePostgresDatabase(ctx context.Context, opts *CreatePostgresDatabaseOpts) (*PostgresDatabase, error)
	DeletePostgresDatabase(ctx context.Context, opts *DeletePostgresDatabaseOpts) error
	CreateS3Bucket(ctx context.Context, opts *CreateS3BucketOpts) (*S3Bucket, error)
	DeleteS3Bucket(ctx context.Context, opts *DeleteS3BucketOpts) error
}

ComponentService defines a set of operations for creating components that integrate with the Kubernetes cluster's applications

type ConfigMap

type ConfigMap struct {
	ID        ID
	Name      string
	Namespace string
	Manifest  []byte
}

ConfigMap is the state of a kubernetes configmap

type ContainerRepository

type ContainerRepository struct {
	ClusterID              ID
	Name                   string
	StackName              string
	CloudFormationTemplate string
}

ContainerRepository represents a container repository

type ContainerRepositoryCloudProvider

type ContainerRepositoryCloudProvider interface {
	CreateContainerRepository(opts *CreateContainerRepositoryOpts) (*ContainerRepository, error)
	DeleteContainerRepository(opts *DeleteContainerRepositoryOpts) error
	EmptyContainerRepository(ctx context.Context, opts EmptyContainerRepositoryOpts) error
}

ContainerRepositoryCloudProvider defines the required cloud operations for container repositories

type ContainerRepositoryService

type ContainerRepositoryService interface {
	CreateContainerRepository(ctx context.Context, opts *CreateContainerRepositoryOpts) (*ContainerRepository, error)
	DeleteContainerRepository(ctx context.Context, opts *DeleteContainerRepositoryOpts) error
	EmptyContainerRepository(ctx context.Context, opts EmptyContainerRepositoryOpts) error
}

ContainerRepositoryService defines operations for container repositories

type CreateBucketOpts

type CreateBucketOpts struct {
	// ClusterID identifies which cluster to do the operation in context of
	ClusterID ID
	// BucketName defines the name of the bucket to create
	BucketName string
	// Determines if the bucket should be protected from public access. N.B.: leaving this as false does not mean public
	// access is allowed nor enabled
	Private bool
	// Encrypted defines if objects should be encrypted
	Encrypted bool
	// EnableVersioning defines if object versioning should be enabled
	EnableVersioning bool
}

CreateBucketOpts defines necessary data for bucket creation

func (CreateBucketOpts) Validate

func (c CreateBucketOpts) Validate() error

Validate ensures correct and required data

type CreateCertificateOpts

type CreateCertificateOpts struct {
	ID           ID
	FQDN         string
	Domain       string
	HostedZoneID string
}

CreateCertificateOpts contains the input required for creating a certificate

func (CreateCertificateOpts) Validate

func (o CreateCertificateOpts) Validate() error

Validate the input

type CreateConfigMapOpts

type CreateConfigMapOpts struct {
	ID        ID
	Name      string
	Namespace string
	Data      map[string]string
	Labels    map[string]string
}

CreateConfigMapOpts contains the required inputs

func (CreateConfigMapOpts) Validate

func (o CreateConfigMapOpts) Validate() error

Validate the inputs

type CreateContainerRepositoryOpts

type CreateContainerRepositoryOpts struct {
	ClusterID ID
	Name      string
	StackName string
}

CreateContainerRepositoryOpts contains necesessary information to create a container repository

func (CreateContainerRepositoryOpts) Validate

func (c CreateContainerRepositoryOpts) Validate() error

Validate ensures the struct contains valid data

type CreateExternalDNSKubeDeploymentOpts

type CreateExternalDNSKubeDeploymentOpts struct {
	ID           ID
	HostedZoneID string
	DomainFilter string
}

CreateExternalDNSKubeDeploymentOpts contains input options

func (CreateExternalDNSKubeDeploymentOpts) Validate

Validate the input

type CreateExternalSecretsOpts

type CreateExternalSecretsOpts struct {
	ID       ID
	Manifest Manifest
}

CreateExternalSecretsOpts contains the required inputs

func (CreateExternalSecretsOpts) Validate

func (o CreateExternalSecretsOpts) Validate() error

Validate the inputs

type CreateHelmReleaseOpts

type CreateHelmReleaseOpts struct {
	ID             ID
	RepositoryName string
	RepositoryURL  string
	ReleaseName    string
	Version        string
	Chart          string
	Namespace      string
	Values         []byte
}

CreateHelmReleaseOpts contains the required inputs for installing a Helm release on the Kubernetes cluster

func (CreateHelmReleaseOpts) Validate

func (o CreateHelmReleaseOpts) Validate() error

Validate the provided inputs

type CreateHostedZoneOpts

type CreateHostedZoneOpts struct {
	ID     ID
	Domain string
	FQDN   string
	NSTTL  int64
}

CreateHostedZoneOpts contains required inputs

func (CreateHostedZoneOpts) Validate

func (o CreateHostedZoneOpts) Validate() error

Validate the inputs

type CreateIdentityPoolClientOpts

type CreateIdentityPoolClientOpts struct {
	ID          ID
	UserPoolID  string
	Purpose     string
	CallbackURL string
}

CreateIdentityPoolClientOpts contains the required inputs

type CreateIdentityPoolOpts

type CreateIdentityPoolOpts struct {
	ID           ID
	AuthDomain   string
	AuthFQDN     string
	HostedZoneID string
}

CreateIdentityPoolOpts contains the required inputs

type CreateIdentityPoolUserOpts

type CreateIdentityPoolUserOpts struct {
	ID         ID
	Email      string
	UserPoolID string
}

CreateIdentityPoolUserOpts input

type CreateNamespaceOpts

type CreateNamespaceOpts struct {
	ID        ID
	Namespace string
	Labels    map[string]string
}

CreateNamespaceOpts contains the required inputs

func (CreateNamespaceOpts) Validate

func (o CreateNamespaceOpts) Validate() error

Validate the inputs

type CreatePolicyOpts

type CreatePolicyOpts struct {
	ID                     ID
	StackName              string
	PolicyOutputName       string
	CloudFormationTemplate []byte
}

CreatePolicyOpts contains all the required inputs for creating a managed policy

func (CreatePolicyOpts) Validate

func (o CreatePolicyOpts) Validate() error

Validate the required inputs

type CreatePostgresDatabaseOpts

type CreatePostgresDatabaseOpts struct {
	ID                ID
	ApplicationName   string
	UserName          string
	StackName         string
	VpcID             string
	DBSubnetGroupName string
	DBSubnetIDs       []string
	DBSubnetCIDRs     []string
	RotaterBucket     string
	RotaterKey        string
}

CreatePostgresDatabaseOpts contains the inputs required for creating a Postgres database

func (*CreatePostgresDatabaseOpts) Validate

func (o *CreatePostgresDatabaseOpts) Validate() error

Validate the inputs

type CreateS3BucketOpts

type CreateS3BucketOpts struct {
	ID               ID
	Name             string
	StackName        string
	Encrypt          bool
	EnableVersioning bool
}

CreateS3BucketOpts contains the required inputs

func (CreateS3BucketOpts) Validate

func (o CreateS3BucketOpts) Validate() error

Validate the inputs

type CreateSecretOpts

type CreateSecretOpts struct {
	ID     ID
	Name   string
	Secret string
}

CreateSecretOpts contains the input required for creating a secret parameter

func (CreateSecretOpts) AnonymizeRequest

func (o CreateSecretOpts) AnonymizeRequest(request interface{}) interface{}

AnonymizeRequest removes sensitive data from the logs

func (CreateSecretOpts) Validate

func (o CreateSecretOpts) Validate() error

Validate the inputs

type CreateSecurityGroupOpts

type CreateSecurityGroupOpts struct {
	ClusterID     ID
	VPCID         string
	Name          string
	Description   string
	InboundRules  []Rule
	OutboundRules []Rule
}

CreateSecurityGroupOpts defines required data to create a Security Group

func (CreateSecurityGroupOpts) Validate

func (s CreateSecurityGroupOpts) Validate() error

Validate ensures the required data is existent and correct

type CreateServiceAccountOpts

type CreateServiceAccountOpts struct {
	ID        ID
	Name      string
	PolicyArn string
	Config    *v1alpha5.ClusterConfig
}

CreateServiceAccountOpts contains the inputs required for creating a new service account

func (CreateServiceAccountOpts) Validate

func (o CreateServiceAccountOpts) Validate() error

Validate the provided inputs

type CreateStorageClassOpts

type CreateStorageClassOpts struct {
	ID          ID
	Name        string
	Parameters  *storageclass.EBSParameters
	Annotations map[string]string
}

CreateStorageClassOpts provides the inputs

func (CreateStorageClassOpts) Validate

func (o CreateStorageClassOpts) Validate() error

Validate the inputs options

type CreateStoreOpts

type CreateStoreOpts struct {
	// ClusterID identifies which cluster the store should be created in context of
	ClusterID ID
	// Name defines the name of the key / value store to create
	Name StoreName
	// Keys defines the provisioned keys the store should accept
	Keys []string
}

CreateStoreOpts defines required data for creating a table

func (CreateStoreOpts) Validate

func (o CreateStoreOpts) Validate() error

Validate ensures opts contains the required and correct data

type CreateVpcOpts

type CreateVpcOpts struct {
	ID      ID
	Cidr    string
	Minimal bool
}

CreateVpcOpts defines the inputs to create a vpc

func (CreateVpcOpts) Validate

func (o CreateVpcOpts) Validate() error

Validate a vpc create request

type Data

type Data struct {
	Key      string
	Name     string
	Property string
}

Data represents the items in the manifest

func (Data) Validate

func (d Data) Validate() error

Validate data

type DeleteBucketOpts

type DeleteBucketOpts struct {
	// ClusterID identifies which cluster to do the operation in context of
	ClusterID ID
	// BucketName defines the name of the bucket to delete
	BucketName string
}

DeleteBucketOpts defines necessary data for bucket deletion

func (DeleteBucketOpts) Validate

func (c DeleteBucketOpts) Validate() error

Validate ensures correct and required data

type DeleteCertificateOpts

type DeleteCertificateOpts struct {
	ID     ID
	Domain string
}

DeleteCertificateOpts contains input required to delete a certificate

func (DeleteCertificateOpts) Validate

func (o DeleteCertificateOpts) Validate() error

Validate the deletion request inputs

type DeleteCognitoCertificateOpts

type DeleteCognitoCertificateOpts struct {
	ID     ID
	Domain string
}

DeleteCognitoCertificateOpts contains the inputs

func (DeleteCognitoCertificateOpts) Validate

func (o DeleteCognitoCertificateOpts) Validate() error

Validate the deletion request inputs

type DeleteConfigMapOpts

type DeleteConfigMapOpts struct {
	ID        ID
	Name      string
	Namespace string
}

DeleteConfigMapOpts contains the required inputs

func (DeleteConfigMapOpts) Validate

func (o DeleteConfigMapOpts) Validate() error

Validate the provided inputs

type DeleteContainerRepositoryOpts

type DeleteContainerRepositoryOpts struct {
	ClusterID ID
	StackName string
}

DeleteContainerRepositoryOpts contains necessary information to delete a container repository

func (DeleteContainerRepositoryOpts) Validate

func (c DeleteContainerRepositoryOpts) Validate() error

Validate ensures the struct contains valid data

type DeleteExternalSecretsOpts

type DeleteExternalSecretsOpts struct {
	ID        ID
	Manifests map[string]string
}

DeleteExternalSecretsOpts contains the required inputs

func (DeleteExternalSecretsOpts) Validate

func (o DeleteExternalSecretsOpts) Validate() error

Validate the provided inputs

type DeleteHelmReleaseOpts

type DeleteHelmReleaseOpts struct {
	ID          ID
	ReleaseName string
	Namespace   string
}

DeleteHelmReleaseOpts contains the required inputs for removing a Helm release from the Kubernetes cluster Experimenting a little bit with a more generic/general interface, starting with Delete operation

func (DeleteHelmReleaseOpts) Validate

func (o DeleteHelmReleaseOpts) Validate() error

Validate the provided inputs

type DeleteHostedZoneOpts

type DeleteHostedZoneOpts struct {
	ID           ID
	HostedZoneID string
	Domain       string
}

DeleteHostedZoneOpts contains required inputs

func (DeleteHostedZoneOpts) Validate

func (o DeleteHostedZoneOpts) Validate() error

Validate the inputs

type DeleteIdentityPoolClientOpts

type DeleteIdentityPoolClientOpts struct {
	ID      ID
	Purpose string
}

DeleteIdentityPoolClientOpts contains the required inputs

type DeleteIdentityPoolOpts

type DeleteIdentityPoolOpts struct {
	ID         ID
	UserPoolID string
	Domain     string
}

DeleteIdentityPoolOpts input

type DeleteIdentityPoolUserOpts

type DeleteIdentityPoolUserOpts struct {
	ClusterID ID
	UserEmail string
}

DeleteIdentityPoolUserOpts contains required inputs for deleting a user in the identity pool

type DeleteItemOpts

type DeleteItemOpts struct {
	// ClusterID identifies which cluster the item should be deleted in context of
	ClusterID ID
	// TableName defines the name of the key / value store to delete an item from
	TableName StoreName
	// Field defines the field of where the key identifying the item should be queried
	Field string
	// Key defines the key identifying the item to delete
	Key string
}

DeleteItemOpts defines required data for deleting an item

func (DeleteItemOpts) Validate

func (o DeleteItemOpts) Validate() error

Validate ensures opts contains the required and correct data

type DeleteNamespaceOpts

type DeleteNamespaceOpts struct {
	ID        ID
	Namespace string
}

DeleteNamespaceOpts provides the inputs

func (DeleteNamespaceOpts) Validate

func (o DeleteNamespaceOpts) Validate() error

Validate the inputs

type DeleteObjectOpts

type DeleteObjectOpts struct {
	// BucketName defines the name of the bucket to do the operation in
	BucketName string
	// Path defines the path of the objcet to delete
	Path string
}

DeleteObjectOpts defines necessary data to delete an object

func (DeleteObjectOpts) Validate

func (c DeleteObjectOpts) Validate() error

Validate ensures correct and required data

type DeletePolicyOpts

type DeletePolicyOpts struct {
	ID        ID
	StackName string
}

DeletePolicyOpts contains all the required inputs for deleting a managed policy

func (DeletePolicyOpts) Validate

func (o DeletePolicyOpts) Validate() error

Validate the required inputs

type DeletePostgresDatabaseOpts

type DeletePostgresDatabaseOpts struct {
	ID        ID
	StackName string
}

DeletePostgresDatabaseOpts contains the inputs required for deleting a Postgres database

func (*DeletePostgresDatabaseOpts) Validate

func (o *DeletePostgresDatabaseOpts) Validate() error

Validate the inputs

type DeleteS3BucketOpts

type DeleteS3BucketOpts struct {
	ID        ID
	StackName string
}

DeleteS3BucketOpts contains the required inputs

func (DeleteS3BucketOpts) Validate

func (o DeleteS3BucketOpts) Validate() error

Validate the inputs

type DeleteSecretOpts

type DeleteSecretOpts struct {
	ID   ID
	Name string
}

DeleteSecretOpts contains the input required for deleting a secret parameter

func (DeleteSecretOpts) Validate

func (o DeleteSecretOpts) Validate() error

Validate the inputs

type DeleteSecurityGroupOpts

type DeleteSecurityGroupOpts struct {
	ClusterName string
	Name        string
}

DeleteSecurityGroupOpts defines required data to delete a Security Group

func (DeleteSecurityGroupOpts) Validate

func (d DeleteSecurityGroupOpts) Validate() error

Validate ensures the required data is existent and correct

type DeleteServiceAccountOpts

type DeleteServiceAccountOpts struct {
	ID     ID
	Name   string
	Config *v1alpha5.ClusterConfig
}

DeleteServiceAccountOpts contains the inputs required for deleting a service account

func (DeleteServiceAccountOpts) Validate

func (o DeleteServiceAccountOpts) Validate() error

Validate the provided inputs

type DeleteStoreOpts

type DeleteStoreOpts struct {
	// ClusterID identifies which cluster the store should be deleted in context of
	ClusterID ID
	// Name defines the name of the key / value store to delete
	Name StoreName
}

DeleteStoreOpts defines required data for deleting a table

func (DeleteStoreOpts) Validate

func (o DeleteStoreOpts) Validate() error

Validate ensures opts contains the required and correct data

type DeleteVpcOpts

type DeleteVpcOpts struct {
	ID ID
}

DeleteVpcOpts defines the inputs to delete a vpc

type DomainCloudProvider

type DomainCloudProvider interface {
	CreateHostedZone(opts CreateHostedZoneOpts) (*HostedZone, error)
	DeleteHostedZone(opts DeleteHostedZoneOpts) error
}

DomainCloudProvider provides the cloud provider layer

type DomainService

type DomainService interface {
	CreateHostedZone(ctx context.Context, opts CreateHostedZoneOpts) (*HostedZone, error)
	DeleteHostedZone(ctx context.Context, opts DeleteHostedZoneOpts) error
}

DomainService provides the service layer

type EarlyTCPDemuxDisabler

type EarlyTCPDemuxDisabler interface {
	DisableEarlyDEMUX(ctx context.Context, clusterID ID) error
}

EarlyTCPDemuxDisabler defines functionality required to disable Early TCP demux in an EKS cluster

type EmptyBucketOpts

type EmptyBucketOpts struct {
	// BucketName defines the name of the bucket to empty
	BucketName string
}

EmptyBucketOpts defines necessary data for

func (EmptyBucketOpts) Validate

func (c EmptyBucketOpts) Validate() error

Validate ensures correct and required data

type EmptyContainerRepositoryOpts

type EmptyContainerRepositoryOpts struct {
	Name string
}

EmptyContainerRepositoryOpts contains necessary information to remove all images in a container repository

func (EmptyContainerRepositoryOpts) Validate

func (c EmptyContainerRepositoryOpts) Validate() error

Validate ensures the struct contains valid data

type ExternalDNSKube

type ExternalDNSKube struct {
	ID           ID
	HostedZoneID string
	DomainFilter string
	Manifests    map[string][]byte
}

ExternalDNSKube is the state of an external dns deployment

type ExternalSecretSpecTemplate

type ExternalSecretSpecTemplate struct {
	StringData map[string]interface{}
}

ExternalSecretSpecTemplate represents the template attribute of an ExternalSecret

type ExternalSecretsKube

type ExternalSecretsKube struct {
	ID        ID
	Name      string
	Namespace string
	Content   []byte
}

ExternalSecretsKube is the state of an external secrets deployment

type GetHelmReleaseOpts

type GetHelmReleaseOpts struct {
	ClusterID   ID
	ReleaseName string
	Namespace   string
}

GetHelmReleaseOpts contains the required inputs for finding a Helm release in the Kubernetes cluster

func (GetHelmReleaseOpts) Validate

func (o GetHelmReleaseOpts) Validate() error

Validate the provided inputs

type GetObjectOpts

type GetObjectOpts struct {
	// ClusterID identifies which cluster to do the operation in context of
	ClusterID ID
	// BucketName defines the name of the bucket to do the operation in
	BucketName string
	// Path defines the path of the object to retrieve
	Path string
}

GetObjectOpts defines necessary data to retrieve an object

func (GetObjectOpts) Validate

func (c GetObjectOpts) Validate() error

Validate ensures correct and required data

type GetSecurityGroupOpts

type GetSecurityGroupOpts struct {
	Name        string
	ClusterName string
}

GetSecurityGroupOpts defines required data for fetching an existing security group

func (GetSecurityGroupOpts) Validate

func (s GetSecurityGroupOpts) Validate() error

Validate ensures the required data is existent and correct

type GetStringOpts

type GetStringOpts struct {
	// ClusterID identifies which cluster to do the operation in context of
	ClusterID ID
	// TableName defines the name of the key / value store to do the operation in context of
	TableName StoreName
	// Selector defines the necessary information to identify an item in the store
	Selector ItemSelector
	// Field defines which attribute of an item to return
	Field string
}

GetStringOpts defines required data for retrieving a string

func (GetStringOpts) Validate

func (o GetStringOpts) Validate() error

Validate ensures opts contains the required and correct data

type Helm

type Helm struct {
	ID      ID
	Release *release.Release
	Chart   *helm.Chart
}

Helm contains the data of a helm release

type HelmRun

type HelmRun interface {
	CreateHelmRelease(opts CreateHelmReleaseOpts) (*Helm, error)
	DeleteHelmRelease(opts DeleteHelmReleaseOpts) error
	GetHelmRelease(opts GetHelmReleaseOpts) (*Helm, error)
}

HelmRun defines the runner layer

type HelmService

type HelmService interface {
	CreateHelmRelease(ctx context.Context, opts CreateHelmReleaseOpts) (*Helm, error)
	DeleteHelmRelease(ctx context.Context, opts DeleteHelmReleaseOpts) error
	GetHelmRelease(ctx context.Context, opts GetHelmReleaseOpts) (*Helm, error)
}

HelmService defines the service layer interface

type HostedZone

type HostedZone struct {
	ID                     ID
	Managed                bool
	FQDN                   string
	Domain                 string
	HostedZoneID           string
	NameServers            []string
	StackName              string
	CloudFormationTemplate []byte
}

HostedZone contains the state for a hosted zone

type ID

type ID struct {
	Region       string
	AWSAccountID string
	ClusterName  string
}

ID contains the state that uniquely identifies a cluster

func (ID) Validate

func (i ID) Validate() error

Validate the identifier

type IdentityManagerCloudProvider

type IdentityManagerCloudProvider interface {
	CreateIdentityPool(certificateARN string, opts CreateIdentityPoolOpts) (*IdentityPool, error)
	CreateIdentityPoolClient(opts CreateIdentityPoolClientOpts) (*IdentityPoolClient, error)
	CreateIdentityPoolUser(opts CreateIdentityPoolUserOpts) (*IdentityPoolUser, error)
	DeleteIdentityPool(opts DeleteIdentityPoolOpts) error
	DeleteIdentityPoolClient(opts DeleteIdentityPoolClientOpts) error
	DeleteIdentityPoolUser(opts DeleteIdentityPoolUserOpts) error
}

IdentityManagerCloudProvider implements the cloud layer

type IdentityManagerService

type IdentityManagerService interface {
	CreateIdentityPool(ctx context.Context, opts CreateIdentityPoolOpts) (*IdentityPool, error)
	CreateIdentityPoolClient(ctx context.Context, opts CreateIdentityPoolClientOpts) (*IdentityPoolClient, error)
	CreateIdentityPoolUser(ctx context.Context, opts CreateIdentityPoolUserOpts) (*IdentityPoolUser, error)
	DeleteIdentityPool(ctx context.Context, opts DeleteIdentityPoolOpts) error
	DeleteIdentityPoolClient(ctx context.Context, opts DeleteIdentityPoolClientOpts) error
	DeleteIdentityPoolUser(ctx context.Context, opts DeleteIdentityPoolUserOpts) error
}

IdentityManagerService implements the service layer

type IdentityPool

type IdentityPool struct {
	ID                      ID
	UserPoolID              string
	AuthDomain              string
	HostedZoneID            string
	StackName               string
	CloudFormationTemplates []byte
	Certificate             *Certificate
	RecordSetAlias          *RecordSetAlias
}

IdentityPool contains the state about the created identity management

type IdentityPoolClient

type IdentityPoolClient struct {
	ID                      ID
	UserPoolID              string
	Purpose                 string
	CallbackURL             string
	ClientID                string
	ClientSecret            string
	StackName               string
	CloudFormationTemplates []byte
}

IdentityPoolClient contains the state about a client

type IdentityPoolUser

type IdentityPoolUser struct {
	ID                     ID
	Email                  string
	UserPoolID             string
	StackName              string
	CloudFormationTemplate []byte
}

IdentityPoolUser state of user

type InsertItemOpts

type InsertItemOpts struct {
	// ClusterID identifies which cluster the store exists in context of
	ClusterID ID
	// TableName defines the name of the key / value store to insert an item in
	TableName StoreName
	// Item defines the item to insert
	Item KeyValueStoreItem
}

InsertItemOpts defines required data for adding a table

func (InsertItemOpts) Validate

func (o InsertItemOpts) Validate() error

Validate ensures opts contains the required and correct data

type ItemSelector

type ItemSelector struct {
	// Key defines a key to match with a value when selecting an item
	Key string
	// Value defines the value a certain key must have which can identify an item
	Value string
}

ItemSelector defines required data for selecting an item

type Itemer

type Itemer interface {
	Stringer
	// InsertItem defines a function that inserts a new item in a key / value store
	InsertItem(opts InsertItemOpts) error
	// RemoveItem defines a function that removes an item from a key / value store
	RemoveItem(opts DeleteItemOpts) error
}

Itemer defines operations done with items of tables

type KeyValueStoreCloudProvider

type KeyValueStoreCloudProvider interface {
	Storer
	Itemer
}

KeyValueStoreCloudProvider defines operations on a key-value database provider

type KeyValueStoreItem

type KeyValueStoreItem struct {
	Fields map[string]interface{}
}

KeyValueStoreItem represents one item in a key value store

type KeyValueStoreService

type KeyValueStoreService interface {
	Storer
	Itemer
}

KeyValueStoreService defines operations on a key-value database service

type KubeConfig

type KubeConfig struct {
	Path    string
	Content string
}

KubeConfig represents a kubeconfig

type KubeConfigStore

type KubeConfigStore interface {
	SaveKubeConfig(cfg *kubeconfig.Config) error
	GetKubeConfig(clusterName string) (*KubeConfig, error)
	DeleteKubeConfig() error
}

KubeConfigStore defines the storage operations on a kubeconfig

type KubeRun

type KubeRun interface {
	EarlyTCPDemuxDisabler
	CreateExternalDNSKubeDeployment(opts CreateExternalDNSKubeDeploymentOpts) (*ExternalDNSKube, error)
	DeleteNamespace(opts DeleteNamespaceOpts) error
	CreateStorageClass(opts CreateStorageClassOpts) (*StorageClassKube, error)
	CreateExternalSecrets(opts CreateExternalSecretsOpts) (*ExternalSecretsKube, error)
	DeleteExternalSecrets(opts DeleteExternalSecretsOpts) error
	CreateConfigMap(opts CreateConfigMapOpts) (*ConfigMap, error)
	DeleteConfigMap(opts DeleteConfigMapOpts) error
	ScaleDeployment(opts ScaleDeploymentOpts) error
	CreateNamespace(opts CreateNamespaceOpts) (*Namespace, error)
}

KubeRun provides kube deployment run layer

type KubeService

type KubeService interface {
	EarlyTCPDemuxDisabler
	CreateExternalDNSKubeDeployment(ctx context.Context, opts CreateExternalDNSKubeDeploymentOpts) (*ExternalDNSKube, error)
	DeleteNamespace(ctx context.Context, opts DeleteNamespaceOpts) error
	CreateStorageClass(ctx context.Context, opts CreateStorageClassOpts) (*StorageClassKube, error)
	CreateExternalSecrets(ctx context.Context, opts CreateExternalSecretsOpts) (*ExternalSecretsKube, error)
	DeleteExternalSecrets(ctx context.Context, opts DeleteExternalSecretsOpts) error
	CreateConfigMap(ctx context.Context, opts CreateConfigMapOpts) (*ConfigMap, error)
	DeleteConfigMap(ctx context.Context, opts DeleteConfigMapOpts) error
	ScaleDeployment(ctx context.Context, opts ScaleDeploymentOpts) error
	CreateNamespace(ctx context.Context, opts CreateNamespaceOpts) (*Namespace, error)
}

KubeService provides kube deployment service layer

type ManagedPolicy

type ManagedPolicy struct {
	ID                     ID
	StackName              string
	PolicyARN              string
	CloudFormationTemplate []byte
}

ManagedPolicy contains all state for a policy

type ManagedPolicyCloudProvider

type ManagedPolicyCloudProvider interface {
	CreatePolicy(opts CreatePolicyOpts) (*ManagedPolicy, error)
	DeletePolicy(opts DeletePolicyOpts) error
}

ManagedPolicyCloudProvider defines the cloud provider layer for managed policies

type ManagedPolicyService

type ManagedPolicyService interface {
	CreatePolicy(ctx context.Context, opts CreatePolicyOpts) (*ManagedPolicy, error)
	DeletePolicy(ctx context.Context, opts DeletePolicyOpts) error
}

ManagedPolicyService defines the service layer for managed policies

type Manifest

type Manifest struct {
	Name        string
	Namespace   string
	Backend     string
	Annotations map[string]string
	Labels      map[string]string
	Data        []Data
	Template    ExternalSecretSpecTemplate
}

Manifest represents a single external secret

func (Manifest) Validate

func (m Manifest) Validate() error

Validate manifest

type Namespace

type Namespace struct {
	ID        ID
	Namespace string
	Labels    map[string]string
	Manifest  []byte
}

Namespace contains the data for a namespace

type ObjectStorageCloudProvider

type ObjectStorageCloudProvider interface {
	Bucketer
	Objecter
}

ObjectStorageCloudProvider provides the cloud provider layer

type ObjectStorageService

type ObjectStorageService interface {
	Bucketer
	Objecter
}

ObjectStorageService defines necessary operations for object storage

type Objecter

type Objecter interface {
	// PutObject knows how to insert an object into a bucket
	PutObject(PutObjectOpts) error
	// GetObject knows how to retrieve an object from a bucket
	GetObject(GetObjectOpts) (io.Reader, error)
	// DeleteObject knows how to remove an object from a bucket
	DeleteObject(DeleteObjectOpts) error
}

Objecter defines functionality related to objects

type Parameter

type Parameter struct {
	ID      ID
	Name    string
	Path    string
	Version int64
	Content string
}

Parameter contains the state for a parameter

type ParameterCloudProvider

type ParameterCloudProvider interface {
	CreateSecret(opts CreateSecretOpts) (*SecretParameter, error)
	DeleteSecret(opts DeleteSecretOpts) error
}

ParameterCloudProvider defines the cloud layer operations

type ParameterService

type ParameterService interface {
	CreateSecret(ctx context.Context, opts CreateSecretOpts) (*SecretParameter, error)
	DeleteSecret(ctx context.Context, opts DeleteSecretOpts) error
}

ParameterService defines the service layer operations

type PostgresDatabase

type PostgresDatabase struct {
	ID                           ID
	ApplicationName              string
	UserName                     string
	StackName                    string
	AdminSecretFriendlyName      string
	EndpointAddress              string
	EndpointPort                 int
	OutgoingSecurityGroupID      string
	SecretsManagerAdminSecretARN string
	LambdaPolicyARN              string
	LambdaRoleARN                string
	LambdaFunctionARN            string
	CloudFormationTemplate       string
}

PostgresDatabase contains the state resulting from a newly created Postgres database

type PutObjectOpts

type PutObjectOpts struct {
	// ClusterID identifies which cluster to do the operation in context of
	ClusterID ID
	// BucketName defines the name of the bucket to do the operation in
	BucketName string
	// Path defines the path to the object
	Path string
	// Content defines the content of the object
	Content io.Reader
}

PutObjectOpts defines necessary data to store an object

func (PutObjectOpts) Validate

func (c PutObjectOpts) Validate() error

Validate ensures correct and required data

type RecordSetAlias

type RecordSetAlias struct {
	AliasDomain            string
	AliasHostedZones       string
	StackName              string
	CloudFormationTemplate []byte
}

RecordSetAlias contains a record set alias this should not be here

type RemoveRuleOpts

type RemoveRuleOpts struct {
	ClusterName               string
	SecurityGroupStackName    string
	SecurityGroupResourceName string
	RuleType                  RuleType
	Rule                      Rule
}

RemoveRuleOpts defines required data for removing a rule from an existing security group

func (RemoveRuleOpts) Validate

func (a RemoveRuleOpts) Validate() error

Validate ensures the required data is existent and correct

type Rule

type Rule struct {
	Description           string `json:"Description"`
	FromPort              int    `json:"FromPort"`
	ToPort                int    `json:"ToPort"`
	CidrIP                string `json:"CidrIp,omitempty"`
	Protocol              string `json:"IpProtocol"`
	SourceSecurityGroupID string `json:"SourceSecurityGroupId,omitempty"`
}

Rule defines an opening in a Security Group

func (Rule) Equals

func (r Rule) Equals(target Rule) bool

Equals knows if two rules can be considered equal

func (Rule) Validate

func (r Rule) Validate() error

Validate ensures the required data is existent and correct

type RuleType

type RuleType string

RuleType defines wether the rule is an inbound or outbound type rule

type S3Bucket

type S3Bucket struct {
	ID                     ID
	Name                   string
	StackName              string
	CloudFormationTemplate string
}

S3Bucket contains the state after an AWS S3 bucket has been created

type ScaleDeploymentOpts

type ScaleDeploymentOpts struct {
	ID        ID
	Name      string
	Namespace string
	Replicas  int32
}

ScaleDeploymentOpts provides required inputs

func (ScaleDeploymentOpts) Validate

func (o ScaleDeploymentOpts) Validate() error

Validate the provided inputs

type SecretParameter

type SecretParameter struct {
	Parameter
}

SecretParameter contains the state for a secret parameter

func (*SecretParameter) AnonymizeResponse

func (p *SecretParameter) AnonymizeResponse(response interface{}) interface{}

AnonymizeResponse removes sensitive data from the logs

type SecurityGroup

type SecurityGroup struct {
	ID            string
	InboundRules  []Rule
	OutboundRules []Rule
}

SecurityGroup defines an AWS Security Group

func (SecurityGroup) Validate

func (s SecurityGroup) Validate() error

Validate ensures the required data is existent and correct

type SecurityGroupCRUDer

type SecurityGroupCRUDer interface {
	CreateSecurityGroup(ctx context.Context, opts CreateSecurityGroupOpts) (SecurityGroup, error)
	GetSecurityGroup(ctx context.Context, opts GetSecurityGroupOpts) (SecurityGroup, error)
	DeleteSecurityGroup(ctx context.Context, opts DeleteSecurityGroupOpts) error
}

SecurityGroupCRUDer defines CRUD operations available for Security Groups

type SecurityGroupCloudProvider

type SecurityGroupCloudProvider interface {
	SecurityGroupCRUDer
	SecurityGroupRuleCRUDer
}

SecurityGroupCloudProvider provides the cloud provider layer

type SecurityGroupRuleCRUDer

type SecurityGroupRuleCRUDer interface {
	AddRule(ctx context.Context, opts AddRuleOpts) (Rule, error)
	RemoveRule(ctx context.Context, opts RemoveRuleOpts) error
}

SecurityGroupRuleCRUDer defines CRUD operations available for rules on existing Security Groups

type SecurityGroupService

type SecurityGroupService interface {
	SecurityGroupCRUDer
	SecurityGroupRuleCRUDer
}

SecurityGroupService provides the service layer

type ServiceAccount

type ServiceAccount struct {
	ID        ID
	Name      string
	PolicyArn string
	Config    *v1alpha5.ClusterConfig
}

ServiceAccount holds state for a service account

type ServiceAccountRun

type ServiceAccountRun interface {
	CreateServiceAccount(*v1alpha5.ClusterConfig) error
	DeleteServiceAccount(*v1alpha5.ClusterConfig) error
}

ServiceAccountRun provides the interface for running operations

type ServiceAccountService

type ServiceAccountService interface {
	CreateServiceAccount(ctx context.Context, opts CreateServiceAccountOpts) (*ServiceAccount, error)
	DeleteServiceAccount(ctx context.Context, opts DeleteServiceAccountOpts) error
}

ServiceAccountService provides the interface for all service account operations

type StorageClassKube

type StorageClassKube struct {
	ID       ID
	Name     string
	Manifest []byte
}

StorageClassKube is the state of a storage class manifest

type StoreName

type StoreName string

StoreName defines a key-value store name

func (StoreName) Validate

func (n StoreName) Validate() error

Validate ensures the name is legal

type Storer

type Storer interface {
	// CreateStore defines a function that creates a key / value store
	CreateStore(CreateStoreOpts) error
	// DeleteStore defines a function that deletes a key / value store
	DeleteStore(DeleteStoreOpts) error
	// ListStores defines a function that lists all available stores
	ListStores() ([]string, error)
}

Storer defines operations done with stores

type Stringer

type Stringer interface {
	// GetString defines a function that retrieves a string from a key / value store
	GetString(opts GetStringOpts) (string, error)
}

Stringer defines operations done with string items

type Vpc

type Vpc struct {
	ID                     ID
	StackName              string
	CloudFormationTemplate []byte

	VpcID                    string
	Cidr                     string
	PublicSubnets            []VpcSubnet
	PrivateSubnets           []VpcSubnet
	DatabaseSubnets          []VpcSubnet
	DatabaseSubnetsGroupName string
}

Vpc represents the state of an aws vpc

type VpcCloudProvider

type VpcCloudProvider interface {
	CreateVpc(opts CreateVpcOpts) (*Vpc, error)
	DeleteVpc(opts DeleteVpcOpts) error
}

VpcCloudProvider defines the cloud actions that a Vpc service requires

type VpcService

type VpcService interface {
	CreateVpc(ctx context.Context, opts CreateVpcOpts) (*Vpc, error)
	DeleteVpc(ctx context.Context, opts DeleteVpcOpts) error
}

VpcService defines the service layer of a vpc

type VpcSubnet

type VpcSubnet struct {
	ID               string
	Cidr             string
	AvailabilityZone string
}

VpcSubnet represents an aws vpc subnet

Source Files

api.go certificate_api.go cluster_api.go component_api.go container_repository_api.go domain_api.go helm_api.go identitymanager_api.go kube_api.go kubeconfig_api.go kvstore_api.go managedpolicy_api.go objectstorage_api.go parameter_api.go securitygroup_api.go serviceaccount_api.go vpc_api.go

Directories

PathSynopsis
pkg/api/corePackage core implements the service layer
pkg/api/core/cloudprovider
pkg/api/core/cloudprovider/awsPackage aws implements the cloud layer
pkg/api/core/runPackage run implements the runnable layer
pkg/api/core/store
pkg/api/core/store/filesystemPackage filesystem implements a filesystem storage layer
pkg/api/mockPackage mock provides mocks for use with tests
Version
v0.0.106 (latest)
Published
Oct 21, 2022
Platform
linux/amd64
Imports
10 packages
Last checked
18 hours ago

Tools for package owners.