{-# 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_retentionLockTimeInDays,
createTapePool_retentionLockType,
createTapePool_tags,
createTapePool_poolName,
createTapePool_storageClass,
CreateTapePoolResponse (..),
newCreateTapePoolResponse,
createTapePoolResponse_poolARN,
createTapePoolResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 Natural
retentionLockTimeInDays :: Prelude.Maybe Prelude.Natural,
CreateTapePool -> Maybe RetentionLockType
retentionLockType :: Prelude.Maybe RetentionLockType,
CreateTapePool -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateTapePool -> Text
poolName :: Prelude.Text,
CreateTapePool -> TapeStorageClass
storageClass :: TapeStorageClass
}
deriving (CreateTapePool -> CreateTapePool -> Bool
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]
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
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. 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'
{ $sel:retentionLockTimeInDays:CreateTapePool' :: Maybe Natural
retentionLockTimeInDays =
forall a. Maybe a
Prelude.Nothing,
$sel:retentionLockType:CreateTapePool' :: Maybe RetentionLockType
retentionLockType = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateTapePool' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:poolName:CreateTapePool' :: Text
poolName = Text
pPoolName_,
$sel:storageClass:CreateTapePool' :: TapeStorageClass
storageClass = TapeStorageClass
pStorageClass_
}
createTapePool_retentionLockTimeInDays :: Lens.Lens' CreateTapePool (Prelude.Maybe Prelude.Natural)
createTapePool_retentionLockTimeInDays :: Lens' CreateTapePool (Maybe Natural)
createTapePool_retentionLockTimeInDays = 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_retentionLockType :: Lens.Lens' CreateTapePool (Prelude.Maybe RetentionLockType)
createTapePool_retentionLockType :: Lens' CreateTapePool (Maybe RetentionLockType)
createTapePool_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_tags :: Lens.Lens' CreateTapePool (Prelude.Maybe [Tag])
createTapePool_tags :: Lens' CreateTapePool (Maybe [Tag])
createTapePool_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' CreateTapePool Text
createTapePool_poolName = 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 :: Lens' CreateTapePool TapeStorageClass
createTapePool_storageClass = 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 :: (Service -> Service) -> CreateTapePool -> Request CreateTapePool
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateTapePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTapePool)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CreateTapePoolResponse
CreateTapePoolResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PoolARN")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateTapePool where
hashWithSalt :: Int -> CreateTapePool -> Int
hashWithSalt Int
_salt CreateTapePool' {Maybe Natural
Maybe [Tag]
Maybe RetentionLockType
Text
TapeStorageClass
storageClass :: TapeStorageClass
poolName :: Text
tags :: Maybe [Tag]
retentionLockType :: Maybe RetentionLockType
retentionLockTimeInDays :: Maybe Natural
$sel:storageClass:CreateTapePool' :: CreateTapePool -> TapeStorageClass
$sel:poolName:CreateTapePool' :: CreateTapePool -> Text
$sel:tags:CreateTapePool' :: CreateTapePool -> Maybe [Tag]
$sel:retentionLockType:CreateTapePool' :: CreateTapePool -> Maybe RetentionLockType
$sel:retentionLockTimeInDays:CreateTapePool' :: CreateTapePool -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
retentionLockTimeInDays
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RetentionLockType
retentionLockType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
poolName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TapeStorageClass
storageClass
instance Prelude.NFData CreateTapePool where
rnf :: CreateTapePool -> ()
rnf CreateTapePool' {Maybe Natural
Maybe [Tag]
Maybe RetentionLockType
Text
TapeStorageClass
storageClass :: TapeStorageClass
poolName :: Text
tags :: Maybe [Tag]
retentionLockType :: Maybe RetentionLockType
retentionLockTimeInDays :: Maybe Natural
$sel:storageClass:CreateTapePool' :: CreateTapePool -> TapeStorageClass
$sel:poolName:CreateTapePool' :: CreateTapePool -> Text
$sel:tags:CreateTapePool' :: CreateTapePool -> Maybe [Tag]
$sel:retentionLockType:CreateTapePool' :: CreateTapePool -> Maybe RetentionLockType
$sel:retentionLockTimeInDays:CreateTapePool' :: CreateTapePool -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
retentionLockTimeInDays
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RetentionLockType
retentionLockType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
poolName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TapeStorageClass
storageClass
instance Data.ToHeaders CreateTapePool where
toHeaders :: CreateTapePool -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"StorageGateway_20130630.CreateTapePool" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateTapePool where
toJSON :: CreateTapePool -> Value
toJSON CreateTapePool' {Maybe Natural
Maybe [Tag]
Maybe RetentionLockType
Text
TapeStorageClass
storageClass :: TapeStorageClass
poolName :: Text
tags :: Maybe [Tag]
retentionLockType :: Maybe RetentionLockType
retentionLockTimeInDays :: Maybe Natural
$sel:storageClass:CreateTapePool' :: CreateTapePool -> TapeStorageClass
$sel:poolName:CreateTapePool' :: CreateTapePool -> Text
$sel:tags:CreateTapePool' :: CreateTapePool -> Maybe [Tag]
$sel:retentionLockType:CreateTapePool' :: CreateTapePool -> Maybe RetentionLockType
$sel:retentionLockTimeInDays:CreateTapePool' :: CreateTapePool -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"RetentionLockTimeInDays" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
retentionLockTimeInDays,
(Key
"RetentionLockType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RetentionLockType
retentionLockType,
(Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"PoolName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
poolName),
forall a. a -> Maybe a
Prelude.Just (Key
"StorageClass" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TapeStorageClass
storageClass)
]
)
instance Data.ToPath CreateTapePool where
toPath :: CreateTapePool -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateTapePool where
toQuery :: CreateTapePool -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:poolARN:CreateTapePoolResponse' :: Maybe Text
poolARN = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateTapePoolResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createTapePoolResponse_poolARN :: Lens.Lens' CreateTapePoolResponse (Prelude.Maybe Prelude.Text)
createTapePoolResponse_poolARN :: Lens' CreateTapePoolResponse (Maybe Text)
createTapePoolResponse_poolARN = 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 :: Lens' CreateTapePoolResponse Int
createTapePoolResponse_httpStatus = 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 where
rnf :: CreateTapePoolResponse -> ()
rnf CreateTapePoolResponse' {Int
Maybe Text
httpStatus :: Int
poolARN :: Maybe Text
$sel:httpStatus:CreateTapePoolResponse' :: CreateTapePoolResponse -> Int
$sel:poolARN:CreateTapePoolResponse' :: CreateTapePoolResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
poolARN
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus