Documentation ¶
Index ¶
- type API
- func (api *API) AddCapability(conf CapConfig) ([]Capability, error)
- func (api *API) CheckBucket(conf BucketConfig) (string, error)
- func (api *API) CreateKey(conf KeyConfig) (*KeysDefinition, error)
- func (api *API) CreateSubUser(conf SubUserConfig) (*SubUsers, error)
- func (api *API) CreateUser(conf UserConfig) (*User, error)
- func (api *API) DelCapability(conf CapConfig) ([]Capability, error)
- func (api *API) DeleteUsage(conf UsageConfig) error
- func (api *API) GetBucket(conf BucketConfig) (Buckets, error)
- func (api *API) GetBucketPolicy(conf BucketConfig) (*Policy, error)
- func (api *API) GetObjectPolicy(conf BucketConfig) (*Policy, error)
- func (api *API) GetQuotas(conf QuotaConfig) (*Quotas, error)
- func (api *API) GetUsage(conf UsageConfig) (*Usage, error)
- func (api *API) GetUser(uid string) (*User, error)
- func (api *API) GetUsers() ([]string, error)
- func (api *API) LinkBucket(conf BucketConfig) error
- func (api *API) RemoveBucket(conf BucketConfig) error
- func (api *API) RemoveKey(conf KeyConfig) error
- func (api *API) RemoveObject(conf BucketConfig) error
- func (api *API) RemoveSubUser(conf SubUserConfig) error
- func (api *API) RemoveUser(conf UserConfig) error
- func (api *API) UnlinkBucket(conf BucketConfig) error
- func (api *API) UpdateQuota(conf QuotaConfig) error
- func (api *API) UpdateSubUser(conf SubUserConfig) (*SubUsers, error)
- func (api *API) UpdateUser(conf UserConfig) (*User, error)
- type Bucket
- type BucketConfig
- type Buckets
- type CapConfig
- type Capability
- type Entry
- type KeyConfig
- type KeysDefinition
- type Policy
- type QuotaConfig
- type Quotas
- type Stats
- type SubUserConfig
- type SubUsers
- type Summary
- type Usage
- type UsageConfig
- type User
- type UserConfig
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 (*API) AddCapability ¶
func (api *API) AddCapability(conf CapConfig) ([]Capability, error)
AddCapability returns user's quotas
!! caps: users=write !!
@UID @UserCaps
func (*API) CheckBucket ¶
func (api *API) CheckBucket(conf BucketConfig) (string, error)
CheckBucket checks the index of an existing bucket. NOTE: to check multipart object accounting with check-objects, fix must be set to True.
!! caps: buckets=write !!
@Bucket @CheckObjects @Fix
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) DelCapability ¶
func (api *API) DelCapability(conf CapConfig) ([]Capability, error)
DelCapability returns user's quotas
!! caps: users=write !!
@UID @UserCaps
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) GetBucket ¶
func (api *API) GetBucket(conf BucketConfig) (Buckets, error)
GetBucket gets information about a subset of the existing buckets. If uid is specified without bucket then all buckets beloning to the user will be returned. If bucket alone is specified, information for that particular bucket will be retrieved
!! caps: buckets=read !!
@Bucket @UID @Stats
func (*API) GetBucketPolicy ¶
func (api *API) GetBucketPolicy(conf BucketConfig) (*Policy, error)
GetBucketPolicy reads the bucket policy
!! caps: buckets=read !!
@Bucket
func (*API) GetObjectPolicy ¶
func (api *API) GetObjectPolicy(conf BucketConfig) (*Policy, error)
GetObjectPolicy reads the object policy
!! caps: buckets=read !!
@Bucket @Object
func (*API) GetQuotas ¶
func (api *API) GetQuotas(conf QuotaConfig) (*Quotas, error)
GetQuotas returns user's quotas
!! caps: users=read !!
@UID @QuotaType
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 ¶
GetUser gets user information. If no user is specified returns the list of all users along with suspension information
!! caps: users=read !!
@uid
func (*API) LinkBucket ¶
func (api *API) LinkBucket(conf BucketConfig) error
LinkBucket links a bucket to a specified user, unlinking the bucket from any previous user.
!! caps: buckets=write !!
@Bucket @UID
func (*API) RemoveBucket ¶
func (api *API) RemoveBucket(conf BucketConfig) error
RemoveBucket removes an existing bucket.
!! caps: buckets=write !!
@Bucket @PurgeObjects
func (*API) RemoveKey ¶
RemoveKey removes an existing key
!! caps: users=write !!
@UID @SubUser @KeyType @AccessKey
func (*API) RemoveObject ¶
func (api *API) RemoveObject(conf BucketConfig) error
RemoveObject removes an existing object. NOTE: Does not require owner to be non-suspended.
!! caps: buckets=write !!
@Bucket @Object
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) UpdateQuota ¶
func (api *API) UpdateQuota(conf QuotaConfig) error
UpdateQuota updates user's quotas
!! caps: users=write !!
@UID @Quota [user,bucket]
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 Object string `url:"object,ifStringIsNotEmpty"` // The object to remove }
BucketConfig bucket request
type CapConfig ¶
type CapConfig struct { UID string `url:"uid,ifStringIsNotEmpty"` // The user ID UserCaps string `url:"user-caps,ifStringIsNotEmpty"` // The administrative capabilities }
CapConfig capability request
type Capability ¶
Capability represents the reponse of capability requests
type Entry ¶
type Entry 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"` }
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 Policy ¶
type Policy struct { Acl struct { AclGroupMap []struct { Acl int `json:"acl"` Group int `json:"group"` } `json:"acl_group_map"` AclUserMap []struct { Acl int `json:"acl"` User string `json:"user"` } `json:"acl_user_map"` GrantMap []struct { Grant struct { Email string `json:"email"` Group int `json:"group"` ID string `json:"id"` Name string `json:"name"` Permission struct { Flags int `json:"flags"` } `json:"permission"` Type struct { Type int `json:"type"` } `json:"type"` } `json:"grant"` ID string `json:"id"` } `json:"grant_map"` } `json:"acl"` Owner struct { DisplayName string `json:"display_name"` ID string `json:"id"` } `json:"owner"` }
Policy represents the response of policy requests
type QuotaConfig ¶
type QuotaConfig struct { UID string `url:"uid,ifStringIsNotEmpty"` // The user to specify a quota MaxObjects string `url:"max-objects,ifStringIsNotEmpty"` // The max-objects setting allows you to specify the maximum number of objects. A negative value disables this setting. MaxSizeKB string `url:"max-size-kb,ifStringIsNotEmpty"` // The max-size-kb option allows you to specify a quota for the maximum number of bytes. A negative value disables this setting Enabled string `url:"enabled,ifStringIsNotEmpty"` // The enabled option enables the quotas QuotaType string `url:"quota-type,ifStringIsNotEmpty"` // The quota-type option sets the scope for the quota. The options are bucket and user. }
QuotaConfig quota request
type Quotas ¶
type Quotas struct { BucketQuota struct { Enabled bool `json:"enabled"` MaxObjects int `json:"max_objects"` MaxSizeKb int `json:"max_size_kb"` } `json:"bucket_quota"` UserQuota struct { Enabled bool `json:"enabled"` MaxObjects int `json:"max_objects"` MaxSizeKb int `json:"max_size_kb"` } `json:"user_quota"` }
Quotas represents the reponse of quotas requests
type Stats ¶
type Stats struct { Bucket string `json:"bucket"` BucketQuota struct { Enabled bool `json:"enabled"` MaxObjects int `json:"max_objects"` MaxSizeKb int `json:"max_size_kb"` } `json:"bucket_quota"` ID string `json:"id"` IndexPool string `json:"index_pool"` Marker string `json:"marker"` MasterVer string `json:"master_ver"` MaxMarker string `json:"max_marker"` Mtime string `json:"mtime"` Owner string `json:"owner"` Pool string `json:"pool"` Usage struct { RgwMain struct { NumObjects int `json:"num_objects"` SizeKb int `json:"size_kb"` SizeKbActual int `json:"size_kb_actual"` } `json:"rgw.main"` } `json:"usage"` Ver string `json:"ver"` }
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 Summary ¶
type 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"` }
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 []Capability `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:"purge-data,ifBoolIsTrue"` // When specified the buckets and objects belonging to the user will also be removed }
UserConfig user request