com.amazonaws.regions.Regions

Here are the examples of the java api com.amazonaws.regions.Regions taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

188 Examples 7

19 Source : AbstractAWSProcessor.java
with Apache License 2.0
from wangrenlei

private static AllowableValue createAllowableValue(final Regions regions) {
    return new AllowableValue(regions.getName(), regions.getName(), regions.getName());
}

19 Source : AbstractAWSProcessor.java
with Apache License 2.0
from wangrenlei

private static AllowableValue[] getAvailableRegions() {
    final List<AllowableValue> values = new ArrayList<>();
    for (final Regions regions : Regions.values()) {
        values.add(createAllowableValue(regions));
    }
    return (AllowableValue[]) values.toArray(new AllowableValue[values.size()]);
}

19 Source : S3Client.java
with Apache License 2.0
from VertaAI

private void initializeMinioClient(String cloudAccessKey, String cloudSecretKey, Regions awsRegion, String minioEndpoint) {
    awsCredentials = new BasicAWSCredentials(cloudAccessKey, cloudSecretKey);
    ClientConfiguration clientConfiguration = new ClientConfiguration();
    clientConfiguration.setSignerOverride("AWSS3V4SignerType");
    this.s3Client = AmazonS3ClientBuilder.standard().withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(minioEndpoint, awsRegion.getName())).withPathStyleAccessEnabled(true).withClientConfiguration(clientConfiguration).withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();
}

19 Source : S3Client.java
with Apache License 2.0
from VertaAI

private void initializeS3ClientWithAccessKey(String cloudAccessKey, String cloudSecretKey, Regions awsRegion) {
    awsCredentials = new BasicAWSCredentials(cloudAccessKey, cloudSecretKey);
    this.s3Client = AmazonS3ClientBuilder.standard().withRegion(awsRegion).withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();
}

19 Source : S3Client.java
with Apache License 2.0
from VertaAI

private void initializetWithEnvironment(Regions awsRegion) {
    this.s3Client = AmazonS3ClientBuilder.standard().withRegion(awsRegion).build();
}

19 Source : ConnectorViewFactory.java
with MIT License
from satr

@Override
public void setRegion(Regions region) {
    if (setRegionOperationInProgress) {
        return;
    }
    try {
        setRegionOperationInProgress = true;
        for (int i = 0; i < regionList.gereplacedemCount(); i++) {
            if (((RegionEnreplacedy) regionList.gereplacedemAt(i)).getName().equals(region.getName())) {
                regionList.setSelectedIndex(i);
                return;
            }
        }
    } finally {
        setRegionOperationInProgress = false;
    }
}

19 Source : ConnectorViewFactory.java
with MIT License
from satr

@Override
public void setRegionList(List<RegionEnreplacedy> regions, Regions selectedRegion) {
    regionList.removeAllItems();
    RegionEnreplacedy selectedRegionEnreplacedy = null;
    for (RegionEnreplacedy enreplacedy : regions) {
        regionList.addItem(enreplacedy);
        if (selectedRegion != null && enreplacedy.getRegion().getName().equals(selectedRegion.getName())) {
            selectedRegionEnreplacedy = enreplacedy;
        }
    }
    if (selectedRegionEnreplacedy != null) {
        regionList.setSelectedItem(selectedRegionEnreplacedy);
    }
}

19 Source : ConnectorPresenterImpl.java
with MIT License
from satr

@Override
public void setRegion(RegionEnreplacedy regionEnreplacedy) {
    Regions region = tryGetRegionBy(regionEnreplacedy.getName());
    if (region == null) {
        return;
    }
    setRegionAndProfile(getConnectorSettings().getLastSelectedCredentialProfile(), region.getName());
}

19 Source : ConnectorPresenterImpl.java
with MIT License
from satr

@Override
@NotNull
protected Regions getLastSelectedRegion() {
    String lastSelectedRegionName = getConnectorSettings().getLastSelectedRegionName();
    Regions region = isEmpty(lastSelectedRegionName) ? Regions.DEFAULT_REGION : tryGetRegionBy(lastSelectedRegionName);
    return region != null ? region : Regions.DEFAULT_REGION;
}

19 Source : ConnectorPresenterImpl.java
with MIT License
from satr

