ostor

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: BSD-2-Clause Imports: 8 Imported by: 0

README

ostor

Package ostor wraps around the object storage management API provided by Virtuozzo Hybrid Infrastructure (VHI) and Acronis Cyber Infrastructure (ACI). You can use this as a library if you wish.

In order to use this code, you need to provision a system user account, to create one, follow the links below.

Further reading:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKeyList added in v0.3.1

type AccessKeyList []AccessKeyPair

type AccessKeyPair added in v0.4.0

type AccessKeyPair struct {
	AccessKeyID     string `json:"AWSAccessKeyId"`
	SecretAccessKey string `json:"AWSSecretAccessKey"`
}

type Bucket added in v0.4.0

type Bucket struct {
	Name      string     `json:"name"`
	Epoch     int        `json:"epoc"`
	CreatedAt string     `json:"creation_date"`
	OwnerID   string     `json:"owner_id"`
	Size      BucketSize `json:"size"`
}

type BucketSize added in v0.4.0

type BucketSize struct {
	Current   int64 `json:"current"`
	HMax      int64 `json:"hmax"`
	HIntegral int64 `json:"h_integral"`
	LastTS    int64 `json:"last_ts"`
}

type ItemCountersNet

type ItemCountersNet struct {
	Uploaded   int64 `json:"uploaded"`
	Downloaded int64 `json:"downloaded"`
}

type ItemCountersOps

type ItemCountersOps struct {
	Put   int64 `json:"put"`
	Get   int64 `json:"get"`
	List  int64 `json:"list"`
	Other int64 `json:"other"`
}

type ItemKey

type ItemKey struct {
	Bucket string `json:"bucket"`
	// identifier for the item/record
	Epoch  int    `json:"epoch"`
	UserID string `json:"user_id"`
	Tag    string `json:"tag"`
}

type OStorObjectUsageResponse

type OStorObjectUsageResponse struct {
	// probably an API version of some kind
	Version int `json:"fmt_version"`
	// volume ID (ostor-ctl get-config)
	ServiceID string `json:"service_id"`
	// start time of the object you are looking at
	StartTS int64 `json:"start_ts"`
	// sample interval of the object (usually ~30 seconds)
	Period int `json:"period"`
	// number of items in the response
	Count int `json:"nr_items"`
	// the actual items
	Items []struct {
		Key      ItemKey `json:"key"`
		Counters struct {
			Operations ItemCountersOps `json:"ops"`
			Net        ItemCountersNet `json:"net_io"`
		} `json:"counters"`
	} `json:"items"`
}

type OStorResponse

type OStorResponse struct {
	Count     int      `json:"nr_items"`
	Truncated bool     `json:"truncated"`
	Items     []string `json:"items"`
}

type Ostor

type Ostor struct {
	// contains filtered or unexported fields
}

func New

func New(endpoint, accessKeyID, secretKeyID string) (*Ostor, error)

func (*Ostor) CreateUser added in v0.2.0

func (o *Ostor) CreateUser(email string) (*OstorCreateUserResponse, *resty.Response, error)

func (*Ostor) DeleteUser added in v0.7.0

func (o *Ostor) DeleteUser(email string) (*resty.Response, error)

func (*Ostor) GenerateCredentials

func (o *Ostor) GenerateCredentials(email string) (*OstorCreateUserResponse, *resty.Response, error)

func (*Ostor) GetBuckets

func (o *Ostor) GetBuckets(email string) (*OstorBucketListResponse, *resty.Response, error)

func (*Ostor) GetUser

func (o *Ostor) GetUser(email string) (*OstorUser, *resty.Response, error)

func (*Ostor) GetUserLimits added in v0.5.0

func (o *Ostor) GetUserLimits(email string) (*OstorUserLimits, *resty.Response, error)

func (*Ostor) List

func (o *Ostor) List(after *string) (*OStorResponse, *resty.Response, error)

func (*Ostor) ListUsers

func (o *Ostor) ListUsers(usage bool) (*OstorUsersListResponse, *resty.Response, error)

func (*Ostor) LockUnlockUser added in v0.3.1

func (o *Ostor) LockUnlockUser(email string, lock bool) (*resty.Response, error)

func (*Ostor) ObjectUsage

func (o *Ostor) ObjectUsage(object string) (*OStorObjectUsageResponse, *resty.Response, error)

func (*Ostor) RevokeKey

func (o *Ostor) RevokeKey(email, accessKeyID string) (*resty.Response, error)

func (*Ostor) RotateKey added in v0.6.0

func (o *Ostor) RotateKey(email, accessKeyID string) (*AccessKeyPair, *resty.Response, error)

RotateKey attempts to rotate the accessKeyID for the given user (email).

This feature is not a native feature in the APIs, so we build around it using our own methods, by checking the user account and verifying what can happen.

type OstorBucketListResponse

type OstorBucketListResponse struct {
	Buckets []Bucket `json:"Buckets"`
}

type OstorCreateUserResponse added in v0.3.1

type OstorCreateUserResponse struct {
	Email      string        `json:"UserEmail"`
	ID         string        `json:"UserId"`
	AccessKeys AccessKeyList `json:"AWSAccessKeys"`
}

type OstorUser

type OstorUser struct {
	Email        string         `json:"UserEmail"`
	ID           string         `json:"UserId"`
	State        string         `json:"State"`
	Owner        string         `json:"OwnerId"`
	Flags        []string       `json:"Flags"`
	AccessKeys   AccessKeyList  `json:"AWSAccessKeys,omitempty"`
	AccountCount string         `json:"AccountCount,omitempty"`
	Accounts     []interface{}  `json:"Accounts,omitempty"`
	Space        *UserSpaceStat `json:"SpaceStat,omitempty"`
}

type OstorUserLimits added in v0.5.0

type OstorUserLimits struct {
	OpsDefault   string `json:"ops:default"`
	OpsGet       string `json:"ops:get"`
	OpsPut       string `json:"ops:put"`
	OpsList      string `json:"ops:list"`
	OpsDelete    string `json:"ops:delete"`
	BandwidthOut string `json:"bandwidth:out"`
}

limits in ops/second bandwidth in kb/second

type OstorUsersListResponse

type OstorUsersListResponse struct {
	Users []OstorUser `json:"users"`
}

type UserSpaceStat added in v0.4.0

type UserSpaceStat struct {
	LastUpdated int   `json:"LastTs"`
	Current     int64 `json:"SizeCurr"`
	SizeHMax    int64 `json:"SizeHMax"` // FIXME: what is it?
	SizeHInt    int64 `json:"SizeHInt"` // FIXME: what is it?
}

Jump to

Keyboard shortcuts

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