create

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Overview

Package create provides functionality to create resources in the nine.ch API.

Index

Constants

View Source
const DefaultReplicas = 2

Variables

This section is empty.

Functions

func AnyFile added in v1.19.0

func AnyFile(files []*os.File) bool

AnyFile reports whether files holds at least one file Kong decoded. A repeated file flag may hold nil entries, those do not count as passed as there is nothing to read from them.

func ApplicationKongVars added in v1.2.0

func ApplicationKongVars() (kong.Vars, error)

ApplicationKongVars returns all variables which are used in the application create command

func BucketKongVars added in v1.12.2

func BucketKongVars() kong.Vars

func BucketUserKongVars added in v1.12.2

func BucketUserKongVars() kong.Vars

func CloudVMKongVars added in v1.9.0

func CloudVMKongVars() kong.Vars

CloudVMKongVars returns all variables which are used in the application create command.

func KeyValueStoreKongVars added in v1.12.2

func KeyValueStoreKongVars() kong.Vars

KeyValueStoreKongVars returns all variables which are used in the KeyValueStore create command.

func MySQLDatabaseKongVars added in v1.9.0

func MySQLDatabaseKongVars() kong.Vars

MySQLDatabaseKongVars returns all variables which are used in the MySQLDatabase create command

func MySQLKongVars added in v1.4.0

func MySQLKongVars() kong.Vars

MySQLKongVars returns all variables which are used in the MySQL create command

func OpenSearchKongVars added in v1.12.2

func OpenSearchKongVars() kong.Vars

OpenSearchKongVars returns all variables which are used in the OpenSearch create command

func ParseAuthorizedKeys added in v1.19.0

func ParseAuthorizedKeys(r io.Reader) ([]string, error)

ParseAuthorizedKeys reads SSH public keys from r. Every key is expected on its own line in the SSH format defined in RFC4253, blank lines and lines prefixed with # are ignored.

The keys are validated with ssh.ParseAuthorizedKey but returned as they were read, only stripped of surrounding whitespace, so that key comments and options are preserved.

func PostgresDatabaseKongVars added in v1.9.0

func PostgresDatabaseKongVars() kong.Vars

PostgresDatabaseKongVars returns all variables which are used in the PostgresDatabase create command

func PostgresKongVars added in v1.6.0

func PostgresKongVars() kong.Vars

PostgresKongVars returns all variables which are used in the Postgres create command

func ReadAuthorizedKeys added in v1.19.0

func ReadAuthorizedKeys(w *format.Writer, flag string, values []string, files []*os.File) ([]string, error)

ReadAuthorizedKeys returns the validated SSH public keys of values, followed by the keys read from files, in that order. flag names the flag values were passed to and is only used to report errors and warnings. The files are closed, they are read exactly once.

A source which holds no key at all is not an error, but it is warned about on w as it is most likely not what the user intended. Values which hold nothing but whitespace are not warned about, as that is how a configured list of keys is cleared.

func ServiceConnectionKongVars added in v1.10.0

func ServiceConnectionKongVars() kong.Vars

ServiceConnectionKongVars returns all variables which are used in the ServiceConnection create command

func StorageKeysWithDeprecatedFile added in v1.19.0

func StorageKeysWithDeprecatedFile(w *format.Writer, keys []string, deprecatedFile *os.File) ([]storage.SSHKey, error)

StorageKeysWithDeprecatedFile converts keys to the type of the storage API, with the keys of the deprecated --ssh-keys-file appended. Its use is warned about on w, pointing at the flag which replaces it. A nil file was not passed and contributes no keys.

It is shared by the database create and update commands, which declare the same three flags but differ in how the flags they replace are declared.

func StorageSSHKeys added in v1.19.0

func StorageSSHKeys(keys []string) []storage.SSHKey

StorageSSHKeys converts keys to the type of the storage API. An empty list of keys converts to nil, so that callers can tell "no keys were given" from "the configured keys are to be cleared" through the flags instead of the result.

Types

type Cmd

