config

package
v0.0.0-...-b8e83fa Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

View Source
const (
	AirshipConfig                         = "config"
	AirshipConfigAPIVersion               = AirshipConfigGroup + "/" + AirshipConfigVersion
	AirshipConfigDir                      = ".airship"
	AirshipConfigEnv                      = "AIRSHIPCONFIG"
	AirshipConfigGroup                    = "airshipit.org"
	AirshipConfigKind                     = "Config"
	AirshipConfigVersion                  = "v1alpha1"
	AirshipDefaultContext                 = "default"
	AirshipDefaultDirectoryPermission     = 0750
	AirshipDefaultFilePermission          = 0640
	AirshipDefaultManagementConfiguration = "default"
	AirshipDefaultManifest                = "default"
	AirshipDefaultManifestRepo            = "treasuremap"
	AirshipDefaultManifestRepoLocation    = "https://opendev.org/airship/" + AirshipDefaultManifestRepo

	// Modules
	AirshipDefaultManagementType = redfish.ClientType

	//HomeEnvVar holds value of HOME directory from env
	HomeEnvVar = "$HOME"
)

Constants defining default values

View Source
const (
	DefaultSystemActionRetries = 30
	DefaultSystemRebootDelay   = 30
)

Default values for remote operations

View Source
const (
	// DefaultTestPhaseRepo holds default repo name
	DefaultTestPhaseRepo = "primary"
	// DefaultManifestMetadataFile default path to manifest metadata file
	DefaultManifestMetadataFile = "manifests/site/test-site/metadata.yaml"
)

Default Value for manifest

View Source
const (
	SSHAuth   = "ssh-key"
	SSHPass   = "ssh-pass"
	HTTPBasic = "http-basic"
	NoAuth    = "none"
)

Constants for possible repo authentication types

View Source
const (
	KubectlTempFilePrefix = "initinfra"
)

Default values for auxiliary parameters

Variables

View Source
var (
	AllowedAuthTypes = []string{SSHAuth, SSHPass, HTTPBasic, NoAuth}
)

RepoAuth methods

Functions

func CreateConfig

func CreateConfig(airshipConfigPath string, overwrite bool) error

CreateConfig saves default config to the specified path

func EncodeString

func EncodeString(given string) string

EncodeString returns the base64 encoding of given string

func NewErrIncompatibleAuthOptions

func NewErrIncompatibleAuthOptions(fo []string, ao string) error

NewErrIncompatibleAuthOptions returns Error of type ErrIncompatibleAuthOptions

func RunGetManifest

func RunGetManifest(cfgFactory Factory, manifestName string, w io.Writer) error

RunGetManifest prints desired manifest(s) by its name

func RunSetManifest

func RunSetManifest(o *ManifestOptions, airconfig *Config, writeToStorage bool) (bool, error)

RunSetManifest validates the given command line options and invokes AddManifest/ModifyManifest

func RunUseContext

func RunUseContext(desiredContext string, airconfig *Config) error

RunUseContext validates the given context name and updates it as current context

Types

type Config

type Config struct {
	// +optional
	Kind string `json:"kind,omitempty"`

	// +optional
	APIVersion string `json:"apiVersion,omitempty"`

	// Permissions is a struct of permissions for file and directory
	Permissions Permissions `json:"permissions,omitempty"`

	// Contexts is a map of referenceable names to context configs
	Contexts map[string]*Context `json:"contexts"`

	// Manifests is a map of referenceable names to documents
	Manifests map[string]*Manifest `json:"manifests"`

	// CurrentContext is the name of the context that you would like to use by default
	CurrentContext string `json:"currentContext"`

	// Management configuration defines management information for all baremetal hosts in a cluster.
	ManagementConfiguration map[string]*ManagementConfiguration `json:"managementConfiguration"`
	// contains filtered or unexported fields
}

Config holds the information required by airshipctl commands It is somewhat a superset of what a kubeconfig looks like

