Files
golib/aws/role/interface.go
Nicolas JUHEL 94f90d7e22 Bump to sdk aws go v2 at release v0.26.0...
Bump dependancies
Refactor / Fix aws to work with sdk-aws-go-v2 at release v0.26.0...
2020-10-02 12:43:08 +02:00

38 lines
869 B
Go

package role
import (
"context"
"github.com/aws/aws-sdk-go-v2/service/iam"
"github.com/aws/aws-sdk-go-v2/service/iam/types"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/nabbar/golib/aws/helper"
"github.com/nabbar/golib/errors"
)
type client struct {
helper.Helper
iam *iam.Client
s3 *s3.Client
}
type Role interface {
List() ([]*types.Role, errors.Error)
Check(name string) (string, errors.Error)
Add(name, role string) (string, errors.Error)
Delete(roleName string) errors.Error
PolicyAttach(policyARN, roleName string) errors.Error
PolicyDetach(policyARN, roleName string) errors.Error
PolicyListAttached(roleName string) ([]*types.AttachedPolicy, errors.Error)
}
func New(ctx context.Context, bucket string, iam *iam.Client, s3 *s3.Client) Role {
return &client{
Helper: helper.New(ctx, bucket),
iam: iam,
s3: s3,
}
}