io.cattle.platform.core.model.Account.getName()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中io.cattle.platform.core.model.Account.getName()方法的一些代码示例,展示了Account.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Account.getName()方法的具体详情如下:
包路径:io.cattle.platform.core.model.Account
类名称:Account
方法名:getName

Account.getName介绍

[英]Getter for cattle.account.name.
[中]

代码示例

代码示例来源:origin: rancher/cattle

public StackMetaData(String stackName, String stackUUID, boolean isSystem, Account account) {
  this.name = stackName;
  this.uuid = stackUUID;
  this.environment_name = account.getName();
  this.environment_uuid = account.getUuid();
  this.system = isSystem;
  this.metadata_kind = "stack";
}

代码示例来源:origin: rancher/cattle

public AccountPolicy(Account account, Account authenticatedAsAccount, Set<Identity> identities, PolicyOptions options) {
  super(account.getId(), authenticatedAsAccount.getId(), account.getName(), identities, options);
}

代码示例来源:origin: rancher/cattle

String targetAgentUri = RegionUtil.getTargetAgentUri(localRegion.getName(), account.getName(), agent.getUuid(), targetResourceAccount.getUuid());
log.info(String.format("Creating external agent with uri [%s] in environment [%s] in region [%s]",
    targetAgentUri,

代码示例来源:origin: rancher/cattle

public static ExternalAccountLink getAccountLinkForExternal(Region targetRegion, ExternalProject targetResourceAccount, Account localAccount,
    JsonMapper jsonMapper) throws IOException {
  String uri = String.format("%s/v2-beta/accountLinks?accountId=%s&linkedAccount=%s&external=false",
      getUrl(targetRegion),
      targetResourceAccount.getId(),
      localAccount.getName());
  Request req = Request.Get(uri);
  setHeaders(req, targetRegion);
  return req.execute().handleResponse(new ResponseHandler<ExternalAccountLink>() {
    @Override
    public ExternalAccountLink handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
      if (response.getStatusLine().getStatusCode() != 200) {
        return null;
      }
      for (ExternalAccountLink link : jsonMapper.readValue(response.getEntity().getContent(), ExternalAccountLinkData.class).data) {
        List<String> invalidStates = Arrays.asList(CommonStatesConstants.REMOVED, CommonStatesConstants.REMOVING);
        if (invalidStates.contains(link.getState())) {
          continue;
        }
        if (link.getLinkedAccountUuid().equalsIgnoreCase(localAccount.getUuid())) {
          return link;
        }
      }
      return null;
    }
  });
}

代码示例来源:origin: rancher/cattle

data.put("accountId", targetResourceAccount.getId());
data.put("external", "true");
data.put("linkedAccount", localAccount.getName());
data.put("linkedRegion", externalRegion.getName());
data.put("linkedRegionId", externalRegion.getId());

代码示例来源:origin: rancher/cattle

public static ExternalAccountLink getExternalAccountLink(Region targetRegion, ExternalProject targetResourceAccount, Account localAccount,
    JsonMapper jsonMapper) throws IOException {
  String uri = String.format("%s/v2-beta/accountLinks?accountId=%s&linkedAccount=%s&external=true",
      getUrl(targetRegion),
      targetResourceAccount.getId(),
      localAccount.getName());
  Request req = Request.Get(uri);
  setHeaders(req, targetRegion);
  return req.execute().handleResponse(new ResponseHandler<ExternalAccountLink>() {
    @Override
    public ExternalAccountLink handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
      if (response.getStatusLine().getStatusCode() != 200) {
        return null;
      }
      for (ExternalAccountLink link : jsonMapper.readValue(response.getEntity().getContent(), ExternalAccountLinkData.class).data) {
        List<String> invalidStates = Arrays.asList(CommonStatesConstants.REMOVED, CommonStatesConstants.REMOVING);
        if (invalidStates.contains(link.getState())) {
          continue;
        }
        if (link.getLinkedAccountUuid().equalsIgnoreCase(localAccount.getUuid())) {
          return link;
        }
      }
      return null;
    }
  });
}

代码示例来源:origin: rancher/cattle

List<Account> projectsFiltered = new ArrayList<>();
for (Account project : projects) {
  if (StringUtils.isNotBlank(name) && !name.equalsIgnoreCase(project.getName())) {
    continue;

代码示例来源:origin: rancher/cattle

@Override
public void fetchEnvironment(final MetaHelperInfo helperInfo, final OutputStream os) {
  Account env = helperInfo.getAccount();
  EnvironmentMetaData data = new EnvironmentMetaData(StringUtils.lowerCase(env.getName()), env.getUuid(), StringUtils.lowerCase(helperInfo.getRegionName()));
  writeToJson(os, data);
}

代码示例来源:origin: rancher/cattle

protected void saveInContext(ApiRequest request, Policy policy, SchemaFactory schemaFactory, Account authorizedAccount) {
  if (schemaFactory != null) {
    request.setSchemaFactory(schemaFactory);
  }
  String accountId = (String) ApiContext.getContext().getIdFormatter().formatId(objectManager.getType(Account.class), policy.getAccountId());
  request.getServletContext().getResponse().addHeader(ACCOUNT_ID_HEADER, accountId);
  String userId = (String) ApiContext.getContext().getIdFormatter().formatId(objectManager.getType(Account.class), policy.getAuthenticatedAsAccountId());
  request.getServletContext().getResponse().addHeader(USER_ID_HEADER, userId);
  request.getServletContext().getResponse().addHeader(ACCOUNT_KIND_HEADER, authorizedAccount.getKind());
  request.getServletContext().getResponse().addHeader(ACCOUNT_NAME_HEADER, authorizedAccount.getName());
  ApiContext.getContext().setPolicy(policy);
}

代码示例来源:origin: rancher/cattle

@Override
public Identity getIdentity(Long id, IdFormatter idFormatter) {
  Account account = getAccountById(id);
  if (account == null || account.getKind().equalsIgnoreCase(ProjectConstants.TYPE) ||
      !accountDao.isActiveAccount(account)) {
    return null;
  }
  Credential credential = create()
      .selectFrom(CREDENTIAL)
      .where(CREDENTIAL.KIND.equalIgnoreCase(CredentialConstants.KIND_PASSWORD)
          .and(CREDENTIAL.ACCOUNT_ID.eq(id))
          .and(CREDENTIAL.STATE.equalIgnoreCase(CommonStatesConstants.ACTIVE))).fetchAny();
  String accountId = idFormatter != null ? (String) idFormatter.formatId(objectManager.getType(Account.class),
      account.getId()) : String.valueOf(id);
  return new Identity(ProjectConstants.RANCHER_ID, accountId, account.getName(),
      null, null, credential == null ? null : credential.getPublicValue(), false);
}

代码示例来源:origin: rancher/cattle

/**
 * {@inheritDoc}
 */
@Override
public void from(io.cattle.platform.core.model.Account from) {
  setId(from.getId());
  setName(from.getName());
  setKind(from.getKind());
  setUuid(from.getUuid());
  setDescription(from.getDescription());
  setState(from.getState());
  setCreated(from.getCreated());
  setRemoved(from.getRemoved());
  setRemoveTime(from.getRemoveTime());
  setData(from.getData());
  setExternalId(from.getExternalId());
  setExternalIdType(from.getExternalIdType());
  setHealthState(from.getHealthState());
  setProjectTemplateId(from.getProjectTemplateId());
  setDefaultNetworkId(from.getDefaultNetworkId());
  setVersion(from.getVersion());
  setRevision(from.getRevision());
}

相关文章