summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-23 14:12:25 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-23 14:12:25 -0400
commit8fb9ed4c74ecd332a1d2c8219cd3429b78053b0b (patch)
tree7f3d227cfae89e6c4201e0384fb8898c91fc42f6 /Remote
parent036942dda47e49f3ef9726f239185078e05ad8b2 (diff)
S3: git annex info will show additional information about a S3 remote (endpoint, port, storage class)
Diffstat (limited to 'Remote')
-rw-r--r--Remote/S3.hs23
1 files changed, 16 insertions, 7 deletions
diff --git a/Remote/S3.hs b/Remote/S3.hs
index c9de36745..cf46c2b28 100644
--- a/Remote/S3.hs
+++ b/Remote/S3.hs
@@ -28,6 +28,7 @@ import Control.Monad.Trans.Resource
import Control.Monad.Catch
import Data.Conduit
import Data.IORef
+import Data.Bits.Utils
import System.Log.Logger
import Common.Annex
@@ -89,13 +90,7 @@ gen r u c gc = do
, availability = GloballyAvailable
, remotetype = remote
, mkUnavailable = gen r u (M.insert "host" "!dne!" c) gc
- , getInfo = includeCredsInfo c (AWS.creds u) $ catMaybes
- [ Just ("bucket", fromMaybe "unknown" (getBucketName c))
- , if configIA c
- then Just ("internet archive item", iaItemUrl $ fromMaybe "unknown" $ getBucketName c)
- else Nothing
- , Just ("partsize", maybe "unlimited" (roughSize storageUnits False) (getPartSize c))
- ]
+ , getInfo = includeCredsInfo c (AWS.creds u) (s3Info c)
, claimUrl = Nothing
, checkUrl = Nothing
}
@@ -528,3 +523,17 @@ debugMapper level t = forward "S3" (T.unpack t)
AWS.Info -> infoM
AWS.Warning -> warningM
AWS.Error -> errorM
+
+s3Info :: RemoteConfig -> [(String, String)]
+s3Info c = catMaybes
+ [ Just ("bucket", fromMaybe "unknown" (getBucketName c))
+ , Just ("endpoint", w82s (S.unpack (S3.s3Endpoint s3c)))
+ , Just ("port", show (S3.s3Port s3c))
+ , Just ("storage class", show (getStorageClass c))
+ , if configIA c
+ then Just ("internet archive item", iaItemUrl $ fromMaybe "unknown" $ getBucketName c)
+ else Nothing
+ , Just ("partsize", maybe "unlimited" (roughSize storageUnits False) (getPartSize c))
+ ]
+ where
+ s3c = s3Configuration c