Passed
Push — master ( b0a384...ad04e3 )
by eval
01:25
created

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