private Regions tryGetRegionBy(String regionName) {
    for (Regions region : Regions.values()) {
        if (region.getName().equals(regionName)) {
            return region;
        }
    }
    return null;
}

19 Source : SQSTriggerQueue.java
with Apache License 2.0
from riboseinc

public void setRegion(Regions region) {
    this.region = region;
}

19 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

public String getEnvironmentDataSecureDataKmsCmkRegion(Regions region) {
    if (!getDecryptedEnvironmentData().getRegionData().containsKey(region)) {
        throw new RuntimeException("There is no region data for region: " + region.getName());
    }
    RegionData data = getDecryptedEnvironmentData().getRegionData().get(region);
    return data.getConfigCmkArn().orElseThrow(() -> new RuntimeException("There is no cms cmk configured for region: " + region.getName()));
}

19 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

public String getConfigBucketForRegion(Regions region) {
    if (!getDecryptedEnvironmentData().getRegionData().containsKey(region)) {
        throw new RuntimeException("There is no region data for region: " + region.getName());
    }
    RegionData data = getDecryptedEnvironmentData().getRegionData().get(region);
    return data.getConfigBucket().orElseThrow(() -> new RuntimeException("There is no config bucket configured for region: " + region.getName()));
}

19 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

public String getCmsCmkForRegion(Regions region) {
    if (!getDecryptedEnvironmentData().getRegionData().containsKey(region)) {
        throw new RuntimeException("There is no region data for region: " + region.getName());
    }
    RegionData data = getDecryptedEnvironmentData().getRegionData().get(region);
    return data.getManagementServiceCmkArn().orElseThrow(() -> new RuntimeException("There is no cms cmk configured for region: " + region.getName()));
}

19 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Get the base stack parameters.
 *
 * @return Base parameters
 */
public Route53Outputs getRoute53StackOutputs(Regions region) {
    return getStackOutputs(region, getCloudFormationStackName(Stack.ROUTE53), Route53Outputs.clreplaced);
}

19 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

public AuditOutputs getAuditStackOutputs(Regions region) {
    return getStackOutputs(region, getCloudFormationStackName(Stack.AUDIT), AuditOutputs.clreplaced);
}

19 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Get the cms iam role stack outputs.
 *
 * @return Base outputs
 */
public ConfigOutputs getConfigBucketStackOutputs(Regions region) {
    return getStackOutputs(region, getCloudFormationStackName(Stack.CONFIG), ConfigOutputs.clreplaced);
}

19 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Get the cms instance profile stack outputs for provided region
 *
 * @return Base outputs
 */
public InstanceProfileOutput getCmsInstanceProfileOutput(Regions region) {
    return getStackOutputs(region, getCloudFormationStackName(Stack.INSTANCE_PROFILE), InstanceProfileOutput.clreplaced);
}

19 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Get the cms iam role stack outputs for provided region
 *
 * @return Base outputs
 */
public IamRolesOutputs getCmsIamRoleOutputs(Regions region) {
    return getStackOutputs(region, getCloudFormationStackName(Stack.IAM_ROLES), IamRolesOutputs.clreplaced);
}

19 Source : Ec2Service.java
with Apache License 2.0
from Nike-Inc

/**
 * Import a key pair to AWS EC2.
 *
 * @param region            The region to use.
 * @param keyName           Friendly name for the key
 * @param publicKeyMaterial Public key
 * @return Key name
 */
public String importKey(Regions region, String keyName, String publicKeyMaterial) {
    AmazonEC2 ec2Client = amazonEC2ClientFactory.getClient(region);
    ImportKeyPairRequest request = new ImportKeyPairRequest(keyName, publicKeyMaterial);
    ImportKeyPairResult result = ec2Client.importKeyPair(request);
    return result.getKeyName();
}

19 Source : CloudFormationService.java
with Apache License 2.0
from Nike-Inc

/**
 * Checks if a stack exists with the specified ID.
 *
 * @param region The Region to use
 * @param stackName Stack ID.
 * @return boolean
 */
public boolean isStackPresent(Regions region, String stackName) {
    Preconditions.checkArgument(StringUtils.isNotBlank(stackName), "Stack ID cannot be blank");
    return getStackStatus(region, stackName) != null;
}

19 Source : AwsClientFactory.java
with Apache License 2.0
from Nike-Inc

protected <M extends AmazonWebServiceClient> M createAmazonClientInstance(Clreplaced<M> clientClreplaced, Regions region) {
    return Region.getRegion(region).createClient(clientClreplaced, getAWSCredentialsProviderChain(), getClientConfiguration());
}

19 Source : XRegionDatabaseReplicationOperation.java
with Apache License 2.0
from Nike-Inc

@Override
public boolean isRunnable(XRegionDatabaseReplicationCommand command) {
    boolean isRunnable = true;
    Regions targetRegion = Regions.fromName(command.getTargetRegion());
    Regions sourceRegion = Regions.fromName(command.getSourceRegion());
    ImmutableList<Regions> regions = ImmutableList.of(targetRegion, sourceRegion);
    if (!configStore.getCmsRegions().containsAll(regions)) {
        log.error("The source and target regions must be configured for the environment");
        isRunnable = false;
    }
    if (isRunnable && !cloudFormationService.isStackPresent(targetRegion, Stack.DATABASE.getFullName(environmentName))) {
        log.error("The Database stack must exist in the target region in order to restore snapshot");
        isRunnable = false;
    }
    return isRunnable;
}

19 Source : DeleteStackOperation.java
with Apache License 2.0
from Nike-Inc

@Override
public boolean isRunnable(DeleteStackCommand command) {
    Regions region = getRegion(command);
    if (!cloudFormationService.isStackPresent(region, command.getStack().getFullName(environmentName))) {
        log.error("The stack: {} does not exist in region: {}", command.getStack(), region.getName());
        return false;
    }
    return true;
}

19 Source : CreateRoute53Operation.java
with Apache License 2.0
from Nike-Inc

private String getLoadBalancerDomainName(String baseDomainName, String loadBalancerDomainNameOverride, Regions region) {
    String defaultLoadBalancerDomainName = String.format("%s.%s.%s", environmentName, region.getName(), baseDomainName);
    return StringUtils.isBlank(loadBalancerDomainNameOverride) ? defaultLoadBalancerDomainName : loadBalancerDomainNameOverride;
}

19 Source : CreateRoute53Operation.java
with Apache License 2.0
from Nike-Inc

private String getOriginDomainName(String baseDomainName, String originDomainNameOverride, Regions region) {
    String defaultOriginDomainName = String.format("origin.%s.%s.%s", region.getName(), environmentName, baseDomainName);
    return StringUtils.isBlank(originDomainNameOverride) ? defaultOriginDomainName : originDomainNameOverride;
}

19 Source : WafAwsClientFactory.java
with Apache License 2.0
from Nike-Inc

private AWSWAFRegionalClient createClient(Regions region) {
    return (AWSWAFRegionalClient) AWSWAFRegionalClientBuilder.standard().withRegion(region).withCredentials(getAWSCredentialsProviderChain()).build();
}

19 Source : KinesisFirehoseAwsClientFactory.java
with Apache License 2.0
from Nike-Inc

private AmazonKinesisFirehoseClient createClient(Regions region) {
    return (AmazonKinesisFirehoseClient) AmazonKinesisFirehoseClientBuilder.standard().withRegion(region).withCredentials(getAWSCredentialsProviderChain()).build();
}

19 Source : AthenaAwsClientFactory.java
with Apache License 2.0
from Nike-Inc

private AmazonAthenaClient createClient(Regions region) {
    return (AmazonAthenaClient) AmazonAthenaClient.builder().withRegion(region).withCredentials(getAWSCredentialsProviderChain()).build();
}

19 Source : AWSS3BuildProcessAdapterHelper.java
with Apache License 2.0
from gonzadocarmo

private AmazonS3 createClientWithRegion(String publicKey, String privateKey, String region, ClientConfiguration clientConfiguration) {
    final Regions defaultRegion = Regions.DEFAULT_REGION;
    Regions clientRegion;
    try {
        clientRegion = Regions.fromName(region);
    } catch (IllegalArgumentException iae) {
        myLogger.warning(String.format("Region '%s' not valid. Using default region: '%s'...", region, defaultRegion.getName()));
        clientRegion = defaultRegion;
    }
    return AmazonS3ClientBuilder.standard().withRegion(clientRegion).withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(publicKey, privateKey))).withClientConfiguration(clientConfiguration).build();
}

19 Source : AWSKafkaConfig.java
with BSD 2-Clause "Simplified" License
from datamachines

private void cfgRegion(String regionName) {
    try {
        Regions tmpRegions = Regions.fromName(regionName);
        setRegion(Region.getRegion(tmpRegions));
        setRegions(tmpRegions);
    } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException("Unrecognized region " + regionName);
    }
}

19 Source : AWSKafkaConfig.java
with BSD 2-Clause "Simplified" License
from datamachines

public void setRegions(Regions regions) {
    this.regions = regions;
}

19 Source : AWSFirewallClient.java
with Apache License 2.0
from cscannerio

private FirewallGroup convert(Regions region, String accountId, SecurityGroup securityGroup) {
    List<FirewallRule> firewallRules = new ArrayList<>();
    firewallRules.addAll(extractFirewallRules(region, accountId, securityGroup, securityGroup.getIpPermissions(), FirewallRule.Direction.INGRESS));
    firewallRules.addAll(extractFirewallRules(region, accountId, securityGroup, securityGroup.getIpPermissionsEgress(), FirewallRule.Direction.EGRESS));
    return new FirewallGroup(securityGroup.getGroupName(), region.toString(), firewallRules);
}

19 Source : AWSFirewallClient.java
with Apache License 2.0
from cscannerio

private String getArn(Regions region, String accountId, String securityGroupId) {
    return "arn:aws:ec2:" + region.getName() + ":" + accountId + ":security-group/" + securityGroupId;
}

19 Source : Constants.java
with Apache License 2.0
from awslabs

public clreplaced Constants {

    // TODO: Update the region to match the API region
    public static final Regions APPSYNC_REGION = Regions.US_EAST_1;

    // TODO: Update the endpoint URL as specified on AppSync console
    public static final String APPSYNC_API_URL = "";

    // API Key Authorization
    // TODO: Copy the API Key specified on the AppSync Console
    public static final String APPSYNC_API_KEY = "API-KEY";

    // IAM based Authorization (Cognito Idenreplacedy)
    // TODO: Update the Cognito Idenreplacedy Pool ID
    public static final String COGNITO_IDENreplacedY = "";

    // TODO: Update the region to match the Cognito Idenreplacedy Pool region
    public static final Regions COGNITO_REGION = Regions.US_EAST_1;

    // Cognito User Pools Authorization
    public static final String USER_POOLS_POOL_ID = "";

    public static final String USER_POOLS_CLIENT_ID = "";

    public static final String USER_POOLS_CLIENT_SECRET = "";

    // TODO: Update the region to match the Cognito User Pools region
    public static final Regions USER_POOLS_REGION = Regions.US_WEST_2;
}

19 Source : App.java
with Apache License 2.0
from aws-samples

public clreplaced App {

    private static final String STREAM_NAME = "testKvs";

    private static final Regions REGION = Regions.US_EAST_1;

    public static void main(String[] args) throws IOException, ModelException {
        AmazonKinesisVideoClientBuilder amazonKinesisVideoBuilder = AmazonKinesisVideoClientBuilder.standard();
        amazonKinesisVideoBuilder.setRegion(REGION.getName());
        amazonKinesisVideoBuilder.setCredentials(new SystemPropertiesCredentialsProvider());
        AmazonKinesisVideo amazonKinesisVideo = amazonKinesisVideoBuilder.build();
        Path outDir = Paths.get("build/out");
        Utils.deleteQuietly(outDir);
        Files.createDirectories(outDir);
        FrameVisitor frameVisitor = FrameVisitor.create(new DjlImageVisitor());
        ExecutorService executorService = Executors.newFixedThreadPool(1);
        GetMediaWorker getMediaWorker = GetMediaWorker.create(REGION, new SystemPropertiesCredentialsProvider(), STREAM_NAME, new StartSelector().withStartSelectorType(StartSelectorType.NOW), amazonKinesisVideo, frameVisitor);
        executorService.submit(getMediaWorker);
    }
}

