mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
81974b977d
* fix: font color * fix: assets from iam when policy is default * fix: remove multiple files * fix mock storage * doc: add asset api * build assets docs * fix operator test * docs * fix remove assets from org label policy and not default * fix remove label policy assets and feature downgrade correctly * fix storage mock * Update docs/docs/apis/apis.md Co-authored-by: fabi <fabienne.gerschwiler@gmail.com> Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
37 lines
882 B
Go
37 lines
882 B
Go
package s3
|
|
|
|
import (
|
|
"github.com/minio/minio-go/v7"
|
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
|
|
|
caos_errs "github.com/caos/zitadel/internal/errors"
|
|
"github.com/caos/zitadel/internal/static"
|
|
)
|
|
|
|
type Config struct {
|
|
Endpoint string
|
|
AccessKeyID string
|
|
SecretAccessKey string
|
|
SSL bool
|
|
Location string
|
|
BucketPrefix string
|
|
MultiDelete bool
|
|
}
|
|
|
|
func (c *Config) NewStorage() (static.Storage, error) {
|
|
minioClient, err := minio.New(c.Endpoint, &minio.Options{
|
|
Creds: credentials.NewStaticV4(c.AccessKeyID, c.SecretAccessKey, ""),
|
|
Secure: c.SSL,
|
|
Region: c.Location,
|
|
})
|
|
if err != nil {
|
|
return nil, caos_errs.ThrowInternal(err, "MINIO-2n9fs", "Errors.Assets.Store.NotInitialized")
|
|
}
|
|
return &Minio{
|
|
Client: minioClient,
|
|
Location: c.Location,
|
|
BucketPrefix: c.BucketPrefix,
|
|
MultiDelete: c.MultiDelete,
|
|
}, nil
|
|
}
|