application

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package application provides utility functions for interacting with Deploio applications.

Index

Constants

View Source
const (
	// BasicAuth key constants which represent the keys used in basic auth
	// secrets
	BasicAuthUsernameKey = "basicAuthUsername"
	BasicAuthPasswordKey = "basicAuthPassword"
)
View Source
const (
	ApplicationNameLabel = "application.apps.nine.ch/name"
)
View Source
const (
	// DNSSetupURL redirects to the proper deplo.io docs entry about
	// how to setup custom hosts
	DNSSetupURL = "https://docs.nine.ch/a/myshbw3EY1"
)

Variables

This section is empty.

Functions

func ApplyProbePatch

func ApplyProbePatch(cfg *apps.Config, pp ProbePatch)

ApplyProbePatch mutates cfg.

func EnvVarByName

func EnvVarByName(envVars apps.EnvVars, name string) *apps.EnvVar

func EnvVarsFromMap

func EnvVarsFromMap(env map[string]string, options ...EnvVarModifier) apps.EnvVars

func LatestAvailableRelease

func LatestAvailableRelease(releases *apps.ReleaseList) *apps.Release

func OrderReleaseList

func OrderReleaseList(releaseList *apps.ReleaseList, reverse bool)

OrderReleaseList orders the given list of releases first by name and then by creation timestamp latest to oldest. Reverse reverses the order by creation timestamp to oldest to latest.

func Releases

func Releases(ctx context.Context, client *api.Client, app types.NamespacedName) (*apps.ReleaseList, error)

Releases returns a release list of an app. If the returned error is nil, the release list is guaranteed to have at least one item.

func StaticEgresses

func StaticEgresses(ctx context.Context, client *api.Client, app types.NamespacedName) ([]networking.StaticEgress, error)

StaticEgresses returns all static egress resources targeting the specified app.

func UnverifiedHosts

func UnverifiedHosts(app *apps.Application) []string

func UpdateEnvVars

func UpdateEnvVars(oldEnvs []apps.EnvVar, newEnvs, sensitiveEnvs map[string]string, toDelete []string) apps.EnvVars

func ValidateConfig

func ValidateConfig(config apps.Config) error

ValidateConfig validates the configuration of an application.

func ValidatePEM

func ValidatePEM(content string) (*string, error)

ValidatePEM validates if the passed content is in valid PEM format, errors out if the content is empty

Types

type BasicAuth

type BasicAuth struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

BasicAuth contains credentials for basic authentication

func NewBasicAuthFromSecret

func NewBasicAuthFromSecret(ctx context.Context, secret meta.Reference, client *api.Client) (*BasicAuth, error)

NewBasicAuthFromSecret returns a basic auth resource filled with data from a secret.

type DNSDetail

type DNSDetail struct {
	Application string `json:"application"`
	Project     string `json:"project"`
	TXTRecord   string `json:"txtRecord"`
	CNAMETarget string `json:"cnameTarget"`
}

func DNSDetails

func DNSDetails(items []apps.Application) []DNSDetail

DNSDetails retrieves the DNS details of all given applications

type EnvVarModifier

type EnvVarModifier func(envVar *apps.EnvVar)

func Sensitive

func Sensitive() EnvVarModifier

type OptInt32

type OptInt32 struct {
	State SetState
	Val   int32
}

OptInt32 is an "Optional int32 field" wrapper. It works the same way as OptString, but for numeric fields. Again, this lets us distinguish Unset (no flag) vs Set (positive value) vs Clear (explicitly reset to nil/default).

type OptString

type OptString struct {
	State SetState
	Val   string
}

OptString is an "Optional string field" wrapper. It carries both a string value and a state (Unset / Set / Clear).

type Patcher

type Patcher interface {
	ToProbePatch() ProbePatch
}

Patcher is implemented by command-specific flag structs to produce a ProbePatch.

type ProbePatch

type ProbePatch struct {
	Path          OptString
	PeriodSeconds OptInt32
}

ProbePatch is the normalized type used by both create and update paths.

type RepositoryValidator

type RepositoryValidator struct {
	format.Writer

	Auth   gitinfo.Auth
	Client *gitinfo.Client
	Debug  bool
}

RepositoryValidator validates a git repository

func (*RepositoryValidator) Validate

func (v *RepositoryValidator) Validate(ctx context.Context, target apps.GitTarget) (apps.GitTarget, error)

Validate validates the repository access and shows a visual spinner while doing so

type SetState

type SetState int

SetState describes how a field should be applied.

const (
	// leave as-is
	Unset SetState = iota
	// set to value
	Set
	// explicitly remove/unset
	Clear
)

Jump to

Keyboard shortcuts

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