19 Source : TerraformRequestHandler.java
with Apache License 2.0
from aws-samples

private static CloudFormationFacade getCfnFacade(CustomResourceRequest request, AWSCredentialsProvider launchRoleCredentials) {
    String stackId = request.getStackId();
    Regions stackRegion = Regions.fromName(Splitter.on(':').splitToList(stackId).get(3));
    return new CloudFormationFacade(stackRegion, launchRoleCredentials);
}

19 Source : RekognitionStreamProcessor.java
with Apache License 2.0
from aws

public static RekognitionStreamProcessor create(final Regions regions, final AWSCredentialsProvider provider, final RekognitionInput rekognitionInput) {
    return new RekognitionStreamProcessor(regions, provider, rekognitionInput);
}

19 Source : KinesisVideoRekognitionLambdaExample.java
with Apache License 2.0
from aws

/**
 * Initialize method to set variables.
 */
private void initialize(final String kvsStreamName, final Regions regionName) {
    this.inputKvsStreamName = kvsStreamName;
    outputKvsStreamName = kvsStreamName + "-Rekognized";
    kvsClient = new StreamOps(regionName, kvsStreamName, credentialsProvider);
    h264FrameProcessor = H264FrameProcessor.create(credentialsProvider, outputKvsStreamName, regionName);
    fragmentCheckpointManager = new DDBBasedFragmentCheckpointManager(kvsClient.getRegion(), credentialsProvider);
    log.info("Initialized with input KVS stream: {}, output {}, region : {}", inputKvsStreamName, outputKvsStreamName, regionName);
}

19 Source : H264FrameProcessor.java
with Apache License 2.0
from aws

public static H264FrameProcessor create(final AWSCredentialsProvider credentialsProvider, final String rekognizedStreamName, final Regions regionName) {
    return new H264FrameProcessor(credentialsProvider, rekognizedStreamName, regionName);
}

19 Source : S3CommonFileSystem.java
with Apache License 2.0
from apache

public AmazonS3 getS3Client() {
    if (client == null && getFileSystemOptions() != null) {
        S3CommonFileSystemConfigBuilder s3CommonFileSystemConfigBuilder = new S3CommonFileSystemConfigBuilder(getFileSystemOptions());
        String accessKey = s3CommonFileSystemConfigBuilder.getAccessKey();
        String secretKey = s3CommonFileSystemConfigBuilder.getSecretKey();
        String sessionToken = s3CommonFileSystemConfigBuilder.getSessionToken();
        String region = s3CommonFileSystemConfigBuilder.getRegion();
        String credentialsFilePath = s3CommonFileSystemConfigBuilder.getCredentialsFile();
        String profileName = s3CommonFileSystemConfigBuilder.getProfileName();
        String endpoint = s3CommonFileSystemConfigBuilder.getEndpoint();
        String signatureVersion = s3CommonFileSystemConfigBuilder.getSignatureVersion();
        String pathStyleAccess = s3CommonFileSystemConfigBuilder.getPathStyleAccess();
        boolean access = (pathStyleAccess == null) || Boolean.parseBoolean(pathStyleAccess);
        AWSCredentialsProvider awsCredentialsProvider = null;
        Regions regions = Regions.DEFAULT_REGION;
        if (!S3Util.isEmpty(accessKey) && !S3Util.isEmpty(secretKey)) {
            AWSCredentials awsCredentials;
            if (S3Util.isEmpty(sessionToken)) {
                awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
            } else {
                awsCredentials = new BasicSessionCredentials(accessKey, secretKey, sessionToken);
            }
            awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
            regions = S3Util.isEmpty(region) ? Regions.DEFAULT_REGION : Regions.fromName(region);
        } else if (!S3Util.isEmpty(credentialsFilePath)) {
            ProfilesConfigFile profilesConfigFile = new ProfilesConfigFile(credentialsFilePath);
            awsCredentialsProvider = new ProfileCredentialsProvider(profilesConfigFile, profileName);
        }
        if (!S3Util.isEmpty(endpoint)) {
            ClientConfiguration clientConfiguration = new ClientConfiguration();
            clientConfiguration.setSignerOverride(S3Util.isEmpty(signatureVersion) ? S3Util.SIGNATURE_VERSION_SYSTEM_PROPERTY : signatureVersion);
            client = AmazonS3ClientBuilder.standard().withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, regions.getName())).withPathStyleAccessEnabled(access).withClientConfiguration(clientConfiguration).withCredentials(awsCredentialsProvider).build();
        } else {
            client = AmazonS3ClientBuilder.standard().enableForceGlobalBucketAccess().withRegion(regions).withCredentials(awsCredentialsProvider).build();
        }
    }
    if (client == null || hasClientChangedCredentials()) {
        try {
            if (isRegionSet()) {
                client = AmazonS3ClientBuilder.standard().enableForceGlobalBucketAccess().build();
            } else {
                client = AmazonS3ClientBuilder.standard().enableForceGlobalBucketAccess().withRegion(Regions.DEFAULT_REGION).build();
            }
            awsAccessKeyCache = System.getProperty(S3Util.ACCESS_KEY_SYSTEM_PROPERTY);
            awsSecretKeyCache = System.getProperty(S3Util.SECRET_KEY_SYSTEM_PROPERTY);
        } catch (Throwable t) {
            logger.error("Could not get an S3Client", t);
        }
    }
    return client;
}

18 Source : S3Client.java
with MIT License
from StubbornJava

public static S3Client fromAccessAndScret(String accessKey, String secretKey, Regions region) {
    BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKey, secretKey);
    return new S3Client(AmazonS3ClientBuilder.standard().withRegion(region).withCredentials(new AWSStaticCredentialsProvider(awsCreds)).build());
}

18 Source : ConnectorPresenterImpl.java
with MIT License
from satr

@Override
public void refreshCredentialProfilesList() {
    getLogger().logDebug("Refresh credential profile list.");
    FunctionConnectorModel functionConnectorModel = getFunctionConnectorModel();
    OperationValueResult<List<CredentialProfileEnreplacedy>> result = functionConnectorModel.getCredentialProfileEnreplacedies();
    if (result.success()) {
        List<CredentialProfileEnreplacedy> profileEnreplacedies = result.getValue();
        CredentialProfileEnreplacedy selectedProfileEntry = getLastSelectedProfileEntry(functionConnectorModel, profileEnreplacedies);
        if (selectedProfileEntry == null) {
            result.addError("Profile is not selected.");
        } else {
            String profileName = selectedProfileEntry.getName();
            getConnectorSettings().setLastSelectedCredentialProfile(profileName);
            view.setCredentialProfilesList(profileEnreplacedies, profileName);
            Regions region = tryGetRegionBy(functionConnectorModel.getRegionName());
            if (region != null) {
                view.setRegion(region);
            }
        }
    }
    getLogger().logOperationResult(result);
    refreshStatus();
}

18 Source : LogProcessorLambdaConfig.java
with Apache License 2.0
from Nike-Inc

