mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-09 00:09:43 +00:00
aws client injection
This commit is contained in:
@@ -10,20 +10,22 @@ import (
|
||||
type AwsS3IdPFactory struct {
|
||||
region string
|
||||
bucketName string
|
||||
awsConfig *awsclient.AwsConfig
|
||||
awsClient awsclient.AwsClient
|
||||
jwk *selfhosted.JWK
|
||||
jwksFileName string
|
||||
}
|
||||
|
||||
func NewAwsS3IdpFactory(ctx context.Context, region, bucketName string, jwk *selfhosted.JWK, jwksFileName string) (*AwsS3IdPFactory, error) {
|
||||
awsConfig, err := awsclient.NewAwsClient(ctx, region)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
func NewAwsS3IdpFactory(ctx context.Context,
|
||||
region, bucketName string,
|
||||
jwk *selfhosted.JWK,
|
||||
jwksFileName string,
|
||||
awsClient awsclient.AwsClient,
|
||||
) (*AwsS3IdPFactory, error) {
|
||||
// awsClient, err := awsclient.NewAwsClientFactory(ctx, region)
|
||||
return &AwsS3IdPFactory{
|
||||
region,
|
||||
bucketName,
|
||||
awsConfig,
|
||||
awsClient,
|
||||
jwk,
|
||||
jwksFileName,
|
||||
}, nil
|
||||
@@ -34,11 +36,11 @@ func (f *AwsS3IdPFactory) IssuerMeta() selfhosted.OIDCIssuerMeta {
|
||||
}
|
||||
|
||||
func (f *AwsS3IdPFactory) IdP(i selfhosted.OIDCIssuerMeta) (selfhosted.OIDCIdP, error) {
|
||||
return NewAwsIdP(f.awsConfig, i)
|
||||
return NewAwsIdP(f.awsClient, i)
|
||||
}
|
||||
|
||||
func (f *AwsS3IdPFactory) IdPDiscovery() selfhosted.OIDCIdPDiscovery {
|
||||
return NewS3IdPDiscovery(f.awsConfig, f.bucketName)
|
||||
return NewS3IdPDiscovery(f.awsClient, f.region, f.bucketName)
|
||||
}
|
||||
|
||||
func (f *AwsS3IdPFactory) IdPDiscoveryContents(i selfhosted.OIDCIssuerMeta) selfhosted.OIDCIdPDiscoveryContents {
|
||||
|
||||
@@ -12,7 +12,7 @@ type AwsIdP struct {
|
||||
issuerMeta selfhosted.OIDCIssuerMeta
|
||||
}
|
||||
|
||||
func NewAwsIdP(awsConfig *client.AwsConfig, issuerMeta selfhosted.OIDCIssuerMeta) (*AwsIdP, error) {
|
||||
func NewAwsIdP(awsConfig client.AwsClient, issuerMeta selfhosted.OIDCIssuerMeta) (*AwsIdP, error) {
|
||||
iamClient := awsConfig.IamCient()
|
||||
return &AwsIdP{iamClient, issuerMeta}, nil
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ type S3IdPDiscovery struct {
|
||||
|
||||
// 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.
|
||||
func NewS3IdPDiscovery(awsConfig *client.AwsConfig, bucketName string) *S3IdPDiscovery {
|
||||
s3Client := awsConfig.S3Cient(bucketName)
|
||||
func NewS3IdPDiscovery(awsConfig client.AwsClient, region, bucketName string) *S3IdPDiscovery {
|
||||
s3Client := awsConfig.S3Cient(region, bucketName)
|
||||
return &S3IdPDiscovery{s3Client}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user