func NewConfig

func NewConfig() *Config

NewConfig returns a newly initialized Config object

func NewEmptyConfig

func NewEmptyConfig() *Config

NewEmptyConfig returns an initialized Config object with no default values

func (*Config) AddContext

func (c *Config) AddContext(ctxName string, opts ...ContextOption) *Context

AddContext creates a new context and returns the instance of newly created context

func (*Config) AddManagementConfig

func (c *Config) AddManagementConfig(mgmtCfgName string, opts ...ManagementConfigOption) *ManagementConfiguration

AddManagementConfig creates a new instance of ManagementConfig object

func (*Config) AddManifest

func (c *Config) AddManifest(theManifest *ManifestOptions) *Manifest

AddManifest creates new Manifest

func (*Config) AddRepository

func (c *Config) AddRepository(manifest *Manifest, theManifest *ManifestOptions) (*Repository, error)

AddRepository creates new Repository

func (*Config) CurrentContextInventoryRepositoryName

func (c *Config) CurrentContextInventoryRepositoryName() (string, error)

CurrentContextInventoryRepositoryName returns phase inventory directory from current context's manifest if it is not defined PhaseRepositoryName will be used instead

func (*Config) CurrentContextManagementConfig

func (c *Config) CurrentContextManagementConfig() (*ManagementConfiguration, error)

CurrentContextManagementConfig returns the management options for the current context

func (*Config) CurrentContextManifest

func (c *Config) CurrentContextManifest() (*Manifest, error)

CurrentContextManifest returns the manifest for the current context

func (*Config) CurrentContextMetadataPath

func (c *Config) CurrentContextMetadataPath() (string, error)

CurrentContextMetadataPath returns metadata path from current context's manifest

func (*Config) CurrentContextPhaseRepositoryDir

func (c *Config) CurrentContextPhaseRepositoryDir() (string, error)

CurrentContextPhaseRepositoryDir returns phase repository directory from current context's manifest E.g. let repository url be "http://dummy.org/phaserepo.git" then repo directory under targetPath is "phaserepo"

func (*Config) CurrentContextTargetPath

func (c *Config) CurrentContextTargetPath() (string, error)

CurrentContextTargetPath returns target path from current context's manifest

func (*Config) EnsureComplete

func (c *Config) EnsureComplete() error

EnsureComplete verifies that a Config object is ready to use. A complete Config object meets the following criteria:

  • At least 1 Context is defined
  • At least 1 Manifest is defined
  • The CurrentContext is set
  • The CurrentContext identifies an existing Context
  • The CurrentContext identifies an existing Manifest

func (*Config) GetContext

func (c *Config) GetContext(cName string) (*Context, error)

GetContext returns a context instance

func (*Config) GetContexts

func (c *Config) GetContexts() []*Context

GetContexts returns all of the contexts associated with the Config sorted by name

func (*Config) GetCurrentContext

func (c *Config) GetCurrentContext() (*Context, error)

GetCurrentContext methods Returns the appropriate information for the current context Current Context holds labels for the appropriate config objects

func (*Config) GetManagementConfiguration

func (c *Config) GetManagementConfiguration(name string) (*ManagementConfiguration, error)

GetManagementConfiguration retrieves a management configuration by name.

func (*Config) GetManifest

func (c *Config) GetManifest(name string) (*Manifest, error)

GetManifest returns a Manifest instance

func (*Config) GetManifests

func (c *Config) GetManifests() []*Manifest

GetManifests returns all of the Manifests associated with the Config sorted by name

func (*Config) LoadConfig

func (c *Config) LoadConfig() error

LoadConfig populates the Config from the file found at airshipConfigPath. If there is no file at airshipConfigPath, this function does nothing. An error is returned if: * airshipConfigPath is the empty string * the file at airshipConfigPath is inaccessible * the file at airshipConfigPath cannot be marshaled into Config