@JsonIgnoreProperties(ignoreUnknown = true)
public clreplaced LogProcessorLambdaConfig {

    private String manualWhitelistIpSetId;

    private String manualBlacklistIpSetId;

    private String rateLimitAutoBlacklistIpSetId;

    private Integer blacklistDurationInMinutes;

    private Integer requestPerIntervalLimit;

    private Integer intervalInMins;

    private String slackWebHookUrl;

    private String slackIcon;

    private String env;

    private String athenaDatabaseName;

    private String athenaTableName;

    private String athenaQueryResultBucketName;

    private String albLogBucketName;

    private String iamPrincipalArn;

    private Regions region;

    public LogProcessorLambdaConfig(String env, String manualWhitelistIpSetId, String manualBlacklistIpSetId, String rateLimitAutoBlacklistIpSetId, Integer blacklistDurationInMinutes, Integer requestPerIntervalLimit, Integer intervalInMins, String slackWebHookUrl, String slackIcon, String athenaDatabaseName, String athenaTableName, String athenaQueryResultBucketName, String albLogBucketName, String iamPrincipalArn, Regions region) {
        this.env = env;
        this.manualWhitelistIpSetId = manualWhitelistIpSetId;
        this.manualBlacklistIpSetId = manualBlacklistIpSetId;
        this.rateLimitAutoBlacklistIpSetId = rateLimitAutoBlacklistIpSetId;
        this.blacklistDurationInMinutes = blacklistDurationInMinutes;
        this.requestPerIntervalLimit = requestPerIntervalLimit;
        this.intervalInMins = intervalInMins;
        this.slackWebHookUrl = slackWebHookUrl;
        this.slackIcon = slackIcon;
        this.athenaDatabaseName = athenaDatabaseName;
        this.athenaTableName = athenaTableName;
        this.athenaQueryResultBucketName = athenaQueryResultBucketName;
        this.albLogBucketName = albLogBucketName;
        this.iamPrincipalArn = iamPrincipalArn;
        this.region = region;
    }

    public LogProcessorLambdaConfig() {
        env = EnvUtils.getRequiredEnv("ENVIRONMENT");
        manualBlacklistIpSetId = EnvUtils.getRequiredEnv("MANUAL_BLACKLIST_IP_SET_ID");
        manualWhitelistIpSetId = EnvUtils.getRequiredEnv("MANUAL_WHITELIST_IP_SET_ID");
        rateLimitAutoBlacklistIpSetId = EnvUtils.getRequiredEnv("RATE_LIMIT_AUTO_BLACKLIST_IP_SET_ID");
        blacklistDurationInMinutes = Integer.parseInt(EnvUtils.getEnvWithDefault("VIOLATION_BLACKLIST_DURATION_IN_MINS", "60"));
        requestPerIntervalLimit = Integer.parseInt(EnvUtils.getEnvWithDefault("REQUEST_PER_INTERVAL_LIMIT", "300"));
        intervalInMins = Integer.parseInt(EnvUtils.getEnvWithDefault("INTERVAL_IN_MINS", "20"));
        slackIcon = EnvUtils.getEnvWithDefault("SLACK_ICON", ":wolf:");
        slackWebHookUrl = EnvUtils.getEnvWithDefault("SLACK_WEB_HOOK_URL", null);
        athenaDatabaseName = EnvUtils.getRequiredEnv("ATHENA_DATABASE_NAME");
        athenaTableName = EnvUtils.getEnvWithDefault("ATHENA_TABLE_NAME", "alb_logs");
        athenaQueryResultBucketName = EnvUtils.getRequiredEnv("ATHENA_QUERY_RESULT_BUCKET_NAME");
        albLogBucketName = EnvUtils.getRequiredEnv("ALB_LOG_BUCKET");
        iamPrincipalArn = EnvUtils.getRequiredEnv("IAM_PRINCIPAL_ARN");
        region = Regions.fromName(EnvUtils.getEnvWithDefault("REGION", "us-west-2"));
    }

    public String getManualWhitelistIpSetId() {
        return manualWhitelistIpSetId;
    }

    public void setManualWhitelistIpSetId(String manualWhitelistIpSetId) {
        this.manualWhitelistIpSetId = manualWhitelistIpSetId;
    }

    public String getManualBlacklistIpSetId() {
        return manualBlacklistIpSetId;
    }

    public void setManualBlacklistIpSetId(String manualBlacklistIpSetId) {
        this.manualBlacklistIpSetId = manualBlacklistIpSetId;
    }

    public String getRateLimitAutoBlacklistIpSetId() {
        return rateLimitAutoBlacklistIpSetId;
    }

    public void setRateLimitAutoBlacklistIpSetId(String rateLimitAutoBlacklistIpSetId) {
        this.rateLimitAutoBlacklistIpSetId = rateLimitAutoBlacklistIpSetId;
    }

    public Integer getBlacklistDurationInMinutes() {
        return blacklistDurationInMinutes;
    }

    public void setBlacklistDurationInMinutes(Integer blacklistDurationInMinutes) {
        this.blacklistDurationInMinutes = blacklistDurationInMinutes;
    }

    public Integer getRequestPerIntervalLimit() {
        return requestPerIntervalLimit;
    }

    public void setRequestPerIntervalLimit(Integer requestPerIntervalLimit) {
        this.requestPerIntervalLimit = requestPerIntervalLimit;
    }

    public Integer getIntervalInMins() {
        return intervalInMins;
    }

    public void setIntervalInMins(Integer intervalInMins) {
        this.intervalInMins = intervalInMins;
    }

    public String getSlackWebHookUrl() {
        return slackWebHookUrl;
    }

    public void setSlackWebHookUrl(String slackWebHookUrl) {
        this.slackWebHookUrl = slackWebHookUrl;
    }

    public String getSlackIcon() {
        return slackIcon;
    }

    public void setSlackIcon(String slackIcon) {
        this.slackIcon = slackIcon;
    }

    public String getEnv() {
        return env;
    }

    public void setEnv(String env) {
        this.env = env;
    }

    public String getAthenaDatabaseName() {
        return athenaDatabaseName;
    }

    public void setAthenaDatabaseName(String athenaDatabaseName) {
        this.athenaDatabaseName = athenaDatabaseName;
    }

    public String getAthenaQueryResultBucketName() {
        return athenaQueryResultBucketName;
    }

    public void setAthenaQueryResultBucketName(String athenaQueryResultBucketName) {
        this.athenaQueryResultBucketName = athenaQueryResultBucketName;
    }

    public String getAlbLogBucketName() {
        return albLogBucketName;
    }

    public void setAlbLogBucketName(String albLogBucketName) {
        this.albLogBucketName = albLogBucketName;
    }

    public String getAthenaTableName() {
        return athenaTableName;
    }

    public void setAthenaTableName(String athenaTableName) {
        this.athenaTableName = athenaTableName;
    }

    public String getIamPrincipalArn() {
        return iamPrincipalArn;
    }

    public void setIamPrincipalArn(String iamPrincipalArn) {
        this.iamPrincipalArn = iamPrincipalArn;
    }

    public Regions getRegion() {
        return region;
    }

    public void setRegion(Regions region) {
        this.region = region;
    }
}

