Passed
Push — master ( ad04e3...c5b8de )
by eval
01:47
created

config.Endpoints.HasCloudwatchLogs   A

Complexity

Conditions 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nop 0
dl 0
loc 5
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
	CloudwatchLogs string
7
	DynamoDB       string
8
	EC2            string
9
	KMS            string
10
	PinpointEmail  string
11
	S3             string
12
	SSM            string
13
}
14
15
func (e Endpoints) HasCloudwatchLogs() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasCloudwatchLogs should have comment or be unexported
Loading history...
16
	if e.CloudwatchLogs != "" {
17
		return true
18
	}
19
	return EnvCloudwatchLogsEndpoint() != ""
20
}
21
22
func (e Endpoints) GetCloudwatchLogs() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetCloudwatchLogs should have comment or be unexported
Loading history...
23
	envvar := EnvCloudwatchLogsEndpoint()
24
	if envvar != "" {
25
		return aws.ResolveWithEndpointURL(envvar)
26
	}
27
	return aws.ResolveWithEndpointURL(e.CloudwatchLogs)
28
}
29
30
func (e Endpoints) HasDynamoDB() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasDynamoDB should have comment or be unexported
Loading history...
31
	if e.DynamoDB != "" {
32
		return true
33
	}
34
	return EnvDynamoDBEndpoint() != ""
35
}
36
37
func (e Endpoints) GetDynamoDB() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetDynamoDB should have comment or be unexported
Loading history...
38
	envvar := EnvDynamoDBEndpoint()
39
	if envvar != "" {
40
		return aws.ResolveWithEndpointURL(envvar)
41
	}
42
	return aws.ResolveWithEndpointURL(e.DynamoDB)
43
}
44
45
func (e Endpoints) HasEC2() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasEC2 should have comment or be unexported
Loading history...
46
	if e.EC2 != "" {
47
		return true
48
	}
49
	return EnvEC2Endpoint() != ""
50
}
51
52
func (e Endpoints) GetEC2() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetEC2 should have comment or be unexported
Loading history...
53
	envvar := EnvEC2Endpoint()
54
	if envvar != "" {
55
		return aws.ResolveWithEndpointURL(envvar)
56
	}
57
	return aws.ResolveWithEndpointURL(e.EC2)
58
}
59
60
func (e Endpoints) HasPinpointEmail() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasPinpointEmail should have comment or be unexported
Loading history...
61
	if e.PinpointEmail != "" {
62
		return true
63
	}
64
	return EnvPinpointEmailEndpoint() != ""
65
}
66
67
func (e Endpoints) GetPinpointEmail() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetPinpointEmail should have comment or be unexported
Loading history...
68
	envvar := EnvPinpointEmailEndpoint()
69
	if envvar != "" {
70
		return aws.ResolveWithEndpointURL(envvar)
71
	}
72
	return aws.ResolveWithEndpointURL(e.PinpointEmail)
73
}
74
75
func (e Endpoints) HasKMS() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasKMS should have comment or be unexported
Loading history...
76
	if e.KMS != "" {
77
		return true
78
	}
79
	return EnvKMSEndpoint() != ""
80
}
81
82
func (e Endpoints) GetKMS() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetKMS should have comment or be unexported
Loading history...
83
	envvar := EnvKMSEndpoint()
84
	if envvar != "" {
85
		return aws.ResolveWithEndpointURL(envvar)
86
	}
87
	return aws.ResolveWithEndpointURL(e.KMS)
88
}
89
90
func (e Endpoints) HasS3() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasS3 should have comment or be unexported
Loading history...
91
	if e.S3 != "" {
92
		return true
93
	}
94
	return EnvS3Endpoint() != ""
95
}
96
97
func (e Endpoints) GetS3() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetS3 should have comment or be unexported
Loading history...
98
	envvar := EnvS3Endpoint()
99
	if envvar != "" {
100
		return aws.ResolveWithEndpointURL(envvar)
101
	}
102
	return aws.ResolveWithEndpointURL(e.S3)
103
}
104
105
func (e Endpoints) HasSSM() bool {
0 ignored issues
show
introduced by
exported method Endpoints.HasSSM should have comment or be unexported
Loading history...
106
	if e.SSM != "" {
107
		return true
108
	}
109
	return EnvSSMEndpoint() != ""
110
}
111
112
func (e Endpoints) GetSSM() aws.ResolveWithEndpoint {
0 ignored issues
show
introduced by
exported method Endpoints.GetSSM should have comment or be unexported
Loading history...
113
	envvar := EnvSSMEndpoint()
114
	if envvar != "" {
115
		return aws.ResolveWithEndpointURL(envvar)
116
	}
117
	return aws.ResolveWithEndpointURL(e.SSM)
118
}
119