{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
module Amazonka.S3.Internal
( Region (..)
, BucketName (..)
, ETag (..)
, ObjectVersionId (..)
, LocationConstraint (..)
, _LocationConstraint
, Delimiter
, ObjectKey (..)
, _ObjectKey
, keyPrefix
, keyName
, keyComponents
, getWebsiteEndpoint
) where
import Amazonka.Lens (IndexedTraversal', iso, prism, traversed, _1, _2)
import Amazonka.Core
import Amazonka.Prelude
import qualified Data.Text as Text
newtype BucketName = BucketName Text
deriving
( BucketName -> BucketName -> Bool
(BucketName -> BucketName -> Bool)
-> (BucketName -> BucketName -> Bool) -> Eq BucketName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BucketName -> BucketName -> Bool
$c/= :: BucketName -> BucketName -> Bool
== :: BucketName -> BucketName -> Bool
$c== :: BucketName -> BucketName -> Bool
Eq
, Eq BucketName
Eq BucketName
-> (BucketName -> BucketName -> Ordering)
-> (BucketName -> BucketName -> Bool)
-> (BucketName -> BucketName -> Bool)
-> (BucketName -> BucketName -> Bool)
-> (BucketName -> BucketName -> Bool)
-> (BucketName -> BucketName -> BucketName)
-> (BucketName -> BucketName -> BucketName)
-> Ord BucketName
BucketName -> BucketName -> Bool
BucketName -> BucketName -> Ordering
BucketName -> BucketName -> BucketName
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: BucketName -> BucketName -> BucketName
$cmin :: BucketName -> BucketName -> BucketName
max :: BucketName -> BucketName -> BucketName
$cmax :: BucketName -> BucketName -> BucketName
>= :: BucketName -> BucketName -> Bool
$c>= :: BucketName -> BucketName -> Bool
> :: BucketName -> BucketName -> Bool
$c> :: BucketName -> BucketName -> Bool
<= :: BucketName -> BucketName -> Bool
$c<= :: BucketName -> BucketName -> Bool
< :: BucketName -> BucketName -> Bool
$c< :: BucketName -> BucketName -> Bool
compare :: BucketName -> BucketName -> Ordering
$ccompare :: BucketName -> BucketName -> Ordering
$cp1Ord :: Eq BucketName
Ord
, ReadPrec [BucketName]
ReadPrec BucketName
Int -> ReadS BucketName
ReadS [BucketName]
(Int -> ReadS BucketName)
-> ReadS [BucketName]
-> ReadPrec BucketName
-> ReadPrec [BucketName]
-> Read BucketName
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BucketName]
$creadListPrec :: ReadPrec [BucketName]
readPrec :: ReadPrec BucketName
$creadPrec :: ReadPrec BucketName
readList :: ReadS [BucketName]
$creadList :: ReadS [BucketName]
readsPrec :: Int -> ReadS BucketName
$creadsPrec :: Int -> ReadS BucketName
Read
, Int -> BucketName -> ShowS
[BucketName] -> ShowS
BucketName -> String
(Int -> BucketName -> ShowS)
-> (BucketName -> String)
-> ([BucketName] -> ShowS)
-> Show BucketName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BucketName] -> ShowS
$cshowList :: [BucketName] -> ShowS
show :: BucketName -> String
$cshow :: BucketName -> String
showsPrec :: Int -> BucketName -> ShowS
$cshowsPrec :: Int -> BucketName -> ShowS
Show
, (forall x. BucketName -> Rep BucketName x)
-> (forall x. Rep BucketName x -> BucketName) -> Generic BucketName
forall x. Rep BucketName x -> BucketName
forall x. BucketName -> Rep BucketName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BucketName x -> BucketName
$cfrom :: forall x. BucketName -> Rep BucketName x
Generic
, String -> BucketName
(String -> BucketName) -> IsString BucketName
forall a. (String -> a) -> IsString a
fromString :: String -> BucketName
$cfromString :: String -> BucketName
IsString
, Text -> Either String BucketName
(Text -> Either String BucketName) -> FromText BucketName
forall a. (Text -> Either String a) -> FromText a
fromText :: Text -> Either String BucketName
$cfromText :: Text -> Either String BucketName
FromText
, BucketName -> Text
(BucketName -> Text) -> ToText BucketName
forall a. (a -> Text) -> ToText a
toText :: BucketName -> Text
$ctoText :: BucketName -> Text
ToText
, BucketName -> ByteString
(BucketName -> ByteString) -> ToByteString BucketName
forall a. (a -> ByteString) -> ToByteString a
toBS :: BucketName -> ByteString
$ctoBS :: BucketName -> ByteString
ToByteString
, [Node] -> Either String BucketName
([Node] -> Either String BucketName) -> FromXML BucketName
forall a. ([Node] -> Either String a) -> FromXML a
parseXML :: [Node] -> Either String BucketName
$cparseXML :: [Node] -> Either String BucketName
FromXML
, BucketName -> XML
(BucketName -> XML) -> ToXML BucketName
forall a. (a -> XML) -> ToXML a
toXML :: BucketName -> XML
$ctoXML :: BucketName -> XML
ToXML
, BucketName -> QueryString
(BucketName -> QueryString) -> ToQuery BucketName
forall a. (a -> QueryString) -> ToQuery a
toQuery :: BucketName -> QueryString
$ctoQuery :: BucketName -> QueryString
ToQuery
, BucketName -> ByteStringBuilder
(BucketName -> ByteStringBuilder) -> ToLog BucketName
forall a. (a -> ByteStringBuilder) -> ToLog a
build :: BucketName -> ByteStringBuilder
$cbuild :: BucketName -> ByteStringBuilder
ToLog
, Value -> Parser [BucketName]
Value -> Parser BucketName
(Value -> Parser BucketName)
-> (Value -> Parser [BucketName]) -> FromJSON BucketName
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [BucketName]
$cparseJSONList :: Value -> Parser [BucketName]
parseJSON :: Value -> Parser BucketName
$cparseJSON :: Value -> Parser BucketName
FromJSON
)
instance Hashable BucketName
instance NFData BucketName
newtype ETag = ETag ByteString
deriving
( ETag -> ETag -> Bool
(ETag -> ETag -> Bool) -> (ETag -> ETag -> Bool) -> Eq ETag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ETag -> ETag -> Bool
$c/= :: ETag -> ETag -> Bool
== :: ETag -> ETag -> Bool
$c== :: ETag -> ETag -> Bool
Eq
, Eq ETag
Eq ETag
-> (ETag -> ETag -> Ordering)
-> (ETag -> ETag -> Bool)
-> (ETag -> ETag -> Bool)
-> (ETag -> ETag -> Bool)
-> (ETag -> ETag -> Bool)
-> (ETag -> ETag -> ETag)
-> (ETag -> ETag -> ETag)
-> Ord ETag
ETag -> ETag -> Bool
ETag -> ETag -> Ordering
ETag -> ETag -> ETag
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ETag -> ETag -> ETag
$cmin :: ETag -> ETag -> ETag
max :: ETag -> ETag -> ETag
$cmax :: ETag -> ETag -> ETag
>= :: ETag -> ETag -> Bool
$c>= :: ETag -> ETag -> Bool
> :: ETag -> ETag -> Bool
$c> :: ETag -> ETag -> Bool
<= :: ETag -> ETag -> Bool
$c<= :: ETag -> ETag -> Bool
< :: ETag -> ETag -> Bool
$c< :: ETag -> ETag -> Bool
compare :: ETag -> ETag -> Ordering
$ccompare :: ETag -> ETag -> Ordering
$cp1Ord :: Eq ETag
Ord
, ReadPrec [ETag]
ReadPrec ETag
Int -> ReadS ETag
ReadS [ETag]
(Int -> ReadS ETag)
-> ReadS [ETag] -> ReadPrec ETag -> ReadPrec [ETag] -> Read ETag
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ETag]
$creadListPrec :: ReadPrec [ETag]
readPrec :: ReadPrec ETag
$creadPrec :: ReadPrec ETag
readList :: ReadS [ETag]
$creadList :: ReadS [ETag]
readsPrec :: Int -> ReadS ETag
$creadsPrec :: Int -> ReadS ETag
Read
, Int -> ETag -> ShowS
[ETag] -> ShowS
ETag -> String
(Int -> ETag -> ShowS)
-> (ETag -> String) -> ([ETag] -> ShowS) -> Show ETag
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ETag] -> ShowS
$cshowList :: [ETag] -> ShowS
show :: ETag -> String
$cshow :: ETag -> String
showsPrec :: Int -> ETag -> ShowS
$cshowsPrec :: Int -> ETag -> ShowS
Show
, (forall x. ETag -> Rep ETag x)
-> (forall x. Rep ETag x -> ETag) -> Generic ETag
forall x. Rep ETag x -> ETag
forall x. ETag -> Rep ETag x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ETag x -> ETag
$cfrom :: forall x. ETag -> Rep ETag x
Generic
, String -> ETag
(String -> ETag) -> IsString ETag
forall a. (String -> a) -> IsString a
fromString :: String -> ETag
$cfromString :: String -> ETag
IsString
, Text -> Either String ETag
(Text -> Either String ETag) -> FromText ETag
forall a. (Text -> Either String a) -> FromText a
fromText :: Text -> Either String ETag
$cfromText :: Text -> Either String ETag
FromText
, ETag -> Text
(ETag -> Text) -> ToText ETag
forall a. (a -> Text) -> ToText a
toText :: ETag -> Text
$ctoText :: ETag -> Text
ToText
, ETag -> ByteString
(ETag -> ByteString) -> ToByteString ETag
forall a. (a -> ByteString) -> ToByteString a
toBS :: ETag -> ByteString
$ctoBS :: ETag -> ByteString
ToByteString
, [Node] -> Either String ETag
([Node] -> Either String ETag) -> FromXML ETag
forall a. ([Node] -> Either String a) -> FromXML a
parseXML :: [Node] -> Either String ETag
$cparseXML :: [Node] -> Either String ETag
FromXML
, ETag -> XML
(ETag -> XML) -> ToXML ETag
forall a. (a -> XML) -> ToXML a
toXML :: ETag -> XML
$ctoXML :: ETag -> XML
ToXML
, ETag -> QueryString
(ETag -> QueryString) -> ToQuery ETag
forall a. (a -> QueryString) -> ToQuery a
toQuery :: ETag -> QueryString
$ctoQuery :: ETag -> QueryString
ToQuery
, ETag -> ByteStringBuilder
(ETag -> ByteStringBuilder) -> ToLog ETag
forall a. (a -> ByteStringBuilder) -> ToLog a
build :: ETag -> ByteStringBuilder
$cbuild :: ETag -> ByteStringBuilder
ToLog
)
instance Hashable ETag
instance NFData ETag
newtype ObjectVersionId = ObjectVersionId Text
deriving
( ObjectVersionId -> ObjectVersionId -> Bool
(ObjectVersionId -> ObjectVersionId -> Bool)
-> (ObjectVersionId -> ObjectVersionId -> Bool)
-> Eq ObjectVersionId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ObjectVersionId -> ObjectVersionId -> Bool
$c/= :: ObjectVersionId -> ObjectVersionId -> Bool
== :: ObjectVersionId -> ObjectVersionId -> Bool
$c== :: ObjectVersionId -> ObjectVersionId -> Bool
Eq
, Eq ObjectVersionId
Eq ObjectVersionId
-> (ObjectVersionId -> ObjectVersionId -> Ordering)
-> (ObjectVersionId -> ObjectVersionId -> Bool)
-> (ObjectVersionId -> ObjectVersionId -> Bool)
-> (ObjectVersionId -> ObjectVersionId -> Bool)
-> (ObjectVersionId -> ObjectVersionId -> Bool)
-> (ObjectVersionId -> ObjectVersionId -> ObjectVersionId)
-> (ObjectVersionId -> ObjectVersionId -> ObjectVersionId)
-> Ord ObjectVersionId
ObjectVersionId -> ObjectVersionId -> Bool
ObjectVersionId -> ObjectVersionId -> Ordering
ObjectVersionId -> ObjectVersionId -> ObjectVersionId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ObjectVersionId -> ObjectVersionId -> ObjectVersionId
$cmin :: ObjectVersionId -> ObjectVersionId -> ObjectVersionId
max :: ObjectVersionId -> ObjectVersionId -> ObjectVersionId
$cmax :: ObjectVersionId -> ObjectVersionId -> ObjectVersionId
>= :: ObjectVersionId -> ObjectVersionId -> Bool
$c>= :: ObjectVersionId -> ObjectVersionId -> Bool
> :: ObjectVersionId -> ObjectVersionId -> Bool
$c> :: ObjectVersionId -> ObjectVersionId -> Bool
<= :: ObjectVersionId -> ObjectVersionId -> Bool
$c<= :: ObjectVersionId -> ObjectVersionId -> Bool
< :: ObjectVersionId -> ObjectVersionId -> Bool
$c< :: ObjectVersionId -> ObjectVersionId -> Bool
compare :: ObjectVersionId -> ObjectVersionId -> Ordering
$ccompare :: ObjectVersionId -> ObjectVersionId -> Ordering
$cp1Ord :: Eq ObjectVersionId
Ord
, ReadPrec [ObjectVersionId]
ReadPrec ObjectVersionId
Int -> ReadS ObjectVersionId
ReadS [ObjectVersionId]
(Int -> ReadS ObjectVersionId)
-> ReadS [ObjectVersionId]
-> ReadPrec ObjectVersionId
-> ReadPrec [ObjectVersionId]
-> Read ObjectVersionId
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ObjectVersionId]
$creadListPrec :: ReadPrec [ObjectVersionId]
readPrec :: ReadPrec ObjectVersionId
$creadPrec :: ReadPrec ObjectVersionId
readList :: ReadS [ObjectVersionId]
$creadList :: ReadS [ObjectVersionId]
readsPrec :: Int -> ReadS ObjectVersionId
$creadsPrec :: Int -> ReadS ObjectVersionId
Read
, Int -> ObjectVersionId -> ShowS
[ObjectVersionId] -> ShowS
ObjectVersionId -> String
(Int -> ObjectVersionId -> ShowS)
-> (ObjectVersionId -> String)
-> ([ObjectVersionId] -> ShowS)
-> Show ObjectVersionId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ObjectVersionId] -> ShowS
$cshowList :: [ObjectVersionId] -> ShowS
show :: ObjectVersionId -> String
$cshow :: ObjectVersionId -> String
showsPrec :: Int -> ObjectVersionId -> ShowS
$cshowsPrec :: Int -> ObjectVersionId -> ShowS
Show
, (forall x. ObjectVersionId -> Rep ObjectVersionId x)
-> (forall x. Rep ObjectVersionId x -> ObjectVersionId)
-> Generic ObjectVersionId
forall x. Rep ObjectVersionId x -> ObjectVersionId
forall x. ObjectVersionId -> Rep ObjectVersionId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ObjectVersionId x -> ObjectVersionId
$cfrom :: forall x. ObjectVersionId -> Rep ObjectVersionId x
Generic
, String -> ObjectVersionId
(String -> ObjectVersionId) -> IsString ObjectVersionId
forall a. (String -> a) -> IsString a
fromString :: String -> ObjectVersionId
$cfromString :: String -> ObjectVersionId
IsString
, Text -> Either String ObjectVersionId
(Text -> Either String ObjectVersionId) -> FromText ObjectVersionId
forall a. (Text -> Either String a) -> FromText a
fromText :: Text -> Either String ObjectVersionId
$cfromText :: Text -> Either String ObjectVersionId
FromText
, ObjectVersionId -> Text
(ObjectVersionId -> Text) -> ToText ObjectVersionId
forall a. (a -> Text) -> ToText a
toText :: ObjectVersionId -> Text
$ctoText :: ObjectVersionId -> Text
ToText
, ObjectVersionId -> ByteString
(ObjectVersionId -> ByteString) -> ToByteString ObjectVersionId
forall a. (a -> ByteString) -> ToByteString a
toBS :: ObjectVersionId -> ByteString
$ctoBS :: ObjectVersionId -> ByteString
ToByteString
, [Node] -> Either String ObjectVersionId
([Node] -> Either String ObjectVersionId)
-> FromXML ObjectVersionId
forall a. ([Node] -> Either String a) -> FromXML a
parseXML :: [Node] -> Either String ObjectVersionId
$cparseXML :: [Node] -> Either String ObjectVersionId
FromXML
, ObjectVersionId -> XML
(ObjectVersionId -> XML) -> ToXML ObjectVersionId
forall a. (a -> XML) -> ToXML a
toXML :: ObjectVersionId -> XML
$ctoXML :: ObjectVersionId -> XML
ToXML
, ObjectVersionId -> QueryString
(ObjectVersionId -> QueryString) -> ToQuery ObjectVersionId
forall a. (a -> QueryString) -> ToQuery a
toQuery :: ObjectVersionId -> QueryString
$ctoQuery :: ObjectVersionId -> QueryString
ToQuery
, ObjectVersionId -> ByteStringBuilder
(ObjectVersionId -> ByteStringBuilder) -> ToLog ObjectVersionId
forall a. (a -> ByteStringBuilder) -> ToLog a
build :: ObjectVersionId -> ByteStringBuilder
$cbuild :: ObjectVersionId -> ByteStringBuilder
ToLog
)
instance Hashable ObjectVersionId
instance NFData ObjectVersionId
newtype LocationConstraint = LocationConstraint { LocationConstraint -> Region
constraintRegion :: Region }
deriving
( LocationConstraint -> LocationConstraint -> Bool
(LocationConstraint -> LocationConstraint -> Bool)
-> (LocationConstraint -> LocationConstraint -> Bool)
-> Eq LocationConstraint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LocationConstraint -> LocationConstraint -> Bool
$c/= :: LocationConstraint -> LocationConstraint -> Bool
== :: LocationConstraint -> LocationConstraint -> Bool
$c== :: LocationConstraint -> LocationConstraint -> Bool
Eq
, Eq LocationConstraint
Eq LocationConstraint
-> (LocationConstraint -> LocationConstraint -> Ordering)
-> (LocationConstraint -> LocationConstraint -> Bool)
-> (LocationConstraint -> LocationConstraint -> Bool)
-> (LocationConstraint -> LocationConstraint -> Bool)
-> (LocationConstraint -> LocationConstraint -> Bool)
-> (LocationConstraint -> LocationConstraint -> LocationConstraint)
-> (LocationConstraint -> LocationConstraint -> LocationConstraint)
-> Ord LocationConstraint
LocationConstraint -> LocationConstraint -> Bool
LocationConstraint -> LocationConstraint -> Ordering
LocationConstraint -> LocationConstraint -> LocationConstraint
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: LocationConstraint -> LocationConstraint -> LocationConstraint
$cmin :: LocationConstraint -> LocationConstraint -> LocationConstraint
max :: LocationConstraint -> LocationConstraint -> LocationConstraint
$cmax :: LocationConstraint -> LocationConstraint -> LocationConstraint
>= :: LocationConstraint -> LocationConstraint -> Bool
$c>= :: LocationConstraint -> LocationConstraint -> Bool
> :: LocationConstraint -> LocationConstraint -> Bool
$c> :: LocationConstraint -> LocationConstraint -> Bool
<= :: LocationConstraint -> LocationConstraint -> Bool
$c<= :: LocationConstraint -> LocationConstraint -> Bool
< :: LocationConstraint -> LocationConstraint -> Bool
$c< :: LocationConstraint -> LocationConstraint -> Bool
compare :: LocationConstraint -> LocationConstraint -> Ordering
$ccompare :: LocationConstraint -> LocationConstraint -> Ordering
$cp1Ord :: Eq LocationConstraint
Ord
, ReadPrec [LocationConstraint]
ReadPrec LocationConstraint
Int -> ReadS LocationConstraint
ReadS [LocationConstraint]
(Int -> ReadS LocationConstraint)
-> ReadS [LocationConstraint]
-> ReadPrec LocationConstraint
-> ReadPrec [LocationConstraint]
-> Read LocationConstraint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LocationConstraint]
$creadListPrec :: ReadPrec [LocationConstraint]
readPrec :: ReadPrec LocationConstraint
$creadPrec :: ReadPrec LocationConstraint
readList :: ReadS [LocationConstraint]
$creadList :: ReadS [LocationConstraint]
readsPrec :: Int -> ReadS LocationConstraint
$creadsPrec :: Int -> ReadS LocationConstraint
Read
, Int -> LocationConstraint -> ShowS
[LocationConstraint] -> ShowS
LocationConstraint -> String
(Int -> LocationConstraint -> ShowS)
-> (LocationConstraint -> String)
-> ([LocationConstraint] -> ShowS)
-> Show LocationConstraint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LocationConstraint] -> ShowS
$cshowList :: [LocationConstraint] -> ShowS
show :: LocationConstraint -> String
$cshow :: LocationConstraint -> String
showsPrec :: Int -> LocationConstraint -> ShowS
$cshowsPrec :: Int -> LocationConstraint -> ShowS
Show
, (forall x. LocationConstraint -> Rep LocationConstraint x)
-> (forall x. Rep LocationConstraint x -> LocationConstraint)
-> Generic LocationConstraint
forall x. Rep LocationConstraint x -> LocationConstraint
forall x. LocationConstraint -> Rep LocationConstraint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LocationConstraint x -> LocationConstraint
$cfrom :: forall x. LocationConstraint -> Rep LocationConstraint x
Generic
, LocationConstraint -> Text
(LocationConstraint -> Text) -> ToText LocationConstraint
forall a. (a -> Text) -> ToText a
toText :: LocationConstraint -> Text
$ctoText :: LocationConstraint -> Text
ToText
, LocationConstraint -> ByteString
(LocationConstraint -> ByteString)
-> ToByteString LocationConstraint
forall a. (a -> ByteString) -> ToByteString a
toBS :: LocationConstraint -> ByteString
$ctoBS :: LocationConstraint -> ByteString
ToByteString
, LocationConstraint -> ByteStringBuilder
(LocationConstraint -> ByteStringBuilder)
-> ToLog LocationConstraint
forall a. (a -> ByteStringBuilder) -> ToLog a
build :: LocationConstraint -> ByteStringBuilder
$cbuild :: LocationConstraint -> ByteStringBuilder
ToLog
)
_LocationConstraint :: Iso' LocationConstraint Region
_LocationConstraint :: p Region (f Region) -> p LocationConstraint (f LocationConstraint)
_LocationConstraint = (LocationConstraint -> Region)
-> (Region -> LocationConstraint)
-> Iso LocationConstraint LocationConstraint Region Region
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso LocationConstraint -> Region
constraintRegion Region -> LocationConstraint
LocationConstraint
instance Hashable LocationConstraint
instance NFData LocationConstraint
instance FromText LocationConstraint where
fromText :: Text -> Either String LocationConstraint
fromText Text
text =
Region -> LocationConstraint
LocationConstraint (Region -> LocationConstraint)
-> Either String Region -> Either String LocationConstraint
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
case Text -> Text
Text.toLower Text
text of
Text
"" -> Region -> Either String Region
forall (f :: * -> *) a. Applicative f => a -> f a
pure Region
NorthVirginia
Text
"eu" -> Region -> Either String Region
forall (f :: * -> *) a. Applicative f => a -> f a
pure Region
Ireland
Text
other -> Region -> Either String Region
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Region -> Either String Region) -> Region -> Either String Region
forall a b. (a -> b) -> a -> b
$ Text -> Region
Region' Text
other
instance FromXML LocationConstraint where
parseXML :: [Node] -> Either String LocationConstraint
parseXML = \case
[] -> LocationConstraint -> Either String LocationConstraint
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Region -> LocationConstraint
LocationConstraint Region
NorthVirginia)
[Node]
ns -> String -> [Node] -> Either String LocationConstraint
forall a. FromText a => String -> [Node] -> Either String a
parseXMLText String
"LocationConstraint" [Node]
ns
instance ToXML LocationConstraint where
toXML :: LocationConstraint -> XML
toXML = \case
LocationConstraint Region
NorthVirginia -> XML
XNull
LocationConstraint Region
r -> Region -> XML
forall a. ToText a => a -> XML
toXMLText Region
r
newtype ObjectKey = ObjectKey Text
deriving
( ObjectKey -> ObjectKey -> Bool
(ObjectKey -> ObjectKey -> Bool)
-> (ObjectKey -> ObjectKey -> Bool) -> Eq ObjectKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ObjectKey -> ObjectKey -> Bool
$c/= :: ObjectKey -> ObjectKey -> Bool
== :: ObjectKey -> ObjectKey -> Bool
$c== :: ObjectKey -> ObjectKey -> Bool
Eq
, Eq ObjectKey
Eq ObjectKey
-> (ObjectKey -> ObjectKey -> Ordering)
-> (ObjectKey -> ObjectKey -> Bool)
-> (ObjectKey -> ObjectKey -> Bool)
-> (ObjectKey -> ObjectKey -> Bool)
-> (ObjectKey -> ObjectKey -> Bool)
-> (ObjectKey -> ObjectKey -> ObjectKey)
-> (ObjectKey -> ObjectKey -> ObjectKey)
-> Ord ObjectKey
ObjectKey -> ObjectKey -> Bool
ObjectKey -> ObjectKey -> Ordering
ObjectKey -> ObjectKey -> ObjectKey
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ObjectKey -> ObjectKey -> ObjectKey
$cmin :: ObjectKey -> ObjectKey -> ObjectKey
max :: ObjectKey -> ObjectKey -> ObjectKey
$cmax :: ObjectKey -> ObjectKey -> ObjectKey
>= :: ObjectKey -> ObjectKey -> Bool
$c>= :: ObjectKey -> ObjectKey -> Bool
> :: ObjectKey -> ObjectKey -> Bool
$c> :: ObjectKey -> ObjectKey -> Bool
<= :: ObjectKey -> ObjectKey -> Bool
$c<= :: ObjectKey -> ObjectKey -> Bool
< :: ObjectKey -> ObjectKey -> Bool
$c< :: ObjectKey -> ObjectKey -> Bool
compare :: ObjectKey -> ObjectKey -> Ordering
$ccompare :: ObjectKey -> ObjectKey -> Ordering
$cp1Ord :: Eq ObjectKey
Ord
, ReadPrec [ObjectKey]
ReadPrec ObjectKey
Int -> ReadS ObjectKey
ReadS [ObjectKey]
(Int -> ReadS ObjectKey)
-> ReadS [ObjectKey]
-> ReadPrec ObjectKey
-> ReadPrec [ObjectKey]
-> Read ObjectKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ObjectKey]
$creadListPrec :: ReadPrec [ObjectKey]
readPrec :: ReadPrec ObjectKey
$creadPrec :: ReadPrec ObjectKey
readList :: ReadS [ObjectKey]
$creadList :: ReadS [ObjectKey]
readsPrec :: Int -> ReadS ObjectKey
$creadsPrec :: Int -> ReadS ObjectKey
Read
, Int -> ObjectKey -> ShowS
[ObjectKey] -> ShowS
ObjectKey -> String
(Int -> ObjectKey -> ShowS)
-> (ObjectKey -> String)
-> ([ObjectKey] -> ShowS)
-> Show ObjectKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ObjectKey] -> ShowS
$cshowList :: [ObjectKey] -> ShowS
show :: ObjectKey -> String
$cshow :: ObjectKey -> String
showsPrec :: Int -> ObjectKey -> ShowS
$cshowsPrec :: Int -> ObjectKey -> ShowS
Show
, (forall x. ObjectKey -> Rep ObjectKey x)
-> (forall x. Rep ObjectKey x -> ObjectKey) -> Generic ObjectKey
forall x. Rep ObjectKey x -> ObjectKey
forall x. ObjectKey -> Rep ObjectKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ObjectKey x -> ObjectKey
$cfrom :: forall x. ObjectKey -> Rep ObjectKey x
Generic
, String -> ObjectKey
(String -> ObjectKey) -> IsString ObjectKey
forall a. (String -> a) -> IsString a
fromString :: String -> ObjectKey
$cfromString :: String -> ObjectKey
IsString
, Text -> Either String ObjectKey
(Text -> Either String ObjectKey) -> FromText ObjectKey
forall a. (Text -> Either String a) -> FromText a
fromText :: Text -> Either String ObjectKey
$cfromText :: Text -> Either String ObjectKey
FromText
, ObjectKey -> Text
(ObjectKey -> Text) -> ToText ObjectKey
forall a. (a -> Text) -> ToText a
toText :: ObjectKey -> Text
$ctoText :: ObjectKey -> Text
ToText
, ObjectKey -> ByteString
(ObjectKey -> ByteString) -> ToByteString ObjectKey
forall a. (a -> ByteString) -> ToByteString a
toBS :: ObjectKey -> ByteString
$ctoBS :: ObjectKey -> ByteString
ToByteString
, [Node] -> Either String ObjectKey
([Node] -> Either String ObjectKey) -> FromXML ObjectKey
forall a. ([Node] -> Either String a) -> FromXML a
parseXML :: [Node] -> Either String ObjectKey
$cparseXML :: [Node] -> Either String ObjectKey
FromXML
, ObjectKey -> XML
(ObjectKey -> XML) -> ToXML ObjectKey
forall a. (a -> XML) -> ToXML a
toXML :: ObjectKey -> XML
$ctoXML :: ObjectKey -> XML
ToXML
, ObjectKey -> QueryString
(ObjectKey -> QueryString) -> ToQuery ObjectKey
forall a. (a -> QueryString) -> ToQuery a
toQuery :: ObjectKey -> QueryString
$ctoQuery :: ObjectKey -> QueryString
ToQuery
, ObjectKey -> ByteString
(ObjectKey -> ByteString) -> ToPath ObjectKey
forall a. (a -> ByteString) -> ToPath a
toPath :: ObjectKey -> ByteString
$ctoPath :: ObjectKey -> ByteString
ToPath
, ObjectKey -> ByteStringBuilder
(ObjectKey -> ByteStringBuilder) -> ToLog ObjectKey
forall a. (a -> ByteStringBuilder) -> ToLog a
build :: ObjectKey -> ByteStringBuilder
$cbuild :: ObjectKey -> ByteStringBuilder
ToLog
)
instance Hashable ObjectKey
instance NFData ObjectKey
type Delimiter = Char
_ObjectKey :: Iso' ObjectKey Text
_ObjectKey :: p Text (f Text) -> p ObjectKey (f ObjectKey)
_ObjectKey = (ObjectKey -> Text)
-> (Text -> ObjectKey) -> Iso ObjectKey ObjectKey Text Text
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(ObjectKey Text
k) -> Text
k) Text -> ObjectKey
ObjectKey
{-# INLINE _ObjectKey #-}
keyPrefix :: Delimiter -> Traversal' ObjectKey Text
keyPrefix :: Delimiter -> Traversal' ObjectKey Text
keyPrefix Delimiter
c = Bool -> Delimiter -> Prism' ObjectKey (Text, Text)
_ObjectKeySnoc Bool
True Delimiter
c (((Text, Text) -> f (Text, Text)) -> ObjectKey -> f ObjectKey)
-> ((Text -> f Text) -> (Text, Text) -> f (Text, Text))
-> (Text -> f Text)
-> ObjectKey
-> f ObjectKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> f Text) -> (Text, Text) -> f (Text, Text)
forall s t a b. Field1 s t a b => Lens s t a b
_1
{-# INLINE keyPrefix #-}
keyName :: Delimiter -> Traversal' ObjectKey Text
keyName :: Delimiter -> Traversal' ObjectKey Text
keyName Delimiter
c = Bool -> Delimiter -> Prism' ObjectKey (Text, Text)
_ObjectKeySnoc Bool
False Delimiter
c (((Text, Text) -> f (Text, Text)) -> ObjectKey -> f ObjectKey)
-> ((Text -> f Text) -> (Text, Text) -> f (Text, Text))
-> (Text -> f Text)
-> ObjectKey
-> f ObjectKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> f Text) -> (Text, Text) -> f (Text, Text)
forall s t a b. Field2 s t a b => Lens s t a b
_2
{-# INLINE keyName #-}
keyComponents :: Delimiter -> IndexedTraversal' Int ObjectKey Text
keyComponents :: Delimiter -> IndexedTraversal' Int ObjectKey Text
keyComponents !Delimiter
c p Text (f Text)
f (ObjectKey Text
k) = [Text] -> ObjectKey
cat ([Text] -> ObjectKey) -> f [Text] -> f ObjectKey
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> p Text (f Text) -> [Text] -> f [Text]
forall (f :: * -> *) a b.
Traversable f =>
IndexedTraversal Int (f a) (f b) a b
traversed p Text (f Text)
f [Text]
split
where
split :: [Text]
split = (Delimiter -> Bool) -> Text -> [Text]
Text.split (Delimiter -> Delimiter -> Bool
forall a. Eq a => a -> a -> Bool
== Delimiter
c) Text
k
cat :: [Text] -> ObjectKey
cat = Text -> ObjectKey
ObjectKey (Text -> ObjectKey) -> ([Text] -> Text) -> [Text] -> ObjectKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text] -> Text
Text.intercalate (Delimiter -> Text
Text.singleton Delimiter
c)
{-# INLINE keyComponents #-}
_ObjectKeySnoc :: Bool -> Delimiter -> Prism' ObjectKey (Text, Text)
_ObjectKeySnoc :: Bool -> Delimiter -> Prism' ObjectKey (Text, Text)
_ObjectKeySnoc Bool
dir !Delimiter
c = ((Text, Text) -> ObjectKey)
-> (ObjectKey -> Either ObjectKey (Text, Text))
-> Prism' ObjectKey (Text, Text)
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism (Text -> ObjectKey
ObjectKey (Text -> ObjectKey)
-> ((Text, Text) -> Text) -> (Text, Text) -> ObjectKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> Text -> Text) -> (Text, Text) -> Text
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Text -> Text -> Text
cat) ObjectKey -> Either ObjectKey (Text, Text)
split
where
split :: ObjectKey -> Either ObjectKey (Text, Text)
split x :: ObjectKey
x@(ObjectKey Text
k) =
let (Text
h, Text
t) = Text -> Text -> (Text, Text)
Text.breakOnEnd Text
suf Text
k
in if | Text -> Int
Text.length Text
h Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
1, Bool
dir -> ObjectKey -> Either ObjectKey (Text, Text)
forall a b. a -> Either a b
Left ObjectKey
x
| Bool
otherwise -> (Text, Text) -> Either ObjectKey (Text, Text)
forall a b. b -> Either a b
Right (Int -> Text -> Text
Text.dropEnd Int
1 Text
h, Text
t)
cat :: Text -> Text -> Text
cat Text
h Text
t
| Text -> Bool
Text.null Text
h = Text
t
| Text -> Bool
Text.null Text
t = Text
h
| Text
suf Text -> Text -> Bool
`Text.isSuffixOf` Text
h = Text
h Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t
| Text
suf Text -> Text -> Bool
`Text.isPrefixOf` Text
t = Text
h Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t
| Bool
otherwise = Text
h Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
suf Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t
suf :: Text
suf = Delimiter -> Text
Text.singleton Delimiter
c
getWebsiteEndpoint :: Region -> Text
getWebsiteEndpoint :: Region -> Text
getWebsiteEndpoint Region
reg = Text
"s3-website-" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Region -> Text
forall a. ToText a => a -> Text
toText Region
reg Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".amazonaws.com"