bucket

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BucketExists = uint8(1)
View Source
var BucketExistsUnknown = uint8(2)
View Source
var BucketNotExist = uint8(0)
View Source
var PermissionAllowed = uint8(1)
View Source
var PermissionDenied = uint8(0)
View Source
var PermissionUnknown = uint8(2)

Functions

func FromReader

func FromReader(r io.Reader, bucketChan chan Bucket) error

func IsValidS3BucketName

func IsValidS3BucketName(bucketName string) bool

func NormalizeName added in v0.2.0

func NormalizeName(raw string) (string, error)

NormalizeName accepts a raw bucket identifier (bucket name, URL, or ARN-like host) and returns a canonical bucket name.

func Permission

func Permission(canDo bool) uint8

Permission is a convenience method to convert a boolean into either a PermissionAllowed or PermissionDenied

func ReadFromFile

func ReadFromFile(bucketFile string, bucketChan chan Bucket) error

Types

type Bucket

type Bucket struct {
	//gorm.Model
	ID                uint      `gorm:"primarykey" json:",omitempty"`
	Name              string    `json:"name" gorm:"name;size:64;index"`
	Region            string    `json:"region" gorm:"size:20"`
	Exists            uint8     `json:"exists"`
	DateScanned       time.Time `json:"date_scanned"`
	Objects           []Object  `json:"objects"`
	ObjectsEnumerated bool      `json:"objects_enumerated"`
	Provider          string    `json:"provider"`
	NumObjects        int32     `json:"num_objects"`

	// Total size of all bucket objects in bytes
	BucketSize       uint64 `json:"bucket_size"`
	OwnerID          string `json:"owner_id"`
	OwnerDisplayName string `json:"owner_display_name"`

	PermAuthUsersRead        uint8 `json:"perm_auth_users_read"`
	PermAuthUsersWrite       uint8 `json:"perm_auth_users_write"`
	PermAuthUsersReadACL     uint8 `json:"perm_auth_users_read_acl"`
	PermAuthUsersWriteACL    uint8 `json:"perm_auth_users_write_acl"`
	PermAuthUsersFullControl uint8 `json:"perm_auth_users_full_control"`

	PermAllUsersRead        uint8 `json:"perm_all_users_read"`
	PermAllUsersWrite       uint8 `json:"perm_all_users_write"`
	PermAllUsersReadACL     uint8 `json:"perm_all_users_read_acl"`
	PermAllUsersWriteACL    uint8 `json:"perm_all_users_write_acl"`
	PermAllUsersFullControl uint8 `json:"perm_all_users_full_control"`
}

func NewBucket

func NewBucket(name string) Bucket

func (*Bucket) DenyAll

func (b *Bucket) DenyAll()

func (*Bucket) ParseACLOutputV2

func (b *Bucket) ParseACLOutputV2(aclOutput *s3.GetBucketAclOutput) error

ParseACLOutputV2 TODO: probably move this to providers.go

func (*Bucket) Permissions

func (b *Bucket) Permissions() map[*types.Grantee]map[string]uint8

func (*Bucket) String

func (b *Bucket) String() string

type Object

type Object struct {
	//gorm.Model
	ID       uint   `gorm:"primarykey" json:",omitempty"`
	Key      string `json:"key" gorm:"type:string;size:1024"` // Keys can be up to 1,024 bytes long, UTF-8 encoded plus an additional byte just in case. https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html
	Size     uint64 `json:"size"`
	BucketID uint   `json:",omitempty"`
}

Jump to

Keyboard shortcuts

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