{-# 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.Config.PutRetentionConfiguration
(
PutRetentionConfiguration (..),
newPutRetentionConfiguration,
putRetentionConfiguration_retentionPeriodInDays,
PutRetentionConfigurationResponse (..),
newPutRetentionConfigurationResponse,
putRetentionConfigurationResponse_retentionConfiguration,
putRetentionConfigurationResponse_httpStatus,
)
where
import Amazonka.Config.Types
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
data PutRetentionConfiguration = PutRetentionConfiguration'
{
PutRetentionConfiguration -> Natural
retentionPeriodInDays :: Prelude.Natural
}
deriving (PutRetentionConfiguration -> PutRetentionConfiguration -> Bool
(PutRetentionConfiguration -> PutRetentionConfiguration -> Bool)
-> (PutRetentionConfiguration -> PutRetentionConfiguration -> Bool)
-> Eq PutRetentionConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRetentionConfiguration -> PutRetentionConfiguration -> Bool
$c/= :: PutRetentionConfiguration -> PutRetentionConfiguration -> Bool
== :: PutRetentionConfiguration -> PutRetentionConfiguration -> Bool
$c== :: PutRetentionConfiguration -> PutRetentionConfiguration -> Bool
Prelude.Eq, ReadPrec [PutRetentionConfiguration]
ReadPrec PutRetentionConfiguration
Int -> ReadS PutRetentionConfiguration
ReadS [PutRetentionConfiguration]
(Int -> ReadS PutRetentionConfiguration)
-> ReadS [PutRetentionConfiguration]
-> ReadPrec PutRetentionConfiguration
-> ReadPrec [PutRetentionConfiguration]
-> Read PutRetentionConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRetentionConfiguration]
$creadListPrec :: ReadPrec [PutRetentionConfiguration]
readPrec :: ReadPrec PutRetentionConfiguration
$creadPrec :: ReadPrec PutRetentionConfiguration
readList :: ReadS [PutRetentionConfiguration]
$creadList :: ReadS [PutRetentionConfiguration]
readsPrec :: Int -> ReadS PutRetentionConfiguration
$creadsPrec :: Int -> ReadS PutRetentionConfiguration
Prelude.Read, Int -> PutRetentionConfiguration -> ShowS
[PutRetentionConfiguration] -> ShowS
PutRetentionConfiguration -> String
(Int -> PutRetentionConfiguration -> ShowS)
-> (PutRetentionConfiguration -> String)
-> ([PutRetentionConfiguration] -> ShowS)
-> Show PutRetentionConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRetentionConfiguration] -> ShowS
$cshowList :: [PutRetentionConfiguration] -> ShowS
show :: PutRetentionConfiguration -> String
$cshow :: PutRetentionConfiguration -> String
showsPrec :: Int -> PutRetentionConfiguration -> ShowS
$cshowsPrec :: Int -> PutRetentionConfiguration -> ShowS
Prelude.Show, (forall x.
PutRetentionConfiguration -> Rep PutRetentionConfiguration x)
-> (forall x.
Rep PutRetentionConfiguration x -> PutRetentionConfiguration)
-> Generic PutRetentionConfiguration
forall x.
Rep PutRetentionConfiguration x -> PutRetentionConfiguration
forall x.
PutRetentionConfiguration -> Rep PutRetentionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutRetentionConfiguration x -> PutRetentionConfiguration
$cfrom :: forall x.
PutRetentionConfiguration -> Rep PutRetentionConfiguration x
Prelude.Generic)
newPutRetentionConfiguration ::
Prelude.Natural ->
PutRetentionConfiguration
newPutRetentionConfiguration :: Natural -> PutRetentionConfiguration
newPutRetentionConfiguration Natural
pRetentionPeriodInDays_ =
PutRetentionConfiguration' :: Natural -> PutRetentionConfiguration
PutRetentionConfiguration'
{ $sel:retentionPeriodInDays:PutRetentionConfiguration' :: Natural
retentionPeriodInDays =
Natural
pRetentionPeriodInDays_
}
putRetentionConfiguration_retentionPeriodInDays :: Lens.Lens' PutRetentionConfiguration Prelude.Natural
putRetentionConfiguration_retentionPeriodInDays :: (Natural -> f Natural)
-> PutRetentionConfiguration -> f PutRetentionConfiguration
putRetentionConfiguration_retentionPeriodInDays = (PutRetentionConfiguration -> Natural)
-> (PutRetentionConfiguration
-> Natural -> PutRetentionConfiguration)
-> Lens
PutRetentionConfiguration PutRetentionConfiguration Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRetentionConfiguration' {Natural
retentionPeriodInDays :: Natural
$sel:retentionPeriodInDays:PutRetentionConfiguration' :: PutRetentionConfiguration -> Natural
retentionPeriodInDays} -> Natural
retentionPeriodInDays) (\s :: PutRetentionConfiguration
s@PutRetentionConfiguration' {} Natural
a -> PutRetentionConfiguration
s {$sel:retentionPeriodInDays:PutRetentionConfiguration' :: Natural
retentionPeriodInDays = Natural
a} :: PutRetentionConfiguration)
instance Core.AWSRequest PutRetentionConfiguration where
type
AWSResponse PutRetentionConfiguration =
PutRetentionConfigurationResponse
request :: PutRetentionConfiguration -> Request PutRetentionConfiguration
request = Service
-> PutRetentionConfiguration -> Request PutRetentionConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutRetentionConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutRetentionConfiguration)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutRetentionConfiguration))
-> Logger
-> Service
-> Proxy PutRetentionConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutRetentionConfiguration)))
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 RetentionConfiguration
-> Int -> PutRetentionConfigurationResponse
PutRetentionConfigurationResponse'
(Maybe RetentionConfiguration
-> Int -> PutRetentionConfigurationResponse)
-> Either String (Maybe RetentionConfiguration)
-> Either String (Int -> PutRetentionConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe RetentionConfiguration)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"RetentionConfiguration")
Either String (Int -> PutRetentionConfigurationResponse)
-> Either String Int
-> Either String PutRetentionConfigurationResponse
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 PutRetentionConfiguration
instance Prelude.NFData PutRetentionConfiguration
instance Core.ToHeaders PutRetentionConfiguration where
toHeaders :: PutRetentionConfiguration -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutRetentionConfiguration -> 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
"StarlingDoveService.PutRetentionConfiguration" ::
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 PutRetentionConfiguration where
toJSON :: PutRetentionConfiguration -> Value
toJSON PutRetentionConfiguration' {Natural
retentionPeriodInDays :: Natural
$sel:retentionPeriodInDays:PutRetentionConfiguration' :: PutRetentionConfiguration -> Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Key
"RetentionPeriodInDays"
Key -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= Natural
retentionPeriodInDays
)
]
)
instance Core.ToPath PutRetentionConfiguration where
toPath :: PutRetentionConfiguration -> ByteString
toPath = ByteString -> PutRetentionConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutRetentionConfiguration where
toQuery :: PutRetentionConfiguration -> QueryString
toQuery = QueryString -> PutRetentionConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutRetentionConfigurationResponse = PutRetentionConfigurationResponse'
{
PutRetentionConfigurationResponse -> Maybe RetentionConfiguration
retentionConfiguration :: Prelude.Maybe RetentionConfiguration,
PutRetentionConfigurationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutRetentionConfigurationResponse
-> PutRetentionConfigurationResponse -> Bool
(PutRetentionConfigurationResponse
-> PutRetentionConfigurationResponse -> Bool)
-> (PutRetentionConfigurationResponse
-> PutRetentionConfigurationResponse -> Bool)
-> Eq PutRetentionConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRetentionConfigurationResponse
-> PutRetentionConfigurationResponse -> Bool
$c/= :: PutRetentionConfigurationResponse
-> PutRetentionConfigurationResponse -> Bool
== :: PutRetentionConfigurationResponse
-> PutRetentionConfigurationResponse -> Bool
$c== :: PutRetentionConfigurationResponse
-> PutRetentionConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [PutRetentionConfigurationResponse]
ReadPrec PutRetentionConfigurationResponse
Int -> ReadS PutRetentionConfigurationResponse
ReadS [PutRetentionConfigurationResponse]
(Int -> ReadS PutRetentionConfigurationResponse)
-> ReadS [PutRetentionConfigurationResponse]
-> ReadPrec PutRetentionConfigurationResponse
-> ReadPrec [PutRetentionConfigurationResponse]
-> Read PutRetentionConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRetentionConfigurationResponse]
$creadListPrec :: ReadPrec [PutRetentionConfigurationResponse]
readPrec :: ReadPrec PutRetentionConfigurationResponse
$creadPrec :: ReadPrec PutRetentionConfigurationResponse
readList :: ReadS [PutRetentionConfigurationResponse]
$creadList :: ReadS [PutRetentionConfigurationResponse]
readsPrec :: Int -> ReadS PutRetentionConfigurationResponse
$creadsPrec :: Int -> ReadS PutRetentionConfigurationResponse
Prelude.Read, Int -> PutRetentionConfigurationResponse -> ShowS
[PutRetentionConfigurationResponse] -> ShowS
PutRetentionConfigurationResponse -> String
(Int -> PutRetentionConfigurationResponse -> ShowS)
-> (PutRetentionConfigurationResponse -> String)
-> ([PutRetentionConfigurationResponse] -> ShowS)
-> Show PutRetentionConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRetentionConfigurationResponse] -> ShowS
$cshowList :: [PutRetentionConfigurationResponse] -> ShowS
show :: PutRetentionConfigurationResponse -> String
$cshow :: PutRetentionConfigurationResponse -> String
showsPrec :: Int -> PutRetentionConfigurationResponse -> ShowS
$cshowsPrec :: Int -> PutRetentionConfigurationResponse -> ShowS
Prelude.Show, (forall x.
PutRetentionConfigurationResponse
-> Rep PutRetentionConfigurationResponse x)
-> (forall x.
Rep PutRetentionConfigurationResponse x
-> PutRetentionConfigurationResponse)
-> Generic PutRetentionConfigurationResponse
forall x.
Rep PutRetentionConfigurationResponse x
-> PutRetentionConfigurationResponse
forall x.
PutRetentionConfigurationResponse
-> Rep PutRetentionConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutRetentionConfigurationResponse x
-> PutRetentionConfigurationResponse
$cfrom :: forall x.
PutRetentionConfigurationResponse
-> Rep PutRetentionConfigurationResponse x
Prelude.Generic)
newPutRetentionConfigurationResponse ::
Prelude.Int ->
PutRetentionConfigurationResponse
newPutRetentionConfigurationResponse :: Int -> PutRetentionConfigurationResponse
newPutRetentionConfigurationResponse Int
pHttpStatus_ =
PutRetentionConfigurationResponse' :: Maybe RetentionConfiguration
-> Int -> PutRetentionConfigurationResponse
PutRetentionConfigurationResponse'
{ $sel:retentionConfiguration:PutRetentionConfigurationResponse' :: Maybe RetentionConfiguration
retentionConfiguration =
Maybe RetentionConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutRetentionConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putRetentionConfigurationResponse_retentionConfiguration :: Lens.Lens' PutRetentionConfigurationResponse (Prelude.Maybe RetentionConfiguration)
putRetentionConfigurationResponse_retentionConfiguration :: (Maybe RetentionConfiguration -> f (Maybe RetentionConfiguration))
-> PutRetentionConfigurationResponse
-> f PutRetentionConfigurationResponse
putRetentionConfigurationResponse_retentionConfiguration = (PutRetentionConfigurationResponse -> Maybe RetentionConfiguration)
-> (PutRetentionConfigurationResponse
-> Maybe RetentionConfiguration
-> PutRetentionConfigurationResponse)
-> Lens
PutRetentionConfigurationResponse
PutRetentionConfigurationResponse
(Maybe RetentionConfiguration)
(Maybe RetentionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRetentionConfigurationResponse' {Maybe RetentionConfiguration
retentionConfiguration :: Maybe RetentionConfiguration
$sel:retentionConfiguration:PutRetentionConfigurationResponse' :: PutRetentionConfigurationResponse -> Maybe RetentionConfiguration
retentionConfiguration} -> Maybe RetentionConfiguration
retentionConfiguration) (\s :: PutRetentionConfigurationResponse
s@PutRetentionConfigurationResponse' {} Maybe RetentionConfiguration
a -> PutRetentionConfigurationResponse
s {$sel:retentionConfiguration:PutRetentionConfigurationResponse' :: Maybe RetentionConfiguration
retentionConfiguration = Maybe RetentionConfiguration
a} :: PutRetentionConfigurationResponse)
putRetentionConfigurationResponse_httpStatus :: Lens.Lens' PutRetentionConfigurationResponse Prelude.Int
putRetentionConfigurationResponse_httpStatus :: (Int -> f Int)
-> PutRetentionConfigurationResponse
-> f PutRetentionConfigurationResponse
putRetentionConfigurationResponse_httpStatus = (PutRetentionConfigurationResponse -> Int)
-> (PutRetentionConfigurationResponse
-> Int -> PutRetentionConfigurationResponse)
-> Lens
PutRetentionConfigurationResponse
PutRetentionConfigurationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRetentionConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutRetentionConfigurationResponse' :: PutRetentionConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutRetentionConfigurationResponse
s@PutRetentionConfigurationResponse' {} Int
a -> PutRetentionConfigurationResponse
s {$sel:httpStatus:PutRetentionConfigurationResponse' :: Int
httpStatus = Int
a} :: PutRetentionConfigurationResponse)
instance
Prelude.NFData
PutRetentionConfigurationResponse