{-# 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.MediaStore.PutLifecyclePolicy
(
PutLifecyclePolicy (..),
newPutLifecyclePolicy,
putLifecyclePolicy_containerName,
putLifecyclePolicy_lifecyclePolicy,
PutLifecyclePolicyResponse (..),
newPutLifecyclePolicyResponse,
putLifecyclePolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaStore.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutLifecyclePolicy = PutLifecyclePolicy'
{
PutLifecyclePolicy -> Text
containerName :: Prelude.Text,
PutLifecyclePolicy -> Text
lifecyclePolicy :: Prelude.Text
}
deriving (PutLifecyclePolicy -> PutLifecyclePolicy -> Bool
(PutLifecyclePolicy -> PutLifecyclePolicy -> Bool)
-> (PutLifecyclePolicy -> PutLifecyclePolicy -> Bool)
-> Eq PutLifecyclePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLifecyclePolicy -> PutLifecyclePolicy -> Bool
$c/= :: PutLifecyclePolicy -> PutLifecyclePolicy -> Bool
== :: PutLifecyclePolicy -> PutLifecyclePolicy -> Bool
$c== :: PutLifecyclePolicy -> PutLifecyclePolicy -> Bool
Prelude.Eq, ReadPrec [PutLifecyclePolicy]
ReadPrec PutLifecyclePolicy
Int -> ReadS PutLifecyclePolicy
ReadS [PutLifecyclePolicy]
(Int -> ReadS PutLifecyclePolicy)
-> ReadS [PutLifecyclePolicy]
-> ReadPrec PutLifecyclePolicy
-> ReadPrec [PutLifecyclePolicy]
-> Read PutLifecyclePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutLifecyclePolicy]
$creadListPrec :: ReadPrec [PutLifecyclePolicy]
readPrec :: ReadPrec PutLifecyclePolicy
$creadPrec :: ReadPrec PutLifecyclePolicy
readList :: ReadS [PutLifecyclePolicy]
$creadList :: ReadS [PutLifecyclePolicy]
readsPrec :: Int -> ReadS PutLifecyclePolicy
$creadsPrec :: Int -> ReadS PutLifecyclePolicy
Prelude.Read, Int -> PutLifecyclePolicy -> ShowS
[PutLifecyclePolicy] -> ShowS
PutLifecyclePolicy -> String
(Int -> PutLifecyclePolicy -> ShowS)
-> (PutLifecyclePolicy -> String)
-> ([PutLifecyclePolicy] -> ShowS)
-> Show PutLifecyclePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLifecyclePolicy] -> ShowS
$cshowList :: [PutLifecyclePolicy] -> ShowS
show :: PutLifecyclePolicy -> String
$cshow :: PutLifecyclePolicy -> String
showsPrec :: Int -> PutLifecyclePolicy -> ShowS
$cshowsPrec :: Int -> PutLifecyclePolicy -> ShowS
Prelude.Show, (forall x. PutLifecyclePolicy -> Rep PutLifecyclePolicy x)
-> (forall x. Rep PutLifecyclePolicy x -> PutLifecyclePolicy)
-> Generic PutLifecyclePolicy
forall x. Rep PutLifecyclePolicy x -> PutLifecyclePolicy
forall x. PutLifecyclePolicy -> Rep PutLifecyclePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutLifecyclePolicy x -> PutLifecyclePolicy
$cfrom :: forall x. PutLifecyclePolicy -> Rep PutLifecyclePolicy x
Prelude.Generic)
newPutLifecyclePolicy ::
Prelude.Text ->
Prelude.Text ->
PutLifecyclePolicy
newPutLifecyclePolicy :: Text -> Text -> PutLifecyclePolicy
newPutLifecyclePolicy
Text
pContainerName_
Text
pLifecyclePolicy_ =
PutLifecyclePolicy' :: Text -> Text -> PutLifecyclePolicy
PutLifecyclePolicy'
{ $sel:containerName:PutLifecyclePolicy' :: Text
containerName =
Text
pContainerName_,
$sel:lifecyclePolicy:PutLifecyclePolicy' :: Text
lifecyclePolicy = Text
pLifecyclePolicy_
}
putLifecyclePolicy_containerName :: Lens.Lens' PutLifecyclePolicy Prelude.Text
putLifecyclePolicy_containerName :: (Text -> f Text) -> PutLifecyclePolicy -> f PutLifecyclePolicy
putLifecyclePolicy_containerName = (PutLifecyclePolicy -> Text)
-> (PutLifecyclePolicy -> Text -> PutLifecyclePolicy)
-> Lens PutLifecyclePolicy PutLifecyclePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecyclePolicy' {Text
containerName :: Text
$sel:containerName:PutLifecyclePolicy' :: PutLifecyclePolicy -> Text
containerName} -> Text
containerName) (\s :: PutLifecyclePolicy
s@PutLifecyclePolicy' {} Text
a -> PutLifecyclePolicy
s {$sel:containerName:PutLifecyclePolicy' :: Text
containerName = Text
a} :: PutLifecyclePolicy)
putLifecyclePolicy_lifecyclePolicy :: Lens.Lens' PutLifecyclePolicy Prelude.Text
putLifecyclePolicy_lifecyclePolicy :: (Text -> f Text) -> PutLifecyclePolicy -> f PutLifecyclePolicy
putLifecyclePolicy_lifecyclePolicy = (PutLifecyclePolicy -> Text)
-> (PutLifecyclePolicy -> Text -> PutLifecyclePolicy)
-> Lens PutLifecyclePolicy PutLifecyclePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecyclePolicy' {Text
lifecyclePolicy :: Text
$sel:lifecyclePolicy:PutLifecyclePolicy' :: PutLifecyclePolicy -> Text
lifecyclePolicy} -> Text
lifecyclePolicy) (\s :: PutLifecyclePolicy
s@PutLifecyclePolicy' {} Text
a -> PutLifecyclePolicy
s {$sel:lifecyclePolicy:PutLifecyclePolicy' :: Text
lifecyclePolicy = Text
a} :: PutLifecyclePolicy)
instance Core.AWSRequest PutLifecyclePolicy where
type
AWSResponse PutLifecyclePolicy =
PutLifecyclePolicyResponse
request :: PutLifecyclePolicy -> Request PutLifecyclePolicy
request = Service -> PutLifecyclePolicy -> Request PutLifecyclePolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutLifecyclePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutLifecyclePolicy)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse PutLifecyclePolicy))
-> Logger
-> Service
-> Proxy PutLifecyclePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutLifecyclePolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> PutLifecyclePolicyResponse
PutLifecyclePolicyResponse'
(Int -> PutLifecyclePolicyResponse)
-> Either String Int -> Either String PutLifecyclePolicyResponse
forall (f :: * -> *) a b. Functor 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 PutLifecyclePolicy
instance Prelude.NFData PutLifecyclePolicy
instance Core.ToHeaders PutLifecyclePolicy where
toHeaders :: PutLifecyclePolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutLifecyclePolicy -> 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
"MediaStore_20170901.PutLifecyclePolicy" ::
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 PutLifecyclePolicy where
toJSON :: PutLifecyclePolicy -> Value
toJSON PutLifecyclePolicy' {Text
lifecyclePolicy :: Text
containerName :: Text
$sel:lifecyclePolicy:PutLifecyclePolicy' :: PutLifecyclePolicy -> Text
$sel:containerName:PutLifecyclePolicy' :: PutLifecyclePolicy -> 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
"ContainerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
containerName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"LifecyclePolicy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
lifecyclePolicy)
]
)
instance Core.ToPath PutLifecyclePolicy where
toPath :: PutLifecyclePolicy -> ByteString
toPath = ByteString -> PutLifecyclePolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutLifecyclePolicy where
toQuery :: PutLifecyclePolicy -> QueryString
toQuery = QueryString -> PutLifecyclePolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutLifecyclePolicyResponse = PutLifecyclePolicyResponse'
{
PutLifecyclePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutLifecyclePolicyResponse -> PutLifecyclePolicyResponse -> Bool
(PutLifecyclePolicyResponse -> PutLifecyclePolicyResponse -> Bool)
-> (PutLifecyclePolicyResponse
-> PutLifecyclePolicyResponse -> Bool)
-> Eq PutLifecyclePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLifecyclePolicyResponse -> PutLifecyclePolicyResponse -> Bool
$c/= :: PutLifecyclePolicyResponse -> PutLifecyclePolicyResponse -> Bool
== :: PutLifecyclePolicyResponse -> PutLifecyclePolicyResponse -> Bool
$c== :: PutLifecyclePolicyResponse -> PutLifecyclePolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutLifecyclePolicyResponse]
ReadPrec PutLifecyclePolicyResponse
Int -> ReadS PutLifecyclePolicyResponse
ReadS [PutLifecyclePolicyResponse]
(Int -> ReadS PutLifecyclePolicyResponse)
-> ReadS [PutLifecyclePolicyResponse]
-> ReadPrec PutLifecyclePolicyResponse
-> ReadPrec [PutLifecyclePolicyResponse]
-> Read PutLifecyclePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutLifecyclePolicyResponse]
$creadListPrec :: ReadPrec [PutLifecyclePolicyResponse]
readPrec :: ReadPrec PutLifecyclePolicyResponse
$creadPrec :: ReadPrec PutLifecyclePolicyResponse
readList :: ReadS [PutLifecyclePolicyResponse]
$creadList :: ReadS [PutLifecyclePolicyResponse]
readsPrec :: Int -> ReadS PutLifecyclePolicyResponse
$creadsPrec :: Int -> ReadS PutLifecyclePolicyResponse
Prelude.Read, Int -> PutLifecyclePolicyResponse -> ShowS
[PutLifecyclePolicyResponse] -> ShowS
PutLifecyclePolicyResponse -> String
(Int -> PutLifecyclePolicyResponse -> ShowS)
-> (PutLifecyclePolicyResponse -> String)
-> ([PutLifecyclePolicyResponse] -> ShowS)
-> Show PutLifecyclePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLifecyclePolicyResponse] -> ShowS
$cshowList :: [PutLifecyclePolicyResponse] -> ShowS
show :: PutLifecyclePolicyResponse -> String
$cshow :: PutLifecyclePolicyResponse -> String
showsPrec :: Int -> PutLifecyclePolicyResponse -> ShowS
$cshowsPrec :: Int -> PutLifecyclePolicyResponse -> ShowS
Prelude.Show, (forall x.
PutLifecyclePolicyResponse -> Rep PutLifecyclePolicyResponse x)
-> (forall x.
Rep PutLifecyclePolicyResponse x -> PutLifecyclePolicyResponse)
-> Generic PutLifecyclePolicyResponse
forall x.
Rep PutLifecyclePolicyResponse x -> PutLifecyclePolicyResponse
forall x.
PutLifecyclePolicyResponse -> Rep PutLifecyclePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutLifecyclePolicyResponse x -> PutLifecyclePolicyResponse
$cfrom :: forall x.
PutLifecyclePolicyResponse -> Rep PutLifecyclePolicyResponse x
Prelude.Generic)
newPutLifecyclePolicyResponse ::
Prelude.Int ->
PutLifecyclePolicyResponse
newPutLifecyclePolicyResponse :: Int -> PutLifecyclePolicyResponse
newPutLifecyclePolicyResponse Int
pHttpStatus_ =
PutLifecyclePolicyResponse' :: Int -> PutLifecyclePolicyResponse
PutLifecyclePolicyResponse'
{ $sel:httpStatus:PutLifecyclePolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putLifecyclePolicyResponse_httpStatus :: Lens.Lens' PutLifecyclePolicyResponse Prelude.Int
putLifecyclePolicyResponse_httpStatus :: (Int -> f Int)
-> PutLifecyclePolicyResponse -> f PutLifecyclePolicyResponse
putLifecyclePolicyResponse_httpStatus = (PutLifecyclePolicyResponse -> Int)
-> (PutLifecyclePolicyResponse
-> Int -> PutLifecyclePolicyResponse)
-> Lens
PutLifecyclePolicyResponse PutLifecyclePolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLifecyclePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutLifecyclePolicyResponse' :: PutLifecyclePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutLifecyclePolicyResponse
s@PutLifecyclePolicyResponse' {} Int
a -> PutLifecyclePolicyResponse
s {$sel:httpStatus:PutLifecyclePolicyResponse' :: Int
httpStatus = Int
a} :: PutLifecyclePolicyResponse)
instance Prelude.NFData PutLifecyclePolicyResponse