Codota Logo
Config.getUsername
Code IndexAdd Codota to your IDE (free)

How to use
getUsername
method
in
io.fabric8.kubernetes.client.Config

Best Java code snippets using io.fabric8.kubernetes.client.Config.getUsername (Showing top 17 results out of 315)

  • Common ways to obtain Config
private void myMethod () {
Config c =
  • Codota IconString str;new ConfigBuilder().withMasterUrl(str).build()
  • Codota Iconnew Config()
  • Codota Iconnew ConfigBuilder().build()
  • Smart code suggestions by Codota
}
origin: fabric8io/kubernetes-client

 @Override
 public Response intercept(Chain chain) throws IOException {
  Request request = chain.request();
  if (Utils.isNotNullOrEmpty(config.getUsername()) && Utils.isNotNullOrEmpty(config.getPassword())) {
   Request authReq = chain.request().newBuilder().addHeader("Authorization", Credentials.basic(config.getUsername(), config.getPassword())).build();
   return chain.proceed(authReq);
  } else if (Utils.isNotNullOrEmpty(config.getOauthToken())) {
   Request authReq = chain.request().newBuilder().addHeader("Authorization", "Bearer " + config.getOauthToken()).build();
   return chain.proceed(authReq);
  }
  return chain.proceed(request);
 }
}).addInterceptor(new ImpersonatorInterceptor(config))
origin: spring-cloud/spring-cloud-kubernetes

    base.getNamespace()))
.withUsername(
    or(kubernetesClientProperties.getUsername(), base.getUsername()))
.withPassword(
    or(kubernetesClientProperties.getPassword(), base.getPassword()))
origin: fabric8io/kubernetes-client

config.setUsername(Utils.getSystemPropertyOrEnvVar(KUBERNETES_AUTH_BASIC_USERNAME_SYSTEM_PROPERTY, config.getUsername()));
config.setPassword(Utils.getSystemPropertyOrEnvVar(KUBERNETES_AUTH_BASIC_PASSWORD_SYSTEM_PROPERTY, config.getPassword()));
origin: fabric8io/kubernetes-client

@Test
public void shouldInstantiateClientUsingSerializeDeserialize() throws MalformedURLException {
 DefaultKubernetesClient original = new DefaultKubernetesClient();
 String json = Serialization.asJson(original.getConfiguration());
 DefaultKubernetesClient copy = DefaultKubernetesClient.fromConfig(json);
 Assert.assertEquals(original.getConfiguration().getMasterUrl(), copy.getConfiguration().getMasterUrl());
 Assert.assertEquals(original.getConfiguration().getOauthToken(), copy.getConfiguration().getOauthToken());
 Assert.assertEquals(original.getConfiguration().getNamespace(), copy.getConfiguration().getNamespace());
 Assert.assertEquals(original.getConfiguration().getUsername(), copy.getConfiguration().getUsername());
 Assert.assertEquals(original.getConfiguration().getPassword(), copy.getConfiguration().getPassword());
}
origin: fabric8io/kubernetes-client

 @Test
 public void shouldInstantiateClientUsingSerializeDeserialize() throws MalformedURLException {
  DefaultOpenShiftClient original = new DefaultOpenShiftClient();
  String json = Serialization.asJson(original.getConfiguration());
  DefaultOpenShiftClient copy = DefaultOpenShiftClient.fromConfig(json);

  Assert.assertEquals(original.getConfiguration().getMasterUrl(), copy.getConfiguration().getMasterUrl());
  Assert.assertEquals(original.getConfiguration().getOauthToken(), copy.getConfiguration().getOauthToken());
  Assert.assertEquals(original.getConfiguration().getNamespace(), copy.getConfiguration().getNamespace());
  Assert.assertEquals(original.getConfiguration().getUsername(), copy.getConfiguration().getUsername());
  Assert.assertEquals(original.getConfiguration().getPassword(), copy.getConfiguration().getPassword());
 }
}
origin: org.domeos/kubernetes-client

 @Override
 public Response intercept(Chain chain) throws IOException {
  Request request = chain.request();
  if (isNotNullOrEmpty(config.getUsername()) && isNotNullOrEmpty(config.getPassword())) {
   Request authReq = chain.request().newBuilder().addHeader("Authorization", Credentials.basic(config.getUsername(), config.getPassword())).build();
   return chain.proceed(authReq);
  } else if (isNotNullOrEmpty(config.getOauthToken())) {
   Request authReq = chain.request().newBuilder().addHeader("Authorization", "Bearer " + config.getOauthToken()).build();
   return chain.proceed(authReq);
  }
  return chain.proceed(request);
 }
});
origin: fabric8io/spring-cloud-kubernetes

@Bean
@ConditionalOnMissingBean(Config.class)
public Config kubernetesClientConfig(KubernetesClientProperties kubernetesClientProperties) {
  Config base = new Config();
  Config properties = new ConfigBuilder(base)
      //Only set values that have been explicitly specified
      .withMasterUrl(or(kubernetesClientProperties.getMasterUrl(), base.getMasterUrl()))
      .withApiVersion(or(kubernetesClientProperties.getApiVersion(), base.getApiVersion()))
      .withNamespace(or(kubernetesClientProperties.getNamespace(), base.getNamespace()))
      .withUsername(or(kubernetesClientProperties.getUsername(), base.getUsername()))
      .withPassword(or(kubernetesClientProperties.getPassword(), base.getPassword()))
      .withCaCertFile(or(kubernetesClientProperties.getCaCertFile(), base.getCaCertFile()))
      .withCaCertData(or(kubernetesClientProperties.getCaCertData(), base.getCaCertData()))
      .withClientKeyFile(or(kubernetesClientProperties.getClientKeyFile(), base.getClientKeyFile()))
      .withClientKeyData(or(kubernetesClientProperties.getClientKeyData(), base.getClientKeyData()))
      .withClientCertFile(or(kubernetesClientProperties.getClientCertFile(), base.getClientCertFile()))
      .withClientCertData(or(kubernetesClientProperties.getClientCertData(), base.getClientCertData()))
      //No magic is done for the properties below so we leave them as is.
      .withClientKeyAlgo(or(kubernetesClientProperties.getClientKeyAlgo(), base.getClientKeyAlgo()))
      .withClientKeyPassphrase(or(kubernetesClientProperties.getClientKeyPassphrase(), base.getClientKeyPassphrase()))
      .withConnectionTimeout(or(kubernetesClientProperties.getConnectionTimeout(), base.getConnectionTimeout()))
      .withRequestTimeout(or(kubernetesClientProperties.getRequestTimeout(), base.getRequestTimeout()))
      .withRollingTimeout(or(kubernetesClientProperties.getRollingTimeout(), base.getRollingTimeout()))
      .withTrustCerts(or(kubernetesClientProperties.isTrustCerts(), base.isTrustCerts()))
      .build();
  if (properties.getNamespace() == null || properties.getNamespace().isEmpty()) {
    LOG.warn("No namespace has been detected. Please specify KUBERNETES_NAMESPACE env var, or use a later kubernetes version (1.3 or later)");
  }
  return properties;
}
origin: fabric8io/kubernetes-client

kubernetesConfig.getClientKeyFile(), kubernetesConfig.getClientKeyData(),
kubernetesConfig.getClientKeyAlgo(), kubernetesConfig.getClientKeyPassphrase(),
kubernetesConfig.getUsername(), kubernetesConfig.getPassword(), kubernetesConfig.getOauthToken(),
kubernetesConfig.getWatchReconnectInterval(), kubernetesConfig.getWatchReconnectLimit(),
kubernetesConfig.getConnectionTimeout(), kubernetesConfig.getRequestTimeout(),
origin: org.eclipse.che.infrastructure/infrastructure-openshift