func (*Config) LoadedConfigPath

func (c *Config) LoadedConfigPath() string

LoadedConfigPath returns the file path of airship config from where the current Config object is created

func (*Config) ModifyContext

func (c *Config) ModifyContext(context *Context, opts ...ContextOption)

ModifyContext updates Context object with given context options

func (*Config) ModifyManagementConfig

func (c *Config) ModifyManagementConfig(mgmtConfig *ManagementConfiguration, opts ...ManagementConfigOption)

ModifyManagementConfig updates ManagementConfig object with given options

func (*Config) ModifyManifest

func (c *Config) ModifyManifest(manifest *Manifest, theManifest *ManifestOptions) error

ModifyManifest set actual values to manifests

func (*Config) ModifyRepository

func (c *Config) ModifyRepository(repository *Repository, theManifest *ManifestOptions) error

ModifyRepository set actual values to repository

func (*Config) PersistConfig

func (c *Config) PersistConfig(overwrite bool) error

PersistConfig updates the airshipctl config file to match the current Config object. If file did not previously exist, the file will be created. The file will be overwritten if overwrite argument set to true

func (*Config) Purge

func (c *Config) Purge() error

Purge removes the config file

func (*Config) SetFs

func (c *Config) SetFs(fsys fs.FileSystem)

SetFs allows to set custom filesystem used in Config object. Required for unit tests

func (*Config) SetLoadedConfigPath

func (c *Config) SetLoadedConfigPath(lcp string)

SetLoadedConfigPath updates the file path of airship config in the Config object

func (*Config) String

func (c *Config) String() string

func (*Config) ToYaml

func (c *Config) ToYaml() ([]byte, error)

ToYaml returns a YAML document It serializes the given Config object to a valid YAML document

func (*Config) WorkDir

func (c *Config) WorkDir() (dir string, err error)

WorkDir returns working directory for airshipctl. Creates if it doesn't exist

type Context

type Context struct {
	// Manifest is the default manifest to be use with this context
	// +optional
	Manifest string `json:"manifest,omitempty"`

	// Management configuration which will be used for all hosts in the cluster
	ManagementConfiguration string `json:"managementConfiguration"`
}

Context is a tuple of references to a cluster (how do I communicate with a kubernetes context), a user (how do I identify myself), and a namespace (what subset of resources do I want to work with)

func NewContext

func NewContext() *Context

NewContext is a convenience function that returns a new Context

func (*Context) String

func (c *Context) String() string

type ContextOption

type ContextOption func(ctx *Context)

ContextOption is a function that allows to modify context object

func SetContextManagementConfig

func SetContextManagementConfig(managementConfig string) ContextOption

SetContextManagementConfig sets management config in context object

func SetContextManifest

func SetContextManifest(manifest string) ContextOption

SetContextManifest sets manifest in context object

type ContextOptions

type ContextOptions struct {
	Name                    string
	CurrentContext          bool
	Manifest                string
	Current                 bool
	ManagementConfiguration string
	Format                  string
}

ContextOptions holds all configurable options for context

func (*ContextOptions) Print

func (o *ContextOptions) Print(cfg *Config, w io.Writer) error

Print prints the config contexts using one of formats `yaml` or `table` to a given output

func (*ContextOptions) Validate

func (o *ContextOptions) Validate() error

Validate checks for the possible context option values and returns Error when invalid value or incompatible choice of values given

type ErrAuthTypeNotSupported

type ErrAuthTypeNotSupported struct {
}

ErrAuthTypeNotSupported is returned when wrong AuthType is provided

func (ErrAuthTypeNotSupported) Error

func (e ErrAuthTypeNotSupported) Error() string

type ErrCheckFile

type ErrCheckFile struct {
	FlagName    string
	Path        string
	InternalErr error
}

ErrCheckFile is returned if there is error when checking file on FS

func (ErrCheckFile) Error

