Repository navigation
Expand file tree
/
Copy pathtypes.go
More file actions
62 lines (50 loc) · 1.61 KB
/
Copy pathtypes.go
File metadata and controls
62 lines (50 loc) · 1.61 KB
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
54
55
56
57
58
59
60
61
62
// Copyright 2026 variHQ OÜ
// SPDX-License-Identifier: BSD-3-Clause
package main
import (
"context"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/iam"
)
type PolicyVersion struct {
CreateDate *time.Time `json:"createDate"`
VersionID *string `json:"versionID"` //nolint:tagliatelle
}
type Output struct {
UnusedPolicies []string `json:"unused"`
WithMultipleVersions map[string][]PolicyVersion `json:"withVersions"`
}
// ServiceIAM lists IAM policies and their versions using the AWS SDK.
type ServiceIAM interface {
iam.ListPoliciesAPIClient
iam.ListPolicyVersionsAPIClient
}
var (
_ iam.ListPoliciesAPIClient = ServiceIAM(nil)
_ iam.ListPolicyVersionsAPIClient = ServiceIAM(nil)
)
// App provides functionality for interacting with the AWS IAM service.
type App struct {
client ServiceIAM
}
// ConfigLoader defines an interface for loading AWS SDK config with customizable options.
type ConfigLoader interface {
LoadDefaultConfig(
ctx context.Context,
optFns ...func(*config.LoadOptions) error,
) (cfg aws.Config, err error)
}
// DefaultConfigLoader loads default AWS SDK config with optional customization.
type DefaultConfigLoader struct{}
// LoadDefaultConfig loads the default AWS SDK config with optional modifiers.
//
//nolint:nonamedreturns
func (d DefaultConfigLoader) LoadDefaultConfig(
ctx context.Context,
optFns ...func(*config.LoadOptions) error,
) (cfg aws.Config, err error) {
return config.LoadDefaultConfig(ctx, optFns...) //nolint:wrapcheck
}
var _ ConfigLoader = (*DefaultConfigLoader)(nil)