Passed
Pull Request — master (#26)
by eval
01:56
created

config.Endpoints.GetEC2   A

Complexity

Conditions 2

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
package config
2
3
import "github.com/aws/aws-sdk-go-v2/aws"
4
5
type Endpoints struct {
0 ignored issues
show
introduced by
exported type Endpoints should have comment or be unexported
Loading history...
6
	Athena         string
7
	CloudwatchLogs string
8
	DynamoDB       string
9
	EC2            string
10
	KMS            string
11
	PinpointEmail  string
12
	S3             string
13
	SES            string
14
	SSM            string
15
}
16
17
func (e Endpoints) HasAthena() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasAthena should have comment or be unexported
Loading history...
18
	if e.Athena != "" {
19
		return true
20
	}
21
	return EnvAthenaEndpoint() != ""
22
}
23
24
func (e Endpoints) GetAthena() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetAthena should have comment or be unexported
Loading history...
25
	envvar := EnvAthenaEndpoint()
26
	if envvar != "" {
27
		return aws.ResolveWithEndpointURL(envvar)
28
	}
29
	return aws.ResolveWithEndpointURL(e.Athena)
30
}
31
32
func (e Endpoints) HasCloudwatchLogs() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasCloudwatchLogs should have comment or be unexported
Loading history...
33
	if e.CloudwatchLogs != "" {
34
		return true
35
	}
36
	return EnvCloudwatchLogsEndpoint() != ""
37
}
38
39
func (e Endpoints) GetCloudwatchLogs() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetCloudwatchLogs should have comment or be unexported
Loading history...
40
	envvar := EnvCloudwatchLogsEndpoint()
41
	if envvar != "" {
42
		return aws.ResolveWithEndpointURL(envvar)
43
	}
44
	return aws.ResolveWithEndpointURL(e.CloudwatchLogs)
45
}
46
47
func (e Endpoints) HasDynamoDB() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasDynamoDB should have comment or be unexported
Loading history...
48
	if e.DynamoDB != "" {
49
		return true
50
	}
51
	return EnvDynamoDBEndpoint() != ""
52
}
53
54
func (e Endpoints) GetDynamoDB() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetDynamoDB should have comment or be unexported
Loading history...
55
	envvar := EnvDynamoDBEndpoint()
56
	if envvar != "" {
57
		return aws.ResolveWithEndpointURL(envvar)
58
	}
59
	return aws.ResolveWithEndpointURL(e.DynamoDB)
60
}
61
62
func (e Endpoints) HasEC2() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasEC2 should have comment or be unexported
Loading history...
63
	if e.EC2 != "" {
64
		return true
65
	}
66
	return EnvEC2Endpoint() != ""
67
}
68
69
func (e Endpoints) GetEC2() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetEC2 should have comment or be unexported
Loading history...
70
	envvar := EnvEC2Endpoint()
71
	if envvar != "" {
72
		return aws.ResolveWithEndpointURL(envvar)
73
	}
74
	return aws.ResolveWithEndpointURL(e.EC2)
75
}
76
77
func (e Endpoints) HasPinpointEmail() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasPinpointEmail should have comment or be unexported
Loading history...
78
	if e.PinpointEmail != "" {
79
		return true
80
	}
81
	return EnvPinpointEmailEndpoint() != ""
82
}
83
84
func (e Endpoints) GetPinpointEmail() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetPinpointEmail should have comment or be unexported
Loading history...
85
	envvar := EnvPinpointEmailEndpoint()
86
	if envvar != "" {
87
		return aws.ResolveWithEndpointURL(envvar)
88
	}
89
	return aws.ResolveWithEndpointURL(e.PinpointEmail)
90
}
91
92
func (e Endpoints) HasKMS() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasKMS should have comment or be unexported
Loading history...
93
	if e.KMS != "" {
94
		return true
95
	}
96
	return EnvKMSEndpoint() != ""
97
}
98
99
func (e Endpoints) GetKMS() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetKMS should have comment or be unexported
Loading history...
100
	envvar := EnvKMSEndpoint()
101
	if envvar != "" {
102
		return aws.ResolveWithEndpointURL(envvar)
103
	}
104
	return aws.ResolveWithEndpointURL(e.KMS)
105
}
106
107
func (e Endpoints) HasS3() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasS3 should have comment or be unexported
Loading history...
108
	if e.S3 != "" {
109
		return true
110
	}
111
	return EnvS3Endpoint() != ""
112
}
113
114
func (e Endpoints) GetS3() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetS3 should have comment or be unexported
Loading history...
115
	envvar := EnvS3Endpoint()
116
	if envvar != "" {
117
		return aws.ResolveWithEndpointURL(envvar)
118
	}
119
	return aws.ResolveWithEndpointURL(e.S3)
120
}
121
122
func (e Endpoints) HasSES() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasSES should have comment or be unexported
Loading history...
123
	if e.SES != "" {
124
		return true
125
	}
126
	return EnvSESEndpoint() != ""
127
}
128
129
func (e Endpoints) GetSES() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetSES should have comment or be unexported
Loading history...
130
	envvar := EnvSESEndpoint()
131
	if envvar != "" {
132
		return aws.ResolveWithEndpointURL(envvar)
133
	}
134
	return aws.ResolveWithEndpointURL(e.SES)
135
}
136
137
func (e Endpoints) HasSSM() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasSSM should have comment or be unexported
Loading history...
138
	if e.SSM != "" {
139
		return true
140
	}
141
	return EnvSSMEndpoint() != ""
142
}
143
144
func (e Endpoints) GetSSM() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetSSM should have comment or be unexported
Loading history...
145
	envvar := EnvSSMEndpoint()
146
	if envvar != "" {
147
		return aws.ResolveWithEndpointURL(envvar)
148
	}
149
	return aws.ResolveWithEndpointURL(e.SSM)
150
}
151