forked from FeLvi-zzz/tentez
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
53 lines (44 loc) · 1.13 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package tentez
import (
"context"
"io"
"os"
"github.com/aws/aws-sdk-go-v2/config"
elbv2 "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2"
)
type elbv2Client interface {
ModifyListener(ctx context.Context, params *elbv2.ModifyListenerInput, optFns ...func(*elbv2.Options)) (*elbv2.ModifyListenerOutput, error)
ModifyRule(ctx context.Context, params *elbv2.ModifyRuleInput, optFns ...func(*elbv2.Options)) (*elbv2.ModifyRuleOutput, error)
DescribeRules(ctx context.Context, params *elbv2.DescribeRulesInput, optFns ...func(*elbv2.Options)) (*elbv2.DescribeRulesOutput, error)
elbv2.DescribeListenersAPIClient
elbv2.DescribeTargetGroupsAPIClient
}
type Client struct {
elbv2 elbv2Client
}
type IOStreams struct {
in io.Reader
out io.Writer
err io.Writer
}
type Config struct {
client Client
io IOStreams
}
func newConfig() (Config, error) {
cfg, err := config.LoadDefaultConfig(context.TODO())
if err != nil {
return Config{}, err
}
elbv2svc := elbv2.NewFromConfig(cfg)
return Config{
client: Client{
elbv2: elbv2svc,
},
io: IOStreams{
in: os.Stdin,
out: os.Stdout,
err: os.Stderr,
},
}, nil
}