@Override
protected Interceptor buildKubernetesInterceptor(Config config) {
 final String oauthToken;
 if (Utils.isNotNullOrEmpty(config.getUsername())
   && Utils.isNotNullOrEmpty(config.getPassword())) {
  synchronized (getHttpClient()) {
    OkHttpClient clone = builder.build();
    String credential = Credentials.basic(config.getUsername(), config.getPassword());
    URL url = new URL(URLUtils.join(config.getMasterUrl(), AUTHORIZE_PATH));
    Response response =
origin: stackoverflow.com

 public class PGService {
  private final Sql2o connectionPool;

  public PGService() throws ConfigurationException, IOException {
    Config cfg = loadConfig("dbconfig.json");
    if (cfg == null) {
      throw new ConfigurationException("Could not load dbconfig.");
    }
    BasicDataSource bds = new BasicDataSource();
    bds.setUsername(cfg.getUsername());
    bds.setPassword(cfg.getPassword());
    bds.setDriverClassName("org.postgresql.Driver");
    bds.setUrl(cfg.getUrl());
    bds.setInitialSize(1);
    connectionPool = new Sql2o(bds);
  }

  public Connection getConnection() {
    return this.connectionPool.open();
  }
}
origin: fabric8io/kubernetes-client

assertEquals("testns", config.getNamespace());
assertEquals("token", config.getOauthToken());
assertEquals("user", config.getUsername());
assertEquals("pass", config.getPassword());
assertEquals("/path/to/cert", config.getCaCertFile());
origin: org.domeos/kubernetes-client

config.setUsername(Utils.getSystemPropertyOrEnvVar(KUBERNETES_AUTH_BASIC_USERNAME_SYSTEM_PROPERTY, config.getUsername()));
config.setPassword(Utils.getSystemPropertyOrEnvVar(KUBERNETES_AUTH_BASIC_PASSWORD_SYSTEM_PROPERTY, config.getPassword()));
String configuredWatchReconnectInterval = Utils.getSystemPropertyOrEnvVar(KUBERNETES_WATCH_RECONNECT_INTERVAL_SYSTEM_PROPERTY);
origin: io.fabric8/sping-cloud-kubernetes-core

@Bean
@ConditionalOnMissingBean(Config.class)
public Config kubernetesClientConfig() {
  Config base = new Config();
  Config properites = new ConfigBuilder(base)
      //Only set values that have been explicitly specified
      .withMasterUrl(or(properties.getMasterUrl(), base.getMasterUrl()))
      .withMasterUrl(or(properties.getApiVersion(), base.getApiVersion()))
      .withMasterUrl(or(properties.getApiVersion(), base.getMasterUrl()))
      .withUsername(or(properties.getUsername(), base.getUsername()))
      .withPassword(or(properties.getPassword(), base.getPassword()))
      .withCaCertFile(or(properties.getCaCertFile(), base.getCaCertFile()))
      .withCaCertData(or(properties.getCaCertData(), base.getCaCertData()))
      .withClientKeyFile(or(properties.getClientKeyFile(), base.getClientKeyFile()))
      .withClientKeyData(or(properties.getClientKeyData(), base.getClientKeyData()))
      .withClientCertFile(or(properties.getClientCertFile(), base.getClientCertFile()))
      .withClientCertData(or(properties.getClientCertData(), base.getClientCertData()))
      //No magic is done for the properties below so we leave them as is.
      .withClientKeyAlgo(or(properties.getClientKeyAlgo(), base.getClientKeyAlgo()))
      .withClientKeyPassphrase(or(properties.getClientKeyPassphrase(), base.getClientKeyPassphrase()))
      .withConnectionTimeout(or(properties.getConnectionTimeout(), base.getConnectionTimeout()))
      .withRequestTimeout(or(properties.getRequestTimeout(), base.getRequestTimeout()))
      .withRollingTimeout(or(properties.getRollingTimeout(), base.getRollingTimeout()))
      .withTrustCerts(or(properties.isTrustCerts(), base.isTrustCerts()))
      .build();
  if (!base.equals(properites)) {
    System.out.println("Objects different");
  }
  return properites;
}
origin: io.fabric8/spring-cloud-kubernetes-core

@Bean
@ConditionalOnMissingBean(Config.class)
public Config kubernetesClientConfig(KubernetesClientProperties kubernetesClientProperties) {
  Config base = new Config();
  Config properties = new ConfigBuilder(base)
      //Only set values that have been explicitly specified
      .withMasterUrl(or(kubernetesClientProperties.getMasterUrl(), base.getMasterUrl()))
      .withApiVersion(or(kubernetesClientProperties.getApiVersion(), base.getApiVersion()))
      .withNamespace(or(kubernetesClientProperties.getNamespace(), base.getNamespace()))
      .withUsername(or(kubernetesClientProperties.getUsername(), base.getUsername()))
      .withPassword(or(kubernetesClientProperties.getPassword(), base.getPassword()))
      .withCaCertFile(or(kubernetesClientProperties.getCaCertFile(), base.getCaCertFile()))
      .withCaCertData(or(kubernetesClientProperties.getCaCertData(), base.getCaCertData()))
      .withClientKeyFile(or(kubernetesClientProperties.getClientKeyFile(), base.getClientKeyFile()))
      .withClientKeyData(or(kubernetesClientProperties.getClientKeyData(), base.getClientKeyData()))
      .withClientCertFile(or(kubernetesClientProperties.getClientCertFile(), base.getClientCertFile()))
      .withClientCertData(or(kubernetesClientProperties.getClientCertData(), base.getClientCertData()))
      //No magic is done for the properties below so we leave them as is.
      .withClientKeyAlgo(or(kubernetesClientProperties.getClientKeyAlgo(), base.getClientKeyAlgo()))
      .withClientKeyPassphrase(or(kubernetesClientProperties.getClientKeyPassphrase(), base.getClientKeyPassphrase()))
      .withConnectionTimeout(or(kubernetesClientProperties.getConnectionTimeout(), base.getConnectionTimeout()))
      .withRequestTimeout(or(kubernetesClientProperties.getRequestTimeout(), base.getRequestTimeout()))
      .withRollingTimeout(or(kubernetesClientProperties.getRollingTimeout(), base.getRollingTimeout()))
      .withTrustCerts(or(kubernetesClientProperties.isTrustCerts(), base.isTrustCerts()))
      .build();
  if (properties.getNamespace() == null || properties.getNamespace().isEmpty()) {
    LOG.warn("No namespace has been detected. Please specify KUBERNETES_NAMESPACE env var, or use a later kubernetes version (1.3 or later)");
  }
  return properties;
}
origin: amoAHCP/vxms

 private void updateKubeConfig(Config kubeConfig, JsonObject config, K8SDiscovery annotation) {
  final String user = ConfigurationUtil.getStringConfiguration(config, USER, annotation.user());
  final String password =
    ConfigurationUtil.getStringConfiguration(config, PASSWORD, annotation.password());
  final String api_token =
    ConfigurationUtil.getStringConfiguration(config, API_TOKEN, annotation.api_token());
  final String master_url =
    ConfigurationUtil.getStringConfiguration(config, MASTER_URL, annotation.master_url());
  final String namespace =
    ConfigurationUtil.getStringConfiguration(config, NAMESPACE, annotation.namespace());
  if (StringUtil.isNullOrEmpty(kubeConfig.getUsername())) kubeConfig.setUsername(user);
  if (StringUtil.isNullOrEmpty(kubeConfig.getPassword())) kubeConfig.setPassword(password);
  if (StringUtil.isNullOrEmpty(kubeConfig.getOauthToken())) kubeConfig.setOauthToken(api_token);
  if (StringUtil.isNullOrEmpty(kubeConfig.getMasterUrl())) kubeConfig.setMasterUrl(master_url);
  if (StringUtil.isNullOrEmpty(kubeConfig.getNamespace())) kubeConfig.setNamespace(namespace);
  // check oauthToken
  if (StringUtil.isNullOrEmpty(kubeConfig.getOauthToken()))
   kubeConfig.setOauthToken(TokenUtil.getAccountToken());
 }
}
origin: org.springframework.cloud/spring-cloud-kubernetes-core

    base.getNamespace()))