type Cmd struct {
	FromFile            fromFile             `cmd:"" group:"create-general" default:"withargs" name:"-f <file>" help:"Create any resource from a yaml or json file."`
	VCluster            vclusterCmd          `cmd:"" group:"create-infra" name:"vcluster" help:"Create a new vcluster."`
	APIServiceAccount   apiServiceAccountCmd `cmd:"" group:"create-access" name:"apiserviceaccount" aliases:"asa" help:"Create a new API Service Account."`
	Project             projectCmd           `cmd:"" group:"create-access" name:"project" help:"Create a new project."`
	Config              configCmd            `cmd:"" group:"create-apps" name:"config"  help:"Create a new deplo.io Project Configuration."`
	Application         applicationCmd       `cmd:"" group:"create-apps" name:"application" aliases:"app,application" help:"Create a new deplo.io Application."`
	MySQL               mySQLCmd             `cmd:"" group:"create-storage" name:"mysql" help:"Create a new MySQL instance."`
	MySQLDatabase       mysqlDatabaseCmd     `cmd:"" group:"create-storage" name:"mysqldatabase" help:"Create a new MySQL database."`
	Postgres            postgresCmd          `cmd:"" group:"create-storage" name:"postgres" help:"Create a new PostgreSQL instance."`
	PostgresDatabase    postgresDatabaseCmd  `cmd:"" group:"create-storage" name:"postgresdatabase" help:"Create a new PostgreSQL database."`
	KeyValueStore       keyValueStoreCmd     `cmd:"" group:"create-storage" name:"keyvaluestore" aliases:"kvs" help:"Create a new KeyValueStore instance."`
	OpenSearch          openSearchCmd        `cmd:"" group:"create-storage" name:"opensearch" aliases:"os" help:"Create a new OpenSearch cluster."`
	CloudVirtualMachine cloudVMCmd           `cmd:"" group:"create-infra" name:"cloudvirtualmachine" aliases:"cloudvm" help:"Create a new CloudVM."`
	ServiceConnection   serviceConnectionCmd `cmd:"" group:"create-network" name:"serviceconnection" aliases:"sc" help:"Create a new ServiceConnection."`
	StaticEgress        staticEgressCmd      `cmd:"" group:"create-network" name:"staticegress" aliases:"se" help:"Create a new StaticEgress."`
	Bucket              bucketCmd            `cmd:"" group:"create-storage" name:"bucket" help:"Create a new Bucket."`
	BucketUser          bucketUserCmd        `cmd:"" group:"create-storage" name:"bucketuser" aliases:"bu" help:"Create a new BucketUser."`
	Grafana             grafanaCmd           `cmd:"" group:"create-observability" name:"grafana" help:"Create a new Grafana instance."`
}

type DatabaseSSHKeysFlags added in v1.19.0

type DatabaseSSHKeysFlags struct {
	SSHKeysFlags

	// Deprecated Flags
	SSHKeysFile *os.File `hidden:"" completion-predictor:"file" help:"Deprecated, use --ssh-keys-from-files instead."`
}

DatabaseSSHKeysFlags declares the SSH public key flags of the database create commands, including the deprecated --ssh-keys-file which the repeatable --ssh-keys-from-files replaces.

func (DatabaseSSHKeysFlags) StorageKeys added in v1.19.0

func (f DatabaseSSHKeysFlags) StorageKeys(w *format.Writer) ([]storage.SSHKey, error)

StorageKeys returns the validated SSH public keys of all three flags, in the order --ssh-keys, --ssh-keys-from-files and --ssh-keys-file.

type DeprecatedKeysFlags added in v1.19.0

type DeprecatedKeysFlags struct {
	DeprecatedKeys          []string   `name:"keys" hidden:"" help:"Deprecated, use --ssh-keys instead."`
	DeprecatedKeysFromFiles []*os.File `name:"keys-from-files" hidden:"" completion-predictor:"file" help:"Deprecated, use --ssh-keys-from-files instead."`
}

DeprecatedKeysFlags declares the --keys and --keys-from-files flags which SSHKeysFlags replaces. It has to be embedded with the prefix the flags were registered under before the rename:

DeprecatedKeysFlags `prefix:"public-"`

The flags are hidden, they only exist to keep the previous spelling working. Unlike SSHKeysFlags they do not set sep:"none", so that values which used to be split on commas keep being split the same way. The fields carry a name tag so that they can be told apart from the fields of SSHKeysFlags wherever both are embedded, the flags are still registered as --<prefix>keys and --<prefix>keys-from-files.

