Documentation ¶
Overview ¶
Package admin contains a set of wrappers around Ceph's RGW Admin Ops API.
Index ¶
- Constants
- type API
- func (api *API) CreateUser(ctx context.Context, user User) (User, error)
- func (api *API) GetBucketInfo(ctx context.Context, bucket Bucket) (Bucket, error)
- func (api *API) GetBucketPolicy(ctx context.Context, bucket Bucket) (Policy, error)
- func (api *API) GetUsage(ctx context.Context, usage Usage) (Usage, error)
- func (api *API) GetUser(ctx context.Context, user User) (User, error)
- func (api *API) GetUserQuota(ctx context.Context, quota QuotaSpec) (QuotaSpec, error)
- func (api *API) GetUsers(ctx context.Context) (*[]string, error)
- func (api *API) ListBuckets(ctx context.Context) ([]string, error)
- func (api *API) ModifyUser(ctx context.Context, user User) (User, error)
- func (api *API) RemoveBucket(ctx context.Context, bucket Bucket) error
- func (api *API) RemoveUser(ctx context.Context, user User) error
- func (api *API) SetUserQuota(ctx context.Context, quota QuotaSpec) error
- func (api *API) TrimUsage(ctx context.Context, usage Usage) error
- type Bucket
- type HTTPClient
- type Policy
- type QuotaSpec
- type Usage
- type User
- type UserCapSpec
- type UserKeySpec
- type UserStat
Constants ¶
const ( // ErrUserExists - Attempt to create existing user ErrUserExists errorReason = "UserAlreadyExists" // ErrNoSuchUser - Attempt to create existing user ErrNoSuchUser errorReason = "NoSuchUser" // ErrInvalidAccessKey - Invalid access key specified ErrInvalidAccessKey errorReason = "InvalidAccessKey" // ErrInvalidSecretKey - Invalid secret key specified ErrInvalidSecretKey errorReason = "InvalidSecretKey" // ErrInvalidKeyType - Invalid key type specified ErrInvalidKeyType errorReason = "InvalidKeyType" // ErrKeyExists - Provided access key exists and belongs to another user ErrKeyExists errorReason = "KeyExists" // ErrEmailExists - Provided email address exists ErrEmailExists errorReason = "EmailExists" // ErrInvalidCapability - Attempt to remove an invalid admin capability ErrInvalidCapability errorReason = "InvalidCapability" // ErrSubuserExists - Specified subuser exists ErrSubuserExists errorReason = "SubuserExists" // ErrInvalidAccess - Invalid subuser access specified ErrInvalidAccess errorReason = "InvalidAccess" // ErrIndexRepairFailed - Bucket index repair failed ErrIndexRepairFailed errorReason = "IndexRepairFailed" // ErrBucketNotEmpty - Attempted to delete non-empty bucket ErrBucketNotEmpty errorReason = "BucketNotEmpty" // ErrObjectRemovalFailed - Unable to remove objects ErrObjectRemovalFailed errorReason = "ObjectRemovalFailed" // ErrBucketUnlinkFailed - Unable to unlink bucket from specified user ErrBucketUnlinkFailed errorReason = "BucketUnlinkFailed" // ErrBucketLinkFailed - Unable to link bucket to specified user ErrBucketLinkFailed errorReason = "BucketLinkFailed" // ErrNoSuchObject - Specified object does not exist ErrNoSuchObject errorReason = "NoSuchObject" // ErrIncompleteBody - Either bucket was not specified for a bucket policy request or bucket and object were not specified for an object policy request. ErrIncompleteBody errorReason = "IncompleteBody" // ErrNoSuchCap - User does not possess specified capability ErrNoSuchCap errorReason = "NoSuchCap" // ErrInternalError - Internal server error. ErrInternalError errorReason = "InternalError" // ErrAccessDenied - Access denied. ErrAccessDenied errorReason = "AccessDenied" // ErrNoSuchBucket - Bucket does not exist. ErrNoSuchBucket errorReason = "NoSuchBucket" // ErrNoSuchKey - No such access key. ErrNoSuchKey errorReason = "NoSuchKey" // ErrInvalidArgument - Invalid argument. ErrInvalidArgument errorReason = "InvalidArgument" // ErrUnknown - reports an unknown error ErrUnknown errorReason = "Unknown" // ErrSignatureDoesNotMatch - the query to the API has invalid parameters ErrSignatureDoesNotMatch errorReason = "SignatureDoesNotMatch" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { AccessKey string SecretKey string Endpoint string HTTPClient HTTPClient }
API struct for New Client
func New ¶
func New(endpoint, accessKey, secretKey string, httpClient HTTPClient) (*API, error)
New returns client for Ceph RGW
func (*API) CreateUser ¶
CreateUser creates a user in the object store
func (*API) GetBucketInfo ¶
GetBucketInfo will return various information about a specific token
func (*API) GetBucketPolicy ¶
GetBucketPolicy - http://docs.ceph.com/docs/mimic/radosgw/adminops/#get-bucket-or-object-policy
func (*API) GetUserQuota ¶
GetUserQuota will return the quota for a user
func (*API) ListBuckets ¶
ListBuckets will return the list of all buckets present in the object store
func (*API) ModifyUser ¶
ModifyUser - http://docs.ceph.com/docs/latest/radosgw/adminops/#modify-user
func (*API) RemoveBucket ¶
RemoveBucket will remove a given token from the object store
func (*API) RemoveUser ¶
RemoveUser remove an user from the object store
func (*API) SetUserQuota ¶
SetUserQuota sets quota to a user Global quotas (https://docs.ceph.com/en/latest/radosgw/admin/#reading-writing-global-quotas) are not surfaced in the Admin Ops API So this library cannot expose it yet
type Bucket ¶
type Bucket struct { Bucket string `json:"bucket" url:"bucket"` Zonegroup string `json:"zonegroup"` PlacementRule string `json:"placement_rule"` ExplicitPlacement struct { DataPool string `json:"data_pool"` DataExtraPool string `json:"data_extra_pool"` IndexPool string `json:"index_pool"` } `json:"explicit_placement"` ID string `json:"id"` Marker string `json:"marker"` IndexType string `json:"index_type"` Owner string `json:"owner"` Ver string `json:"ver"` MasterVer string `json:"master_ver"` Mtime string `json:"mtime"` MaxMarker string `json:"max_marker"` Usage struct { RgwMain struct { Size *uint64 `json:"size"` SizeActual *uint64 `json:"size_actual"` SizeUtilized *uint64 `json:"size_utilized"` SizeKb *uint64 `json:"size_kb"` SizeKbActual *uint64 `json:"size_kb_actual"` SizeKbUtilized *uint64 `json:"size_kb_utilized"` NumObjects *uint64 `json:"num_objects"` } `json:"rgw.main"` RgwMultimeta struct { Size *uint64 `json:"size"` SizeActual *uint64 `json:"size_actual"` SizeUtilized *uint64 `json:"size_utilized"` SizeKb *uint64 `json:"size_kb"` SizeKbActual *uint64 `json:"size_kb_actual"` SizeKbUtilized *uint64 `json:"size_kb_utilized"` NumObjects *uint64 `json:"num_objects"` } `json:"rgw.multimeta"` } `json:"usage"` BucketQuota QuotaSpec `json:"bucket_quota"` Policy *bool `url:"policy"` PurgeObject *bool `url:"purge-objects"` }
Bucket describes an object store bucket
type HTTPClient ¶ added in v0.11.0
HTTPClient interface that conforms to that of the http package's Client.
type Policy ¶
type Policy struct { ACL struct { ACLUserMap []struct { User string `json:"user"` ACL *int `json:"acl"` } `json:"acl_user_map"` ACLGroupMap []interface{} `json:"acl_group_map"` GrantMap []struct { ID string `json:"id"` Grant struct { Type struct { Type int `json:"type"` } `json:"type"` ID string `json:"id"` Email string `json:"email"` Permission struct { Flags int `json:"flags"` } `json:"permission"` Name string `json:"name"` Group *int `json:"group"` URLSpec string `json:"url_spec"` } `json:"grant"` } `json:"grant_map"` } `json:"acl"` Owner struct { ID string `json:"id"` DisplayName string `json:"display_name"` } `json:"owner"` }
Policy describes a bucket policy
type QuotaSpec ¶
type QuotaSpec struct { UID string `json:"user_id" url:"uid"` QuotaType string `url:"quota-type"` Enabled *bool `json:"enabled" url:"enabled"` CheckOnRaw bool `json:"check_on_raw"` MaxSize *int64 `json:"max_size" url:"max-size"` MaxSizeKb *int `json:"max_size_kb" url:"max-size-kb"` MaxObjects *int64 `json:"max_objects" url:"max-objects"` }
QuotaSpec describes an object store quota for a user or a bucket Only user's quota are supported
type Usage ¶
type Usage struct { Entries []struct { User string `json:"user"` Buckets []struct { Bucket string `json:"bucket"` Time string `json:"time"` Epoch uint64 `json:"epoch"` Owner string `json:"owner"` Categories []struct { Category string `json:"category"` BytesSent uint64 `json:"bytes_sent"` BytesReceived uint64 `json:"bytes_received"` Ops uint64 `json:"ops"` SuccessfulOps uint64 `json:"successful_ops"` } `json:"categories"` } `json:"buckets"` } `json:"entries"` Summary []struct { User string `json:"user"` Categories []struct { Category string `json:"category"` BytesSent uint64 `json:"bytes_sent"` BytesReceived uint64 `json:"bytes_received"` Ops uint64 `json:"ops"` SuccessfulOps uint64 `json:"successful_ops"` } `json:"categories"` Total struct { BytesSent uint64 `json:"bytes_sent"` BytesReceived uint64 `json:"bytes_received"` Ops uint64 `json:"ops"` SuccessfulOps uint64 `json:"successful_ops"` } `json:"total"` } `json:"summary"` Start string `url:"start"` //Example: 2012-09-25 16:00:00 End string `url:"end"` ShowEntries *bool `url:"show-entries"` ShowSummary *bool `url:"show-summary"` RemoveAll *bool `url:"remove-all"` //true }
Usage struct
type User ¶
type User struct { ID string `json:"user_id" url:"uid"` DisplayName string `json:"display_name" url:"display-name"` Email string `json:"email" url:"email"` Suspended *int `json:"suspended" url:"suspended"` MaxBuckets *int `json:"max_buckets" url:"max-buckets"` Subusers []interface{} `json:"subusers"` Keys []UserKeySpec `json:"keys"` SwiftKeys []interface{} `json:"swift_keys"` Caps []UserCapSpec `json:"caps"` OpMask string `json:"op_mask"` DefaultPlacement string `json:"default_placement"` DefaultStorageClass string `json:"default_storage_class"` PlacementTags []interface{} `json:"placement_tags"` BucketQuota QuotaSpec `json:"bucket_quota"` UserQuota QuotaSpec `json:"user_quota"` TempURLKeys []interface{} `json:"temp_url_keys"` Type string `json:"type"` MfaIds []interface{} `json:"mfa_ids"` KeyType string `url:"key-type"` Tenant string `url:"tenant"` GenerateKey *bool `url:"generate-key"` PurgeData *int `url:"purge-data"` GenerateStat *bool `url:"stats"` Stat UserStat `json:"stats"` UserCaps string `url:"user-caps"` }
User is GO representation of the json output of a user creation
type UserCapSpec ¶
UserCapSpec represents a user capability which gives access to certain ressources
type UserKeySpec ¶
type UserKeySpec struct { User string `json:"user"` AccessKey string `json:"access_key" url:"access-key"` SecretKey string `json:"secret_key" url:"secret-key"` }
UserKeySpec is the user credential configuration