{-# 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_requestId,
putContainerRecipePolicyResponse_containerRecipeArn,
putContainerRecipePolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ImageBuilder.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 PutContainerRecipePolicy = PutContainerRecipePolicy'
{
PutContainerRecipePolicy -> Text
containerRecipeArn :: Prelude.Text,
PutContainerRecipePolicy -> Text
policy :: Prelude.Text
}
deriving (PutContainerRecipePolicy -> PutContainerRecipePolicy -> Bool
(PutContainerRecipePolicy -> PutContainerRecipePolicy -> Bool)
-> (PutContainerRecipePolicy -> PutContainerRecipePolicy -> Bool)
-> Eq PutContainerRecipePolicy
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]
(Int -> ReadS PutContainerRecipePolicy)
-> ReadS [PutContainerRecipePolicy]
-> ReadPrec PutContainerRecipePolicy
-> ReadPrec [PutContainerRecipePolicy]
-> Read 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
(Int -> PutContainerRecipePolicy -> ShowS)
-> (PutContainerRecipePolicy -> String)
-> ([PutContainerRecipePolicy] -> ShowS)
-> Show PutContainerRecipePolicy
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.
PutContainerRecipePolicy -> Rep PutContainerRecipePolicy x)
-> (forall x.
Rep PutContainerRecipePolicy x -> PutContainerRecipePolicy)
-> Generic PutContainerRecipePolicy
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' :: Text -> Text -> PutContainerRecipePolicy
PutContainerRecipePolicy'
{ $sel:containerRecipeArn:PutContainerRecipePolicy' :: Text
containerRecipeArn =
Text
pContainerRecipeArn_,
$sel:policy:PutContainerRecipePolicy' :: Text
policy = Text
pPolicy_
}
putContainerRecipePolicy_containerRecipeArn :: Lens.Lens' PutContainerRecipePolicy Prelude.Text
putContainerRecipePolicy_containerRecipeArn :: (Text -> f Text)
-> PutContainerRecipePolicy -> f PutContainerRecipePolicy
putContainerRecipePolicy_containerRecipeArn = (PutContainerRecipePolicy -> Text)
-> (PutContainerRecipePolicy -> Text -> PutContainerRecipePolicy)
-> Lens PutContainerRecipePolicy PutContainerRecipePolicy Text Text
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 :: (Text -> f Text)
-> PutContainerRecipePolicy -> f PutContainerRecipePolicy
putContainerRecipePolicy_policy = (PutContainerRecipePolicy -> Text)
-> (PutContainerRecipePolicy -> Text -> PutContainerRecipePolicy)
-> Lens PutContainerRecipePolicy PutContainerRecipePolicy Text Text
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 :: PutContainerRecipePolicy -> Request PutContainerRecipePolicy
request = Service
-> PutContainerRecipePolicy -> Request PutContainerRecipePolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutContainerRecipePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutContainerRecipePolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutContainerRecipePolicy))
-> Logger
-> Service
-> Proxy PutContainerRecipePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutContainerRecipePolicy)))
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 Text -> Maybe Text -> Int -> PutContainerRecipePolicyResponse
PutContainerRecipePolicyResponse'
(Maybe Text
-> Maybe Text -> Int -> PutContainerRecipePolicyResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Int -> PutContainerRecipePolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"requestId")
Either
String (Maybe Text -> Int -> PutContainerRecipePolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutContainerRecipePolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"containerRecipeArn")
Either String (Int -> PutContainerRecipePolicyResponse)
-> Either String Int
-> Either String PutContainerRecipePolicyResponse
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 PutContainerRecipePolicy
instance Prelude.NFData PutContainerRecipePolicy
instance Core.ToHeaders PutContainerRecipePolicy where
toHeaders :: PutContainerRecipePolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutContainerRecipePolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 PutContainerRecipePolicy where
toJSON :: PutContainerRecipePolicy -> Value
toJSON PutContainerRecipePolicy' {Text
policy :: Text
containerRecipeArn :: Text
$sel:policy:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> Text
$sel:containerRecipeArn:PutContainerRecipePolicy' :: PutContainerRecipePolicy -> 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
"containerRecipeArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
containerRecipeArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"policy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
policy)
]
)
instance Core.ToPath PutContainerRecipePolicy where
toPath :: PutContainerRecipePolicy -> ByteString
toPath = ByteString -> PutContainerRecipePolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/PutContainerRecipePolicy"
instance Core.ToQuery PutContainerRecipePolicy where
toQuery :: PutContainerRecipePolicy -> QueryString
toQuery = QueryString -> PutContainerRecipePolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutContainerRecipePolicyResponse = PutContainerRecipePolicyResponse'
{
PutContainerRecipePolicyResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
PutContainerRecipePolicyResponse -> Maybe Text
containerRecipeArn :: Prelude.Maybe Prelude.Text,
PutContainerRecipePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutContainerRecipePolicyResponse
-> PutContainerRecipePolicyResponse -> Bool
(PutContainerRecipePolicyResponse
-> PutContainerRecipePolicyResponse -> Bool)
-> (PutContainerRecipePolicyResponse
-> PutContainerRecipePolicyResponse -> Bool)
-> Eq PutContainerRecipePolicyResponse
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]
(Int -> ReadS PutContainerRecipePolicyResponse)
-> ReadS [PutContainerRecipePolicyResponse]
-> ReadPrec PutContainerRecipePolicyResponse
-> ReadPrec [PutContainerRecipePolicyResponse]
-> Read 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
(Int -> PutContainerRecipePolicyResponse -> ShowS)
-> (PutContainerRecipePolicyResponse -> String)
-> ([PutContainerRecipePolicyResponse] -> ShowS)
-> Show PutContainerRecipePolicyResponse
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.
PutContainerRecipePolicyResponse
-> Rep PutContainerRecipePolicyResponse x)
-> (forall x.
Rep PutContainerRecipePolicyResponse x
-> PutContainerRecipePolicyResponse)
-> Generic PutContainerRecipePolicyResponse
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' :: Maybe Text -> Maybe Text -> Int -> PutContainerRecipePolicyResponse
PutContainerRecipePolicyResponse'
{ $sel:requestId:PutContainerRecipePolicyResponse' :: Maybe Text
requestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:containerRecipeArn:PutContainerRecipePolicyResponse' :: Maybe Text
containerRecipeArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutContainerRecipePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putContainerRecipePolicyResponse_requestId :: Lens.Lens' PutContainerRecipePolicyResponse (Prelude.Maybe Prelude.Text)
putContainerRecipePolicyResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> PutContainerRecipePolicyResponse
-> f PutContainerRecipePolicyResponse
putContainerRecipePolicyResponse_requestId = (PutContainerRecipePolicyResponse -> Maybe Text)
-> (PutContainerRecipePolicyResponse
-> Maybe Text -> PutContainerRecipePolicyResponse)
-> Lens
PutContainerRecipePolicyResponse
PutContainerRecipePolicyResponse
(Maybe Text)
(Maybe Text)
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_containerRecipeArn :: Lens.Lens' PutContainerRecipePolicyResponse (Prelude.Maybe Prelude.Text)
putContainerRecipePolicyResponse_containerRecipeArn :: (Maybe Text -> f (Maybe Text))
-> PutContainerRecipePolicyResponse
-> f PutContainerRecipePolicyResponse
putContainerRecipePolicyResponse_containerRecipeArn = (PutContainerRecipePolicyResponse -> Maybe Text)
-> (PutContainerRecipePolicyResponse
-> Maybe Text -> PutContainerRecipePolicyResponse)
-> Lens
PutContainerRecipePolicyResponse
PutContainerRecipePolicyResponse
(Maybe Text)
(Maybe Text)
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_httpStatus :: Lens.Lens' PutContainerRecipePolicyResponse Prelude.Int
putContainerRecipePolicyResponse_httpStatus :: (Int -> f Int)
-> PutContainerRecipePolicyResponse
-> f PutContainerRecipePolicyResponse
putContainerRecipePolicyResponse_httpStatus = (PutContainerRecipePolicyResponse -> Int)
-> (PutContainerRecipePolicyResponse
-> Int -> PutContainerRecipePolicyResponse)
-> Lens
PutContainerRecipePolicyResponse
PutContainerRecipePolicyResponse
Int
Int
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