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>
32 lines
860 B
Go
32 lines
860 B
Go
package command
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/caos/zitadel/internal/domain"
|
|
caos_errors "github.com/caos/zitadel/internal/errors"
|
|
)
|
|
|
|
func (c *Commands) UploadAsset(ctx context.Context, bucketName, objectName, contentType string, file io.Reader, size int64) (*domain.AssetInfo, error) {
|
|
if c.static == nil {
|
|
return nil, caos_errors.ThrowPreconditionFailed(nil, "STATIC-Fm92f", "Errors.Assets.Store.NotConfigured")
|
|
}
|
|
return c.static.PutObject(ctx,
|
|
bucketName,
|
|
objectName,
|
|
contentType,
|
|
file,
|
|
size,
|
|
true,
|
|
)
|
|
}
|
|
|
|
func (c *Commands) RemoveAsset(ctx context.Context, bucketName, storeKey string) error {
|
|
return c.static.RemoveObject(ctx, bucketName, storeKey)
|
|
}
|
|
|
|
func (c *Commands) RemoveAssetsFolder(ctx context.Context, bucketName, path string, recursive bool) error {
|
|
return c.static.RemoveObjects(ctx, bucketName, path, recursive)
|
|
}
|