{-# 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.PutComponentPolicy
(
PutComponentPolicy (..),
newPutComponentPolicy,
putComponentPolicy_componentArn,
putComponentPolicy_policy,
PutComponentPolicyResponse (..),
newPutComponentPolicyResponse,
putComponentPolicyResponse_componentArn,
putComponentPolicyResponse_requestId,
putComponentPolicyResponse_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 PutComponentPolicy = PutComponentPolicy'
{
PutComponentPolicy -> Text
componentArn :: Prelude.Text,
PutComponentPolicy -> Text
policy :: Prelude.Text
}
deriving (PutComponentPolicy -> PutComponentPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutComponentPolicy -> PutComponentPolicy -> Bool
$c/= :: PutComponentPolicy -> PutComponentPolicy -> Bool
== :: PutComponentPolicy -> PutComponentPolicy -> Bool
$c== :: PutComponentPolicy -> PutComponentPolicy -> Bool
Prelude.Eq, ReadPrec [PutComponentPolicy]
ReadPrec PutComponentPolicy
Int -> ReadS PutComponentPolicy
ReadS [PutComponentPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutComponentPolicy]
$creadListPrec :: ReadPrec [PutComponentPolicy]
readPrec :: ReadPrec PutComponentPolicy
$creadPrec :: ReadPrec PutComponentPolicy
readList :: ReadS [PutComponentPolicy]
$creadList :: ReadS [PutComponentPolicy]
readsPrec :: Int -> ReadS PutComponentPolicy
$creadsPrec :: Int -> ReadS PutComponentPolicy
Prelude.Read, Int -> PutComponentPolicy -> ShowS
[PutComponentPolicy] -> ShowS
PutComponentPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutComponentPolicy] -> ShowS
$cshowList :: [PutComponentPolicy] -> ShowS
show :: PutComponentPolicy -> String
$cshow :: PutComponentPolicy -> String
showsPrec :: Int -> PutComponentPolicy -> ShowS
$cshowsPrec :: Int -> PutComponentPolicy -> ShowS
Prelude.Show, forall x. Rep PutComponentPolicy x -> PutComponentPolicy
forall x. PutComponentPolicy -> Rep PutComponentPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutComponentPolicy x -> PutComponentPolicy
$cfrom :: forall x. PutComponentPolicy -> Rep PutComponentPolicy x
Prelude.Generic)
newPutComponentPolicy ::
Prelude.Text ->
Prelude.Text ->
PutComponentPolicy
newPutComponentPolicy :: Text -> Text -> PutComponentPolicy
newPutComponentPolicy Text
pComponentArn_ Text
pPolicy_ =
PutComponentPolicy'
{ $sel:componentArn:PutComponentPolicy' :: Text
componentArn = Text
pComponentArn_,
$sel:policy:PutComponentPolicy' :: Text
policy = Text
pPolicy_
}
putComponentPolicy_componentArn :: Lens.Lens' PutComponentPolicy Prelude.Text
putComponentPolicy_componentArn :: Lens' PutComponentPolicy Text
putComponentPolicy_componentArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutComponentPolicy' {Text
componentArn :: Text
$sel:componentArn:PutComponentPolicy' :: PutComponentPolicy -> Text
componentArn} -> Text
componentArn) (\s :: PutComponentPolicy
s@PutComponentPolicy' {} Text
a -> PutComponentPolicy
s {$sel:componentArn:PutComponentPolicy' :: Text
componentArn = Text
a} :: PutComponentPolicy)
putComponentPolicy_policy :: Lens.Lens' PutComponentPolicy Prelude.Text
putComponentPolicy_policy :: Lens' PutComponentPolicy Text
putComponentPolicy_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutComponentPolicy' {Text
policy :: Text
$sel:policy:PutComponentPolicy' :: PutComponentPolicy -> Text
policy} -> Text
policy) (\s :: PutComponentPolicy
s@PutComponentPolicy' {} Text
a -> PutComponentPolicy
s {$sel:policy:PutComponentPolicy' :: Text
policy = Text
a} :: PutComponentPolicy)
instance Core.AWSRequest PutComponentPolicy where
type
AWSResponse PutComponentPolicy =
PutComponentPolicyResponse
request :: (Service -> Service)
-> PutComponentPolicy -> Request PutComponentPolicy
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 PutComponentPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutComponentPolicy)))
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 -> PutComponentPolicyResponse
PutComponentPolicyResponse'
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
"componentArn")
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 PutComponentPolicy where
hashWithSalt :: Int -> PutComponentPolicy -> Int
hashWithSalt Int
_salt PutComponentPolicy' {Text
policy :: Text
componentArn :: Text
$sel:policy:PutComponentPolicy' :: PutComponentPolicy -> Text
$sel:componentArn:PutComponentPolicy' :: PutComponentPolicy -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
componentArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policy
instance Prelude.NFData PutComponentPolicy where
rnf :: PutComponentPolicy -> ()
rnf PutComponentPolicy' {Text
policy :: Text
componentArn :: Text
$sel:policy:PutComponentPolicy' :: PutComponentPolicy -> Text
$sel:componentArn:PutComponentPolicy' :: PutComponentPolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
componentArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policy
instance Data.ToHeaders PutComponentPolicy where
toHeaders :: PutComponentPolicy -> 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 PutComponentPolicy where
toJSON :: PutComponentPolicy -> Value
toJSON PutComponentPolicy' {Text
policy :: Text
componentArn :: Text
$sel:policy:PutComponentPolicy' :: PutComponentPolicy -> Text
$sel:componentArn:PutComponentPolicy' :: PutComponentPolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"componentArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
componentArn),
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 PutComponentPolicy where
toPath :: PutComponentPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/PutComponentPolicy"
instance Data.ToQuery PutComponentPolicy where
toQuery :: PutComponentPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutComponentPolicyResponse = PutComponentPolicyResponse'
{
PutComponentPolicyResponse -> Maybe Text
componentArn :: Prelude.Maybe Prelude.Text,
PutComponentPolicyResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
PutComponentPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutComponentPolicyResponse -> PutComponentPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutComponentPolicyResponse -> PutComponentPolicyResponse -> Bool
$c/= :: PutComponentPolicyResponse -> PutComponentPolicyResponse -> Bool
== :: PutComponentPolicyResponse -> PutComponentPolicyResponse -> Bool
$c== :: PutComponentPolicyResponse -> PutComponentPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutComponentPolicyResponse]
ReadPrec PutComponentPolicyResponse
Int -> ReadS PutComponentPolicyResponse
ReadS [PutComponentPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutComponentPolicyResponse]
$creadListPrec :: ReadPrec [PutComponentPolicyResponse]
readPrec :: ReadPrec PutComponentPolicyResponse
$creadPrec :: ReadPrec PutComponentPolicyResponse
readList :: ReadS [PutComponentPolicyResponse]
$creadList :: ReadS [PutComponentPolicyResponse]
readsPrec :: Int -> ReadS PutComponentPolicyResponse
$creadsPrec :: Int -> ReadS PutComponentPolicyResponse
Prelude.Read, Int -> PutComponentPolicyResponse -> ShowS
[PutComponentPolicyResponse] -> ShowS
PutComponentPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutComponentPolicyResponse] -> ShowS
$cshowList :: [PutComponentPolicyResponse] -> ShowS
show :: PutComponentPolicyResponse -> String
$cshow :: PutComponentPolicyResponse -> String
showsPrec :: Int -> PutComponentPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutComponentPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep PutComponentPolicyResponse x -> PutComponentPolicyResponse
forall x.
PutComponentPolicyResponse -> Rep PutComponentPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutComponentPolicyResponse x -> PutComponentPolicyResponse
$cfrom :: forall x.
PutComponentPolicyResponse -> Rep PutComponentPolicyResponse x
Prelude.Generic)
newPutComponentPolicyResponse ::
Prelude.Int ->
PutComponentPolicyResponse
newPutComponentPolicyResponse :: Int -> PutComponentPolicyResponse
newPutComponentPolicyResponse Int
pHttpStatus_ =
PutComponentPolicyResponse'
{ $sel:componentArn:PutComponentPolicyResponse' :: Maybe Text
componentArn =
forall a. Maybe a
Prelude.Nothing,
$sel:requestId:PutComponentPolicyResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutComponentPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putComponentPolicyResponse_componentArn :: Lens.Lens' PutComponentPolicyResponse (Prelude.Maybe Prelude.Text)
putComponentPolicyResponse_componentArn :: Lens' PutComponentPolicyResponse (Maybe Text)
putComponentPolicyResponse_componentArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutComponentPolicyResponse' {Maybe Text
componentArn :: Maybe Text
$sel:componentArn:PutComponentPolicyResponse' :: PutComponentPolicyResponse -> Maybe Text
componentArn} -> Maybe Text
componentArn) (\s :: PutComponentPolicyResponse
s@PutComponentPolicyResponse' {} Maybe Text
a -> PutComponentPolicyResponse
s {$sel:componentArn:PutComponentPolicyResponse' :: Maybe Text
componentArn = Maybe Text
a} :: PutComponentPolicyResponse)
putComponentPolicyResponse_requestId :: Lens.Lens' PutComponentPolicyResponse (Prelude.Maybe Prelude.Text)
putComponentPolicyResponse_requestId :: Lens' PutComponentPolicyResponse (Maybe Text)
putComponentPolicyResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutComponentPolicyResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:PutComponentPolicyResponse' :: PutComponentPolicyResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: PutComponentPolicyResponse
s@PutComponentPolicyResponse' {} Maybe Text
a -> PutComponentPolicyResponse
s {$sel:requestId:PutComponentPolicyResponse' :: Maybe Text
requestId = Maybe Text
a} :: PutComponentPolicyResponse)
putComponentPolicyResponse_httpStatus :: Lens.Lens' PutComponentPolicyResponse Prelude.Int
putComponentPolicyResponse_httpStatus :: Lens' PutComponentPolicyResponse Int
putComponentPolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutComponentPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutComponentPolicyResponse' :: PutComponentPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutComponentPolicyResponse
s@PutComponentPolicyResponse' {} Int
a -> PutComponentPolicyResponse
s {$sel:httpStatus:PutComponentPolicyResponse' :: Int
httpStatus = Int
a} :: PutComponentPolicyResponse)
instance Prelude.NFData PutComponentPolicyResponse where
rnf :: PutComponentPolicyResponse -> ()
rnf PutComponentPolicyResponse' {Int
Maybe Text
httpStatus :: Int
requestId :: Maybe Text
componentArn :: Maybe Text
$sel:httpStatus:PutComponentPolicyResponse' :: PutComponentPolicyResponse -> Int
$sel:requestId:PutComponentPolicyResponse' :: PutComponentPolicyResponse -> Maybe Text
$sel:componentArn:PutComponentPolicyResponse' :: PutComponentPolicyResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentArn
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