Documentation ¶
Overview ¶
Package nb makes client API calls to noobaa servers.
Index ¶
- Constants
- func BigIntToHumanBytes(bi *BigInt) string
- func FindPortByName(srv *corev1.Service, portName string) *corev1.ServicePort
- func GetAPIPortName(api string) string
- func IntToHumanBytes(bi int64) string
- type APIRouter
- type APIRouterNodePort
- type APIRouterPodPort
- type APIRouterPortForward
- type APIRouterServicePort
- type AccountAllowedBuckets
- type AccountInfo
- type AddExternalConnectionParams
- type AllowedBuckets
- type BackingStoreInfo
- type BigInt
- type BucketClaimInfo
- type BucketClassInfo
- type BucketInfo
- type CheckExternalConnectionReply
- type ChunkCoderConfig
- type ChunkSplitConfig
- type Client
- type CloudAuthMethod
- type CreateAccountParams
- type CreateAccountReply
- type CreateAuthParams
- type CreateAuthReply
- type CreateBucketParams
- type CreateCloudPoolParams
- type CreateHostsPoolParams
- type CreateSystemParams
- type CreateSystemReply
- type CreateTierParams
- type DeleteAccountParams
- type DeleteBucketParams
- type DeleteExternalConnectionParams
- type DeletePoolParams
- type EditExternalConnectionCredentialsParams
- type EndpointType
- type ExternalConnectionInfo
- type ExternalConnectionStatus
- type HostInfo
- type IntRange
- type ListAccountsReply
- type ListBucketsReply
- type ListHostsParams
- type ListHostsQuery
- type ListHostsReply
- type PoolHostsInfo
- type PoolInfo
- type RPC
- type RPCBuffer
- type RPCClient
- func (c *RPCClient) AddExternalConnectionAPI(params AddExternalConnectionParams) error
- func (c *RPCClient) Call(req *RPCMessage, res RPCResponse) error
- func (c *RPCClient) CheckExternalConnectionAPI(params AddExternalConnectionParams) (CheckExternalConnectionReply, error)
- func (c *RPCClient) CreateAccountAPI(params CreateAccountParams) (CreateAccountReply, error)
- func (c *RPCClient) CreateAuthAPI(params CreateAuthParams) (CreateAuthReply, error)
- func (c *RPCClient) CreateBucketAPI(params CreateBucketParams) error
- func (c *RPCClient) CreateCloudPoolAPI(params CreateCloudPoolParams) error
- func (c *RPCClient) CreateHostsPoolAPI(params CreateHostsPoolParams) (string, error)
- func (c *RPCClient) CreateSystemAPI(params CreateSystemParams) (CreateSystemReply, error)
- func (c *RPCClient) CreateTierAPI(params CreateTierParams) error
- func (c *RPCClient) CreateTieringPolicyAPI(params TieringPolicyInfo) error
- func (c *RPCClient) DeleteAccountAPI(params DeleteAccountParams) error
- func (c *RPCClient) DeleteBucketAPI(params DeleteBucketParams) error
- func (c *RPCClient) DeleteBucketAndObjectsAPI(params DeleteBucketParams) error
- func (c *RPCClient) DeleteExternalConnectionAPI(params DeleteExternalConnectionParams) error
- func (c *RPCClient) DeletePoolAPI(params DeletePoolParams) error
- func (c *RPCClient) EditExternalConnectionCredentialsAPI(params EditExternalConnectionCredentialsParams) error
- func (c *RPCClient) GetAuthToken() string
- func (c *RPCClient) ListAccountsAPI() (ListAccountsReply, error)
- func (c *RPCClient) ListBucketsAPI() (ListBucketsReply, error)
- func (c *RPCClient) ListHostsAPI(params ListHostsParams) (ListHostsReply, error)
- func (c *RPCClient) ReadAccountAPI(params ReadAccountParams) (AccountInfo, error)
- func (c *RPCClient) ReadAuthAPI() (ReadAuthReply, error)
- func (c *RPCClient) ReadBucketAPI(params ReadBucketParams) (BucketInfo, error)
- func (c *RPCClient) ReadPoolAPI(params ReadPoolParams) (PoolInfo, error)
- func (c *RPCClient) ReadSystemAPI() (SystemInfo, error)
- func (c *RPCClient) ReadSystemStatusAPI() (ReadySystemStatusReply, error)
- func (c *RPCClient) RegisterToCluster() error
- func (c *RPCClient) SetAuthToken(token string)
- func (c *RPCClient) UpdateAccountS3Access(params UpdateAccountS3AccessParams) error
- func (c *RPCClient) UpdateAllBucketsDefaultPool(params UpdateDefaultPoolParams) error
- func (c *RPCClient) UpdateBucketClass(params UpdateBucketClassParams) (BucketClassInfo, error)
- func (c *RPCClient) UpdateEndpointGroupAPI(params UpdateEndpointGroupParams) error
- func (c *RPCClient) UpdateHostsPoolAPI(params UpdateHostsPoolParams) error
- type RPCConn
- type RPCConnHTTP
- type RPCConnWS
- func (c *RPCConnWS) Call(req *RPCMessage, res RPCResponse) error
- func (c *RPCConnWS) Close()
- func (c *RPCConnWS) CloseUnderLock()
- func (c *RPCConnWS) ConnectUnderLock() error
- func (c *RPCConnWS) GetAddress() string
- func (c *RPCConnWS) HandlePing(msg *RPCMessage)
- func (c *RPCConnWS) HandleRequest(req *RPCMessage)
- func (c *RPCConnWS) HandleResponse(msg *RPCMessage)
- func (c *RPCConnWS) NewRequest(req *RPCMessage, res RPCResponse) chan error
- func (c *RPCConnWS) ReadMessage() (*RPCMessage, error)
- func (c *RPCConnWS) ReadMessages()
- func (c *RPCConnWS) Reconnect()
- func (c *RPCConnWS) SendMessage(msg interface{}) error
- type RPCError
- type RPCHandler
- type RPCMessage
- type RPCMessageReply
- type RPCPendingRequest
- type RPCResponse
- type ReadAccountParams
- type ReadAuthReply
- type ReadBucketParams
- type ReadPoolParams
- type ReadySystemStatusReply
- type S3AccessKeys
- type SimpleRouter
- type StorageInfo
- type SystemInfo
- type TierInfo
- type TierItem
- type TieringPolicyInfo
- type UpdateAccountS3AccessParams
- type UpdateBucketClassParams
- type UpdateDefaultPoolParams
- type UpdateEndpointGroupParams
- type UpdateHostsPoolParams
Constants ¶
const ( // RPCVersionNumber specifies the RPC version number RPCVersionNumber uint32 = 0xba000000 // RPCMaxMessageSize is a limit to protect the process from allocating too much memory // for a single incoming message for example in case the connection is out of sync or other bugs. RPCMaxMessageSize = 64 * 1024 * 1024 )
const ( // CloudAuthMethodAwsV2 enum CloudAuthMethodAwsV2 CloudAuthMethod = "AWS_V2" // CloudAuthMethodAwsV4 enum CloudAuthMethodAwsV4 CloudAuthMethod = "AWS_V4" // EndpointTypeAws enum EndpointTypeAws EndpointType = "AWS" // EndpointTypeAzure enum EndpointTypeAzure EndpointType = "AZURE" // EndpointTypeGoogle enum EndpointTypeGoogle EndpointType = "GOOGLE" // EndpointTypeS3Compat enum EndpointTypeS3Compat EndpointType = "S3_COMPATIBLE" // EndpointTypeIBMCos enum EndpointTypeIBMCos EndpointType = "IBM_COS" // ExternalConnectionSuccess enum ExternalConnectionSuccess ExternalConnectionStatus = "SUCCESS" // ExternalConnectionTimeout enum ExternalConnectionTimeout ExternalConnectionStatus = "TIMEOUT" // ExternalConnectionInvalidEndpoint enum ExternalConnectionInvalidEndpoint ExternalConnectionStatus = "INVALID_ENDPOINT" // ExternalConnectionInvalidCredentials enum ExternalConnectionInvalidCredentials ExternalConnectionStatus = "INVALID_CREDENTIALS" // ExternalConnectionNotSupported enum ExternalConnectionNotSupported ExternalConnectionStatus = "NOT_SUPPORTED" // ExternalConnectionTimeSkew enum ExternalConnectionTimeSkew ExternalConnectionStatus = "TIME_SKEW" // ExternalConnectionUnknownFailure enum ExternalConnectionUnknownFailure ExternalConnectionStatus = "UNKNOWN_FAILURE" )
Variables ¶
This section is empty.
Functions ¶
func BigIntToHumanBytes ¶ added in v2.0.9
BigIntToHumanBytes returns a human readable bytes string
func FindPortByName ¶
func FindPortByName(srv *corev1.Service, portName string) *corev1.ServicePort
FindPortByName returns the port in the service that matches the given name.
func GetAPIPortName ¶
GetAPIPortName maps every noobaa api name to the service port name that serves it.
func IntToHumanBytes ¶ added in v2.0.9
IntToHumanBytes returns a human readable bytes string
Types ¶
type APIRouter ¶
APIRouter should be able to map noobaa api names to actual addresses See implementations below: APIRouterNodePort, APIRouterPodPort, APIRouterServicePort
type APIRouterNodePort ¶
APIRouterNodePort uses the service node port to route to NodeIP:NodePorts
func (*APIRouterNodePort) GetAddress ¶
func (r *APIRouterNodePort) GetAddress(api string) string
GetAddress implements the router
type APIRouterPodPort ¶
APIRouterPodPort uses the service target port to route to PodIP:TargetPort
func (*APIRouterPodPort) GetAddress ¶
func (r *APIRouterPodPort) GetAddress(api string) string
GetAddress implements the router
type APIRouterPortForward ¶ added in v2.0.2
type APIRouterPortForward struct { ServiceMgmt *corev1.Service PodNamespace string PodName string // Start() will setup these fields: PF *portforward.PortForwarder StopChan chan struct{} MapRemotePortToLocal map[uint16]uint16 }
APIRouterPortForward uses portforwarding to the the pod
func (*APIRouterPortForward) GetAddress ¶ added in v2.0.2
func (r *APIRouterPortForward) GetAddress(api string) string
GetAddress implements the router
func (*APIRouterPortForward) Start ¶ added in v2.0.2
func (r *APIRouterPortForward) Start() error
Start initializes and runs portforwarding by listening on to local ports and forwarding their connections to the target pod ports See
func (*APIRouterPortForward) Stop ¶ added in v2.0.2
func (r *APIRouterPortForward) Stop()
Stop the port forwarding
type APIRouterServicePort ¶
APIRouterServicePort uses the service port to route to Srv.Namespace:Port
func (*APIRouterServicePort) GetAddress ¶
func (r *APIRouterServicePort) GetAddress(api string) string
GetAddress implements the router
type AccountAllowedBuckets ¶
type AccountAllowedBuckets struct { FullPermission bool `json:"full_permission"` PermissionList []string `json:"permission_list"` }
AccountAllowedBuckets is part of CreateAccountParams
type AccountInfo ¶
type AccountInfo struct { Name string `json:"name"` Email string `json:"email"` IsSupport bool `json:"is_support"` HasLogin bool `json:"has_login"` HasS3Access bool `json:"has_s3_access"` CanCreateBuckets bool `json:"can_create_buckets"` NextPasswordChange int64 `json:"next_password_change"` DefaultPool string `json:"default_pool"` AccessKeys []S3AccessKeys `json:"access_keys"` AllowedIPs []struct { Start string `json:"start"` End string `json:"end"` } `json:"allowed_ips"` ExternalConnections struct { Count int `json:"count"` Connections []ExternalConnectionInfo `json:"connections"` } `json:"external_connections"` AllowedBuckets AllowedBuckets `json:"allowed_buckets"` Systems []struct { Name string `json:"name"` Roles []string `json:"roles"` } `json:"systems"` Preferences struct { UITheme string `json:"ui_theme"` } `json:"preferences"` }
AccountInfo is a struct of account info returned by the API
type AddExternalConnectionParams ¶
type AddExternalConnectionParams struct { Name string `json:"name"` EndpointType EndpointType `json:"endpoint_type"` Endpoint string `json:"endpoint"` Identity string `json:"identity"` Secret string `json:"secret"` AuthMethod CloudAuthMethod `json:"auth_method,omitempty"` }
AddExternalConnectionParams is the params of account_api.add_external_connection()
type AllowedBuckets ¶
type AllowedBuckets struct { FullPermission bool `json:"full_permission"` PermissionList []string `json:"permission_list"` }
AllowedBuckets is a struct for setting which buckets an account can access
type BackingStoreInfo ¶ added in v2.1.0
type BackingStoreInfo struct { // Name describes backingstore name Name string `json:"name"` // Namespace describes backingstore namespace Namespace string `json:"namespace"` }
BackingStoreInfo describes backingstore info
type BigInt ¶ added in v2.0.2
BigInt is an api type to handle large integers that cannot be represented by JSON which is limited to 53 bits (less than 8 PB)
func (BigInt) MarshalJSON ¶ added in v2.0.3
MarshalJSON is custom marshalling because the json schema is oneOf integer or {n,peta}
func (*BigInt) UnmarshalJSON ¶ added in v2.0.3
UnmarshalJSON is custom unmarshalling because the json schema is oneOf integer or {n,peta}
type BucketClaimInfo ¶ added in v2.0.2
type BucketClaimInfo struct { BucketClass string `json:"bucket_class,omitempty"` Namespace string `json:"namespace,omitempty"` }
BucketClaimInfo is the params of bucket_api.create_bucket()
type BucketClassInfo ¶ added in v2.1.0
type BucketClassInfo struct { ErrorMessage string `json:"error_message"` ShouldRevert bool `json:"should_revert"` RevertToPolicy UpdateBucketClassParams `json:"revert_to_policy"` }
BucketClassInfo is the is the reply of tiering_policy_api.update_bucket_class()
type BucketInfo ¶
type BucketInfo struct { Name string `json:"name"` BucketType string `json:"bucket_type"` Mode string `json:"mode"` Undeletable string `json:"undeletable"` BucketClaim *BucketClaimInfo `json:"bucket_claim,omitempty"` Tiering *TieringPolicyInfo `json:"tiering,omitempty"` DataCapacity *struct { Size *BigInt `json:"size,omitempty"` SizeReduced *BigInt `json:"size_reduced,omitempty"` Free *BigInt `json:"free,omitempty"` AvailableToUpload *BigInt `json:"available_for_upload,omitempty"` LastUpdate int64 `json:"last_update"` } `json:"data,omitempty"` StorageCapacity *struct { Values *StorageInfo `json:"values,omitempty"` LastUpdate int64 `json:"last_update"` } `json:"storage,omitempty"` NumObjects *struct { Value int64 `json:"value"` LastUpdate int64 `json:"last_update"` } `json:"num_objects,omitempty"` Quota *struct { Size int64 `json:"size"` Unit string `json:"unit"` } `json:"quota,omitempty"` PolicyModes *struct { ResiliencyStatus string `json:"resiliency_status"` QuotaStatus string `json:"quota_status"` } `json:"policy_modes,omitempty"` }
BucketInfo is a struct of bucket info returned by the API
type CheckExternalConnectionReply ¶
type CheckExternalConnectionReply struct { Status ExternalConnectionStatus `json:"status"` Error struct { Code string `json:"code"` Message string `json:"message"` } `json:"error,omitempty"` }
CheckExternalConnectionReply is the reply of account_api.check_external_connection()
type ChunkCoderConfig ¶
type ChunkCoderConfig struct { DigestType *string `json:"digest_type,omitempty"` FragDigestType *string `json:"frag_digest_type,omitempty"` CompressType *string `json:"compress_type,omitempty"` CipherType *string `json:"cipher_type,omitempty"` // Data Copies: Replicas *int64 `json:"replicas,omitempty"` // Erasure Coding: DataFrags *int64 `json:"data_frags,omitempty"` ParityFrags *int64 `json:"parity_frags,omitempty"` ParityType *string `json:"parity_type,omitempty"` // LRC: LrcGroup *int64 `json:"lrc_group,omitempty"` LrcFrags *int64 `json:"lrc_frags,omitempty"` LrcType *string `json:"lrc_type,omitempty"` }
ChunkCoderConfig defines a storage coding configuration
type ChunkSplitConfig ¶
type ChunkSplitConfig struct { AvgChunk int64 `json:"avg_chunk"` DeltaChunk int64 `json:"delta_chunk"` }
ChunkSplitConfig defines a storage chunking (splitting objects) configuration
type Client ¶
type Client interface { Call(req *RPCMessage, res RPCResponse) error SetAuthToken(token string) GetAuthToken() string ReadAuthAPI() (ReadAuthReply, error) ReadAccountAPI(ReadAccountParams) (AccountInfo, error) ReadSystemStatusAPI() (ReadySystemStatusReply, error) ReadSystemAPI() (SystemInfo, error) ReadBucketAPI(ReadBucketParams) (BucketInfo, error) ReadPoolAPI(ReadPoolParams) (PoolInfo, error) ListAccountsAPI() (ListAccountsReply, error) ListBucketsAPI() (ListBucketsReply, error) ListHostsAPI(ListHostsParams) (ListHostsReply, error) CreateAuthAPI(CreateAuthParams) (CreateAuthReply, error) CreateSystemAPI(CreateSystemParams) (CreateSystemReply, error) CreateAccountAPI(CreateAccountParams) (CreateAccountReply, error) CreateBucketAPI(CreateBucketParams) error CreateHostsPoolAPI(CreateHostsPoolParams) (string, error) UpdateHostsPoolAPI(UpdateHostsPoolParams) error CreateCloudPoolAPI(CreateCloudPoolParams) error CreateTierAPI(CreateTierParams) error CreateTieringPolicyAPI(TieringPolicyInfo) error DeleteBucketAPI(DeleteBucketParams) error DeleteBucketAndObjectsAPI(DeleteBucketParams) error DeleteAccountAPI(DeleteAccountParams) error DeletePoolAPI(DeletePoolParams) error UpdateAccountS3Access(UpdateAccountS3AccessParams) error UpdateAllBucketsDefaultPool(UpdateDefaultPoolParams) error UpdateBucketClass(UpdateBucketClassParams) (BucketClassInfo, error) AddExternalConnectionAPI(AddExternalConnectionParams) error CheckExternalConnectionAPI(AddExternalConnectionParams) (CheckExternalConnectionReply, error) EditExternalConnectionCredentialsAPI(EditExternalConnectionCredentialsParams) error DeleteExternalConnectionAPI(DeleteExternalConnectionParams) error UpdateEndpointGroupAPI(UpdateEndpointGroupParams) error RegisterToCluster() error }
Client is the interface providing typed noobaa API calls
type CreateAccountParams ¶
type CreateAccountParams struct { Name string `json:"name"` Email string `json:"email"` HasLogin bool `json:"has_login"` S3Access bool `json:"s3_access"` AllowBucketCreate bool `json:"allow_bucket_creation"` AllowedBuckets AccountAllowedBuckets `json:"allowed_buckets"` DefaultPool string `json:"default_pool,omitempty"` }
CreateAccountParams is the params of account_api.create_account()
type CreateAccountReply ¶
type CreateAccountReply struct { Token string `json:"token"` AccessKeys []S3AccessKeys `json:"access_keys"` }
CreateAccountReply is the reply of account_api.create_account()
type CreateAuthParams ¶
type CreateAuthParams struct { System string `json:"system"` Role string `json:"role"` Email string `json:"email"` Password string `json:"password,omitempty"` }
CreateAuthParams is the params of auth_api.create_auth()
type CreateAuthReply ¶
type CreateAuthReply struct {
Token string `json:"token"`
}
CreateAuthReply is the reply of auth_api.create_auth()
type CreateBucketParams ¶
type CreateBucketParams struct { Name string `json:"name"` Tiering string `json:"tiering,omitempty"` BucketClaim *BucketClaimInfo `json:"bucket_claim,omitempty"` }
CreateBucketParams is the params of bucket_api.create_bucket()
type CreateCloudPoolParams ¶
type CreateCloudPoolParams struct { Name string `json:"name"` Connection string `json:"connection"` TargetBucket string `json:"target_bucket"` Backingstore *BackingStoreInfo `json:"backingstore,omitempty"` }
CreateCloudPoolParams is the reply of pool_api.create_cloud_pool()
type CreateHostsPoolParams ¶
type CreateHostsPoolParams struct { Name string `json:"name"` IsManaged bool `json:"is_managed"` HostCount int `json:"host_count"` HostConfig PoolHostsInfo `json:"host_config"` Backingstore *BackingStoreInfo `json:"backingstore,omitempty"` }
CreateHostsPoolParams is the params of pool_api.create_hosts_pool()
type CreateSystemParams ¶
type CreateSystemParams struct { Name string `json:"name"` Email string `json:"email"` Password string `json:"password"` }
CreateSystemParams is the params of system_api.create_system()
type CreateSystemReply ¶
type CreateSystemReply struct { Token string `json:"token"` OperatorToken string `json:"operator_token"` }
CreateSystemReply is the reply of system_api.create_system()
type CreateTierParams ¶
type CreateTierParams struct { Name string `json:"name"` DataPlacement string `json:"data_placement,omitempty"` AttachedPools []string `json:"attached_pools,omitempty"` ChunkCoderConfig *ChunkCoderConfig `json:"chunk_coder_config,omitempty"` }
CreateTierParams is the reply of tier_api.create_tier()
type DeleteAccountParams ¶
type DeleteAccountParams struct {
Email string `json:"email"`
}
DeleteAccountParams is the params of account_api.delete_account()
type DeleteBucketParams ¶
type DeleteBucketParams struct {
Name string `json:"name"`
}
DeleteBucketParams is the params of bucket_api.delete_bucket()
type DeleteExternalConnectionParams ¶
type DeleteExternalConnectionParams struct {
Name string `json:"connection_name"`
}
DeleteExternalConnectionParams is the params of account_api.delete_external_connection()
type DeletePoolParams ¶
type DeletePoolParams struct {
Name string `json:"name"`
}
DeletePoolParams is the params of pool_api.delete_pool()
type EditExternalConnectionCredentialsParams ¶
type EditExternalConnectionCredentialsParams struct { Name string `json:"name"` Identity string `json:"identity"` Secret string `json:"secret"` }
EditExternalConnectionCredentialsParams is the params of account_api.edit_external_connection_credentials()
type ExternalConnectionInfo ¶
type ExternalConnectionInfo struct { Name string `json:"name"` EndpointType EndpointType `json:"endpoint_type"` Endpoint string `json:"endpoint"` Identity string `json:"identity"` AuthMethod CloudAuthMethod `json:"auth_method,omitempty"` Usage []struct { UsageType string `json:"usage_type"` Entity string `json:"entity"` ExternalEntity string `json:"external_entity"` } `json:"usage"` }
ExternalConnectionInfo is a struct for reply with connection info
type ExternalConnectionStatus ¶
type ExternalConnectionStatus string
ExternalConnectionStatus is an enum
type HostInfo ¶ added in v2.3.0
type HostInfo struct {
Name string `json:"name"`
}
HostInfo is the information of a host(partial)
type ListAccountsReply ¶
type ListAccountsReply struct {
Accounts []*AccountInfo `json:"accounts"`
}
ListAccountsReply is the reply to account_api.list_accounts()
type ListBucketsReply ¶
type ListBucketsReply struct { Buckets []struct { Name string `json:"name"` } `json:"buckets"` }
ListBucketsReply is the reply of bucket_api.list_buckets()
type ListHostsParams ¶ added in v2.3.0
type ListHostsParams struct {
Query ListHostsQuery `json:"query"`
}
ListHostsParams is the params to host_api.list_hosts()
type ListHostsQuery ¶ added in v2.3.0
type ListHostsQuery struct {
Pools []string `json:"pools"`
}
ListHostsQuery is the query params to host_api.list_hosts()
type ListHostsReply ¶ added in v2.3.0
type ListHostsReply struct {
Hosts []HostInfo `json:"hosts"`
}
ListHostsReply is the reply of host_api.list_hosts()
type PoolHostsInfo ¶
type PoolHostsInfo struct { // TODO encode/decode BigInt VolumeSize int64 `json:"volume_size"` }
PoolHostsInfo is the config/info of a hosts pool
type PoolInfo ¶
type PoolInfo struct { Name string `json:"name"` ResourceType string `json:"resource_type"` Mode string `json:"mode,omitempty"` Region string `json:"region,omitempty"` PoolNodeType string `json:"pool_node_type,omitempty"` Undeletable string `json:"undeletable,omitempty"` CloudInfo *struct { EndpointType EndpointType `json:"endpoint_type,omitempty"` Endpoint string `json:"endpoint,omitempty"` TargetBucket string `json:"target_bucket,omitempty"` Identity string `json:"identity,omitempty"` NodeName string `json:"node_name,omitempty"` CreatedBy string `json:"created_by,omitempty"` Host string `json:"host,omitempty"` AuthMethod CloudAuthMethod `json:"auth_method,omitempty"` } `json:"cloud_info,omitempty"` MongoInfo *map[string]interface{} `json:"mongo_info,omitempty"` HostInfo *PoolHostsInfo `json:"host_info,omitempty"` Hosts *struct { ConfiguredCount int64 `json:"configured_count"` Count int64 `json:"count"` } `json:"hosts,omitempty"` }
PoolInfo is a struct of pool info returned by the API
type RPC ¶ added in v2.1.0
type RPC struct { HTTPClient http.Client ConnMap map[string]RPCConn ConnMapLock sync.Mutex Handler RPCHandler }
RPC is a struct that describes the relevant fields upon handeling rpc protocol
var GlobalRPC *RPC
GlobalRPC is the global rpc
func (*RPC) GetConnection ¶ added in v2.1.0
GetConnection finds the connection related to the pending request or creates a new one
func (*RPC) RemoveConnection ¶ added in v2.1.0
RemoveConnection removes the connection from the RPC connections map and start reconnecting
type RPCBuffer ¶ added in v2.1.0
type RPCBuffer struct { Name string `json:"name,omitempty"` Length int32 `json:"len,omitempty"` Buffer []byte `json:"-"` }
RPCBuffer is a struct that describes the fields related to an rpc buffer
type RPCClient ¶
RPCClient makes API calls to noobaa. Requests to noobaa are plain http requests with json request and json response.
func (*RPCClient) AddExternalConnectionAPI ¶
func (c *RPCClient) AddExternalConnectionAPI(params AddExternalConnectionParams) error
AddExternalConnectionAPI calls account_api.add_external_connection()
func (*RPCClient) Call ¶
func (c *RPCClient) Call(req *RPCMessage, res RPCResponse) error
Call an API method to noobaa over wss or https protocol The response type should be defined to include RPCResponse inline. This is needed in order for json.Unmarshal() to decode into the reply structure.
func (*RPCClient) CheckExternalConnectionAPI ¶
func (c *RPCClient) CheckExternalConnectionAPI(params AddExternalConnectionParams) (CheckExternalConnectionReply, error)
CheckExternalConnectionAPI calls account_api.check_external_connection()
func (*RPCClient) CreateAccountAPI ¶
func (c *RPCClient) CreateAccountAPI(params CreateAccountParams) (CreateAccountReply, error)
CreateAccountAPI calls account_api.create_account()
func (*RPCClient) CreateAuthAPI ¶
func (c *RPCClient) CreateAuthAPI(params CreateAuthParams) (CreateAuthReply, error)
CreateAuthAPI calls auth_api.create_auth()
func (*RPCClient) CreateBucketAPI ¶
func (c *RPCClient) CreateBucketAPI(params CreateBucketParams) error
CreateBucketAPI calls bucket_api.create_bucket()
func (*RPCClient) CreateCloudPoolAPI ¶
func (c *RPCClient) CreateCloudPoolAPI(params CreateCloudPoolParams) error
CreateCloudPoolAPI calls pool_api.create_cloud_pool()
func (*RPCClient) CreateHostsPoolAPI ¶
func (c *RPCClient) CreateHostsPoolAPI(params CreateHostsPoolParams) (string, error)
CreateHostsPoolAPI calls pool_api.create_hosts_pool()
func (*RPCClient) CreateSystemAPI ¶
func (c *RPCClient) CreateSystemAPI(params CreateSystemParams) (CreateSystemReply, error)
CreateSystemAPI calls system_api.create_system()
func (*RPCClient) CreateTierAPI ¶
func (c *RPCClient) CreateTierAPI(params CreateTierParams) error
CreateTierAPI calls tier_api.create_tier()
func (*RPCClient) CreateTieringPolicyAPI ¶
func (c *RPCClient) CreateTieringPolicyAPI(params TieringPolicyInfo) error
CreateTieringPolicyAPI calls tiering_policy_api.create_policy()
func (*RPCClient) DeleteAccountAPI ¶
func (c *RPCClient) DeleteAccountAPI(params DeleteAccountParams) error
DeleteAccountAPI calls account_api.delete_account()
func (*RPCClient) DeleteBucketAPI ¶
func (c *RPCClient) DeleteBucketAPI(params DeleteBucketParams) error
DeleteBucketAPI calls bucket_api.delete_bucket()
func (*RPCClient) DeleteBucketAndObjectsAPI ¶ added in v2.0.5
func (c *RPCClient) DeleteBucketAndObjectsAPI(params DeleteBucketParams) error
DeleteBucketAndObjectsAPI calls bucket_api.delete_bucket()
func (*RPCClient) DeleteExternalConnectionAPI ¶
func (c *RPCClient) DeleteExternalConnectionAPI(params DeleteExternalConnectionParams) error
DeleteExternalConnectionAPI calls account_api.delete_external_connection()
func (*RPCClient) DeletePoolAPI ¶
func (c *RPCClient) DeletePoolAPI(params DeletePoolParams) error
DeletePoolAPI calls pool_api.delete_pool()
func (*RPCClient) EditExternalConnectionCredentialsAPI ¶
func (c *RPCClient) EditExternalConnectionCredentialsAPI(params EditExternalConnectionCredentialsParams) error
EditExternalConnectionCredentialsAPI calls account_api.edit_external_connection_credentials()
func (*RPCClient) GetAuthToken ¶
GetAuthToken is getting the client token for next calls
func (*RPCClient) ListAccountsAPI ¶
func (c *RPCClient) ListAccountsAPI() (ListAccountsReply, error)
ListAccountsAPI calls account_api.list_accounts()
func (*RPCClient) ListBucketsAPI ¶
func (c *RPCClient) ListBucketsAPI() (ListBucketsReply, error)
ListBucketsAPI calls bucket_api.list_buckets()
func (*RPCClient) ListHostsAPI ¶ added in v2.3.0
func (c *RPCClient) ListHostsAPI(params ListHostsParams) (ListHostsReply, error)
ListHostsAPI calls host_api.list_hosts()
func (*RPCClient) ReadAccountAPI ¶
func (c *RPCClient) ReadAccountAPI(params ReadAccountParams) (AccountInfo, error)
ReadAccountAPI calls account_api.read_account()
func (*RPCClient) ReadAuthAPI ¶
func (c *RPCClient) ReadAuthAPI() (ReadAuthReply, error)
ReadAuthAPI calls auth_api.read_auth()
func (*RPCClient) ReadBucketAPI ¶
func (c *RPCClient) ReadBucketAPI(params ReadBucketParams) (BucketInfo, error)
ReadBucketAPI calls bucket_api.read_bucket()
func (*RPCClient) ReadPoolAPI ¶ added in v2.1.0
func (c *RPCClient) ReadPoolAPI(params ReadPoolParams) (PoolInfo, error)
ReadPoolAPI calls pool_api.read_pool()
func (*RPCClient) ReadSystemAPI ¶
func (c *RPCClient) ReadSystemAPI() (SystemInfo, error)
ReadSystemAPI calls system_api.read_system()
func (*RPCClient) ReadSystemStatusAPI ¶ added in v2.3.0
func (c *RPCClient) ReadSystemStatusAPI() (ReadySystemStatusReply, error)
ReadSystemStatusAPI calls system_api.get_system_status()
func (*RPCClient) RegisterToCluster ¶ added in v2.1.0
RegisterToCluster calls redirector_api.RegisterToCluster()
func (*RPCClient) SetAuthToken ¶
SetAuthToken is setting the client token for next calls
func (*RPCClient) UpdateAccountS3Access ¶
func (c *RPCClient) UpdateAccountS3Access(params UpdateAccountS3AccessParams) error
UpdateAccountS3Access calls account_api.update_account_s3_access()
func (*RPCClient) UpdateAllBucketsDefaultPool ¶ added in v2.0.2
func (c *RPCClient) UpdateAllBucketsDefaultPool(params UpdateDefaultPoolParams) error
UpdateAllBucketsDefaultPool calls bucket_api.update_all_buckets_default_pool()
func (*RPCClient) UpdateBucketClass ¶ added in v2.1.0
func (c *RPCClient) UpdateBucketClass(params UpdateBucketClassParams) (BucketClassInfo, error)
UpdateBucketClass calls bucket_api.update_bucket_class()
func (*RPCClient) UpdateEndpointGroupAPI ¶ added in v2.1.0
func (c *RPCClient) UpdateEndpointGroupAPI(params UpdateEndpointGroupParams) error
UpdateEndpointGroupAPI updates the noobaa core about endpoint configuration changes
func (*RPCClient) UpdateHostsPoolAPI ¶ added in v2.3.0
func (c *RPCClient) UpdateHostsPoolAPI(params UpdateHostsPoolParams) error
UpdateHostsPoolAPI calls pool_api.scale_hosts_pool()
type RPCConn ¶ added in v2.1.0
type RPCConn interface { // GetAddress returns the connection address GetAddress() string // Reonnect should make sure the connection is ready to be used Reconnect() // Call sends request and receives the response Call(req *RPCMessage, res RPCResponse) error }
RPCConn is a common connection interface implemented by http and ws
type RPCConnHTTP ¶ added in v2.1.0
RPCConnHTTP is an http connection which is created per request since the actual http connection pooling is handled in the standard http library
func NewRPCConnHTTP ¶ added in v2.1.0
func NewRPCConnHTTP(r *RPC, address string) *RPCConnHTTP
NewRPCConnHTTP returns a new http connection
func (*RPCConnHTTP) Call ¶ added in v2.1.0
func (c *RPCConnHTTP) Call(req *RPCMessage, res RPCResponse) error
Call calls an API method to noobaa over https
func (*RPCConnHTTP) GetAddress ¶ added in v2.1.0
func (c *RPCConnHTTP) GetAddress() string
GetAddress returns the connection address
func (*RPCConnHTTP) Reconnect ¶ added in v2.1.0
func (c *RPCConnHTTP) Reconnect()
Reconnect is doing nothing for http connection
type RPCConnWS ¶ added in v2.1.0
type RPCConnWS struct { RPC *RPC Address string State string WS *websocket.Conn PendingRequests map[string]*RPCPendingRequest NextRequestID uint64 Lock sync.Mutex ReconnectDelay time.Duration }
RPCConnWS is an websocket connection which is shared and multiplexed for all concurrent requests to the same address
func NewRPCConnWS ¶ added in v2.1.0
NewRPCConnWS returns a new websocket connection
func (*RPCConnWS) Call ¶ added in v2.1.0
func (c *RPCConnWS) Call(req *RPCMessage, res RPCResponse) error
Call calls an API method to noobaa over wss
func (*RPCConnWS) Close ¶ added in v2.1.0
func (c *RPCConnWS) Close()
Close locks the connection and call close
func (*RPCConnWS) CloseUnderLock ¶ added in v2.1.0
func (c *RPCConnWS) CloseUnderLock()
CloseUnderLock closes the connection
func (*RPCConnWS) ConnectUnderLock ¶ added in v2.1.0
ConnectUnderLock is opening a ws connection for new connection or after the previous one closed it can delay the reconnect attempts in case of repeated failures such as when the host is unreachable, etc.
func (*RPCConnWS) GetAddress ¶ added in v2.1.0
GetAddress returns the connection address
func (*RPCConnWS) HandlePing ¶ added in v2.1.0
func (c *RPCConnWS) HandlePing(msg *RPCMessage)
HandlePing handles an incoming message of type ping
func (*RPCConnWS) HandleRequest ¶ added in v2.1.0
func (c *RPCConnWS) HandleRequest(req *RPCMessage)
HandleRequest handles an incoming message of type request
func (*RPCConnWS) HandleResponse ¶ added in v2.1.0
func (c *RPCConnWS) HandleResponse(msg *RPCMessage)
HandleResponse handles an incoming message of type response
func (*RPCConnWS) NewRequest ¶ added in v2.1.0
func (c *RPCConnWS) NewRequest(req *RPCMessage, res RPCResponse) chan error
NewRequest initializes the request id and register it on the connection pending requests
func (*RPCConnWS) ReadMessage ¶ added in v2.1.0
func (c *RPCConnWS) ReadMessage() (*RPCMessage, error)
ReadMessage handles a message
func (*RPCConnWS) ReadMessages ¶ added in v2.1.0
func (c *RPCConnWS) ReadMessages()
ReadMessages handles incoming messages
func (*RPCConnWS) Reconnect ¶ added in v2.1.0
func (c *RPCConnWS) Reconnect()
Reconnect connects after setting a delay
func (*RPCConnWS) SendMessage ¶ added in v2.1.0
SendMessage sends the pending request
type RPCHandler ¶ added in v2.1.0
type RPCHandler func(req *RPCMessage) (interface{}, error)
RPCHandler is the interface for RPCHandler struct
type RPCMessage ¶ added in v2.1.0
type RPCMessage struct { Op string `json:"op"` API string `json:"api,omitempty"` Method string `json:"method,omitempty"` RequestID string `json:"reqid,omitempty"` AuthToken string `json:"auth_token,omitempty"` Took float64 `json:"took,omitempty"` Error *RPCError `json:"error,omitempty"` Params interface{} `json:"params,omitempty"` Buffers []RPCBuffer `json:"buffers,omitempty"` RawBytes []byte `json:"-"` }
RPCMessage structure encoded in every RPC message
func (*RPCMessage) Response ¶ added in v2.1.0
func (msg *RPCMessage) Response() *RPCMessage
Response is implementing the RPCResponse interface
func (*RPCMessage) SetBuffers ¶ added in v2.1.0
func (msg *RPCMessage) SetBuffers(buffers []byte)
SetBuffers assigns the buffers from the message and slices them to the message buffers
type RPCMessageReply ¶ added in v2.1.0
type RPCMessageReply struct { RPCMessage `json:",inline"` Reply interface{} `json:"reply,omitempty"` }
RPCMessageReply structure encoded in every RPC message that contains reply
type RPCPendingRequest ¶ added in v2.1.0
type RPCPendingRequest struct { Conn *RPCConnWS Req *RPCMessage Res RPCResponse ReplyChan chan error }
RPCPendingRequest is a struct that describes the fields related to an rpc pending requests
type RPCResponse ¶
type RPCResponse interface {
Response() *RPCMessage
}
RPCResponse is the interface for response structs. RPCMessage is the only real implementor of it.
type ReadAccountParams ¶
type ReadAccountParams struct {
Email string `json:"email"`
}
ReadAccountParams is the params to account_api.read_account()
type ReadAuthReply ¶
type ReadAuthReply struct { Account struct { Name string `json:"name"` Email string `json:"email"` IsSupport bool `json:"is_support"` MustChangePassword bool `json:"must_change_password"` } `json:"account"` System struct { Name string `json:"name"` } `json:"system"` AuthorizedBy string `json:"authorized_by"` Role string `json:"role"` Extra map[string]interface{} `json:"extra"` }
ReadAuthReply is the reply of auth_api.read_auth()
type ReadBucketParams ¶
type ReadBucketParams struct {
Name string `json:"name"`
}
ReadBucketParams is the params to bucket_api.read_bucket()
type ReadPoolParams ¶ added in v2.1.0
type ReadPoolParams struct {
Name string `json:"name"`
}
ReadPoolParams is the params to pool_api.read_pool()
type ReadySystemStatusReply ¶ added in v2.3.0
type ReadySystemStatusReply struct {
State string `json:"state,omitempty"`
}
ReadySystemStatusReply is the reply to system_pai.get_system_status()
type S3AccessKeys ¶
type S3AccessKeys struct { AccessKey string `json:"access_key"` SecretKey string `json:"secret_key"` }
S3AccessKeys is a struct holding S3 access and secret keys
type SimpleRouter ¶ added in v2.1.0
type SimpleRouter struct {
Address string
}
SimpleRouter is a basic router
func (*SimpleRouter) GetAddress ¶ added in v2.1.0
func (r *SimpleRouter) GetAddress(api string) string
GetAddress implements the router
type StorageInfo ¶ added in v2.0.2
type StorageInfo struct { Total *BigInt `json:"total,omitempty"` Free *BigInt `json:"free,omitempty"` Used *BigInt `json:"used,omitempty"` UsedOther *BigInt `json:"used_other,omitempty"` UsedReduced *BigInt `json:"used_reduced,omitempty"` Alloc *BigInt `json:"alloc,omitempty"` Limit *BigInt `json:"limit,omitempty"` Reserved *BigInt `json:"reserved,omitempty"` Real *BigInt `json:"real,omitempty"` }
StorageInfo contains storage capacity information with specific break down
type SystemInfo ¶
type SystemInfo struct { Accounts []AccountInfo `json:"accounts"` Buckets []BucketInfo `json:"buckets"` Pools []PoolInfo `json:"pools"` Tiers []TierInfo `json:"tiers"` Version string `json:"version"` }
SystemInfo is a struct of system info returned by the API
type TierInfo ¶ added in v2.0.2
type TierInfo struct { Name string `json:"name"` DataPlacement string `json:"data_placement,omitempty"` AttachedPools []string `json:"attached_pools,omitempty"` ChunkCoderConfig *ChunkCoderConfig `json:"chunk_coder_config,omitempty"` DataCapacity *StorageInfo `json:"data,omitempty"` StorageCapacity *StorageInfo `json:"storage,omitempty"` }
TierInfo is the information of a tier
type TierItem ¶
type TierItem struct { Order int64 `json:"order"` Tier string `json:"tier"` Mode string `json:"mode,omitempty"` }
TierItem is an item in a tiering policy
type TieringPolicyInfo ¶ added in v2.0.2
type TieringPolicyInfo struct { Name string `json:"name"` Tiers []TierItem `json:"tiers"` ChunkSplitConfig *ChunkSplitConfig `json:"chunk_split_config,omitempty"` DataCapacity *StorageInfo `json:"data,omitempty"` StorageCapacity *StorageInfo `json:"storage,omitempty"` Mode string `json:"mode,omitempty"` }
TieringPolicyInfo is the information of a tiering policy
type UpdateAccountS3AccessParams ¶
type UpdateAccountS3AccessParams struct { Email string `json:"email"` S3Access bool `json:"s3_access"` DefaultPool *string `json:"default_pool,omitempty"` AllowBucketCreation *bool `json:"allow_bucket_creation,omitempty"` AllowBuckets *AllowedBuckets `json:"allowed_buckets,omitempty"` }
UpdateAccountS3AccessParams is the params of account_api.update_account_s3_access()
type UpdateBucketClassParams ¶ added in v2.1.0
type UpdateBucketClassParams struct { Name string `json:"name"` Policy TieringPolicyInfo `json:"policy"` Tiers []TierInfo `json:"tiers"` }
UpdateBucketClassParams is the params of tiering_policy_api.update_bucket_class()
type UpdateDefaultPoolParams ¶ added in v2.0.2
type UpdateDefaultPoolParams struct {
PoolName string `json:"pool_name"`
}
UpdateDefaultPoolParams is the params of bucket_api.update_all_buckets_default_pool()
type UpdateEndpointGroupParams ¶ added in v2.1.0
type UpdateEndpointGroupParams struct { GroupName string `json:"group_name"` IsRemote bool `json:"is_remote"` Region string `json:"region"` EndpointRange IntRange `json:"endpoint_range"` }
UpdateEndpointGroupParams is the params of system_api.update_endpoint_group()
type UpdateHostsPoolParams ¶ added in v2.3.0
type UpdateHostsPoolParams struct { Name string `json:"name"` Backingstore *BackingStoreInfo `json:"backingstore,omitempty"` }
UpdateHostsPoolParams is the params of pool_api.update_hosts_pool()