@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; } }
@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; } }