本文整理汇总了Java中io.fabric8.openshift.api.model.User类的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
User类属于io.fabric8.openshift.api.model包,在下文中一共展示了User类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserName
import io.fabric8.openshift.api.model.User; //导入依赖的package包/类
/**
* Returns the current users kubernetes/openshift user name
*/
public String getUserName() {
OpenShiftClient oc = getOpenShiftClientOrNull();
if (oc != null) {
User user = oc.users().withName("~").get();
if (user == null) {
LOG.warn("Failed to find current logged in user!");
} else {
String answer = KubernetesHelper.getName(user);
if (Strings.isNullOrBlank(answer)) {
LOG.warn("No name for User " + user);
} else {
return answer;
}
}
}
// TODO needs to use the current token to find the current user name
return Configs.currentUserName();
}
示例2: whoAmI
import io.fabric8.openshift.api.model.User; //导入依赖的package包/类
@Override
public User whoAmI(String openShiftToken) {
return openShiftClient.withRequestConfig(
new RequestConfigBuilder().withOauthToken(openShiftToken).build()
).call(OpenShiftClient::currentUser);
}
示例3: whoAmI
import io.fabric8.openshift.api.model.User; //导入依赖的package包/类
@Override
public User whoAmI(String openShiftToken) {
return new UserBuilder().withNewMetadata().withName("openshift_noop").and().withFullName("OpenShift NoOp").build();
}
示例4: whoAmI
import io.fabric8.openshift.api.model.User; //导入依赖的package包/类
/**
* Returns the currently logged in user.
* @return The currently logged in user.
*/
User whoAmI(String token);