func (e ErrCheckFile) Error() string

type ErrConfigFailed

type ErrConfigFailed struct {
}

ErrConfigFailed returned in case of failure during configuration

func (ErrConfigFailed) Error

func (e ErrConfigFailed) Error() string

type ErrConfigFileExists

type ErrConfigFileExists struct {
	Path string
}

ErrConfigFileExists is returned when there is an existing file at specified location

func (ErrConfigFileExists) Error

func (e ErrConfigFileExists) Error() string

type ErrConflictingAuthOptions

type ErrConflictingAuthOptions struct {
}

ErrConflictingAuthOptions returned in case both token and username/password is set at same time

func (ErrConflictingAuthOptions) Error

type ErrConflictingClusterOptions

type ErrConflictingClusterOptions struct {
}

ErrConflictingClusterOptions returned when both certificate-authority and insecure-skip-tls-verify is set at same time

func (ErrConflictingClusterOptions) Error

type ErrConflictingContextOptions

type ErrConflictingContextOptions struct {
}

ErrConflictingContextOptions returned when both context and --current is set at same time

func (ErrConflictingContextOptions) Error

type ErrDecodingCredentials

type ErrDecodingCredentials struct {
	Given string
}

ErrDecodingCredentials returned when the given string cannot be decoded

func (ErrDecodingCredentials) Error

func (e ErrDecodingCredentials) Error() string

type ErrEmptyContextName

type ErrEmptyContextName struct {
}

ErrEmptyContextName returned when empty context name is set

func (ErrEmptyContextName) Error

func (e ErrEmptyContextName) Error() string

type ErrEmptyManagementConfigurationName

type ErrEmptyManagementConfigurationName struct {
}

ErrEmptyManagementConfigurationName returned when attempted to create/modify management config with empty name

func (ErrEmptyManagementConfigurationName) Error

type ErrIncompatibleAuthOptions

type ErrIncompatibleAuthOptions struct {
	ForbiddenOptions []string
	AuthType         string
}

ErrIncompatibleAuthOptions is returned when incompatible AuthTypes are provided

func (ErrIncompatibleAuthOptions) Error

Error of type ErrIncompatibleAuthOptions is returned when ssh-pass type is selected and http-pass, ssh-key or key-pass options are defined

type ErrInvalidConfig

type ErrInvalidConfig struct {
	What string
}

ErrInvalidConfig returned in case of incorrect configuration

func (ErrInvalidConfig) Error

func (e ErrInvalidConfig) Error() string

type ErrManagementConfigurationNotFound

type ErrManagementConfigurationNotFound struct {
	Name string
}

ErrManagementConfigurationNotFound describes a situation in which a user has attempted to reference a management configuration that cannot be referenced.

func (ErrManagementConfigurationNotFound) Error

type ErrMissingConfig

type ErrMissingConfig struct {
	What string
}

ErrMissingConfig returned in case of missing configuration

func (ErrMissingConfig) Error

func (e ErrMissingConfig) Error() string

type ErrMissingCurrentContext

type ErrMissingCurrentContext struct {
}

ErrMissingCurrentContext returned in case --current used without setting current-context

func (ErrMissingCurrentContext) Error

func (e ErrMissingCurrentContext) Error() string

type ErrMissingFlag

type ErrMissingFlag struct {
	FlagName string
}

ErrMissingFlag is returned when flag is not provided

func (ErrMissingFlag) Error

func (e ErrMissingFlag) Error() string

type ErrMissingManagementConfiguration

type ErrMissingManagementConfiguration struct {
	// contains filtered or unexported fields
}

ErrMissingManagementConfiguration means the management configuration was not defined for the active cluster.

func (ErrMissingManagementConfiguration) Error

type ErrMissingManifestName

type ErrMissingManifestName struct {
}

ErrMissingManifestName is returned when manifest name is empty

func (ErrMissingManifestName) Error

func (e ErrMissingManifestName) Error() string

type ErrMissingPhaseDocument

type ErrMissingPhaseDocument struct {
	PhaseName string
}

ErrMissingPhaseDocument returned when appropriate Phase document was not found in the filesystem

func (ErrMissingPhaseDocument) Error

func (e ErrMissingPhaseDocument) Error() string

type ErrMissingPhaseRepo

type ErrMissingPhaseRepo struct {
}

ErrMissingPhaseRepo returned when Phase Repository is not set in context manifest

func (ErrMissingPhaseRepo) Error

func (e ErrMissingPhaseRepo) Error() string

type ErrMissingRepoCheckoutOptions

type ErrMissingRepoCheckoutOptions struct {
}

ErrMissingRepoCheckoutOptions is returned if repository checkout options is empty in set-manifest

func (ErrMissingRepoCheckoutOptions) Error

type ErrMissingRepoURL

type ErrMissingRepoURL struct {
}

ErrMissingRepoURL is returned if repository is empty when using --phase in set-manifest

func (ErrMissingRepoURL) Error

func (e ErrMissingRepoURL) Error() string

type ErrMissingRepositoryName

type ErrMissingRepositoryName struct {
	RepoType string
}

ErrMissingRepositoryName is returned if repository name is empty when using in set-manifest

func (ErrMissingRepositoryName) Error

func (e ErrMissingRepositoryName) Error() string

type ErrMutuallyExclusiveCheckout

type ErrMutuallyExclusiveCheckout struct {
}

ErrMutuallyExclusiveCheckout is returned if mutually exclusive options are given as checkout options

func (ErrMutuallyExclusiveCheckout) Error

type ErrRepoSpecRequiresURL

type ErrRepoSpecRequiresURL struct {
}

ErrRepoSpecRequiresURL is returned when repository URL is not specified

func (ErrRepoSpecRequiresURL) Error

func (e ErrRepoSpecRequiresURL) Error() string

type ErrRepositoryNotFound

type ErrRepositoryNotFound struct {
	Name string
}

ErrRepositoryNotFound is returned if repository is empty when using in set-manifest

func (ErrRepositoryNotFound) Error

func (e ErrRepositoryNotFound) Error() string

type ErrUnknownManagementType

type ErrUnknownManagementType struct {
	Type string
}

ErrUnknownManagementType describes a situation in which an unknown management type is listed in the airshipctl config.

func (ErrUnknownManagementType) Error

func (e ErrUnknownManagementType) Error() string

type ErrWrongOutputFormat

type ErrWrongOutputFormat struct {
	Wrong    string
	Possible []string
}

ErrWrongOutputFormat is returned when unknown output format is defined for printing config

func (ErrWrongOutputFormat) Error

func (e ErrWrongOutputFormat) Error() string

type Factory

type Factory func() (*Config, error)

Factory is a function which returns ready to use config object and error (if any)

func CreateFactory

func CreateFactory(airshipConfigPath *string) Factory

CreateFactory returns function which creates ready to use Config object

type InventoryMeta

type InventoryMeta struct {
	Path string `json:"path,omitempty"`
}

InventoryMeta holds inventory metadata, this is to be extended in the future when we have more information how to handle non-baremetal inventories path is a kustomize entrypoint against which we will build bundle containing bmh hosts

type ManagementConfigOption

type ManagementConfigOption func(mgmtConf *ManagementConfiguration)

ManagementConfigOption is a function that allows to modify ManagementConfig object

func SetManagementConfigInsecure

func SetManagementConfigInsecure(insecure bool) ManagementConfigOption

SetManagementConfigInsecure sets Insecure option in ManagementConfig object

func SetManagementConfigMgmtType

func SetManagementConfigMgmtType(mgmtType string) ManagementConfigOption

SetManagementConfigMgmtType sets Type in ManagementConfig object

func SetManagementConfigSystemActionRetries

