@Override protected Account buildAccount(String accountName) { AwsAccount account = (AwsAccount) new AwsAccount().setName(accountName); account.setDefaultKeyPair(defaultKeyPair) .setEdda(edda) .setDiscovery(discovery) .setAccountId(accountId) .setRegions(regions .stream() .map(r -> new AwsProvider.AwsRegion().setName(r)) .collect(Collectors.toList()) ) .setAssumeRole(assumeRole); return account; }
@Override protected Account editAccount(AwsAccount account) { account.setDefaultKeyPair(isSet(defaultKeyPair) ? defaultKeyPair : account.getDefaultKeyPair()); account.setEdda(isSet(edda) ? edda : account.getEdda()); account.setDiscovery(isSet(discovery) ? discovery : account.getDiscovery()); account.setAccountId(isSet(accountId) ? accountId : account.getAccountId()); account.setAssumeRole(isSet(assumeRole) ? assumeRole : account.getAssumeRole()); try { List<String> existingRegions = account .getRegions() .stream() .map(AwsProvider.AwsRegion::getName).collect(Collectors.toList()); regions = updateStringList(existingRegions, regions, addRegion, removeRegion); account.setRegions(regions .stream() .map(r -> new AwsProvider.AwsRegion().setName(r)) .collect(Collectors.toList()) ); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Set either --regions or --[add/remove]-region"); } return account; } }
if (awsProvider.getPrimaryAccount() != null) { AwsAccount awsAccount = (AwsAccount) accountService.getProviderAccount(deploymentConfiguration.getName(), "aws", awsProvider.getPrimaryAccount()); AwsProvider.AwsRegion firstRegion = awsAccount.getRegions().get(0); if (firstRegion != null) { bindings.put("aws.default.region", firstRegion.getName());
@Override protected Account emptyAccount() { return new AwsAccount(); } }
@Override protected Account editAccount(AwsAccount account) { account.setDefaultKeyPair(isSet(defaultKeyPair) ? defaultKeyPair : account.getDefaultKeyPair()); account.setEdda(isSet(edda) ? edda : account.getEdda()); account.setDiscovery(isSet(discovery) ? discovery : account.getDiscovery()); account.setAccountId(isSet(accountId) ? accountId : account.getAccountId()); account.setAssumeRole(isSet(assumeRole) ? assumeRole : account.getAssumeRole()); try { List<String> existingRegions = account .getRegions() .stream() .map(AwsProvider.AwsRegion::getName).collect(Collectors.toList()); regions = updateStringList(existingRegions, regions, addRegion, removeRegion); account.setRegions(regions .stream() .map(r -> new AwsProvider.AwsRegion().setName(r)) .collect(Collectors.toList()) ); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Set either --regions or --[add/remove]-region"); } return account; } }
if (awsProvider.getPrimaryAccount() != null) { AwsAccount awsAccount = (AwsAccount) accountService.getProviderAccount(deploymentConfiguration.getName(), "aws", awsProvider.getPrimaryAccount()); List<AwsProvider.AwsRegion> regionList = awsAccount.getRegions(); if (!regionList.isEmpty() && regionList.get(0) != null) { bindings.put("aws.default.region", regionList.get(0).getName());
@Override protected Account emptyAccount() { return new AwsAccount(); } }
@Override protected Account buildAccount(String accountName) { AwsAccount account = (AwsAccount) new AwsAccount().setName(accountName); account.setDefaultKeyPair(defaultKeyPair) .setEdda(edda) .setDiscovery(discovery) .setAccountId(accountId) .setRegions(regions .stream() .map(r -> new AwsProvider.AwsRegion().setName(r)) .collect(Collectors.toList()) ) .setAssumeRole(assumeRole); return account; }