Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(aws): Implement the account API for AWS accounts #6209

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.netflix.spinnaker.clouddriver.security.AccessControlledAccountDefinition;
import com.netflix.spinnaker.fiat.model.resources.Permissions;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
Expand Down Expand Up @@ -57,8 +58,8 @@ public static class Account implements AccessControlledAccountDefinition {
@Include private Boolean enabled;
@Include private List<CredentialsConfig.Region> regions;
@Include private List<String> defaultSecurityGroups;
private List<String> requiredGroupMembership;
@Include private Permissions.Builder permissions;
private List<String> requiredGroupMembership = new ArrayList<>();
@Include private Permissions.Builder permissions = new Permissions.Builder();
@Include private String edda;
@Include private Boolean eddaEnabled;
@Include private Boolean lambdaEnabled;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2023 Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.netflix.spinnaker.clouddriver.aws.security.config;

import com.netflix.spinnaker.clouddriver.security.AccountDefinitionRepository;
import com.netflix.spinnaker.clouddriver.security.AccountDefinitionSource;
import com.netflix.spinnaker.credentials.definition.CredentialsDefinitionSource;
import java.util.List;
import java.util.Optional;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
@ConditionalOnProperty({"account.storage.enabled", "account.storage.aws.enabled"})
public class AmazonAccountDefinitionSourceConfiguration {
@Bean
@Primary
public CredentialsDefinitionSource<AccountsConfiguration.Account> amazonAccountSource(
AccountDefinitionRepository repository,
Optional<List<CredentialsDefinitionSource<AccountsConfiguration.Account>>> additionalSources,
AccountsConfiguration accountProperties) {
return new AccountDefinitionSource<>(
repository,
AccountsConfiguration.Account.class,
additionalSources.orElseGet(() -> List.of(accountProperties::getAccounts)));
}
}
Loading