18 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Get the stack outputs for a specific stack name.
 *
 * @param stackName   Full stack name
 * @param outputClreplaced Outputs clreplaced
 * @param <M>         Outputs type
 * @return Outputs
 */
public <M> M getStackOutputs(Regions region, String stackName, Clreplaced<M> outputClreplaced) {
    if (!cloudFormationService.isStackPresent(region, stackName)) {
        throw new IllegalStateException("Failed to get CloudFormation output for stack: '" + stackName + "'. Stack does not exist.");
    }
    Map<String, String> stackOutputs = cloudFormationService.getStackOutputs(region, stackName);
    return cloudFormationObjectMapper.convertValue(stackOutputs, outputClreplaced);
}

18 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Copy all files from config region's config bucket to destination region's config bucket
 * @param destinationRegion Region to copy files to
 */
public void sync(Regions destinationRegion) {
    EnvironmentData decryptedEnvironmentData = getDecryptedEnvironmentData();
    StoreService destinationStoreService = getStoreServiceForRegion(destinationRegion, decryptedEnvironmentData);
    String sourceBucket = findConfigBucketInSuppliedConfigRegion();
    listKeys().forEach(k -> destinationStoreService.copyFrom(sourceBucket, k));
}

18 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Get the base stack outputs.
 *
 * @return Base outputs
 */
public VpcOutputs getVpcStackOutputs(Regions region) {
    return getStackOutputs(region, getCloudFormationStackName(Stack.VPC), VpcOutputs.clreplaced);
}

18 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Get the base stack outputs.
 *
 * @return Base outputs
 */
public DatabaseOutputs getDatabaseStackOutputs(Regions region) {
    return getStackOutputs(region, getCloudFormationStackName(Stack.DATABASE), DatabaseOutputs.clreplaced);
}

18 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Get the base stack parameters.
 *
 * @return Base parameters
 */
public VpcParameters getVpcStackParameters(Regions region) {
    return getStackParameters(region, getCloudFormationStackName(Stack.VPC), VpcParameters.clreplaced);
}

18 Source : ConfigStore.java
with Apache License 2.0
from Nike-Inc

/**
 * Get the base stack outputs.
 *
 * @return Base outputs
 */
public SecurityGroupOutputs getSecurityGroupStackOutputs(Regions region) {
    return getStackOutputs(region, getCloudFormationStackName(Stack.SECURITY_GROUPS), SecurityGroupOutputs.clreplaced);
}

See More Examples