func (DeprecatedKeysFlags) Keys added in v1.19.0

func (f DeprecatedKeysFlags) Keys(w *format.Writer, prefix, replacement string) ([]string, error)

Keys returns the validated SSH public keys of the deprecated flags registered under prefix, or nil if none of them was passed. Their use is warned about on w, pointing at the flags which SSHKeysFlags registered under replacement.

func (DeprecatedKeysFlags) Set added in v1.19.0

func (f DeprecatedKeysFlags) Set() bool

Set reports whether one of the deprecated flags was passed. Unlike the flags of SSHKeysFlags they cannot be used to clear a configured list of keys.

type KubernetesClusterOptions added in v1.10.0

type KubernetesClusterOptions struct {
	PodSelector       *LabelSelector `` /* 403-byte string literal not displayed */
	NamespaceSelector *LabelSelector `` /* 268-byte string literal not displayed */
}

KubernetesClusterOptions contains options for a KubernetesCluster source. https://pkg.go.dev/github.com/ninech/apis@v0.0.0-20250708054129-4d49f7a6c606/networking/v1alpha1#KubernetesClusterOptions

func (*KubernetesClusterOptions) APIType added in v1.10.0

APIType returns the API type networking.KubernetesClusterOptions of the KubernetesClusterOptions.

type LabelSelector added in v1.10.0

type LabelSelector struct {
	metav1.LabelSelector
}

LabelSelector is a label query over a set of resources. https://pkg.go.dev/k8s.io/kubectl@v0.33.2/pkg/cmd/util#AddLabelSelectorFlagVar

func (*LabelSelector) UnmarshalText added in v1.10.0

func (ls *LabelSelector) UnmarshalText(text []byte) error

UnmarshalText parses a label selector from a string. https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#list-and-watch-filtering

type LocalReference added in v1.12.2

type LocalReference struct {
	meta.LocalReference
}

LocalReference references another object in the same namespace.

func (*LocalReference) UnmarshalText added in v1.12.2

func (r *LocalReference) UnmarshalText(text []byte) error

UnmarshalText parses a local reference from a string.

type ResourceCmd added in v1.19.0

type ResourceCmd struct {
	format.Writer `kong:"-"`
	Name          string        `arg:"" help:"Name of the new resource. A random name is generated if omitted." default:""`
	Wait          bool          `default:"true" help:"Wait until resource is fully created."`
	WaitTimeout   time.Duration `default:"30m" help:"Duration to wait for resource getting ready. Only relevant if wait is set."`
}

ResourceCmd is the shared base for the create sub-commands.

It has to be exported so that Kong initializes the embedded format.Writer, see format.Writer.BeforeApply.

func (*ResourceCmd) BeforeApply added in v1.19.0

func (cmd *ResourceCmd) BeforeApply(writer io.Writer) error

BeforeApply initializes Writer from Kong's bound io.Writer.

type SSHKeysFlags added in v1.19.0

type SSHKeysFlags struct {
	// sep:"none" keeps Kong from splitting a value on commas, which would tear
	// apart the options of an authorized_keys line. Repeat the flag or separate
	// the keys by newlines to pass more than one.
	SSHKeys          []string   `` /* 223-byte string literal not displayed */
	SSHKeysFromFiles []*os.File `` /* 199-byte string literal not displayed */
}

SSHKeysFlags declares the --ssh-keys and --ssh-keys-from-files flags. Embed it with a prefix to scope the flags to a part of a resource and set ssh_keys_purpose to the clause which says what the keys are used for, it completes the help of both flags:

SSHKeysFlags `prefix:"rescue-" set:"ssh_keys_purpose=to connect while booted into rescue"`

The same prefix has to be passed to SSHKeysFlags.Keys, as Kong does not tell a flag which name it ended up being registered under. A mismatch between the two only shows in the errors and warnings, so every command embedding the flags is expected to have a test which parses real arguments through Kong and asserts the flag names those messages spell out.

func (SSHKeysFlags) Keys added in v1.19.0

func (f SSHKeysFlags) Keys(w *format.Writer, prefix string) ([]string, error)

Keys returns the validated SSH public keys of --<prefix>ssh-keys followed by those of --<prefix>ssh-keys-from-files, in that order.

Jump to

Keyboard shortcuts

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