{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.StorageGateway.CreateTapePool
(
CreateTapePool (..),
newCreateTapePool,
createTapePool_retentionLockType,
createTapePool_retentionLockTimeInDays,
createTapePool_tags,
createTapePool_poolName,
createTapePool_storageClass,
CreateTapePoolResponse (..),
newCreateTapePoolResponse,
createTapePoolResponse_poolARN,
createTapePoolResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.StorageGateway.Types
data CreateTapePool = CreateTapePool'
{
CreateTapePool -> Maybe RetentionLockType
retentionLockType :: Prelude.Maybe RetentionLockType,
CreateTapePool -> Maybe Natural
retentionLockTimeInDays :: Prelude.Maybe Prelude.Natural,
CreateTapePool -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateTapePool -> Text
poolName :: Prelude.Text,
CreateTapePool -> TapeStorageClass
storageClass :: TapeStorageClass
}
deriving (CreateTapePool -> CreateTapePool -> Bool
(CreateTapePool -> CreateTapePool -> Bool)
-> (CreateTapePool -> CreateTapePool -> Bool) -> Eq CreateTapePool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTapePool -> CreateTapePool -> Bool
$c/= :: CreateTapePool -> CreateTapePool -> Bool
== :: CreateTapePool -> CreateTapePool -> Bool
$c== :: CreateTapePool -> CreateTapePool -> Bool
Prelude.Eq, ReadPrec [CreateTapePool]
ReadPrec CreateTapePool
Int -> ReadS CreateTapePool
ReadS [CreateTapePool]
(Int -> ReadS CreateTapePool)
-> ReadS [CreateTapePool]
-> ReadPrec CreateTapePool
-> ReadPrec [CreateTapePool]
-> Read CreateTapePool
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTapePool]
$creadListPrec :: ReadPrec [CreateTapePool]
readPrec :: ReadPrec CreateTapePool
$creadPrec :: ReadPrec CreateTapePool
readList :: ReadS [CreateTapePool]
$creadList :: ReadS [CreateTapePool]
readsPrec :: Int -> ReadS CreateTapePool
$creadsPrec :: Int -> ReadS CreateTapePool
Prelude.Read, Int -> CreateTapePool -> ShowS
[CreateTapePool] -> ShowS
CreateTapePool -> String
(Int -> CreateTapePool -> ShowS)
-> (CreateTapePool -> String)
-> ([CreateTapePool] -> ShowS)
-> Show CreateTapePool
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTapePool] -> ShowS
$cshowList :: [CreateTapePool] -> ShowS
show :: CreateTapePool -> String
$cshow :: CreateTapePool -> String
showsPrec :: Int -> CreateTapePool -> ShowS
$cshowsPrec :: Int -> CreateTapePool -> ShowS
Prelude.Show, (forall x. CreateTapePool -> Rep CreateTapePool x)
-> (forall x. Rep CreateTapePool x -> CreateTapePool)
-> Generic CreateTapePool
forall x. Rep CreateTapePool x -> CreateTapePool
forall x. CreateTapePool -> Rep CreateTapePool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTapePool x -> CreateTapePool
$cfrom :: forall x. CreateTapePool -> Rep CreateTapePool x
Prelude.Generic)
newCreateTapePool ::
Prelude.Text ->
TapeStorageClass ->
CreateTapePool
newCreateTapePool :: Text -> TapeStorageClass -> CreateTapePool
newCreateTapePool Text
pPoolName_ TapeStorageClass
pStorageClass_ =
CreateTapePool' :: Maybe RetentionLockType
-> Maybe Natural
-> Maybe [Tag]
-> Text
-> TapeStorageClass
-> CreateTapePool
CreateTapePool'
{ $sel:retentionLockType:CreateTapePool' :: Maybe RetentionLockType
retentionLockType =
Maybe RetentionLockType
forall a. Maybe a
Prelude.Nothing,
$sel:retentionLockTimeInDays:CreateTapePool' :: Maybe Natural
retentionLockTimeInDays = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateTapePool' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:poolName:CreateTapePool' :: Text
poolName = Text
pPoolName_,
$sel:storageClass:CreateTapePool' :: TapeStorageClass
storageClass = TapeStorageClass
pStorageClass_
}
createTapePool_retentionLockType :: Lens.Lens' CreateTapePool (Prelude.Maybe RetentionLockType)
createTapePool_retentionLockType :: (Maybe RetentionLockType -> f (Maybe RetentionLockType))
-> CreateTapePool -> f CreateTapePool
createTapePool_retentionLockType = (CreateTapePool -> Maybe RetentionLockType)
-> (CreateTapePool -> Maybe RetentionLockType -> CreateTapePool)
-> Lens
CreateTapePool
CreateTapePool
(Maybe RetentionLockType)
(Maybe RetentionLockType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapePool' {Maybe RetentionLockType
retentionLockType :: Maybe RetentionLockType
$sel:retentionLockType:CreateTapePool' :: CreateTapePool -> Maybe RetentionLockType
retentionLockType} -> Maybe RetentionLockType
retentionLockType) (\s :: CreateTapePool
s@CreateTapePool' {} Maybe RetentionLockType
a -> CreateTapePool
s {$sel:retentionLockType:CreateTapePool' :: Maybe RetentionLockType
retentionLockType = Maybe RetentionLockType
a} :: CreateTapePool)
createTapePool_retentionLockTimeInDays :: Lens.Lens' CreateTapePool (Prelude.Maybe Prelude.Natural)
createTapePool_retentionLockTimeInDays :: (Maybe Natural -> f (Maybe Natural))
-> CreateTapePool -> f CreateTapePool
createTapePool_retentionLockTimeInDays = (CreateTapePool -> Maybe Natural)
-> (CreateTapePool -> Maybe Natural -> CreateTapePool)
-> Lens
CreateTapePool CreateTapePool (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapePool' {Maybe Natural
retentionLockTimeInDays :: Maybe Natural
$sel:retentionLockTimeInDays:CreateTapePool' :: CreateTapePool -> Maybe Natural
retentionLockTimeInDays} -> Maybe Natural
retentionLockTimeInDays) (\s :: CreateTapePool
s@CreateTapePool' {} Maybe Natural
a -> CreateTapePool
s {$sel:retentionLockTimeInDays:CreateTapePool' :: Maybe Natural
retentionLockTimeInDays = Maybe Natural
a} :: CreateTapePool)
createTapePool_tags :: Lens.Lens' CreateTapePool (Prelude.Maybe [Tag])
createTapePool_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateTapePool -> f CreateTapePool
createTapePool_tags = (CreateTapePool -> Maybe [Tag])
-> (CreateTapePool -> Maybe [Tag] -> CreateTapePool)
-> Lens CreateTapePool CreateTapePool (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapePool' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateTapePool' :: CreateTapePool -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateTapePool
s@CreateTapePool' {} Maybe [Tag]
a -> CreateTapePool
s {$sel:tags:CreateTapePool' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateTapePool) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateTapePool -> f CreateTapePool)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateTapePool
-> f CreateTapePool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createTapePool_poolName :: Lens.Lens' CreateTapePool Prelude.Text
createTapePool_poolName :: (Text -> f Text) -> CreateTapePool -> f CreateTapePool
createTapePool_poolName = (CreateTapePool -> Text)
-> (CreateTapePool -> Text -> CreateTapePool)
-> Lens CreateTapePool CreateTapePool Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapePool' {Text
poolName :: Text
$sel:poolName:CreateTapePool' :: CreateTapePool -> Text
poolName} -> Text
poolName) (\s :: CreateTapePool
s@CreateTapePool' {} Text
a -> CreateTapePool
s {$sel:poolName:CreateTapePool' :: Text
poolName = Text
a} :: CreateTapePool)
createTapePool_storageClass :: Lens.Lens' CreateTapePool TapeStorageClass
createTapePool_storageClass :: (TapeStorageClass -> f TapeStorageClass)
-> CreateTapePool -> f CreateTapePool
createTapePool_storageClass = (CreateTapePool -> TapeStorageClass)
-> (CreateTapePool -> TapeStorageClass -> CreateTapePool)
-> Lens
CreateTapePool CreateTapePool TapeStorageClass TapeStorageClass
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapePool' {TapeStorageClass
storageClass :: TapeStorageClass
$sel:storageClass:CreateTapePool' :: CreateTapePool -> TapeStorageClass
storageClass} -> TapeStorageClass
storageClass) (\s :: CreateTapePool
s@CreateTapePool' {} TapeStorageClass
a -> CreateTapePool
s {$sel:storageClass:CreateTapePool' :: TapeStorageClass
storageClass = TapeStorageClass
a} :: CreateTapePool)
instance Core.AWSRequest CreateTapePool where
type
AWSResponse CreateTapePool =
CreateTapePoolResponse
request :: CreateTapePool -> Request CreateTapePool
request = Service -> CreateTapePool -> Request CreateTapePool
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateTapePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTapePool)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateTapePool))
-> Logger
-> Service
-> Proxy CreateTapePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTapePool)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CreateTapePoolResponse
CreateTapePoolResponse'
(Maybe Text -> Int -> CreateTapePoolResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateTapePoolResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PoolARN")
Either String (Int -> CreateTapePoolResponse)
-> Either String Int -> Either String CreateTapePoolResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateTapePool
instance Prelude.NFData CreateTapePool
instance Core.ToHeaders CreateTapePool where
toHeaders :: CreateTapePool -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateTapePool -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"StorageGateway_20130630.CreateTapePool" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateTapePool where
toJSON :: CreateTapePool -> Value
toJSON CreateTapePool' {Maybe Natural
Maybe [Tag]
Maybe RetentionLockType
Text
TapeStorageClass
storageClass :: TapeStorageClass
poolName :: Text
tags :: Maybe [Tag]
retentionLockTimeInDays :: Maybe Natural
retentionLockType :: Maybe RetentionLockType
$sel:storageClass:CreateTapePool' :: CreateTapePool -> TapeStorageClass
$sel:poolName:CreateTapePool' :: CreateTapePool -> Text
$sel:tags:CreateTapePool' :: CreateTapePool -> Maybe [Tag]
$sel:retentionLockTimeInDays:CreateTapePool' :: CreateTapePool -> Maybe Natural
$sel:retentionLockType:CreateTapePool' :: CreateTapePool -> Maybe RetentionLockType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RetentionLockType" Text -> RetentionLockType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(RetentionLockType -> Pair)
-> Maybe RetentionLockType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RetentionLockType
retentionLockType,
(Text
"RetentionLockTimeInDays" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
retentionLockTimeInDays,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PoolName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
poolName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StorageClass" Text -> TapeStorageClass -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TapeStorageClass
storageClass)
]
)
instance Core.ToPath CreateTapePool where
toPath :: CreateTapePool -> ByteString
toPath = ByteString -> CreateTapePool -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateTapePool where
toQuery :: CreateTapePool -> QueryString
toQuery = QueryString -> CreateTapePool -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateTapePoolResponse = CreateTapePoolResponse'
{
CreateTapePoolResponse -> Maybe Text
poolARN :: Prelude.Maybe Prelude.Text,
CreateTapePoolResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateTapePoolResponse -> CreateTapePoolResponse -> Bool
(CreateTapePoolResponse -> CreateTapePoolResponse -> Bool)
-> (CreateTapePoolResponse -> CreateTapePoolResponse -> Bool)
-> Eq CreateTapePoolResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTapePoolResponse -> CreateTapePoolResponse -> Bool
$c/= :: CreateTapePoolResponse -> CreateTapePoolResponse -> Bool
== :: CreateTapePoolResponse -> CreateTapePoolResponse -> Bool
$c== :: CreateTapePoolResponse -> CreateTapePoolResponse -> Bool
Prelude.Eq, ReadPrec [CreateTapePoolResponse]
ReadPrec CreateTapePoolResponse
Int -> ReadS CreateTapePoolResponse
ReadS [CreateTapePoolResponse]
(Int -> ReadS CreateTapePoolResponse)
-> ReadS [CreateTapePoolResponse]
-> ReadPrec CreateTapePoolResponse
-> ReadPrec [CreateTapePoolResponse]
-> Read CreateTapePoolResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTapePoolResponse]
$creadListPrec :: ReadPrec [CreateTapePoolResponse]
readPrec :: ReadPrec CreateTapePoolResponse
$creadPrec :: ReadPrec CreateTapePoolResponse
readList :: ReadS [CreateTapePoolResponse]
$creadList :: ReadS [CreateTapePoolResponse]
readsPrec :: Int -> ReadS CreateTapePoolResponse
$creadsPrec :: Int -> ReadS CreateTapePoolResponse
Prelude.Read, Int -> CreateTapePoolResponse -> ShowS
[CreateTapePoolResponse] -> ShowS
CreateTapePoolResponse -> String
(Int -> CreateTapePoolResponse -> ShowS)
-> (CreateTapePoolResponse -> String)
-> ([CreateTapePoolResponse] -> ShowS)
-> Show CreateTapePoolResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTapePoolResponse] -> ShowS
$cshowList :: [CreateTapePoolResponse] -> ShowS
show :: CreateTapePoolResponse -> String
$cshow :: CreateTapePoolResponse -> String
showsPrec :: Int -> CreateTapePoolResponse -> ShowS
$cshowsPrec :: Int -> CreateTapePoolResponse -> ShowS
Prelude.Show, (forall x. CreateTapePoolResponse -> Rep CreateTapePoolResponse x)
-> (forall x.
Rep CreateTapePoolResponse x -> CreateTapePoolResponse)
-> Generic CreateTapePoolResponse
forall x. Rep CreateTapePoolResponse x -> CreateTapePoolResponse
forall x. CreateTapePoolResponse -> Rep CreateTapePoolResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTapePoolResponse x -> CreateTapePoolResponse
$cfrom :: forall x. CreateTapePoolResponse -> Rep CreateTapePoolResponse x
Prelude.Generic)
newCreateTapePoolResponse ::
Prelude.Int ->
CreateTapePoolResponse
newCreateTapePoolResponse :: Int -> CreateTapePoolResponse
newCreateTapePoolResponse Int
pHttpStatus_ =
CreateTapePoolResponse' :: Maybe Text -> Int -> CreateTapePoolResponse
CreateTapePoolResponse'
{ $sel:poolARN:CreateTapePoolResponse' :: Maybe Text
poolARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateTapePoolResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createTapePoolResponse_poolARN :: Lens.Lens' CreateTapePoolResponse (Prelude.Maybe Prelude.Text)
createTapePoolResponse_poolARN :: (Maybe Text -> f (Maybe Text))
-> CreateTapePoolResponse -> f CreateTapePoolResponse
createTapePoolResponse_poolARN = (CreateTapePoolResponse -> Maybe Text)
-> (CreateTapePoolResponse -> Maybe Text -> CreateTapePoolResponse)
-> Lens
CreateTapePoolResponse
CreateTapePoolResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapePoolResponse' {Maybe Text
poolARN :: Maybe Text
$sel:poolARN:CreateTapePoolResponse' :: CreateTapePoolResponse -> Maybe Text
poolARN} -> Maybe Text
poolARN) (\s :: CreateTapePoolResponse
s@CreateTapePoolResponse' {} Maybe Text
a -> CreateTapePoolResponse
s {$sel:poolARN:CreateTapePoolResponse' :: Maybe Text
poolARN = Maybe Text
a} :: CreateTapePoolResponse)
createTapePoolResponse_httpStatus :: Lens.Lens' CreateTapePoolResponse Prelude.Int
createTapePoolResponse_httpStatus :: (Int -> f Int)
-> CreateTapePoolResponse -> f CreateTapePoolResponse
createTapePoolResponse_httpStatus = (CreateTapePoolResponse -> Int)
-> (CreateTapePoolResponse -> Int -> CreateTapePoolResponse)
-> Lens CreateTapePoolResponse CreateTapePoolResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapePoolResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTapePoolResponse' :: CreateTapePoolResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTapePoolResponse
s@CreateTapePoolResponse' {} Int
a -> CreateTapePoolResponse
s {$sel:httpStatus:CreateTapePoolResponse' :: Int
httpStatus = Int
a} :: CreateTapePoolResponse)
instance Prelude.NFData CreateTapePoolResponse