{-# 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.ImageBuilder.PutContainerRecipePolicy
(
PutContainerRecipePolicy (..),
newPutContainerRecipePolicy,
putContainerRecipePolicy_containerRecipeArn,
putContainerRecipePolicy_policy,
PutContainerRecipePolicyResponse (..),
newPutContainerRecipePolicyResponse,
putContainerRecipePolicyResponse_containerRecipeArn,
putContainerRecipePolicyResponse_requestId,
putContainerRecipePolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ImageBuilder.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutContainerRecipePolicy = PutContainerRecipePolicy'
{
PutContainerRecipePolicy -> Text
containerRecipeArn :: Prelude.Text,
PutContainerRecipePolicy -> Text
policy :: Prelude.Text
}
deriving (PutContainerRecipePolicy -> PutContainerRecipePolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutContainerRecipePolicy -> PutContainerRecipePolicy -> Bool
$c/= :: PutContainerRecipePolicy -> PutContainerRecipePolicy -> Bool
== :: PutContainerRecipePolicy -> PutContainerRecipePolicy -> Bool
$c== :: PutContainerRecipePolicy -> PutContainerRecipePolicy -> Bool
Prelude.Eq, ReadPrec [PutContainerRecipePolicy]
ReadPrec PutContainerRecipePolicy
Int -> ReadS PutContainerRecipePolicy
ReadS [PutContainerRecipePolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutContainerRecipePolicy]
$creadListPrec :: ReadPrec [PutContainerRecipePolicy]
readPrec :: ReadPrec PutContainerRecipePolicy
$creadPrec :: ReadPrec PutContainerRecipePolicy
readList :: ReadS [PutContainerRecipePolicy]
$creadList :: ReadS [PutContainerRecipePolicy]
readsPrec :: Int -> ReadS PutContainerRecipePolicy
$creadsPrec :: Int -> ReadS PutContainerRecipePolicy
Prelude.Read, Int -> PutContainerRecipePolicy -> ShowS
[PutContainerRecipePolicy] -> ShowS
PutContainerRecipePolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutContainerRecipePolicy] -> ShowS
$cshowList :: [PutContainerRecipePolicy] -> ShowS
show :: PutContainerRecipePolicy -> String
$cshow :: PutContainerRecipePolicy -> String
showsPrec :: Int -> PutContainerRecipePolicy -> ShowS
$cshowsPrec :: Int -> PutContainerRecipePolicy -> ShowS
Prelude.Show, forall x.
Rep PutContainerRecipePolicy x -> PutContainerRecipePolicy
forall x.
PutContainerRecipePolicy -> Rep PutContainerRecipePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutContainerRecipePolicy x -> PutContainerRecipePolicy
$cfrom :: forall x.
PutContainerRecipePolicy -> Rep PutContainerRecipePolicy x
Prelude.Generic)
newPutContainerRecipePolicy ::
Prelude.Text ->
Prelude.Text ->
PutContainerRecipePolicy
newPutContainerRecipePolicy :: Text -> Text -> PutContainerRecipePolicy
newPutContainerRecipePolicy
Text
pContainerRecipeArn_
Text
pPolicy_ =
PutContainerRecipePolicy'
{ $sel:containerRecipeArn:PutContainerRecipePolicy' :: Text
containerRecipeArn =
Text
pContainerRecipeArn_,
$sel:policy:PutContainerRecipePolicy' :: Text
policy = Text
pPolicy_
}
putContainerRecipePolicy_containerRecipeArn :: Lens.Lens' PutContainerRecipePolicy Prelude.Text
putContainerRecipePolicy_containerRecipeArn :: Lens' PutContainerRecipePolicy Text
putContainerRecipePolicy_containerRecipeArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContainerRecipePolicy' {Text
containerRecipeArn :: Text
$sel:containerRecipeArn:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> Text
containerRecipeArn} -> Text
containerRecipeArn) (\s :: PutContainerRecipePolicy
s@PutContainerRecipePolicy' {} Text
a -> PutContainerRecipePolicy
s {$sel:containerRecipeArn:PutContainerRecipePolicy' :: Text
containerRecipeArn = Text
a} :: PutContainerRecipePolicy)
putContainerRecipePolicy_policy :: Lens.Lens' PutContainerRecipePolicy Prelude.Text
putContainerRecipePolicy_policy :: Lens' PutContainerRecipePolicy Text
putContainerRecipePolicy_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContainerRecipePolicy' {Text
policy :: Text
$sel:policy:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> Text
policy} -> Text
policy) (\s :: PutContainerRecipePolicy
s@PutContainerRecipePolicy' {} Text
a -> PutContainerRecipePolicy
s {$sel:policy:PutContainerRecipePolicy' :: Text
policy = Text
a} :: PutContainerRecipePolicy)
instance Core.AWSRequest PutContainerRecipePolicy where
type
AWSResponse PutContainerRecipePolicy =
PutContainerRecipePolicyResponse
request :: (Service -> Service)
-> PutContainerRecipePolicy -> Request PutContainerRecipePolicy
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutContainerRecipePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutContainerRecipePolicy)))
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 -> Maybe Text -> Int -> PutContainerRecipePolicyResponse
PutContainerRecipePolicyResponse'
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
"containerRecipeArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"requestId")
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 PutContainerRecipePolicy where
hashWithSalt :: Int -> PutContainerRecipePolicy -> Int
hashWithSalt Int
_salt PutContainerRecipePolicy' {Text
policy :: Text
containerRecipeArn :: Text
$sel:policy:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> Text
$sel:containerRecipeArn:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
containerRecipeArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policy
instance Prelude.NFData PutContainerRecipePolicy where
rnf :: PutContainerRecipePolicy -> ()
rnf PutContainerRecipePolicy' {Text
policy :: Text
containerRecipeArn :: Text
$sel:policy:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> Text
$sel:containerRecipeArn:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
containerRecipeArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policy
instance Data.ToHeaders PutContainerRecipePolicy where
toHeaders :: PutContainerRecipePolicy -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON PutContainerRecipePolicy where
toJSON :: PutContainerRecipePolicy -> Value
toJSON PutContainerRecipePolicy' {Text
policy :: Text
containerRecipeArn :: Text
$sel:policy:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> Text
$sel:containerRecipeArn:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"containerRecipeArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
containerRecipeArn),
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 PutContainerRecipePolicy where
toPath :: PutContainerRecipePolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/PutContainerRecipePolicy"
instance Data.ToQuery PutContainerRecipePolicy where
toQuery :: PutContainerRecipePolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutContainerRecipePolicyResponse = PutContainerRecipePolicyResponse'
{
PutContainerRecipePolicyResponse -> Maybe Text
containerRecipeArn :: Prelude.Maybe Prelude.Text,
PutContainerRecipePolicyResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
PutContainerRecipePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutContainerRecipePolicyResponse
-> PutContainerRecipePolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutContainerRecipePolicyResponse
-> PutContainerRecipePolicyResponse -> Bool
$c/= :: PutContainerRecipePolicyResponse
-> PutContainerRecipePolicyResponse -> Bool
== :: PutContainerRecipePolicyResponse
-> PutContainerRecipePolicyResponse -> Bool
$c== :: PutContainerRecipePolicyResponse
-> PutContainerRecipePolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutContainerRecipePolicyResponse]
ReadPrec PutContainerRecipePolicyResponse
Int -> ReadS PutContainerRecipePolicyResponse
ReadS [PutContainerRecipePolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutContainerRecipePolicyResponse]
$creadListPrec :: ReadPrec [PutContainerRecipePolicyResponse]
readPrec :: ReadPrec PutContainerRecipePolicyResponse
$creadPrec :: ReadPrec PutContainerRecipePolicyResponse
readList :: ReadS [PutContainerRecipePolicyResponse]
$creadList :: ReadS [PutContainerRecipePolicyResponse]
readsPrec :: Int -> ReadS PutContainerRecipePolicyResponse
$creadsPrec :: Int -> ReadS PutContainerRecipePolicyResponse
Prelude.Read, Int -> PutContainerRecipePolicyResponse -> ShowS
[PutContainerRecipePolicyResponse] -> ShowS
PutContainerRecipePolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutContainerRecipePolicyResponse] -> ShowS
$cshowList :: [PutContainerRecipePolicyResponse] -> ShowS
show :: PutContainerRecipePolicyResponse -> String
$cshow :: PutContainerRecipePolicyResponse -> String
showsPrec :: Int -> PutContainerRecipePolicyResponse -> ShowS
$cshowsPrec :: Int -> PutContainerRecipePolicyResponse -> ShowS
Prelude.Show, forall x.
Rep PutContainerRecipePolicyResponse x
-> PutContainerRecipePolicyResponse
forall x.
PutContainerRecipePolicyResponse
-> Rep PutContainerRecipePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutContainerRecipePolicyResponse x
-> PutContainerRecipePolicyResponse
$cfrom :: forall x.
PutContainerRecipePolicyResponse
-> Rep PutContainerRecipePolicyResponse x
Prelude.Generic)
newPutContainerRecipePolicyResponse ::
Prelude.Int ->
PutContainerRecipePolicyResponse
newPutContainerRecipePolicyResponse :: Int -> PutContainerRecipePolicyResponse
newPutContainerRecipePolicyResponse Int
pHttpStatus_ =
PutContainerRecipePolicyResponse'
{ $sel:containerRecipeArn:PutContainerRecipePolicyResponse' :: Maybe Text
containerRecipeArn =
forall a. Maybe a
Prelude.Nothing,
$sel:requestId:PutContainerRecipePolicyResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutContainerRecipePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putContainerRecipePolicyResponse_containerRecipeArn :: Lens.Lens' PutContainerRecipePolicyResponse (Prelude.Maybe Prelude.Text)
putContainerRecipePolicyResponse_containerRecipeArn :: Lens' PutContainerRecipePolicyResponse (Maybe Text)
putContainerRecipePolicyResponse_containerRecipeArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContainerRecipePolicyResponse' {Maybe Text
containerRecipeArn :: Maybe Text
$sel:containerRecipeArn:PutContainerRecipePolicyResponse' :: PutContainerRecipePolicyResponse -> Maybe Text
containerRecipeArn} -> Maybe Text
containerRecipeArn) (\s :: PutContainerRecipePolicyResponse
s@PutContainerRecipePolicyResponse' {} Maybe Text
a -> PutContainerRecipePolicyResponse
s {$sel:containerRecipeArn:PutContainerRecipePolicyResponse' :: Maybe Text
containerRecipeArn = Maybe Text
a} :: PutContainerRecipePolicyResponse)
putContainerRecipePolicyResponse_requestId :: Lens.Lens' PutContainerRecipePolicyResponse (Prelude.Maybe Prelude.Text)
putContainerRecipePolicyResponse_requestId :: Lens' PutContainerRecipePolicyResponse (Maybe Text)
putContainerRecipePolicyResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContainerRecipePolicyResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:PutContainerRecipePolicyResponse' :: PutContainerRecipePolicyResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: PutContainerRecipePolicyResponse
s@PutContainerRecipePolicyResponse' {} Maybe Text
a -> PutContainerRecipePolicyResponse
s {$sel:requestId:PutContainerRecipePolicyResponse' :: Maybe Text
requestId = Maybe Text
a} :: PutContainerRecipePolicyResponse)
putContainerRecipePolicyResponse_httpStatus :: Lens.Lens' PutContainerRecipePolicyResponse Prelude.Int
putContainerRecipePolicyResponse_httpStatus :: Lens' PutContainerRecipePolicyResponse Int
putContainerRecipePolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContainerRecipePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutContainerRecipePolicyResponse' :: PutContainerRecipePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutContainerRecipePolicyResponse
s@PutContainerRecipePolicyResponse' {} Int
a -> PutContainerRecipePolicyResponse
s {$sel:httpStatus:PutContainerRecipePolicyResponse' :: Int
httpStatus = Int
a} :: PutContainerRecipePolicyResponse)
instance
Prelude.NFData
PutContainerRecipePolicyResponse
where
rnf :: PutContainerRecipePolicyResponse -> ()
rnf PutContainerRecipePolicyResponse' {Int
Maybe Text
httpStatus :: Int
requestId :: Maybe Text
containerRecipeArn :: Maybe Text
$sel:httpStatus:PutContainerRecipePolicyResponse' :: PutContainerRecipePolicyResponse -> Int
$sel:requestId:PutContainerRecipePolicyResponse' :: PutContainerRecipePolicyResponse -> Maybe Text
$sel:containerRecipeArn:PutContainerRecipePolicyResponse' :: PutContainerRecipePolicyResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
containerRecipeArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus