Documentation ¶
Index ¶
- Constants
- Variables
- func BindMarketplaceFlags(clusterInfo *datactlapi.UploadAPI, flags *pflag.FlagSet, ...)
- func BindOverrideFlags(overrides *ConfigOverrides, flags *pflag.FlagSet, ...)
- func LoadFromFile(filename string) (*clientcmdapi.Config, error)
- func ModifyConfig(configAccess ConfigAccess, newConfig datactlapi.Config, relativizePaths bool) error
- func Write(config datactlapi.Config) ([]byte, error)
- func WriteToFile(config datactlapi.Config, filename string) error
- type ClientConfig
- type ClientConfigLoader
- type ClientConfigLoadingRules
- func (rules *ClientConfigLoadingRules) GetDefaultFilename() string
- func (rules *ClientConfigLoadingRules) GetExplicitFile() string
- func (rules *ClientConfigLoadingRules) GetLoadingPrecedence() []string
- func (rules *ClientConfigLoadingRules) GetStartingConfig() (*clientcmdapi.Config, error)
- func (rules *ClientConfigLoadingRules) IsDefaultConfig(config *datactlapi.Config) bool
- func (rules *ClientConfigLoadingRules) IsExplicitFile() bool
- func (rules *ClientConfigLoadingRules) Load() (*clientcmdapi.Config, error)
- type ConfigAccess
- type ConfigFlags
- func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet)
- func (f *ConfigFlags) ConfigAccess() ConfigAccess
- func (f *ConfigFlags) DataServiceClient(source api.Source) (dataservice.Client, error)
- func (f *ConfigFlags) IlmtClient(source api.Source) (ilmt.Client, error)
- func (f *ConfigFlags) MarketplaceClient() (marketplace.Client, error)
- func (f *ConfigFlags) MeteringExport() (*datactlapi.MeteringExport, error)
- func (f *ConfigFlags) RawPersistentConfigLoader() ClientConfig
- type ConfigOverrideFlags
- type ConfigOverrides
- type DeferredLoadingClientConfig
- func (config *DeferredLoadingClientConfig) ConfigAccess() ConfigAccess
- func (config *DeferredLoadingClientConfig) DataServiceClientConfig(source api.Source) (*dataservice.DataServiceConfig, error)
- func (config *DeferredLoadingClientConfig) IlmtClientConfig(source api.Source) (*ilmt.IlmtConfig, error)
- func (config *DeferredLoadingClientConfig) MarketplaceClientConfig() (*marketplace.MarketplaceConfig, error)
- func (config *DeferredLoadingClientConfig) MeteringExport() (*datactlapi.MeteringExport, error)
- func (config *DeferredLoadingClientConfig) RawConfig() (*datactlapi.Config, error)
- type DirectClientConfig
- func (config *DirectClientConfig) ConfigAccess() ConfigAccess
- func (config *DirectClientConfig) DataServiceClientConfig(source api.Source) (*dataservice.DataServiceConfig, error)
- func (config *DirectClientConfig) IlmtClientConfig(source api.Source) (*ilmt.IlmtConfig, error)
- func (config *DirectClientConfig) MarketplaceClientConfig() (*marketplace.MarketplaceConfig, error)
- func (config *DirectClientConfig) MeteringExport() (*datactlapi.MeteringExport, error)
- func (config *DirectClientConfig) RawConfig() (*datactlapi.Config, error)
- type MarketplaceOverrideFlags
- type ModifyableConfig
Constants ¶
const ( RecommendedConfigPathFlag = "datactl-config" RecommendedConfigPathEnvVar = "DATACTL_CONFIG" RecommendedHomeDir = ".datactl" RecommendedFileName = "config" RecommendedSchemaName = "schema" RecommendedDataName = "data" )
const ( FlagMarketplaceHost = "upload-api-host" FlagContext = "context" FlagTimeout = "request-timeout" )
Variables ¶
var ( RecommendedConfigDir = filepath.Join(homedir.HomeDir(), RecommendedHomeDir) RecommendedHomeFile = filepath.Join(RecommendedConfigDir, RecommendedFileName) RecommendedSchemaFile = filepath.Join(RecommendedConfigDir, RecommendedSchemaName) RecommendedDataDir = filepath.Join(RecommendedConfigDir, RecommendedDataName) )
var ( // UseModifyConfigLock ensures that access to kubeconfig file using ModifyConfig method // is being guarded by a lock file. // This variable is intentionaly made public so other consumers of this library // can modify its default behavior, but be caution when disabling it since // this will make your code not threadsafe. UseModifyConfigLock = true )
Functions ¶
func BindMarketplaceFlags ¶
func BindMarketplaceFlags(clusterInfo *datactlapi.UploadAPI, flags *pflag.FlagSet, flagNames MarketplaceOverrideFlags)
func BindOverrideFlags ¶
func BindOverrideFlags(overrides *ConfigOverrides, flags *pflag.FlagSet, flagNames ConfigOverrideFlags)
func LoadFromFile ¶
func LoadFromFile(filename string) (*clientcmdapi.Config, error)
func ModifyConfig ¶
func ModifyConfig(configAccess ConfigAccess, newConfig datactlapi.Config, relativizePaths bool) error
func Write ¶
func Write(config datactlapi.Config) ([]byte, error)
Write serializes the config to yaml. Encapsulates serialization without assuming the destination is a file.
func WriteToFile ¶
func WriteToFile(config datactlapi.Config, filename string) error
WriteToFile serializes the config to yaml and writes it out to a file. If not present, it creates the file with the mode 0600. If it is present it stomps the contents
Types ¶
type ClientConfig ¶
type ClientConfig interface { // RawConfig returns the merged result of all overrides RawConfig() (*datactlapi.Config, error) MarketplaceClientConfig() (*marketplace.MarketplaceConfig, error) DataServiceClientConfig(source api.Source) (*dataservice.DataServiceConfig, error) IlmtClientConfig(source api.Source) (*ilmt.IlmtConfig, error) MeteringExport() (*datactlapi.MeteringExport, error) ConfigAccess() ConfigAccess }
func NewNonInteractiveClientConfig ¶
func NewNonInteractiveClientConfig(config datactlapi.Config, contextName string, overrides *ConfigOverrides, configAccess ConfigAccess, kubectl *genericclioptions.ConfigFlags) ClientConfig
func NewNonInteractiveDeferredLoadingClientConfig ¶
func NewNonInteractiveDeferredLoadingClientConfig(loader ClientConfigLoader, overrides *ConfigOverrides, kubectl *genericclioptions.ConfigFlags) ClientConfig
type ClientConfigLoader ¶
type ClientConfigLoader interface { // Load returns the latest config Load() (*clientcmdapi.Config, error) ConfigAccess }
type ClientConfigLoadingRules ¶
type ClientConfigLoadingRules struct { ExplicitFile string ExplicitPath string Precedence []string DoNotResolvePaths bool WarnIfAllMissing bool }
func NewDefaultClientConfigLoadingRules ¶
func NewDefaultClientConfigLoadingRules() *ClientConfigLoadingRules
func (*ClientConfigLoadingRules) GetDefaultFilename ¶
func (rules *ClientConfigLoadingRules) GetDefaultFilename() string
GetDefaultFilename implements ConfigAccess
func (*ClientConfigLoadingRules) GetExplicitFile ¶
func (rules *ClientConfigLoadingRules) GetExplicitFile() string
GetExplicitFile implements ConfigAccess
func (*ClientConfigLoadingRules) GetLoadingPrecedence ¶
func (rules *ClientConfigLoadingRules) GetLoadingPrecedence() []string
GetLoadingPrecedence implements ConfigAccess
func (*ClientConfigLoadingRules) GetStartingConfig ¶
func (rules *ClientConfigLoadingRules) GetStartingConfig() (*clientcmdapi.Config, error)
GetStartingConfig implements ConfigAccess
func (*ClientConfigLoadingRules) IsDefaultConfig ¶
func (rules *ClientConfigLoadingRules) IsDefaultConfig(config *datactlapi.Config) bool
IsDefaultConfig returns true if the provided configuration matches the default
func (*ClientConfigLoadingRules) IsExplicitFile ¶
func (rules *ClientConfigLoadingRules) IsExplicitFile() bool
IsExplicitFile implements ConfigAccess
func (*ClientConfigLoadingRules) Load ¶
func (rules *ClientConfigLoadingRules) Load() (*clientcmdapi.Config, error)
type ConfigAccess ¶
type ConfigAccess interface { // GetLoadingPrecedence returns the slice of files that should be used for loading and inspecting the config GetLoadingPrecedence() []string // GetStartingConfig returns the config that subcommands should being operating against. It may or may not be merged depending on loading rules GetStartingConfig() (*datactlapi.Config, error) // GetDefaultFilename returns the name of the file you should write into (create if necessary), if you're trying to create a new stanza as opposed to updating an existing one. GetDefaultFilename() string // IsExplicitFile indicates whether or not this command is interested in exactly one file. This implementation only ever does that via a flag, but implementations that handle local, global, and flags may have more IsExplicitFile() bool // GetExplicitFile returns the particular file this command is operating against. This implementation only ever has one, but implementations that handle local, global, and flags may have more GetExplicitFile() string }
ConfigAccess is used by subcommands and methods in this package to load and modify the appropriate config files
type ConfigFlags ¶
type ConfigFlags struct { DATACTLConfig *string // config flags MarketplaceHost *string MarketplaceToken *string // TLS config MinVersion *string CipherSuites *[]string // export flags ExportFileName *string // dataservice DataServiceCAFile *string KubectlConfig *genericclioptions.ConfigFlags // contains filtered or unexported fields }
func NewConfigFlags ¶
func NewConfigFlags(kubeFlags *genericclioptions.ConfigFlags) *ConfigFlags
func (*ConfigFlags) AddFlags ¶
func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet)
func (*ConfigFlags) ConfigAccess ¶
func (f *ConfigFlags) ConfigAccess() ConfigAccess
func (*ConfigFlags) DataServiceClient ¶
func (f *ConfigFlags) DataServiceClient(source api.Source) (dataservice.Client, error)
func (*ConfigFlags) IlmtClient ¶ added in v0.3.0
func (*ConfigFlags) MarketplaceClient ¶
func (f *ConfigFlags) MarketplaceClient() (marketplace.Client, error)
func (*ConfigFlags) MeteringExport ¶
func (f *ConfigFlags) MeteringExport() (*datactlapi.MeteringExport, error)
func (*ConfigFlags) RawPersistentConfigLoader ¶
func (f *ConfigFlags) RawPersistentConfigLoader() ClientConfig
type ConfigOverrideFlags ¶
type ConfigOverrideFlags struct { Marketplace MarketplaceOverrideFlags CurrentContext clientcmd.FlagInfo Timeout clientcmd.FlagInfo // TLS MinVersion clientcmd.FlagInfo CipherSuites clientcmd.FlagInfo }
func RecommendedConfigOverrideFlags ¶
func RecommendedConfigOverrideFlags(prefix string) ConfigOverrideFlags
type ConfigOverrides ¶
type DeferredLoadingClientConfig ¶
type DeferredLoadingClientConfig struct {
// contains filtered or unexported fields
}
func (*DeferredLoadingClientConfig) ConfigAccess ¶
func (config *DeferredLoadingClientConfig) ConfigAccess() ConfigAccess
func (*DeferredLoadingClientConfig) DataServiceClientConfig ¶
func (config *DeferredLoadingClientConfig) DataServiceClientConfig(source api.Source) (*dataservice.DataServiceConfig, error)
func (*DeferredLoadingClientConfig) IlmtClientConfig ¶ added in v0.3.0
func (config *DeferredLoadingClientConfig) IlmtClientConfig(source api.Source) (*ilmt.IlmtConfig, error)
func (*DeferredLoadingClientConfig) MarketplaceClientConfig ¶
func (config *DeferredLoadingClientConfig) MarketplaceClientConfig() (*marketplace.MarketplaceConfig, error)
func (*DeferredLoadingClientConfig) MeteringExport ¶
func (config *DeferredLoadingClientConfig) MeteringExport() (*datactlapi.MeteringExport, error)
func (*DeferredLoadingClientConfig) RawConfig ¶
func (config *DeferredLoadingClientConfig) RawConfig() (*datactlapi.Config, error)
type DirectClientConfig ¶
type DirectClientConfig struct {
// contains filtered or unexported fields
}
DirectClientConfig is a ClientConfig interface that is backed by a clientcmdapi.Config, options overrides, and an optional fallbackReader for auth information. Is responsible for generating the result.
func (*DirectClientConfig) ConfigAccess ¶
func (config *DirectClientConfig) ConfigAccess() ConfigAccess
func (*DirectClientConfig) DataServiceClientConfig ¶
func (config *DirectClientConfig) DataServiceClientConfig(source api.Source) (*dataservice.DataServiceConfig, error)
func (*DirectClientConfig) IlmtClientConfig ¶ added in v0.3.0
func (config *DirectClientConfig) IlmtClientConfig(source api.Source) (*ilmt.IlmtConfig, error)
func (*DirectClientConfig) MarketplaceClientConfig ¶
func (config *DirectClientConfig) MarketplaceClientConfig() (*marketplace.MarketplaceConfig, error)
func (*DirectClientConfig) MeteringExport ¶
func (config *DirectClientConfig) MeteringExport() (*datactlapi.MeteringExport, error)
func (*DirectClientConfig) RawConfig ¶
func (config *DirectClientConfig) RawConfig() (*datactlapi.Config, error)
type MarketplaceOverrideFlags ¶
func RecommendMarketplaceOverrideFlags ¶
func RecommendMarketplaceOverrideFlags(prefix string) MarketplaceOverrideFlags
type ModifyableConfig ¶ added in v0.3.0
type ModifyableConfig struct { *datactlapi.Config // contains filtered or unexported fields }
func (*ModifyableConfig) Save ¶ added in v0.3.0
func (m *ModifyableConfig) Save() error