func SetManagementConfigSystemActionRetries(sysActionRetries int) ManagementConfigOption

SetManagementConfigSystemActionRetries sets SystemActionRetries in ManagementConfig object

func SetManagementConfigSystemRebootDelay

func SetManagementConfigSystemRebootDelay(sysRebootDelay int) ManagementConfigOption

SetManagementConfigSystemRebootDelay sets SystemRebootDelay in ManagementConfig object

func SetManagementConfigUseProxy

func SetManagementConfigUseProxy(useProxy bool) ManagementConfigOption

SetManagementConfigUseProxy sets UseProxy in ManagementConfig object

type ManagementConfiguration

type ManagementConfiguration struct {
	// Insecure indicates whether the SSL certificate should be checked on remote management requests.
	Insecure bool `json:"insecure,omitempty"`

	// SystemActionRetries is the number of attempts to poll a host for a status.
	SystemActionRetries int `json:"systemActionRetries,omitempty"`

	// SystemRebootDelay is the number of seconds to wait between power actions (e.g. shutdown, startup).
	SystemRebootDelay int `json:"systemRebootDelay,omitempty"`

	// Type the type of out-of-band management that will be used for baremetal orchestration, e.g. redfish.
	Type string `json:"type"`

	// UseProxy indicates whether airshipctl should transmit remote management requests through a proxy server when
	// one is configured in an environment.
	UseProxy bool `json:"useproxy,omitempty"`
}

ManagementConfiguration defines configuration data for all remote systems within a context.

func NewManagementConfiguration

func NewManagementConfiguration() *ManagementConfiguration

NewManagementConfiguration returns a management configuration with default values.

func (*ManagementConfiguration) SetType

func (m *ManagementConfiguration) SetType(managementType string) error

SetType is a helper function that sets and validates the management type.

func (*ManagementConfiguration) String

func (m *ManagementConfiguration) String() string

String converts a management configuration to a human-readable string.

func (*ManagementConfiguration) Validate

func (m *ManagementConfiguration) Validate() error

Validate validates that a management configuration is valid. Currently, this only checks the value of the management type as the other fields have appropriate zero values and may be omitted.

type Manifest

type Manifest struct {
	// PhaseRepositoryName is a name of the repo, that contains site/<site-name> directory
	// and is a starting point for building document bundle
	PhaseRepositoryName string `json:"phaseRepositoryName"`
	// InventoryRepositoryName is a name of the repo contains inventory objects
	// to be used mostly with baremetal deployments
	// If not defined PhaseRepositoryName will be used to locate inventory
	InventoryRepositoryName string `json:"inventoryRepositoryName"`
	// ExtraRepositories is the map of extra repositories addressable by a name
	Repositories map[string]*Repository `json:"repositories,omitempty"`
	// TargetPath Local Target path for working or home directory for all Manifest Cloned/Returned/Generated
	TargetPath string `json:"targetPath"`
	// MetadataPath path to a metadata file relative to TargetPath
	MetadataPath string `json:"metadataPath"`
}

Manifest is a tuple of references to a Manifest (how do Identify, collect , find the yaml manifests that airship uses to perform its operations)

func NewManifest

func NewManifest() *Manifest

NewManifest is a convenience function that returns a new Manifest object with non-nil maps

func (*Manifest) GetMetadataPath

func (m *Manifest) GetMetadataPath() string

GetMetadataPath returns MetadataPath field

func (*Manifest) GetTargetPath

func (m *Manifest) GetTargetPath() string

GetTargetPath returns TargetPath field

func (*Manifest) String

func (m *Manifest) String() string

Manifest functions

type ManifestOptions

type ManifestOptions struct {
	Name         string
	RepoName     string
	URL          string
	Branch       string
	CommitHash   string
	Tag          string
	Force        bool
	IsPhase      bool
	TargetPath   string
	MetadataPath string
}

ManifestOptions holds all configurable options for manifest configuration

