mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-09 00:09:43 +00:00
IT with aws client mock
This commit is contained in:
@@ -64,7 +64,7 @@ GOLANGCI_LINT_VERSION ?= v1.57.2
|
|||||||
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: fmt vet lint generate manifests kustomize helmify generate-docs mock
|
all: fmt vet lint generate manifests kustomize helmify generate-docs
|
||||||
|
|
||||||
|
|
||||||
##@ Development
|
##@ Development
|
||||||
@@ -72,10 +72,6 @@ all: fmt vet lint generate manifests kustomize helmify generate-docs mock
|
|||||||
helm: manifests kustomize helmify
|
helm: manifests kustomize helmify
|
||||||
$(KUSTOMIZE) build config/release | $(HELMIFY) -crd-dir charts/irsa-manager
|
$(KUSTOMIZE) build config/release | $(HELMIFY) -crd-dir charts/irsa-manager
|
||||||
|
|
||||||
.PHONY: mock
|
|
||||||
mock: mockgen
|
|
||||||
mockgen -source internal/client/aws.go -destination internal/mock/aws_mock.go -package mock
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: manifests
|
.PHONY: manifests
|
||||||
@@ -96,7 +92,7 @@ vet: ## Run go vet against code.
|
|||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: manifests generate fmt vet envtest ## Run tests.
|
test: manifests generate fmt vet envtest ## Run tests.
|
||||||
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -coverprofile cover.out
|
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
|
||||||
|
|
||||||
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
|
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
|
||||||
golangci-lint:
|
golangci-lint:
|
||||||
@@ -185,11 +181,6 @@ envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
|
|||||||
$(ENVTEST): $(LOCALBIN)
|
$(ENVTEST): $(LOCALBIN)
|
||||||
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
|
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
|
||||||
|
|
||||||
.PHONY: mockgen
|
|
||||||
mockgen: $(MOCKGEN) ## Download envtest-setup locally if necessary.
|
|
||||||
$(MOCKGEN): $(LOCALBIN)
|
|
||||||
test -s $(LOCALBIN)/mockgen || GOBIN=$(LOCALBIN) go install go.uber.org/mock/mockgen@latest
|
|
||||||
|
|
||||||
.PHONY: helmify
|
.PHONY: helmify
|
||||||
helmify: $(HELMIFY) ## Download helmify locally if necessary.
|
helmify: $(HELMIFY) ## Download helmify locally if necessary.
|
||||||
$(HELMIFY): $(LOCALBIN)
|
$(HELMIFY): $(LOCALBIN)
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ type AwsS3API interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AwsClient interface {
|
type AwsClient interface {
|
||||||
IamCient() *AwsIamClient
|
IamClient() *AwsIamClient
|
||||||
S3Cient(region, bucketName string) *AwsS3Client
|
S3Client(region, bucketName string) *AwsS3Client
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAwsClientFactory(ctx context.Context) (*AwsClientFactory, error) {
|
func NewAwsClientFactory(ctx context.Context) (*AwsClientFactory, error) {
|
||||||
@@ -43,13 +43,13 @@ func NewAwsClientFactory(ctx context.Context) (*AwsClientFactory, error) {
|
|||||||
return &AwsClientFactory{config: cfg}, nil
|
return &AwsClientFactory{config: cfg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AwsClientFactory) IamCient() *AwsIamClient {
|
func (a *AwsClientFactory) IamClient() *AwsIamClient {
|
||||||
return &AwsIamClient{
|
return &AwsIamClient{
|
||||||
iam.NewFromConfig(a.config),
|
iam.NewFromConfig(a.config),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AwsClientFactory) S3Cient(bucketName, region string) *AwsS3Client {
|
func (a *AwsClientFactory) S3Client(bucketName, region string) *AwsS3Client {
|
||||||
return &AwsS3Client{
|
return &AwsS3Client{
|
||||||
s3.NewFromConfig(a.config),
|
s3.NewFromConfig(a.config),
|
||||||
region,
|
region,
|
||||||
|
|||||||
@@ -19,12 +19,16 @@ package controller
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/aws/aws-sdk-go-v2/aws"
|
||||||
|
"github.com/aws/aws-sdk-go-v2/service/iam"
|
||||||
|
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||||
|
|
||||||
|
awsclient "github.com/kkb0318/irsa-manager/internal/client"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
irsav1alpha1 "github.com/kkb0318/irsa-manager/api/v1alpha1"
|
irsav1alpha1 "github.com/kkb0318/irsa-manager/api/v1alpha1"
|
||||||
@@ -75,10 +79,12 @@ var _ = Describe("IRSASetup Controller", func() {
|
|||||||
Expect(k8sClient.Delete(ctx, resource)).To(Succeed())
|
Expect(k8sClient.Delete(ctx, resource)).To(Succeed())
|
||||||
})
|
})
|
||||||
It("should successfully reconcile the resource", func() {
|
It("should successfully reconcile the resource", func() {
|
||||||
|
awsClient := newMockAwsClient()
|
||||||
By("Reconciling the created resource")
|
By("Reconciling the created resource")
|
||||||
controllerReconciler := &IRSASetupReconciler{
|
controllerReconciler := &IRSASetupReconciler{
|
||||||
Client: k8sClient,
|
Client: k8sClient,
|
||||||
Scheme: k8sClient.Scheme(),
|
Scheme: k8sClient.Scheme(),
|
||||||
|
AwsClient: awsClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := controllerReconciler.Reconcile(ctx, reconcile.Request{
|
_, err := controllerReconciler.Reconcile(ctx, reconcile.Request{
|
||||||
@@ -90,3 +96,42 @@ var _ = Describe("IRSASetup Controller", func() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
func newMockAwsClient() awsclient.AwsClient {
|
||||||
|
return &mockAwsClient{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type mockAwsClient struct{}
|
||||||
|
|
||||||
|
func (m *mockAwsClient) IamClient() *awsclient.AwsIamClient {
|
||||||
|
return &awsclient.AwsIamClient{AwsIamAPI: &mockAwsIamAPI{}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mockAwsClient) S3Client(region, bucketName string) *awsclient.AwsS3Client {
|
||||||
|
return &awsclient.AwsS3Client{AwsS3API: &mockAwsS3API{}}
|
||||||
|
}
|
||||||
|
|
||||||
|
type (
|
||||||
|
mockAwsIamAPI struct{}
|
||||||
|
mockAwsS3API struct{}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (m *mockAwsIamAPI) CreateOpenIDConnectProvider(ctx context.Context, params *iam.CreateOpenIDConnectProviderInput, optFns ...func(*iam.Options)) (*iam.CreateOpenIDConnectProviderOutput, error) {
|
||||||
|
return &iam.CreateOpenIDConnectProviderOutput{OpenIDConnectProviderArn: aws.String("arn::mock")}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mockAwsS3API) CreateBucket(ctx context.Context, params *s3.CreateBucketInput, optFns ...func(*s3.Options)) (*s3.CreateBucketOutput, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mockAwsS3API) PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mockAwsS3API) DeletePublicAccessBlock(ctx context.Context, params *s3.DeletePublicAccessBlockInput, optFns ...func(*s3.Options)) (*s3.DeletePublicAccessBlockOutput, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mockAwsS3API) PutBucketOwnershipControls(ctx context.Context, params *s3.PutBucketOwnershipControlsInput, optFns ...func(*s3.Options)) (*s3.PutBucketOwnershipControlsOutput, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,9 +39,11 @@ import (
|
|||||||
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
|
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
|
||||||
// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.
|
// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.
|
||||||
|
|
||||||
var cfg *rest.Config
|
var (
|
||||||
var k8sClient client.Client
|
cfg *rest.Config
|
||||||
var testEnv *envtest.Environment
|
k8sClient client.Client
|
||||||
|
testEnv *envtest.Environment
|
||||||
|
)
|
||||||
|
|
||||||
func TestControllers(t *testing.T) {
|
func TestControllers(t *testing.T) {
|
||||||
RegisterFailHandler(Fail)
|
RegisterFailHandler(Fail)
|
||||||
@@ -80,7 +82,6 @@ var _ = BeforeSuite(func() {
|
|||||||
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
|
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(k8sClient).NotTo(BeNil())
|
Expect(k8sClient).NotTo(BeNil())
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
|
|||||||
@@ -1,217 +0,0 @@
|
|||||||
// Code generated by MockGen. DO NOT EDIT.
|
|
||||||
// Source: internal/client/aws.go
|
|
||||||
//
|
|
||||||
// Generated by this command:
|
|
||||||
//
|
|
||||||
// mockgen -source internal/client/aws.go -destination internal/mock/aws_mock.go -package mock
|
|
||||||
//
|
|
||||||
|
|
||||||
// Package mock is a generated GoMock package.
|
|
||||||
package mock
|
|
||||||
|
|
||||||
import (
|
|
||||||
context "context"
|
|
||||||
reflect "reflect"
|
|
||||||
|
|
||||||
iam "github.com/aws/aws-sdk-go-v2/service/iam"
|
|
||||||
s3 "github.com/aws/aws-sdk-go-v2/service/s3"
|
|
||||||
client "github.com/kkb0318/irsa-manager/internal/client"
|
|
||||||
gomock "go.uber.org/mock/gomock"
|
|
||||||
)
|
|
||||||
|
|
||||||
// MockAwsIamAPI is a mock of AwsIamAPI interface.
|
|
||||||
type MockAwsIamAPI struct {
|
|
||||||
ctrl *gomock.Controller
|
|
||||||
recorder *MockAwsIamAPIMockRecorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// MockAwsIamAPIMockRecorder is the mock recorder for MockAwsIamAPI.
|
|
||||||
type MockAwsIamAPIMockRecorder struct {
|
|
||||||
mock *MockAwsIamAPI
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewMockAwsIamAPI creates a new mock instance.
|
|
||||||
func NewMockAwsIamAPI(ctrl *gomock.Controller) *MockAwsIamAPI {
|
|
||||||
mock := &MockAwsIamAPI{ctrl: ctrl}
|
|
||||||
mock.recorder = &MockAwsIamAPIMockRecorder{mock}
|
|
||||||
return mock
|
|
||||||
}
|
|
||||||
|
|
||||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
||||||
func (m *MockAwsIamAPI) EXPECT() *MockAwsIamAPIMockRecorder {
|
|
||||||
return m.recorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOpenIDConnectProvider mocks base method.
|
|
||||||
func (m *MockAwsIamAPI) CreateOpenIDConnectProvider(ctx context.Context, params *iam.CreateOpenIDConnectProviderInput, optFns ...func(*iam.Options)) (*iam.CreateOpenIDConnectProviderOutput, error) {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
varargs := []any{ctx, params}
|
|
||||||
for _, a := range optFns {
|
|
||||||
varargs = append(varargs, a)
|
|
||||||
}
|
|
||||||
ret := m.ctrl.Call(m, "CreateOpenIDConnectProvider", varargs...)
|
|
||||||
ret0, _ := ret[0].(*iam.CreateOpenIDConnectProviderOutput)
|
|
||||||
ret1, _ := ret[1].(error)
|
|
||||||
return ret0, ret1
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOpenIDConnectProvider indicates an expected call of CreateOpenIDConnectProvider.
|
|
||||||
func (mr *MockAwsIamAPIMockRecorder) CreateOpenIDConnectProvider(ctx, params any, optFns ...any) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
varargs := append([]any{ctx, params}, optFns...)
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOpenIDConnectProvider", reflect.TypeOf((*MockAwsIamAPI)(nil).CreateOpenIDConnectProvider), varargs...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MockAwsS3API is a mock of AwsS3API interface.
|
|
||||||
type MockAwsS3API struct {
|
|
||||||
ctrl *gomock.Controller
|
|
||||||
recorder *MockAwsS3APIMockRecorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// MockAwsS3APIMockRecorder is the mock recorder for MockAwsS3API.
|
|
||||||
type MockAwsS3APIMockRecorder struct {
|
|
||||||
mock *MockAwsS3API
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewMockAwsS3API creates a new mock instance.
|
|
||||||
func NewMockAwsS3API(ctrl *gomock.Controller) *MockAwsS3API {
|
|
||||||
mock := &MockAwsS3API{ctrl: ctrl}
|
|
||||||
mock.recorder = &MockAwsS3APIMockRecorder{mock}
|
|
||||||
return mock
|
|
||||||
}
|
|
||||||
|
|
||||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
||||||
func (m *MockAwsS3API) EXPECT() *MockAwsS3APIMockRecorder {
|
|
||||||
return m.recorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateBucket mocks base method.
|
|
||||||
func (m *MockAwsS3API) CreateBucket(ctx context.Context, params *s3.CreateBucketInput, optFns ...func(*s3.Options)) (*s3.CreateBucketOutput, error) {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
varargs := []any{ctx, params}
|
|
||||||
for _, a := range optFns {
|
|
||||||
varargs = append(varargs, a)
|
|
||||||
}
|
|
||||||
ret := m.ctrl.Call(m, "CreateBucket", varargs...)
|
|
||||||
ret0, _ := ret[0].(*s3.CreateBucketOutput)
|
|
||||||
ret1, _ := ret[1].(error)
|
|
||||||
return ret0, ret1
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateBucket indicates an expected call of CreateBucket.
|
|
||||||
func (mr *MockAwsS3APIMockRecorder) CreateBucket(ctx, params any, optFns ...any) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
varargs := append([]any{ctx, params}, optFns...)
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateBucket", reflect.TypeOf((*MockAwsS3API)(nil).CreateBucket), varargs...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePublicAccessBlock mocks base method.
|
|
||||||
func (m *MockAwsS3API) DeletePublicAccessBlock(ctx context.Context, params *s3.DeletePublicAccessBlockInput, optFns ...func(*s3.Options)) (*s3.DeletePublicAccessBlockOutput, error) {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
varargs := []any{ctx, params}
|
|
||||||
for _, a := range optFns {
|
|
||||||
varargs = append(varargs, a)
|
|
||||||
}
|
|
||||||
ret := m.ctrl.Call(m, "DeletePublicAccessBlock", varargs...)
|
|
||||||
ret0, _ := ret[0].(*s3.DeletePublicAccessBlockOutput)
|
|
||||||
ret1, _ := ret[1].(error)
|
|
||||||
return ret0, ret1
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePublicAccessBlock indicates an expected call of DeletePublicAccessBlock.
|
|
||||||
func (mr *MockAwsS3APIMockRecorder) DeletePublicAccessBlock(ctx, params any, optFns ...any) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
varargs := append([]any{ctx, params}, optFns...)
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePublicAccessBlock", reflect.TypeOf((*MockAwsS3API)(nil).DeletePublicAccessBlock), varargs...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// PutBucketOwnershipControls mocks base method.
|
|
||||||
func (m *MockAwsS3API) PutBucketOwnershipControls(ctx context.Context, params *s3.PutBucketOwnershipControlsInput, optFns ...func(*s3.Options)) (*s3.PutBucketOwnershipControlsOutput, error) {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
varargs := []any{ctx, params}
|
|
||||||
for _, a := range optFns {
|
|
||||||
varargs = append(varargs, a)
|
|
||||||
}
|
|
||||||
ret := m.ctrl.Call(m, "PutBucketOwnershipControls", varargs...)
|
|
||||||
ret0, _ := ret[0].(*s3.PutBucketOwnershipControlsOutput)
|
|
||||||
ret1, _ := ret[1].(error)
|
|
||||||
return ret0, ret1
|
|
||||||
}
|
|
||||||
|
|
||||||
// PutBucketOwnershipControls indicates an expected call of PutBucketOwnershipControls.
|
|
||||||
func (mr *MockAwsS3APIMockRecorder) PutBucketOwnershipControls(ctx, params any, optFns ...any) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
varargs := append([]any{ctx, params}, optFns...)
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutBucketOwnershipControls", reflect.TypeOf((*MockAwsS3API)(nil).PutBucketOwnershipControls), varargs...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// PutObject mocks base method.
|
|
||||||
func (m *MockAwsS3API) PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error) {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
varargs := []any{ctx, params}
|
|
||||||
for _, a := range optFns {
|
|
||||||
varargs = append(varargs, a)
|
|
||||||
}
|
|
||||||
ret := m.ctrl.Call(m, "PutObject", varargs...)
|
|
||||||
ret0, _ := ret[0].(*s3.PutObjectOutput)
|
|
||||||
ret1, _ := ret[1].(error)
|
|
||||||
return ret0, ret1
|
|
||||||
}
|
|
||||||
|
|
||||||
// PutObject indicates an expected call of PutObject.
|
|
||||||
func (mr *MockAwsS3APIMockRecorder) PutObject(ctx, params any, optFns ...any) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
varargs := append([]any{ctx, params}, optFns...)
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutObject", reflect.TypeOf((*MockAwsS3API)(nil).PutObject), varargs...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MockAwsClient is a mock of AwsClient interface.
|
|
||||||
type MockAwsClient struct {
|
|
||||||
ctrl *gomock.Controller
|
|
||||||
recorder *MockAwsClientMockRecorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// MockAwsClientMockRecorder is the mock recorder for MockAwsClient.
|
|
||||||
type MockAwsClientMockRecorder struct {
|
|
||||||
mock *MockAwsClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewMockAwsClient creates a new mock instance.
|
|
||||||
func NewMockAwsClient(ctrl *gomock.Controller) *MockAwsClient {
|
|
||||||
mock := &MockAwsClient{ctrl: ctrl}
|
|
||||||
mock.recorder = &MockAwsClientMockRecorder{mock}
|
|
||||||
return mock
|
|
||||||
}
|
|
||||||
|
|
||||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
||||||
func (m *MockAwsClient) EXPECT() *MockAwsClientMockRecorder {
|
|
||||||
return m.recorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// IamCient mocks base method.
|
|
||||||
func (m *MockAwsClient) IamCient() *client.AwsIamClient {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
ret := m.ctrl.Call(m, "IamCient")
|
|
||||||
ret0, _ := ret[0].(*client.AwsIamClient)
|
|
||||||
return ret0
|
|
||||||
}
|
|
||||||
|
|
||||||
// IamCient indicates an expected call of IamCient.
|
|
||||||
func (mr *MockAwsClientMockRecorder) IamCient() *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IamCient", reflect.TypeOf((*MockAwsClient)(nil).IamCient))
|
|
||||||
}
|
|
||||||
|
|
||||||
// S3Cient mocks base method.
|
|
||||||
func (m *MockAwsClient) S3Cient(region, bucketName string) *client.AwsS3Client {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
ret := m.ctrl.Call(m, "S3Cient", region, bucketName)
|
|
||||||
ret0, _ := ret[0].(*client.AwsS3Client)
|
|
||||||
return ret0
|
|
||||||
}
|
|
||||||
|
|
||||||
// S3Cient indicates an expected call of S3Cient.
|
|
||||||
func (mr *MockAwsClientMockRecorder) S3Cient(region, bucketName any) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "S3Cient", reflect.TypeOf((*MockAwsClient)(nil).S3Cient), region, bucketName)
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ type AwsIdP struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewAwsIdP(awsConfig client.AwsClient, issuerMeta selfhosted.OIDCIssuerMeta) (*AwsIdP, error) {
|
func NewAwsIdP(awsConfig client.AwsClient, issuerMeta selfhosted.OIDCIssuerMeta) (*AwsIdP, error) {
|
||||||
iamClient := awsConfig.IamCient()
|
iamClient := awsConfig.IamClient()
|
||||||
return &AwsIdP{iamClient, issuerMeta}, nil
|
return &AwsIdP{iamClient, issuerMeta}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ type S3IdPDiscovery struct {
|
|||||||
// NewS3IdPDiscovery initializes a new instance of S3IdPCreator with the specified AWS region and bucket name.
|
// NewS3IdPDiscovery initializes a new instance of S3IdPCreator with the specified AWS region and bucket name.
|
||||||
// This function attempts to create an AWS client configured for the specified region.
|
// This function attempts to create an AWS client configured for the specified region.
|
||||||
func NewS3IdPDiscovery(awsConfig client.AwsClient, region, bucketName string) *S3IdPDiscovery {
|
func NewS3IdPDiscovery(awsConfig client.AwsClient, region, bucketName string) *S3IdPDiscovery {
|
||||||
s3Client := awsConfig.S3Cient(region, bucketName)
|
s3Client := awsConfig.S3Client(region, bucketName)
|
||||||
return &S3IdPDiscovery{s3Client}
|
return &S3IdPDiscovery{s3Client}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user