minio_api

package
v1.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package minio_api

Index

Constants

View Source
const (
	IAMIBAP = "IBAP"
	IAMRBAP = "RBAP"

	IdentifyAdmin     = "Admin"
	IdentifyAccessKey = "AccessKey"

	OneBucketObjectCRUD = "WithOneBucketObjectCRUD"
)
View Source
const (
	AccessKeyIDMaxLen     = 50
	SecretAccessKeyMaxLen = 128
)

Variables

This section is empty.

Functions

func NewCred

func NewCred(id, secret string) miniocred.Value

Types

type BucketConfig

type BucketConfig struct {
	// username to make bucket
	BusinessUser BusinessUser

	// restrict bucket Quota size: /Byte
	Quota uint64

	// bucket name to get, delete, update
	BucketName string
}

type BusinessUser

type BusinessUser struct {
	ID   string
	Name string
}

BusinessUser assume the business user is

type Client

type Client struct {
	Endpoint string
	miniocred.Value
	Secure bool
	// contains filtered or unexported fields
}

func New

func New(
	endpoint string,
	accessKeyID string,
	secretAccessKey string,
	sessionToken string,
	secure bool,
) (*Client, error)

func (*Client) AddIAMUser added in v1.1.1

func (c *Client) AddIAMUser(cred *miniocred.Value) error

func (*Client) AtomicWorkflow added in v1.1.1

func (c *Client) AtomicWorkflow(req Req) (resp Resp, err error)

AtomicWorkflow functionality:

  1. create a bucket, set bucket quota by byte{BucketQuotaByte} with optional bucket name{BucketName}
  2. create an iam credential{AccessKeyID, SecretAccessKey}
  3. set bucket RBAPolicy, with info(2): Principal{AccessKeyID}, with info(1): Resource{BucketName, BucketName/*}, Action{CRUD}
  4. iam user policy (1). create an IAM IBAPolicy, with info(1): Resource{BucketName, BucketName/*}, with Action{CRUD} (2). attach policy with info(4) to info(2)
  5. return Result of all sensitive info(1,2,3,4,5)

atomicity:

  1. when any of 1,2,3,4,5 failed, rollback all, return error
  2. when all of 1,2,3,4,5 success, return Resp

synchronization 1. the func call may take some time and may be failure with nothing created in Minio Server so call to with go func() { resp, err := minioClient.AtomicWorkflow() } or use channel is a good practice

func (*Client) BatchDeleteAccessKey added in v1.1.4

func (c *Client) BatchDeleteAccessKey()

func (*Client) BatchDeleteBucket added in v1.1.4

func (c *Client) BatchDeleteBucket()

func (*Client) BatchDeletePolicy added in v1.1.4

func (c *Client) BatchDeletePolicy()

func (*Client) CreateAccessKey

func (c *Client) CreateAccessKey() (miniocred.Value, error)

func (*Client) DeleteAccessKey

func (c *Client) DeleteAccessKey(accessKeyID string) error

func (*Client) DeleteAccessPolicy

func (c *Client) DeleteAccessPolicy(config *PolicyConfig) error

DeleteAccessPolicy 1. detach the PolicyJSONString from an exists user 1. delete the PolicyJSONString from Minio Server(Minio IAM)

func (*Client) GC added in v1.1.4

func (c *Client) GC(gcFn ...util.Func)

GC garbage collection of resource that allocated: 1. Object 2. Bucket 3. AccessKey 4. IBAPolicy

func (*Client) ListAccessKey added in v1.1.4

func (c *Client) ListAccessKey()

func (*Client) ListBucket added in v1.1.4

func (c *Client) ListBucket()

func (*Client) ListCannedPolicy added in v1.1.4

func (c *Client) ListCannedPolicy()

func (*Client) MakeBucket

func (c *Client) MakeBucket(bucketConfig *BucketConfig) error

MakeBucket 1. make a new bucket 2. set bucket quota: size(B) 3. set bucket access policy

func (*Client) RemoveBucket

func (c *Client) RemoveBucket(bucketConfig *BucketConfig) error

func (*Client) RemoveIAMUser added in v1.1.1

func (c *Client) RemoveIAMUser(accessKeyID string) error

func (*Client) SetAccessPolicy added in v1.1.1

func (c *Client) SetAccessPolicy(config *PolicyConfig) error

SetAccessPolicy 1. create an IBA AccessKey Policy(IAM Policy) from business user information 2. and attach the created policy to the business user's AccessKey

func (*Client) SetBucketPolicy added in v1.1.1

func (c *Client) SetBucketPolicy(policyConfig *PolicyConfig) error

func (*Client) TempGetObject added in v1.1.3

func (c *Client) TempGetObject(objectConfig *ObjectConfig, expiry time.Duration) (*url.URL, error)

func (*Client) TempPutObject added in v1.1.3

func (c *Client) TempPutObject(objectConfig *ObjectConfig, expiry time.Duration) (*url.URL, error)

func (*Client) UpdateBucketQuota

func (c *Client) UpdateBucketQuota(bucketConfig *BucketConfig) error

func (*Client) WithContext added in v1.1.1

func (c *Client) WithContext(ctx context.Context) *Client

type ObjectConfig added in v1.1.3

type ObjectConfig struct {
	// +required
	BucketName string

	// +optional
	ObjectPath string

	// +required
	ObjectName string
}

func (*ObjectConfig) ObjectAbsName added in v1.1.3

func (c *ObjectConfig) ObjectAbsName() string

func (*ObjectConfig) ObjectAbsPath added in v1.1.3

func (c *ObjectConfig) ObjectAbsPath() string

type PolicyConfig

type PolicyConfig struct {
	// +required
	BusinessUser BusinessUser

	// Minio's UserName equals to Minio's AccessKeyID
	// +required Cred.AccessKeyID
	Cred miniocred.Value

	// +optional
	GroupName string

	// +required
	BucketName string

	// when delete policy from a user, must provide the PolicyName
	// +required
	// when create policy from a user, api will ignore the PolicyName
	// +optional
	PolicyName string
}

func (*PolicyConfig) IBAPAccessKeyWithOneBucketObjectCRUDPolicy

func (c *PolicyConfig) IBAPAccessKeyWithOneBucketObjectCRUDPolicy() (string, error)

func (*PolicyConfig) RBAPBucketWithAccessKeyOneBucketObjectCRUDStatement

func (c *PolicyConfig) RBAPBucketWithAccessKeyOneBucketObjectCRUDStatement() s3apiv2.Statement

func (*PolicyConfig) RBAPBucketWithAdminAllStatement

func (c *PolicyConfig) RBAPBucketWithAdminAllStatement() s3apiv2.Statement

func (*PolicyConfig) RBAPBucketWithAdminAllWithAccessKeyOneBucketObjectCRUDPolicy

func (c *PolicyConfig) RBAPBucketWithAdminAllWithAccessKeyOneBucketObjectCRUDPolicy() (string, error)

type Req added in v1.1.1

type Req struct {
	// +required
	UserID uint64
	// +required
	UserName string
	// +required
	BucketQuotaByte uint64
	// +optional
	BucketName string
}

type Resp added in v1.1.1

type Resp struct {
	Req
	CredValue      miniocred.Value
	CredPolicyName string
}

Directories

Path Synopsis
Package minio_inst/client.go was generated by codegen, please fix its package dependency, but do not modify its functionality
Package minio_inst/client.go was generated by codegen, please fix its package dependency, but do not modify its functionality

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL