1 /*
2 * Copyright 2013-2019 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.springframework.cloud.aws.autoconfigure.context.properties;
18
19 /**
20 * Properties related to AWS region configuration.
21 *
22 * @author Tom Gianos
23 * @author Maciej Walkowiak
24 * @since 2.0.2
25 * @see org.springframework.cloud.aws.autoconfigure.context.ContextRegionProviderAutoConfiguration
26 */
27 public class AwsRegionProperties {
28
29 /**
30 * Enables automatic region detection based on the EC2 meta data service.
31 */
32 private boolean auto = true;
33
34 /**
35 * Whether default AWS SDK region provider chain should be used when auto is set to
36 * true.
37 */
38 private boolean useDefaultAwsRegionChain;
39
40 /**
41 * Configures a static region for the application. Possible regions are (currently)
42 * us-east-1, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1,
43 * ap-southeast-1, ap-northeast-1, sa-east-1, cn-north-1 and any custom region
44 * configured with own region meta data.
45 */
46 private String staticRegion;
47
48 public boolean isAuto() {
49 return this.auto;
50 }
51
52 public void setAuto(boolean auto) {
53 this.auto = auto;
54 }
55
56 public String getStatic() {
57 return this.staticRegion;
58 }
59
60 public void setStatic(String staticRegion) {
61 // Feels like validation should be done to make sure this is a valid AWS region
62 // value. However current
63 // configuration in ContextRegionProviderAutoConfiguration doesn't seem to check
64 // property is valid before
65 // creating a bean definition. Leaving for now.
66 // - tgianos 11/26/2018
67 this.staticRegion = staticRegion;
68 }
69
70 public boolean isUseDefaultAwsRegionChain() {
71 return useDefaultAwsRegionChain;
72 }
73
74 public void setUseDefaultAwsRegionChain(boolean useDefaultAwsRegionChain) {
75 this.useDefaultAwsRegionChain = useDefaultAwsRegionChain;
76 }
77
78 }
79