radosAPI

package
v0.0.0-...-eb6b7a3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API contains fields to communicate with the rados-gateway

func New

func New(host, accessKey, secretKey string, adminPrefix ...string) *API

New returns client for Ceph RADOS Gateway

func (*API) CreateKey

func (api *API) CreateKey(conf KeyConfig) (*KeysDefinition, error)

CreateKey creates a new key. If a subuser is specified then by default created keys will be swift type. If only one of access-key or secret-key is provided the committed key will be automatically generated, that is if only secret-key is specified then access-key will be automatically generated. By default, a generated key is added to the keyring without replacing an existing key pair. If access-key is specified and refers to an existing key owned by the user then it will be modified. The response is a container listing all keys of the same type as the key created. Note that when creating a swift key, specifying the option access-key will have no effect. Additionally, only one swift key may be held by each user or subuser.

!! caps: users=write !!

@UID @SubUser @KeyType @AccessKey @SecretKey @GenerateSecret

func (*API) CreateSubUser

func (api *API) CreateSubUser(conf SubUserConfig) (*SubUsers, error)

CreateSubUser creates a new subuser (primarily useful for clients using the Swift API). Note that either gen-subuser or subuser is required for a valid request. Note that in general for a subuser to be useful, it must be granted permissions by specifying access. As with user creation if subuser is specified without secret, then a secret key will be automatically generated.

!! caps: users=write !!

@UID @SubUser @KeyType @Access @SecretKey @GenerateSecret

func (*API) CreateUser

func (api *API) CreateUser(conf UserConfig) (*User, error)

CreateUser creates a new user. By Default, a S3 key pair will be created automatically and returned in the response. If only one of access-key or secret-key is provided, the omitted key will be automatically generated. By default, a generated key is added to the keyring without replacing an existing key pair. If access-key is specified and refers to an existing key owned by the user then it will be modified

!! caps: users=write !!

@UID @DisplayName @Email @KeyType @AccessKey @SecretKey @UserCaps @GenerateKey @MaxBuckets @Suspended

func (*API) DeleteUsage

func (api *API) DeleteUsage(conf UsageConfig) error

DeleteUsage removes usage information. With no dates specified, removes all usage information

!! caps: usage=write !!

@UID @Start @End @RemoveAll

func (*API) GetBuckets

func (api *API) GetBuckets(conf BucketConfig) (Buckets, error)

func (*API) GetUsage

func (api *API) GetUsage(conf UsageConfig) (*Usage, error)

GetUsage requests bandwidth usage information.

!! caps: usage=read !!

@UID @Start @End @ShowEntries @ShowSummary

func (*API) GetUser

func (api *API) GetUser(uid ...string) (*User, error)

GetUser gets user information. If no user is specified returns the list of all users along with suspension information

** If no user is specified returns the list ... ** Don't works for me

!! caps: users=read !!

@uid

func (*API) RemoveBucket

func (api *API) RemoveBucket(conf BucketConfig) error

RemoveBucket removes an existing bucket.

!! caps: buckets=write !!

@Bucket @PurgeObjects

func (*API) RemoveKey

func (api *API) RemoveKey(conf KeyConfig) error

RemoveKey removes an existing key

!! caps: users=write !!

@UID @SubUser @KeyType @AccessKey

func (*API) RemoveSubUser

func (api *API) RemoveSubUser(conf SubUserConfig) error

RemoveSubUser remove an existing subuser

!! caps: users=write !!

@UID @SubUser @PurgeKeys

func (*API) RemoveUser

func (api *API) RemoveUser(conf UserConfig) error

RemoveUser removes an existing user.

!! caps: users=write !!

@UID @PurgeData

func (*API) UnlinkBucket

func (api *API) UnlinkBucket(conf BucketConfig) error

UnlinkBucket unlinks a bucket from a specified user. Primarily useful for changing bucket ownership.

!! caps: buckets=write !!

@Bucket @UID

func (*API) UpdateSubUser

func (api *API) UpdateSubUser(conf SubUserConfig) (*SubUsers, error)

UpdateSubUser modifies an existing subuser

!! caps: users=write !!

@UID @SubUser @KeyType @Access @Secret @GenerateSecret

func (*API) UpdateUser

func (api *API) UpdateUser(conf UserConfig) (*User, error)

UpdateUser modifies a user

!! caps: users=write !!

@UID @DisplayName @Email @KeyType @AccessKey @SecretKey @UserCaps @GenerateKey @MaxBuckets @Suspended

type BucketConfig

type BucketConfig struct {
	Bucket       string `url:"bucket,ifStringIsNotEmpty"`  // The bucket to return info on
	UID          string `url:"uid,ifStringIsNotEmpty"`     // The user to retrieve bucket information for
	Stats        bool   `url:"stats,ifBoolIsTrue"`         // Return bucket statistics
	CheckObjects bool   `url:"check-objects,ifBoolIsTrue"` // Check multipart object accounting
	Fix          bool   `url:"fix,ifBoolIsTrue"`           // Also fix the bucket index when checking
	PurgeObjects bool   `url:"purge-objects,ifBoolIsTrue"` // Remove a buckets objects before deletion
}

BucketConfig bucket request

type Buckets

type Buckets []bucket

Buckets represents the response of bucket requests

type KeyConfig

type KeyConfig struct {
	UID            string `url:"uid,ifStringIsNotEmpty"`        // The user ID to receive the new key
	SubUser        string `url:"subuser,ifStringIsNotEmpty"`    // The subuser ID to receive the new key
	KeyType        string `url:"key-type,ifStringIsNotEmpty"`   // Key type to be generated, options are: swift, s3 (default)
	AccessKey      string `url:"access-key,ifStringIsNotEmpty"` // Specify the access key
	SecretKey      string `url:"secret-key,ifStringIsNotEmpty"` // Specify secret key
	GenerateSecret bool   `url:"generate-secret,ifBoolIsTrue"`  // Generate a new key pair and add to the existing keyring
}

KeyConfig key request

type KeysDefinition

type KeysDefinition []struct {
	AccessKey string `json:"access_key,omitempty"`
	SecretKey string `json:"secret_key"`
	User      string `json:"user"`
}

KeysDefinition represents the response of key requests

type SubUserConfig

type SubUserConfig struct {
	UID            string `url:"uid,ifStringIsNotEmpty"`        // The user ID under which a subuser is to be created
	SubUser        string `url:"subuser,ifStringIsNotEmpty"`    // Specify the subuser ID to be created
	KeyType        string `url:"key-type,ifStringIsNotEmpty"`   // Key type to be generated, options are: swift (default), s3
	Access         string `url:"access,ifStringIsNotEmpty"`     // Set access permissions for sub-user, should be one of read, write, readwrite, full
	Secret         string `url:"secret,ifStringIsNotEmpty"`     // Specify secret key
	SecretKey      string `url:"secret-key,ifStringIsNotEmpty"` // Specify secret key
	GenerateSecret bool   `url:"generate-secret,ifBoolIsTrue"`  // Generate the secret key
	PurgeKeys      bool   `url:"purge-keys,ifBoolIsTrue"`       // Remove keys belonging to the subuser
}

SubUserConfig subuser request

type SubUsers

type SubUsers []struct {
	ID          string `json:"id"`
	Permissions string `json:"permissions"`
}

SubUsers represents the response of subuser requests

type Usage

type Usage struct {
	Entries []struct {
		Buckets []struct {
			Bucket     string `json:"bucket"`
			Categories []struct {
				BytesReceived int    `json:"bytes_received"`
				BytesSent     int    `json:"bytes_sent"`
				Category      string `json:"category"`
				Ops           int    `json:"ops"`
				SuccessfulOps int    `json:"successful_ops"`
			} `json:"categories"`
			Epoch int    `json:"epoch"`
			Time  string `json:"time"`
		} `json:"buckets"`
		Owner string `json:"owner"`
	} `json:"entries"`
	Summary []struct {
		Categories []struct {
			BytesReceived int    `json:"bytes_received"`
			BytesSent     int    `json:"bytes_sent"`
			Category      string `json:"category"`
			Ops           int    `json:"ops"`
			SuccessfulOps int    `json:"successful_ops"`
		} `json:"categories"`
		Total struct {
			BytesReceived int `json:"bytes_received"`
			BytesSent     int `json:"bytes_sent"`
			Ops           int `json:"ops"`
			SuccessfulOps int `json:"successful_ops"`
		} `json:"total"`
		User string `json:"user"`
	} `json:"summary"`
}

Usage represents the response of usage requests

type UsageConfig

type UsageConfig struct {
	UID         string     `url:"uid,ifStringIsNotEmpty"`     // The user for which the information is requested. If not specified will apply to all users
	Start       *time.Time `url:"start,ifTimeIsNotNilCeph"`   // Date and (optional) time that specifies the start time of the requested data
	End         *time.Time `url:"end,ifTimeIsNotNilCeph"`     // Date and (optional) time that specifies the end time of the requested data (non-inclusive)
	ShowEntries bool       `url:"show-entries,ifBoolIsFalse"` // Specifies whether data entries should be returned.
	ShowSummary bool       `url:"show-summary,ifBoolIsFalse"` // Specifies whether data summary should be returned
	RemoveAll   bool       `url:"remove-all,ifBoolIsTrue"`    // Required when uid is not specified, in order to acknowledge multi user data removal.
}

UsageConfig usage request

type User

type User struct {
	Caps []struct {
		Perm string `json:"perm"`
		Type string `json:"type"`
	} `json:"caps"`
	DisplayName string         `json:"display_name"`
	Email       string         `json:"email"`
	Keys        KeysDefinition `json:"keys"`
	MaxBuckets  int            `json:"max_buckets"`
	Subusers    SubUsers       `json:"subusers"`
	Suspended   int            `json:"suspended"`
	SwiftKeys   KeysDefinition `json:"swift_keys"`
	UserID      string         `json:"user_id"`
}

User represents the response of user requests

type UserConfig

type UserConfig struct {
	UID         string `url:"uid,ifStringIsNotEmpty"`          // The user ID to be created
	DisplayName string `url:"display-name,ifStringIsNotEmpty"` // The display name of the user to be created
	Email       string `url:"email,ifStringIsNotEmpty"`        // The email address associated with the user
	KeyType     string `url:"key-type,ifStringIsNotEmpty"`     // Key type to be generated, options are: swift, s3 (default)
	AccessKey   string `url:"access-key,ifStringIsNotEmpty"`   // Specify access key
	SecretKey   string `url:"secret-key,ifStringIsNotEmpty"`   // Specify secret key
	UserCaps    string `url:"user-caps,ifStringIsNotEmpty"`    // User capabilities
	MaxBuckets  *int   `url:"max-buckets,itoaIfNotNil"`        // Specify the maximum number of buckets the user can own
	GenerateKey bool   `url:"generate-key,ifBoolIsTrue"`       // Generate a new key pair and add to the existing keyring
	Suspended   bool   `url:"suspended,ifBoolIsTrue"`          // Specify whether the user should be suspended
	PurgeData   bool   `url:"suspended,ifBoolIsTrue"`          // When specified the buckets and objects belonging to the user will also be removed
}

UserConfig user request

type Users

type Users []User

Jump to

Keyboard shortcuts

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