func (*ManifestOptions) Validate

func (o *ManifestOptions) Validate() error

Validate checks for the possible manifest option values and returns Error when invalid value or incompatible choice of values given

type Metadata

type Metadata struct {
	Inventory *InventoryMeta `json:"inventory,omitempty"`
	PhaseMeta *PhaseMeta     `json:"phase,omitempty"`
}

Metadata holds entrypoints for phases, inventory and clusterctl

type Permissions

type Permissions struct {
	DirectoryPermission uint32
	FilePermission      uint32
}

Permissions has the permissions for file and directory

type PhaseMeta

type PhaseMeta struct {
	// path is a kustomize entrypoint against which we will build bundle with phase objects
	Path string `json:"path,omitempty"`
	// docEntryPointPrefix is the path prefix for documentEntryPoint field in the phase config
	// If it is defined in the manifest metadata then it will be prepended
	// to the documentEntryPoint defined in the phase itself. So in this case the full path will be
	// targetPath + phaseRepoDir + docEntryPointPrefix + documentEntryPoint
	// E.g. let
	// targetPath (defined in airship config file) be /tmp
	// phaseRepoDir (this is the last part of the repo url given in the airship config file) be reponame
	// docEntryPointPrefix (defined in metadata) be foo/bar and
	// documentEntryPoint (defined in a phase) be baz/xyz
	// then the full path to the document bundle will be /tmp/reponame/foo/bar/baz/xyz
	// If docEntryPointPrefix is empty or not given at all, then the full path will be
	// targetPath + phaseRepoDir + documentEntryPoint (in our case /tmp/reponame/baz/xyz)
	DocEntryPointPrefix string `json:"docEntryPointPrefix,omitempty"`
}

PhaseMeta holds phase metadata

type RepoAuth

type RepoAuth struct {
	// Type of authentication method to be used with given repository
	// supported types are "ssh-key", "ssh-pass", "http-basic", "none"
	Type string `json:"type,omitempty"`
	//KeyPassword is a password decrypt ssh private key (used with ssh-key auth type)
	KeyPassword string `json:"keyPass,omitempty"`
	// KeyPath is path to private ssh key on disk (used with ssh-key auth type)
	KeyPath string `json:"sshKey,omitempty"`
	//HTTPPassword is password for basic http authentication (used with http-basic auth type)
	HTTPPassword string `json:"httpPass,omitempty"`
	// SSHPassword is password for ssh password authentication (used with ssh-pass)
	SSHPassword string `json:"sshPass,omitempty"`
	// Username to authenticate against git remote (used with any type)
	Username string `json:"username,omitempty"`
}

RepoAuth struct describes method of authentication against given repository

func (*RepoAuth) String

func (auth *RepoAuth) String() string

String returns repository authentication details in string format

func (*RepoAuth) Validate

func (auth *RepoAuth) Validate() error

Validate checks for possible values for repository authentication and returns Error for incorrect values returns nil when there are no errors

type RepoCheckout

type RepoCheckout struct {
	// CommitHash is full hash of the commit that will be used to checkout
	CommitHash string `json:"commitHash"`
	// Branch is the branch name to checkout
	Branch string `json:"branch"`
	// Tag is the tag name to checkout
	Tag string `json:"tag"`
	// Ref is the ref to checkout
	// for example refs/changes/04/691202/5
	Ref string `json:"ref,omitempty"`
	// ForceCheckout is a boolean to indicate whether to use the `--force` option when checking out
	ForceCheckout bool `json:"force"`
	// LocalBranch is a boolean to indicate whether the Branch is local one. False by default
	LocalBranch bool `json:"localBranch"`
}

RepoCheckout container holds information how to checkout repository Each field is mutually exclusive

func (*RepoCheckout) String

func (c *RepoCheckout) String() string

func (*RepoCheckout) Validate

func (c *RepoCheckout) Validate() error

Validate checks for possible values for repository checkout and returns Error for incorrect values returns nil when there are no errors

type RepoFetch

type RepoFetch struct {
	// RemoteRefSpec is used for remote fetches such as gerrit change
	// requests and github pull requests. The format of the refspec is an
	// optional +, followed by <src>:<dst>, where <src> is the pattern for
	// references on the remote side and <dst> is where those references
	// will be written locally. The + tells Git to update the reference
	// even if it isn't a fast-forward.
	// eg.: refs/changes/04/691202/5:refs/changes/04/691202/5
	RemoteRefSpec string `json:"remoteRefSpec,omitempty"`
}

RepoFetch holds information on which remote ref to fetch

func (*RepoFetch) Validate

func (rf *RepoFetch) Validate() error

Validate verifies that the remote refspec is valid. If a remote refspec was not supplied, Validate does nothing.

type Repository

type Repository struct {
	// URLString for Repository
	URLString string `json:"url"`
	// Auth holds authentication options against remote
	Auth *RepoAuth `json:"auth,omitempty"`
	// CheckoutOptions holds options to checkout repository
	CheckoutOptions *RepoCheckout `json:"checkout,omitempty"`
	// FetchOptions holds options for fetching remote refs
	FetchOptions *RepoFetch `json:"fetch,omitempty"`
}

Repository struct holds the information for the remote sources of manifest yaml documents. Information such as location, authentication info, as well as details of what to get such as branch, tag, commit it, etc.

func NewRepository

func NewRepository() *Repository

NewRepository is a convenience function that returns a new Repository

func (*Repository) String

func (repo *Repository) String() string

String returns repository details in a string format

func (*Repository) ToAuth

func (repo *Repository) ToAuth() (transport.AuthMethod, error)

ToAuth returns an implementation of transport.AuthMethod for the given auth type to establish an ssh connection

func (*Repository) ToCheckoutOptions

func (repo *Repository) ToCheckoutOptions() *git.CheckoutOptions

ToCheckoutOptions returns an instance of git.CheckoutOptions with respective values(Branch/Tag/Hash) in checkout options initialized CheckoutOptions describes how a checkout operation should be performed

func (*Repository) ToCloneOptions

func (repo *Repository) ToCloneOptions(auth transport.AuthMethod) *git.CloneOptions

ToCloneOptions returns an instance of git.CloneOptions with authentication and URL set CloneOptions describes how a clone should be performed

func (*Repository) ToFetchOptions

func (repo *Repository) ToFetchOptions(auth transport.AuthMethod) *git.FetchOptions

ToFetchOptions returns an instance of git.FetchOptions for given authentication FetchOptions describes how a fetch should be performed

func (*Repository) URL

func (repo *Repository) URL() string

URL returns the repository URL in a string format

func (*Repository) Validate

func (repo *Repository) Validate() error

Validate check possible values for repository and returns Error when incorrect value is given returns nil when there are no errors

type RunSetContextOptions

type RunSetContextOptions struct {
	CfgFactory Factory
	CtxName    string
	Current    bool
	Writer     io.Writer
}

RunSetContextOptions are options required to create/modify airshipctl context

func (*RunSetContextOptions) RunSetContext

func (o *RunSetContextOptions) RunSetContext(opts ...ContextOption) error

RunSetContext validates the given command line options and invokes AddContext/ModifyContext

type RunSetManagementConfigOptions

type RunSetManagementConfigOptions struct {
	CfgFactory  Factory
	MgmtCfgName string
	Writer      io.Writer
}

RunSetManagementConfigOptions are options required to create/modify airshipctl management config

func (*RunSetManagementConfigOptions) RunSetManagementConfig

func (o *RunSetManagementConfigOptions) RunSetManagementConfig(opts ...ManagementConfigOption) error

RunSetManagementConfig validates the given command line options and invokes add/modify ManagementConfig

Jump to

Keyboard shortcuts

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