{-# 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.PutImageRecipePolicy
(
PutImageRecipePolicy (..),
newPutImageRecipePolicy,
putImageRecipePolicy_imageRecipeArn,
putImageRecipePolicy_policy,
PutImageRecipePolicyResponse (..),
newPutImageRecipePolicyResponse,
putImageRecipePolicyResponse_requestId,
putImageRecipePolicyResponse_imageRecipeArn,
putImageRecipePolicyResponse_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 PutImageRecipePolicy = PutImageRecipePolicy'
{
PutImageRecipePolicy -> Text
imageRecipeArn :: Prelude.Text,
PutImageRecipePolicy -> Text
policy :: Prelude.Text
}
deriving (PutImageRecipePolicy -> PutImageRecipePolicy -> Bool
(PutImageRecipePolicy -> PutImageRecipePolicy -> Bool)
-> (PutImageRecipePolicy -> PutImageRecipePolicy -> Bool)
-> Eq PutImageRecipePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutImageRecipePolicy -> PutImageRecipePolicy -> Bool
$c/= :: PutImageRecipePolicy -> PutImageRecipePolicy -> Bool
== :: PutImageRecipePolicy -> PutImageRecipePolicy -> Bool
$c== :: PutImageRecipePolicy -> PutImageRecipePolicy -> Bool
Prelude.Eq, ReadPrec [PutImageRecipePolicy]
ReadPrec PutImageRecipePolicy
Int -> ReadS PutImageRecipePolicy
ReadS [PutImageRecipePolicy]
(Int -> ReadS PutImageRecipePolicy)
-> ReadS [PutImageRecipePolicy]
-> ReadPrec PutImageRecipePolicy
-> ReadPrec [PutImageRecipePolicy]
-> Read PutImageRecipePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutImageRecipePolicy]
$creadListPrec :: ReadPrec [PutImageRecipePolicy]
readPrec :: ReadPrec PutImageRecipePolicy
$creadPrec :: ReadPrec PutImageRecipePolicy
readList :: ReadS [PutImageRecipePolicy]
$creadList :: ReadS [PutImageRecipePolicy]
readsPrec :: Int -> ReadS PutImageRecipePolicy
$creadsPrec :: Int -> ReadS PutImageRecipePolicy
Prelude.Read, Int -> PutImageRecipePolicy -> ShowS
[PutImageRecipePolicy] -> ShowS
PutImageRecipePolicy -> String
(Int -> PutImageRecipePolicy -> ShowS)
-> (PutImageRecipePolicy -> String)
-> ([PutImageRecipePolicy] -> ShowS)
-> Show PutImageRecipePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutImageRecipePolicy] -> ShowS
$cshowList :: [PutImageRecipePolicy] -> ShowS
show :: PutImageRecipePolicy -> String
$cshow :: PutImageRecipePolicy -> String
showsPrec :: Int -> PutImageRecipePolicy -> ShowS
$cshowsPrec :: Int -> PutImageRecipePolicy -> ShowS
Prelude.Show, (forall x. PutImageRecipePolicy -> Rep PutImageRecipePolicy x)
-> (forall x. Rep PutImageRecipePolicy x -> PutImageRecipePolicy)
-> Generic PutImageRecipePolicy
forall x. Rep PutImageRecipePolicy x -> PutImageRecipePolicy
forall x. PutImageRecipePolicy -> Rep PutImageRecipePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutImageRecipePolicy x -> PutImageRecipePolicy
$cfrom :: forall x. PutImageRecipePolicy -> Rep PutImageRecipePolicy x
Prelude.Generic)
newPutImageRecipePolicy ::
Prelude.Text ->
Prelude.Text ->
PutImageRecipePolicy
newPutImageRecipePolicy :: Text -> Text -> PutImageRecipePolicy
newPutImageRecipePolicy Text
pImageRecipeArn_ Text
pPolicy_ =
PutImageRecipePolicy' :: Text -> Text -> PutImageRecipePolicy
PutImageRecipePolicy'
{ $sel:imageRecipeArn:PutImageRecipePolicy' :: Text
imageRecipeArn =
Text
pImageRecipeArn_,
$sel:policy:PutImageRecipePolicy' :: Text
policy = Text
pPolicy_
}
putImageRecipePolicy_imageRecipeArn :: Lens.Lens' PutImageRecipePolicy Prelude.Text
putImageRecipePolicy_imageRecipeArn :: (Text -> f Text) -> PutImageRecipePolicy -> f PutImageRecipePolicy
putImageRecipePolicy_imageRecipeArn = (PutImageRecipePolicy -> Text)
-> (PutImageRecipePolicy -> Text -> PutImageRecipePolicy)
-> Lens PutImageRecipePolicy PutImageRecipePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImageRecipePolicy' {Text
imageRecipeArn :: Text
$sel:imageRecipeArn:PutImageRecipePolicy' :: PutImageRecipePolicy -> Text
imageRecipeArn} -> Text
imageRecipeArn) (\s :: PutImageRecipePolicy
s@PutImageRecipePolicy' {} Text
a -> PutImageRecipePolicy
s {$sel:imageRecipeArn:PutImageRecipePolicy' :: Text
imageRecipeArn = Text
a} :: PutImageRecipePolicy)
putImageRecipePolicy_policy :: Lens.Lens' PutImageRecipePolicy Prelude.Text
putImageRecipePolicy_policy :: (Text -> f Text) -> PutImageRecipePolicy -> f PutImageRecipePolicy
putImageRecipePolicy_policy = (PutImageRecipePolicy -> Text)
-> (PutImageRecipePolicy -> Text -> PutImageRecipePolicy)
-> Lens PutImageRecipePolicy PutImageRecipePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImageRecipePolicy' {Text
policy :: Text
$sel:policy:PutImageRecipePolicy' :: PutImageRecipePolicy -> Text
policy} -> Text
policy) (\s :: PutImageRecipePolicy
s@PutImageRecipePolicy' {} Text
a -> PutImageRecipePolicy
s {$sel:policy:PutImageRecipePolicy' :: Text
policy = Text
a} :: PutImageRecipePolicy)
instance Core.AWSRequest PutImageRecipePolicy where
type
AWSResponse PutImageRecipePolicy =
PutImageRecipePolicyResponse
request :: PutImageRecipePolicy -> Request PutImageRecipePolicy
request = Service -> PutImageRecipePolicy -> Request PutImageRecipePolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutImageRecipePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutImageRecipePolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutImageRecipePolicy))
-> Logger
-> Service
-> Proxy PutImageRecipePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutImageRecipePolicy)))
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 -> PutImageRecipePolicyResponse
PutImageRecipePolicyResponse'
(Maybe Text -> Maybe Text -> Int -> PutImageRecipePolicyResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Int -> PutImageRecipePolicyResponse)
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 -> PutImageRecipePolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutImageRecipePolicyResponse)
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
"imageRecipeArn")
Either String (Int -> PutImageRecipePolicyResponse)
-> Either String Int -> Either String PutImageRecipePolicyResponse
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 PutImageRecipePolicy
instance Prelude.NFData PutImageRecipePolicy
instance Core.ToHeaders PutImageRecipePolicy where
toHeaders :: PutImageRecipePolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutImageRecipePolicy -> 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 PutImageRecipePolicy where
toJSON :: PutImageRecipePolicy -> Value
toJSON PutImageRecipePolicy' {Text
policy :: Text
imageRecipeArn :: Text
$sel:policy:PutImageRecipePolicy' :: PutImageRecipePolicy -> Text
$sel:imageRecipeArn:PutImageRecipePolicy' :: PutImageRecipePolicy -> 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
"imageRecipeArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
imageRecipeArn),
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 PutImageRecipePolicy where
toPath :: PutImageRecipePolicy -> ByteString
toPath = ByteString -> PutImageRecipePolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/PutImageRecipePolicy"
instance Core.ToQuery PutImageRecipePolicy where
toQuery :: PutImageRecipePolicy -> QueryString
toQuery = QueryString -> PutImageRecipePolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutImageRecipePolicyResponse = PutImageRecipePolicyResponse'
{
PutImageRecipePolicyResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
PutImageRecipePolicyResponse -> Maybe Text
imageRecipeArn :: Prelude.Maybe Prelude.Text,
PutImageRecipePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutImageRecipePolicyResponse
-> PutImageRecipePolicyResponse -> Bool
(PutImageRecipePolicyResponse
-> PutImageRecipePolicyResponse -> Bool)
-> (PutImageRecipePolicyResponse
-> PutImageRecipePolicyResponse -> Bool)
-> Eq PutImageRecipePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutImageRecipePolicyResponse
-> PutImageRecipePolicyResponse -> Bool
$c/= :: PutImageRecipePolicyResponse
-> PutImageRecipePolicyResponse -> Bool
== :: PutImageRecipePolicyResponse
-> PutImageRecipePolicyResponse -> Bool
$c== :: PutImageRecipePolicyResponse
-> PutImageRecipePolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutImageRecipePolicyResponse]
ReadPrec PutImageRecipePolicyResponse
Int -> ReadS PutImageRecipePolicyResponse
ReadS [PutImageRecipePolicyResponse]
(Int -> ReadS PutImageRecipePolicyResponse)
-> ReadS [PutImageRecipePolicyResponse]
-> ReadPrec PutImageRecipePolicyResponse
-> ReadPrec [PutImageRecipePolicyResponse]
-> Read PutImageRecipePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutImageRecipePolicyResponse]
$creadListPrec :: ReadPrec [PutImageRecipePolicyResponse]
readPrec :: ReadPrec PutImageRecipePolicyResponse
$creadPrec :: ReadPrec PutImageRecipePolicyResponse
readList :: ReadS [PutImageRecipePolicyResponse]
$creadList :: ReadS [PutImageRecipePolicyResponse]
readsPrec :: Int -> ReadS PutImageRecipePolicyResponse
$creadsPrec :: Int -> ReadS PutImageRecipePolicyResponse
Prelude.Read, Int -> PutImageRecipePolicyResponse -> ShowS
[PutImageRecipePolicyResponse] -> ShowS
PutImageRecipePolicyResponse -> String
(Int -> PutImageRecipePolicyResponse -> ShowS)
-> (PutImageRecipePolicyResponse -> String)
-> ([PutImageRecipePolicyResponse] -> ShowS)
-> Show PutImageRecipePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutImageRecipePolicyResponse] -> ShowS
$cshowList :: [PutImageRecipePolicyResponse] -> ShowS
show :: PutImageRecipePolicyResponse -> String
$cshow :: PutImageRecipePolicyResponse -> String
showsPrec :: Int -> PutImageRecipePolicyResponse -> ShowS
$cshowsPrec :: Int -> PutImageRecipePolicyResponse -> ShowS
Prelude.Show, (forall x.
PutImageRecipePolicyResponse -> Rep PutImageRecipePolicyResponse x)
-> (forall x.
Rep PutImageRecipePolicyResponse x -> PutImageRecipePolicyResponse)
-> Generic PutImageRecipePolicyResponse
forall x.
Rep PutImageRecipePolicyResponse x -> PutImageRecipePolicyResponse
forall x.
PutImageRecipePolicyResponse -> Rep PutImageRecipePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutImageRecipePolicyResponse x -> PutImageRecipePolicyResponse
$cfrom :: forall x.
PutImageRecipePolicyResponse -> Rep PutImageRecipePolicyResponse x
Prelude.Generic)
newPutImageRecipePolicyResponse ::
Prelude.Int ->
PutImageRecipePolicyResponse
newPutImageRecipePolicyResponse :: Int -> PutImageRecipePolicyResponse
newPutImageRecipePolicyResponse Int
pHttpStatus_ =
PutImageRecipePolicyResponse' :: Maybe Text -> Maybe Text -> Int -> PutImageRecipePolicyResponse
PutImageRecipePolicyResponse'
{ $sel:requestId:PutImageRecipePolicyResponse' :: Maybe Text
requestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:imageRecipeArn:PutImageRecipePolicyResponse' :: Maybe Text
imageRecipeArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutImageRecipePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putImageRecipePolicyResponse_requestId :: Lens.Lens' PutImageRecipePolicyResponse (Prelude.Maybe Prelude.Text)
putImageRecipePolicyResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> PutImageRecipePolicyResponse -> f PutImageRecipePolicyResponse
putImageRecipePolicyResponse_requestId = (PutImageRecipePolicyResponse -> Maybe Text)
-> (PutImageRecipePolicyResponse
-> Maybe Text -> PutImageRecipePolicyResponse)
-> Lens
PutImageRecipePolicyResponse
PutImageRecipePolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImageRecipePolicyResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:PutImageRecipePolicyResponse' :: PutImageRecipePolicyResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: PutImageRecipePolicyResponse
s@PutImageRecipePolicyResponse' {} Maybe Text
a -> PutImageRecipePolicyResponse
s {$sel:requestId:PutImageRecipePolicyResponse' :: Maybe Text
requestId = Maybe Text
a} :: PutImageRecipePolicyResponse)
putImageRecipePolicyResponse_imageRecipeArn :: Lens.Lens' PutImageRecipePolicyResponse (Prelude.Maybe Prelude.Text)
putImageRecipePolicyResponse_imageRecipeArn :: (Maybe Text -> f (Maybe Text))
-> PutImageRecipePolicyResponse -> f PutImageRecipePolicyResponse
putImageRecipePolicyResponse_imageRecipeArn = (PutImageRecipePolicyResponse -> Maybe Text)
-> (PutImageRecipePolicyResponse
-> Maybe Text -> PutImageRecipePolicyResponse)
-> Lens
PutImageRecipePolicyResponse
PutImageRecipePolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImageRecipePolicyResponse' {Maybe Text
imageRecipeArn :: Maybe Text
$sel:imageRecipeArn:PutImageRecipePolicyResponse' :: PutImageRecipePolicyResponse -> Maybe Text
imageRecipeArn} -> Maybe Text
imageRecipeArn) (\s :: PutImageRecipePolicyResponse
s@PutImageRecipePolicyResponse' {} Maybe Text
a -> PutImageRecipePolicyResponse
s {$sel:imageRecipeArn:PutImageRecipePolicyResponse' :: Maybe Text
imageRecipeArn = Maybe Text
a} :: PutImageRecipePolicyResponse)
putImageRecipePolicyResponse_httpStatus :: Lens.Lens' PutImageRecipePolicyResponse Prelude.Int
putImageRecipePolicyResponse_httpStatus :: (Int -> f Int)
-> PutImageRecipePolicyResponse -> f PutImageRecipePolicyResponse
putImageRecipePolicyResponse_httpStatus = (PutImageRecipePolicyResponse -> Int)
-> (PutImageRecipePolicyResponse
-> Int -> PutImageRecipePolicyResponse)
-> Lens
PutImageRecipePolicyResponse PutImageRecipePolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImageRecipePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutImageRecipePolicyResponse' :: PutImageRecipePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutImageRecipePolicyResponse
s@PutImageRecipePolicyResponse' {} Int
a -> PutImageRecipePolicyResponse
s {$sel:httpStatus:PutImageRecipePolicyResponse' :: Int
httpStatus = Int
a} :: PutImageRecipePolicyResponse)
instance Prelude.NFData PutImageRecipePolicyResponse