{-# 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.PutContainerPolicy
(
PutContainerPolicy (..),
newPutContainerPolicy,
putContainerPolicy_containerName,
putContainerPolicy_policy,
PutContainerPolicyResponse (..),
newPutContainerPolicyResponse,
putContainerPolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaStore.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutContainerPolicy = PutContainerPolicy'
{
PutContainerPolicy -> Text
containerName :: Prelude.Text,
PutContainerPolicy -> Text
policy :: Prelude.Text
}
deriving (PutContainerPolicy -> PutContainerPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutContainerPolicy -> PutContainerPolicy -> Bool
$c/= :: PutContainerPolicy -> PutContainerPolicy -> Bool
== :: PutContainerPolicy -> PutContainerPolicy -> Bool
$c== :: PutContainerPolicy -> PutContainerPolicy -> Bool
Prelude.Eq, ReadPrec [PutContainerPolicy]
ReadPrec PutContainerPolicy
Int -> ReadS PutContainerPolicy
ReadS [PutContainerPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutContainerPolicy]
$creadListPrec :: ReadPrec [PutContainerPolicy]
readPrec :: ReadPrec PutContainerPolicy
$creadPrec :: ReadPrec PutContainerPolicy
readList :: ReadS [PutContainerPolicy]
$creadList :: ReadS [PutContainerPolicy]
readsPrec :: Int -> ReadS PutContainerPolicy
$creadsPrec :: Int -> ReadS PutContainerPolicy
Prelude.Read, Int -> PutContainerPolicy -> ShowS
[PutContainerPolicy] -> ShowS
PutContainerPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutContainerPolicy] -> ShowS
$cshowList :: [PutContainerPolicy] -> ShowS
show :: PutContainerPolicy -> String
$cshow :: PutContainerPolicy -> String
showsPrec :: Int -> PutContainerPolicy -> ShowS
$cshowsPrec :: Int -> PutContainerPolicy -> ShowS
Prelude.Show, forall x. Rep PutContainerPolicy x -> PutContainerPolicy
forall x. PutContainerPolicy -> Rep PutContainerPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutContainerPolicy x -> PutContainerPolicy
$cfrom :: forall x. PutContainerPolicy -> Rep PutContainerPolicy x
Prelude.Generic)
newPutContainerPolicy ::
Prelude.Text ->
Prelude.Text ->
PutContainerPolicy
newPutContainerPolicy :: Text -> Text -> PutContainerPolicy
newPutContainerPolicy Text
pContainerName_ Text
pPolicy_ =
PutContainerPolicy'
{ $sel:containerName:PutContainerPolicy' :: Text
containerName =
Text
pContainerName_,
$sel:policy:PutContainerPolicy' :: Text
policy = Text
pPolicy_
}
putContainerPolicy_containerName :: Lens.Lens' PutContainerPolicy Prelude.Text
putContainerPolicy_containerName :: Lens' PutContainerPolicy Text
putContainerPolicy_containerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContainerPolicy' {Text
containerName :: Text
$sel:containerName:PutContainerPolicy' :: PutContainerPolicy -> Text
containerName} -> Text
containerName) (\s :: PutContainerPolicy
s@PutContainerPolicy' {} Text
a -> PutContainerPolicy
s {$sel:containerName:PutContainerPolicy' :: Text
containerName = Text
a} :: PutContainerPolicy)
putContainerPolicy_policy :: Lens.Lens' PutContainerPolicy Prelude.Text
putContainerPolicy_policy :: Lens' PutContainerPolicy Text
putContainerPolicy_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContainerPolicy' {Text
policy :: Text
$sel:policy:PutContainerPolicy' :: PutContainerPolicy -> Text
policy} -> Text
policy) (\s :: PutContainerPolicy
s@PutContainerPolicy' {} Text
a -> PutContainerPolicy
s {$sel:policy:PutContainerPolicy' :: Text
policy = Text
a} :: PutContainerPolicy)
instance Core.AWSRequest PutContainerPolicy where
type
AWSResponse PutContainerPolicy =
PutContainerPolicyResponse
request :: (Service -> Service)
-> PutContainerPolicy -> Request PutContainerPolicy
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 PutContainerPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutContainerPolicy)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> PutContainerPolicyResponse
PutContainerPolicyResponse'
forall (f :: * -> *) a b. Functor 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 PutContainerPolicy where
hashWithSalt :: Int -> PutContainerPolicy -> Int
hashWithSalt Int
_salt PutContainerPolicy' {Text
policy :: Text
containerName :: Text
$sel:policy:PutContainerPolicy' :: PutContainerPolicy -> Text
$sel:containerName:PutContainerPolicy' :: PutContainerPolicy -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
containerName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policy
instance Prelude.NFData PutContainerPolicy where
rnf :: PutContainerPolicy -> ()
rnf PutContainerPolicy' {Text
policy :: Text
containerName :: Text
$sel:policy:PutContainerPolicy' :: PutContainerPolicy -> Text
$sel:containerName:PutContainerPolicy' :: PutContainerPolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
containerName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policy
instance Data.ToHeaders PutContainerPolicy where
toHeaders :: PutContainerPolicy -> 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
"MediaStore_20170901.PutContainerPolicy" ::
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 PutContainerPolicy where
toJSON :: PutContainerPolicy -> Value
toJSON PutContainerPolicy' {Text
policy :: Text
containerName :: Text
$sel:policy:PutContainerPolicy' :: PutContainerPolicy -> Text
$sel:containerName:PutContainerPolicy' :: PutContainerPolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"ContainerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
containerName),
forall a. a -> Maybe a
Prelude.Just (Key
"Policy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
policy)
]
)
instance Data.ToPath PutContainerPolicy where
toPath :: PutContainerPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PutContainerPolicy where
toQuery :: PutContainerPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutContainerPolicyResponse = PutContainerPolicyResponse'
{
PutContainerPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutContainerPolicyResponse -> PutContainerPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutContainerPolicyResponse -> PutContainerPolicyResponse -> Bool
$c/= :: PutContainerPolicyResponse -> PutContainerPolicyResponse -> Bool
== :: PutContainerPolicyResponse -> PutContainerPolicyResponse -> Bool
$c== :: PutContainerPolicyResponse -> PutContainerPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutContainerPolicyResponse]
ReadPrec PutContainerPolicyResponse
Int -> ReadS PutContainerPolicyResponse
ReadS [PutContainerPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutContainerPolicyResponse]
$creadListPrec :: ReadPrec [PutContainerPolicyResponse]
readPrec :: ReadPrec PutContainerPolicyResponse
$creadPrec :: ReadPrec PutContainerPolicyResponse
readList :: ReadS [PutContainerPolicyResponse]
$creadList :: ReadS [PutContainerPolicyResponse]
readsPrec :: Int -> ReadS PutContainerPolicyResponse
$creadsPrec :: Int -> ReadS PutContainerPolicyResponse
Prelude.Read, Int -> PutContainerPolicyResponse -> ShowS
[PutContainerPolicyResponse] -> ShowS
PutContainerPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutContainerPolicyResponse] -> ShowS
$cshowList :: [PutContainerPolicyResponse] -> ShowS
show :: PutContainerPolicyResponse -> String
$cshow :: PutContainerPolicyResponse -> String
showsPrec :: Int -> PutContainerPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutContainerPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep PutContainerPolicyResponse x -> PutContainerPolicyResponse
forall x.
PutContainerPolicyResponse -> Rep PutContainerPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutContainerPolicyResponse x -> PutContainerPolicyResponse
$cfrom :: forall x.
PutContainerPolicyResponse -> Rep PutContainerPolicyResponse x
Prelude.Generic)
newPutContainerPolicyResponse ::
Prelude.Int ->
PutContainerPolicyResponse
newPutContainerPolicyResponse :: Int -> PutContainerPolicyResponse
newPutContainerPolicyResponse Int
pHttpStatus_ =
PutContainerPolicyResponse'
{ $sel:httpStatus:PutContainerPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putContainerPolicyResponse_httpStatus :: Lens.Lens' PutContainerPolicyResponse Prelude.Int
putContainerPolicyResponse_httpStatus :: Lens' PutContainerPolicyResponse Int
putContainerPolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContainerPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutContainerPolicyResponse' :: PutContainerPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutContainerPolicyResponse
s@PutContainerPolicyResponse' {} Int
a -> PutContainerPolicyResponse
s {$sel:httpStatus:PutContainerPolicyResponse' :: Int
httpStatus = Int
a} :: PutContainerPolicyResponse)
instance Prelude.NFData PutContainerPolicyResponse where
rnf :: PutContainerPolicyResponse -> ()
rnf PutContainerPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutContainerPolicyResponse' :: PutContainerPolicyResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus