{-# 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.EFS.PutLifecycleConfiguration
(
PutLifecycleConfiguration (..),
newPutLifecycleConfiguration,
putLifecycleConfiguration_fileSystemId,
putLifecycleConfiguration_lifecyclePolicies,
LifecycleConfigurationDescription (..),
newLifecycleConfigurationDescription,
lifecycleConfigurationDescription_lifecyclePolicies,
)
where
import qualified Amazonka.Core as Core
import Amazonka.EFS.Types
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 PutLifecycleConfiguration = PutLifecycleConfiguration'
{
PutLifecycleConfiguration -> Text
fileSystemId :: Prelude.Text,
PutLifecycleConfiguration -> [LifecyclePolicy]
lifecyclePolicies :: [LifecyclePolicy]
}
deriving (PutLifecycleConfiguration -> PutLifecycleConfiguration -> Bool
(PutLifecycleConfiguration -> PutLifecycleConfiguration -> Bool)
-> (PutLifecycleConfiguration -> PutLifecycleConfiguration -> Bool)
-> Eq PutLifecycleConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLifecycleConfiguration -> PutLifecycleConfiguration -> Bool
$c/= :: PutLifecycleConfiguration -> PutLifecycleConfiguration -> Bool
== :: PutLifecycleConfiguration -> PutLifecycleConfiguration -> Bool
$c== :: PutLifecycleConfiguration -> PutLifecycleConfiguration -> Bool
Prelude.Eq, ReadPrec [PutLifecycleConfiguration]
ReadPrec PutLifecycleConfiguration
Int -> ReadS PutLifecycleConfiguration
ReadS [PutLifecycleConfiguration]
(Int -> ReadS PutLifecycleConfiguration)
-> ReadS [PutLifecycleConfiguration]
-> ReadPrec PutLifecycleConfiguration
-> ReadPrec [PutLifecycleConfiguration]
-> Read PutLifecycleConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutLifecycleConfiguration]
$creadListPrec :: ReadPrec [PutLifecycleConfiguration]
readPrec :: ReadPrec PutLifecycleConfiguration
$creadPrec :: ReadPrec PutLifecycleConfiguration
readList :: ReadS [PutLifecycleConfiguration]
$creadList :: ReadS [PutLifecycleConfiguration]
readsPrec :: Int -> ReadS PutLifecycleConfiguration
$creadsPrec :: Int -> ReadS PutLifecycleConfiguration
Prelude.Read, Int -> PutLifecycleConfiguration -> ShowS
[PutLifecycleConfiguration] -> ShowS
PutLifecycleConfiguration -> String
(Int -> PutLifecycleConfiguration -> ShowS)
-> (PutLifecycleConfiguration -> String)
-> ([PutLifecycleConfiguration] -> ShowS)
-> Show PutLifecycleConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLifecycleConfiguration] -> ShowS
$cshowList :: [PutLifecycleConfiguration] -> ShowS
show :: PutLifecycleConfiguration -> String
$cshow :: PutLifecycleConfiguration -> String
showsPrec :: Int -> PutLifecycleConfiguration -> ShowS
$cshowsPrec :: Int -> PutLifecycleConfiguration -> ShowS
Prelude.Show, (forall x.
PutLifecycleConfiguration -> Rep PutLifecycleConfiguration x)
-> (forall x.
Rep PutLifecycleConfiguration x -> PutLifecycleConfiguration)
-> Generic PutLifecycleConfiguration
forall x.
Rep PutLifecycleConfiguration x -> PutLifecycleConfiguration
forall x.
PutLifecycleConfiguration -> Rep PutLifecycleConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutLifecycleConfiguration x -> PutLifecycleConfiguration
$cfrom :: forall x.
PutLifecycleConfiguration -> Rep PutLifecycleConfiguration x
Prelude.Generic)
newPutLifecycleConfiguration ::
Prelude.Text ->
PutLifecycleConfiguration
newPutLifecycleConfiguration :: Text -> PutLifecycleConfiguration
newPutLifecycleConfiguration Text
pFileSystemId_ =
PutLifecycleConfiguration' :: Text -> [LifecyclePolicy] -> PutLifecycleConfiguration
PutLifecycleConfiguration'
{ $sel:fileSystemId:PutLifecycleConfiguration' :: Text
fileSystemId =
Text
pFileSystemId_,
$sel:lifecyclePolicies:PutLifecycleConfiguration' :: [LifecyclePolicy]
lifecyclePolicies = [LifecyclePolicy]
forall a. Monoid a => a
Prelude.mempty
}
putLifecycleConfiguration_fileSystemId :: Lens.Lens' PutLifecycleConfiguration Prelude.Text
putLifecycleConfiguration_fileSystemId :: (Text -> f Text)
-> PutLifecycleConfiguration -> f PutLifecycleConfiguration
putLifecycleConfiguration_fileSystemId = (PutLifecycleConfiguration -> Text)
-> (PutLifecycleConfiguration -> Text -> PutLifecycleConfiguration)
-> Lens
PutLifecycleConfiguration PutLifecycleConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecycleConfiguration' {Text
fileSystemId :: Text
$sel:fileSystemId:PutLifecycleConfiguration' :: PutLifecycleConfiguration -> Text
fileSystemId} -> Text
fileSystemId) (\s :: PutLifecycleConfiguration
s@PutLifecycleConfiguration' {} Text
a -> PutLifecycleConfiguration
s {$sel:fileSystemId:PutLifecycleConfiguration' :: Text
fileSystemId = Text
a} :: PutLifecycleConfiguration)
putLifecycleConfiguration_lifecyclePolicies :: Lens.Lens' PutLifecycleConfiguration [LifecyclePolicy]
putLifecycleConfiguration_lifecyclePolicies :: ([LifecyclePolicy] -> f [LifecyclePolicy])
-> PutLifecycleConfiguration -> f PutLifecycleConfiguration
putLifecycleConfiguration_lifecyclePolicies = (PutLifecycleConfiguration -> [LifecyclePolicy])
-> (PutLifecycleConfiguration
-> [LifecyclePolicy] -> PutLifecycleConfiguration)
-> Lens
PutLifecycleConfiguration
PutLifecycleConfiguration
[LifecyclePolicy]
[LifecyclePolicy]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecycleConfiguration' {[LifecyclePolicy]
lifecyclePolicies :: [LifecyclePolicy]
$sel:lifecyclePolicies:PutLifecycleConfiguration' :: PutLifecycleConfiguration -> [LifecyclePolicy]
lifecyclePolicies} -> [LifecyclePolicy]
lifecyclePolicies) (\s :: PutLifecycleConfiguration
s@PutLifecycleConfiguration' {} [LifecyclePolicy]
a -> PutLifecycleConfiguration
s {$sel:lifecyclePolicies:PutLifecycleConfiguration' :: [LifecyclePolicy]
lifecyclePolicies = [LifecyclePolicy]
a} :: PutLifecycleConfiguration) (([LifecyclePolicy] -> f [LifecyclePolicy])
-> PutLifecycleConfiguration -> f PutLifecycleConfiguration)
-> (([LifecyclePolicy] -> f [LifecyclePolicy])
-> [LifecyclePolicy] -> f [LifecyclePolicy])
-> ([LifecyclePolicy] -> f [LifecyclePolicy])
-> PutLifecycleConfiguration
-> f PutLifecycleConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LifecyclePolicy] -> f [LifecyclePolicy])
-> [LifecyclePolicy] -> f [LifecyclePolicy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest PutLifecycleConfiguration where
type
AWSResponse PutLifecycleConfiguration =
LifecycleConfigurationDescription
request :: PutLifecycleConfiguration -> Request PutLifecycleConfiguration
request = Service
-> PutLifecycleConfiguration -> Request PutLifecycleConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutLifecycleConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutLifecycleConfiguration)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutLifecycleConfiguration))
-> Logger
-> Service
-> Proxy PutLifecycleConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutLifecycleConfiguration)))
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 -> Object -> Either String LifecycleConfigurationDescription
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable PutLifecycleConfiguration
instance Prelude.NFData PutLifecycleConfiguration
instance Core.ToHeaders PutLifecycleConfiguration where
toHeaders :: PutLifecycleConfiguration -> ResponseHeaders
toHeaders = ResponseHeaders -> PutLifecycleConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON PutLifecycleConfiguration where
toJSON :: PutLifecycleConfiguration -> Value
toJSON PutLifecycleConfiguration' {[LifecyclePolicy]
Text
lifecyclePolicies :: [LifecyclePolicy]
fileSystemId :: Text
$sel:lifecyclePolicies:PutLifecycleConfiguration' :: PutLifecycleConfiguration -> [LifecyclePolicy]
$sel:fileSystemId:PutLifecycleConfiguration' :: PutLifecycleConfiguration -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"LifecyclePolicies" Text -> [LifecyclePolicy] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [LifecyclePolicy]
lifecyclePolicies)
]
)
instance Core.ToPath PutLifecycleConfiguration where
toPath :: PutLifecycleConfiguration -> ByteString
toPath PutLifecycleConfiguration' {[LifecyclePolicy]
Text
lifecyclePolicies :: [LifecyclePolicy]
fileSystemId :: Text
$sel:lifecyclePolicies:PutLifecycleConfiguration' :: PutLifecycleConfiguration -> [LifecyclePolicy]
$sel:fileSystemId:PutLifecycleConfiguration' :: PutLifecycleConfiguration -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2015-02-01/file-systems/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
fileSystemId,
ByteString
"/lifecycle-configuration"
]
instance Core.ToQuery PutLifecycleConfiguration where
toQuery :: PutLifecycleConfiguration -> QueryString
toQuery = QueryString -> PutLifecycleConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty