{-# 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.GetComponentPolicy
(
GetComponentPolicy (..),
newGetComponentPolicy,
getComponentPolicy_componentArn,
GetComponentPolicyResponse (..),
newGetComponentPolicyResponse,
getComponentPolicyResponse_requestId,
getComponentPolicyResponse_policy,
getComponentPolicyResponse_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 GetComponentPolicy = GetComponentPolicy'
{
GetComponentPolicy -> Text
componentArn :: Prelude.Text
}
deriving (GetComponentPolicy -> GetComponentPolicy -> Bool
(GetComponentPolicy -> GetComponentPolicy -> Bool)
-> (GetComponentPolicy -> GetComponentPolicy -> Bool)
-> Eq GetComponentPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetComponentPolicy -> GetComponentPolicy -> Bool
$c/= :: GetComponentPolicy -> GetComponentPolicy -> Bool
== :: GetComponentPolicy -> GetComponentPolicy -> Bool
$c== :: GetComponentPolicy -> GetComponentPolicy -> Bool
Prelude.Eq, ReadPrec [GetComponentPolicy]
ReadPrec GetComponentPolicy
Int -> ReadS GetComponentPolicy
ReadS [GetComponentPolicy]
(Int -> ReadS GetComponentPolicy)
-> ReadS [GetComponentPolicy]
-> ReadPrec GetComponentPolicy
-> ReadPrec [GetComponentPolicy]
-> Read GetComponentPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetComponentPolicy]
$creadListPrec :: ReadPrec [GetComponentPolicy]
readPrec :: ReadPrec GetComponentPolicy
$creadPrec :: ReadPrec GetComponentPolicy
readList :: ReadS [GetComponentPolicy]
$creadList :: ReadS [GetComponentPolicy]
readsPrec :: Int -> ReadS GetComponentPolicy
$creadsPrec :: Int -> ReadS GetComponentPolicy
Prelude.Read, Int -> GetComponentPolicy -> ShowS
[GetComponentPolicy] -> ShowS
GetComponentPolicy -> String
(Int -> GetComponentPolicy -> ShowS)
-> (GetComponentPolicy -> String)
-> ([GetComponentPolicy] -> ShowS)
-> Show GetComponentPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetComponentPolicy] -> ShowS
$cshowList :: [GetComponentPolicy] -> ShowS
show :: GetComponentPolicy -> String
$cshow :: GetComponentPolicy -> String
showsPrec :: Int -> GetComponentPolicy -> ShowS
$cshowsPrec :: Int -> GetComponentPolicy -> ShowS
Prelude.Show, (forall x. GetComponentPolicy -> Rep GetComponentPolicy x)
-> (forall x. Rep GetComponentPolicy x -> GetComponentPolicy)
-> Generic GetComponentPolicy
forall x. Rep GetComponentPolicy x -> GetComponentPolicy
forall x. GetComponentPolicy -> Rep GetComponentPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetComponentPolicy x -> GetComponentPolicy
$cfrom :: forall x. GetComponentPolicy -> Rep GetComponentPolicy x
Prelude.Generic)
newGetComponentPolicy ::
Prelude.Text ->
GetComponentPolicy
newGetComponentPolicy :: Text -> GetComponentPolicy
newGetComponentPolicy Text
pComponentArn_ =
GetComponentPolicy' :: Text -> GetComponentPolicy
GetComponentPolicy' {$sel:componentArn:GetComponentPolicy' :: Text
componentArn = Text
pComponentArn_}
getComponentPolicy_componentArn :: Lens.Lens' GetComponentPolicy Prelude.Text
getComponentPolicy_componentArn :: (Text -> f Text) -> GetComponentPolicy -> f GetComponentPolicy
getComponentPolicy_componentArn = (GetComponentPolicy -> Text)
-> (GetComponentPolicy -> Text -> GetComponentPolicy)
-> Lens GetComponentPolicy GetComponentPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentPolicy' {Text
componentArn :: Text
$sel:componentArn:GetComponentPolicy' :: GetComponentPolicy -> Text
componentArn} -> Text
componentArn) (\s :: GetComponentPolicy
s@GetComponentPolicy' {} Text
a -> GetComponentPolicy
s {$sel:componentArn:GetComponentPolicy' :: Text
componentArn = Text
a} :: GetComponentPolicy)
instance Core.AWSRequest GetComponentPolicy where
type
AWSResponse GetComponentPolicy =
GetComponentPolicyResponse
request :: GetComponentPolicy -> Request GetComponentPolicy
request = Service -> GetComponentPolicy -> Request GetComponentPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetComponentPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetComponentPolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetComponentPolicy))
-> Logger
-> Service
-> Proxy GetComponentPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetComponentPolicy)))
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 -> GetComponentPolicyResponse
GetComponentPolicyResponse'
(Maybe Text -> Maybe Text -> Int -> GetComponentPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetComponentPolicyResponse)
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 -> GetComponentPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetComponentPolicyResponse)
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
"policy")
Either String (Int -> GetComponentPolicyResponse)
-> Either String Int -> Either String GetComponentPolicyResponse
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 GetComponentPolicy
instance Prelude.NFData GetComponentPolicy
instance Core.ToHeaders GetComponentPolicy where
toHeaders :: GetComponentPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetComponentPolicy -> 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.ToPath GetComponentPolicy where
toPath :: GetComponentPolicy -> ByteString
toPath = ByteString -> GetComponentPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/GetComponentPolicy"
instance Core.ToQuery GetComponentPolicy where
toQuery :: GetComponentPolicy -> QueryString
toQuery GetComponentPolicy' {Text
componentArn :: Text
$sel:componentArn:GetComponentPolicy' :: GetComponentPolicy -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"componentArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
componentArn]
data GetComponentPolicyResponse = GetComponentPolicyResponse'
{
GetComponentPolicyResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
GetComponentPolicyResponse -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
GetComponentPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetComponentPolicyResponse -> GetComponentPolicyResponse -> Bool
(GetComponentPolicyResponse -> GetComponentPolicyResponse -> Bool)
-> (GetComponentPolicyResponse
-> GetComponentPolicyResponse -> Bool)
-> Eq GetComponentPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetComponentPolicyResponse -> GetComponentPolicyResponse -> Bool
$c/= :: GetComponentPolicyResponse -> GetComponentPolicyResponse -> Bool
== :: GetComponentPolicyResponse -> GetComponentPolicyResponse -> Bool
$c== :: GetComponentPolicyResponse -> GetComponentPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetComponentPolicyResponse]
ReadPrec GetComponentPolicyResponse
Int -> ReadS GetComponentPolicyResponse
ReadS [GetComponentPolicyResponse]
(Int -> ReadS GetComponentPolicyResponse)
-> ReadS [GetComponentPolicyResponse]
-> ReadPrec GetComponentPolicyResponse
-> ReadPrec [GetComponentPolicyResponse]
-> Read GetComponentPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetComponentPolicyResponse]
$creadListPrec :: ReadPrec [GetComponentPolicyResponse]
readPrec :: ReadPrec GetComponentPolicyResponse
$creadPrec :: ReadPrec GetComponentPolicyResponse
readList :: ReadS [GetComponentPolicyResponse]
$creadList :: ReadS [GetComponentPolicyResponse]
readsPrec :: Int -> ReadS GetComponentPolicyResponse
$creadsPrec :: Int -> ReadS GetComponentPolicyResponse
Prelude.Read, Int -> GetComponentPolicyResponse -> ShowS
[GetComponentPolicyResponse] -> ShowS
GetComponentPolicyResponse -> String
(Int -> GetComponentPolicyResponse -> ShowS)
-> (GetComponentPolicyResponse -> String)
-> ([GetComponentPolicyResponse] -> ShowS)
-> Show GetComponentPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetComponentPolicyResponse] -> ShowS
$cshowList :: [GetComponentPolicyResponse] -> ShowS
show :: GetComponentPolicyResponse -> String
$cshow :: GetComponentPolicyResponse -> String
showsPrec :: Int -> GetComponentPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetComponentPolicyResponse -> ShowS
Prelude.Show, (forall x.
GetComponentPolicyResponse -> Rep GetComponentPolicyResponse x)
-> (forall x.
Rep GetComponentPolicyResponse x -> GetComponentPolicyResponse)
-> Generic GetComponentPolicyResponse
forall x.
Rep GetComponentPolicyResponse x -> GetComponentPolicyResponse
forall x.
GetComponentPolicyResponse -> Rep GetComponentPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetComponentPolicyResponse x -> GetComponentPolicyResponse
$cfrom :: forall x.
GetComponentPolicyResponse -> Rep GetComponentPolicyResponse x
Prelude.Generic)
newGetComponentPolicyResponse ::
Prelude.Int ->
GetComponentPolicyResponse
newGetComponentPolicyResponse :: Int -> GetComponentPolicyResponse
newGetComponentPolicyResponse Int
pHttpStatus_ =
GetComponentPolicyResponse' :: Maybe Text -> Maybe Text -> Int -> GetComponentPolicyResponse
GetComponentPolicyResponse'
{ $sel:requestId:GetComponentPolicyResponse' :: Maybe Text
requestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policy:GetComponentPolicyResponse' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetComponentPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getComponentPolicyResponse_requestId :: Lens.Lens' GetComponentPolicyResponse (Prelude.Maybe Prelude.Text)
getComponentPolicyResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> GetComponentPolicyResponse -> f GetComponentPolicyResponse
getComponentPolicyResponse_requestId = (GetComponentPolicyResponse -> Maybe Text)
-> (GetComponentPolicyResponse
-> Maybe Text -> GetComponentPolicyResponse)
-> Lens
GetComponentPolicyResponse
GetComponentPolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentPolicyResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:GetComponentPolicyResponse' :: GetComponentPolicyResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: GetComponentPolicyResponse
s@GetComponentPolicyResponse' {} Maybe Text
a -> GetComponentPolicyResponse
s {$sel:requestId:GetComponentPolicyResponse' :: Maybe Text
requestId = Maybe Text
a} :: GetComponentPolicyResponse)
getComponentPolicyResponse_policy :: Lens.Lens' GetComponentPolicyResponse (Prelude.Maybe Prelude.Text)
getComponentPolicyResponse_policy :: (Maybe Text -> f (Maybe Text))
-> GetComponentPolicyResponse -> f GetComponentPolicyResponse
getComponentPolicyResponse_policy = (GetComponentPolicyResponse -> Maybe Text)
-> (GetComponentPolicyResponse
-> Maybe Text -> GetComponentPolicyResponse)
-> Lens
GetComponentPolicyResponse
GetComponentPolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentPolicyResponse' {Maybe Text
policy :: Maybe Text
$sel:policy:GetComponentPolicyResponse' :: GetComponentPolicyResponse -> Maybe Text
policy} -> Maybe Text
policy) (\s :: GetComponentPolicyResponse
s@GetComponentPolicyResponse' {} Maybe Text
a -> GetComponentPolicyResponse
s {$sel:policy:GetComponentPolicyResponse' :: Maybe Text
policy = Maybe Text
a} :: GetComponentPolicyResponse)
getComponentPolicyResponse_httpStatus :: Lens.Lens' GetComponentPolicyResponse Prelude.Int
getComponentPolicyResponse_httpStatus :: (Int -> f Int)
-> GetComponentPolicyResponse -> f GetComponentPolicyResponse
getComponentPolicyResponse_httpStatus = (GetComponentPolicyResponse -> Int)
-> (GetComponentPolicyResponse
-> Int -> GetComponentPolicyResponse)
-> Lens
GetComponentPolicyResponse GetComponentPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetComponentPolicyResponse' :: GetComponentPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetComponentPolicyResponse
s@GetComponentPolicyResponse' {} Int
a -> GetComponentPolicyResponse
s {$sel:httpStatus:GetComponentPolicyResponse' :: Int
httpStatus = Int
a} :: GetComponentPolicyResponse)
instance Prelude.NFData GetComponentPolicyResponse