本文整理匯總了Golang中github.com/openshift/origin/pkg/generate/app/cmd.AppConfig.SecretAccessor方法的典型用法代碼示例。如果您正苦於以下問題:Golang AppConfig.SecretAccessor方法的具體用法?Golang AppConfig.SecretAccessor怎麽用?Golang AppConfig.SecretAccessor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/openshift/origin/pkg/generate/app/cmd.AppConfig
的用法示例。
在下文中一共展示了AppConfig.SecretAccessor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setupAppConfig
func setupAppConfig(f *clientcmd.Factory, out io.Writer, c *cobra.Command, args []string, config *newcmd.AppConfig) error {
namespace, _, err := f.DefaultNamespace()
if err != nil {
return err
}
dockerClient, _, err := dockerutil.NewHelper().GetClient()
if err == nil {
if err = dockerClient.Ping(); err == nil {
config.SetDockerClient(dockerClient)
} else {
glog.V(4).Infof("Docker client did not respond to a ping: %v", err)
}
}
if err != nil {
glog.V(2).Infof("No local Docker daemon detected: %v", err)
}
osclient, kclient, err := f.Clients()
if err != nil {
return err
}
config.KubeClient = kclient
config.SetOpenShiftClient(osclient, namespace)
// Only output="" should print descriptions of intermediate steps. Everything
// else should print only some specific output (json, yaml, go-template, ...)
output := cmdutil.GetFlagString(c, "output")
if len(output) == 0 {
config.Out = out
} else {
config.Out = ioutil.Discard
}
config.ErrOut = c.Out()
if config.AllowSecretUse {
cfg, err := f.OpenShiftClientConfig.ClientConfig()
if err != nil {
return err
}
config.SecretAccessor = newConfigSecretRetriever(cfg)
}
unknown := config.AddArguments(args)
if len(unknown) != 0 {
return cmdutil.UsageError(c, "Did not recognize the following arguments: %v", unknown)
}
if config.AllowMissingImages && config.AsSearch {
return cmdutil.UsageError(c, "--allow-missing-images and --search are mutually exclusive.")
}
if len(config.SourceImage) != 0 && len(config.SourceImagePath) == 0 {
return cmdutil.UsageError(c, "--source-image-path must be specified when --source-image is specified.")
}
if len(config.SourceImage) == 0 && len(config.SourceImagePath) != 0 {
return cmdutil.UsageError(c, "--source-image must be specified when --source-image-path is specified.")
}
return nil
}
示例2: CompleteAppConfig
func CompleteAppConfig(config *newcmd.AppConfig, f *clientcmd.Factory, c *cobra.Command, args []string) error {
mapper, typer := f.Object(false)
if config.Mapper == nil {
config.Mapper = mapper
}
if config.Typer == nil {
config.Typer = typer
}
if config.ClientMapper == nil {
config.ClientMapper = resource.ClientMapperFunc(f.ClientForMapping)
}
namespace, _, err := f.DefaultNamespace()
if err != nil {
return err
}
osclient, _, kclient, err := f.Clients()
if err != nil {
return err
}
config.KubeClient = kclient
dockerClient, _ := getDockerClient()
config.SetOpenShiftClient(osclient, namespace, dockerClient)
if config.AllowSecretUse {
cfg, err := f.OpenShiftClientConfig.ClientConfig()
if err != nil {
return err
}
config.SecretAccessor = newConfigSecretRetriever(cfg)
}
unknown := config.AddArguments(args)
if len(unknown) != 0 {
return kcmdutil.UsageError(c, "Did not recognize the following arguments: %v", unknown)
}
if config.AllowMissingImages && config.AsSearch {
return kcmdutil.UsageError(c, "--allow-missing-images and --search are mutually exclusive.")
}
if len(config.SourceImage) != 0 && len(config.SourceImagePath) == 0 {
return kcmdutil.UsageError(c, "--source-image-path must be specified when --source-image is specified.")
}
if len(config.SourceImage) == 0 && len(config.SourceImagePath) != 0 {
return kcmdutil.UsageError(c, "--source-image must be specified when --source-image-path is specified.")
}
if config.BinaryBuild && config.Strategy == generate.StrategyPipeline {
return kcmdutil.UsageError(c, "specifying binary builds and the pipeline strategy at the same time is not allowed.")
}
return nil
}
示例3: setupAppConfig
func setupAppConfig(f *clientcmd.Factory, out io.Writer, c *cobra.Command, args []string, config *newcmd.AppConfig) error {
namespace, _, err := f.DefaultNamespace()
if err != nil {
return err
}
dockerClient, _, err := dockerutil.NewHelper().GetClient()
if err == nil {
if err = dockerClient.Ping(); err == nil {
config.SetDockerClient(dockerClient)
} else {
glog.V(4).Infof("Docker client did not respond to a ping: %v", err)
}
}
if err != nil {
glog.V(2).Infof("No local Docker daemon detected: %v", err)
}
osclient, kclient, err := f.Clients()
if err != nil {
return err
}
config.KubeClient = kclient
config.SetOpenShiftClient(osclient, namespace)
config.Out = out
config.ErrOut = c.Out()
if config.AllowSecretUse {
cfg, err := f.OpenShiftClientConfig.ClientConfig()
if err != nil {
return err
}
config.SecretAccessor = newConfigSecretRetriever(cfg)
}
unknown := config.AddArguments(args)
if len(unknown) != 0 {
return cmdutil.UsageError(c, "Did not recognize the following arguments: %v", unknown)
}
if config.AllowMissingImages && config.AsSearch {
return cmdutil.UsageError(c, "--allow-missing-images and --search are mutually exclusive.")
}
return nil
}