.withUsername(
    or(kubernetesClientProperties.getUsername(), base.getUsername()))
.withPassword(
    or(kubernetesClientProperties.getPassword(), base.getPassword()))
origin: io.fabric8/openshift-client

kubernetesConfig.getClientKeyFile(), kubernetesConfig.getClientKeyData(),
kubernetesConfig.getClientKeyAlgo(), kubernetesConfig.getClientKeyPassphrase(),
kubernetesConfig.getUsername(), kubernetesConfig.getPassword(), kubernetesConfig.getOauthToken(),
kubernetesConfig.getWatchReconnectInterval(), kubernetesConfig.getWatchReconnectLimit(),
kubernetesConfig.getConnectionTimeout(), kubernetesConfig.getRequestTimeout(),
io.fabric8.kubernetes.clientConfiggetUsername

Popular methods of Config

  • getMasterUrl
  • getOauthToken
  • getNamespace
  • getPassword
  • getCaCertData
  • getClientCertData
  • getClientKeyData
  • getClientKeyPassphrase
  • getCaCertFile
  • getClientCertFile
  • getClientKeyAlgo
  • getClientKeyFile
  • getClientKeyAlgo,
  • getClientKeyFile,
  • getRequestTimeout,
  • isTrustCerts,
  • autoConfigure,
  • getApiVersion,
  • getConnectionTimeout,
  • getRollingTimeout,
  • <init>

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now