noobaa-operator icon indicating copy to clipboard operation
noobaa-operator copied to clipboard

CLI Command - noobaa object list (enhancement)

Open guymguym opened this issue 4 years ago • 1 comments

Followup on - https://stackoverflow.com/questions/61925930/how-to-check-content-of-a-noobaa-bucket

I think the admins wants the CLI to have a simple command to list objects just like aws s3 ls. Clearly this opens up room for more noobaa object <subcommand> such as head, get, put, and also status that will show metadata, size reduction, and mapping to storage locations. We'd want to keep this focused on getting information that admins want, not completely generic S3 client. It should be a straightforward implementation in the CLI by calling the internal object_api.

Note that we also have the noobaa api <api> <method> <params-json> command that can be used to print noobaa api object list_objects '{ "bucket":"first.bucket" }' but at least in current operator from brew (v2.1.0) I see this fails to resolve an rpc address.

guymguym avatar May 28 '20 22:05 guymguym

Hi @guymguym , Do you have any open git issues to deal with noobaa api object list_objects error which you have mentioned in the description of this enhancement?

It seems I am hitting same:

# noobaa api object list_objects '{"name": "first.bucket"}'
INFO[0000] ✅ Exists: NooBaa "noobaa"                    
INFO[0000] ✅ Exists: Service "noobaa-mgmt"              
INFO[0000] ✅ Exists: Secret "noobaa-operator"           
INFO[0000] ✅ Exists: Secret "noobaa-admin"              
INFO[0000] ✈️  RPC: object.list_objects() Request: map[name:first.bucket] 
WARN[0000] RPC: GetConnection creating connection to wss://localhost:0/rpc/ 0xc000ceb090 
INFO[0000] RPC: Connecting websocket (0xc000ceb090) &{RPC:0xc00003bdb0 Address:wss://localhost:0/rpc/ State:init WS:<nil> PendingRequests:map[] NextRequestID:0 Lock:{state:1 sema:0} ReconnectDelay:0s} 
ERRO[0000] RPC: closing connection (0xc000ceb090) &{RPC:0xc00003bdb0 Address:wss://localhost:0/rpc/ State:init WS:<nil> PendingRequests:map[] NextRequestID:0 Lock:{state:1 sema:0} ReconnectDelay:0s} 
WARN[0000] RPC: RemoveConnection wss://localhost:0/rpc/ current=0xc000ceb090 conn=0xc000ceb090 
ERRO[0000] ⚠️  RPC: object.list_objects() Call failed: failed to websocket dial: failed to send handshake request: Get "https://localhost:0/rpc/": dial tcp 127.0.0.1:0: connect: connection refused 
FATA[0000] ❌ failed to websocket dial: failed to send handshake request: Get "https://localhost:0/rpc/": dial tcp 127.0.0.1:0: connect: connection refused 

bssrikanth avatar Dec 02 '20 05:12 bssrikanth