{-# 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_policy,
getComponentPolicyResponse_requestId,
getComponentPolicyResponse_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 GetComponentPolicy = GetComponentPolicy'
{
GetComponentPolicy -> Text
componentArn :: Prelude.Text
}
deriving (GetComponentPolicy -> GetComponentPolicy -> Bool
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]
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
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. 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' {$sel:componentArn:GetComponentPolicy' :: Text
componentArn = Text
pComponentArn_}
getComponentPolicy_componentArn :: Lens.Lens' GetComponentPolicy Prelude.Text
getComponentPolicy_componentArn :: Lens' GetComponentPolicy Text
getComponentPolicy_componentArn = 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 :: (Service -> Service)
-> GetComponentPolicy -> Request GetComponentPolicy
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetComponentPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetComponentPolicy)))
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 -> GetComponentPolicyResponse
GetComponentPolicyResponse'
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
"policy")
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 GetComponentPolicy where
hashWithSalt :: Int -> GetComponentPolicy -> Int
hashWithSalt Int
_salt GetComponentPolicy' {Text
componentArn :: Text
$sel:componentArn:GetComponentPolicy' :: GetComponentPolicy -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
componentArn
instance Prelude.NFData GetComponentPolicy where
rnf :: GetComponentPolicy -> ()
rnf GetComponentPolicy' {Text
componentArn :: Text
$sel:componentArn:GetComponentPolicy' :: GetComponentPolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
componentArn
instance Data.ToHeaders GetComponentPolicy where
toHeaders :: GetComponentPolicy -> 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.ToPath GetComponentPolicy where
toPath :: GetComponentPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/GetComponentPolicy"
instance Data.ToQuery GetComponentPolicy where
toQuery :: GetComponentPolicy -> QueryString
toQuery GetComponentPolicy' {Text
componentArn :: Text
$sel:componentArn:GetComponentPolicy' :: GetComponentPolicy -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"componentArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
componentArn]
data GetComponentPolicyResponse = GetComponentPolicyResponse'
{
GetComponentPolicyResponse -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
GetComponentPolicyResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
GetComponentPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetComponentPolicyResponse -> GetComponentPolicyResponse -> Bool
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]
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
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.
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'
{ $sel:policy:GetComponentPolicyResponse' :: Maybe Text
policy =
forall a. Maybe a
Prelude.Nothing,
$sel:requestId:GetComponentPolicyResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetComponentPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getComponentPolicyResponse_policy :: Lens.Lens' GetComponentPolicyResponse (Prelude.Maybe Prelude.Text)
getComponentPolicyResponse_policy :: Lens' GetComponentPolicyResponse (Maybe Text)
getComponentPolicyResponse_policy = 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_requestId :: Lens.Lens' GetComponentPolicyResponse (Prelude.Maybe Prelude.Text)
getComponentPolicyResponse_requestId :: Lens' GetComponentPolicyResponse (Maybe Text)
getComponentPolicyResponse_requestId = 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_httpStatus :: Lens.Lens' GetComponentPolicyResponse Prelude.Int
getComponentPolicyResponse_httpStatus :: Lens' GetComponentPolicyResponse Int
getComponentPolicyResponse_httpStatus = 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 where
rnf :: GetComponentPolicyResponse -> ()
rnf GetComponentPolicyResponse' {Int
Maybe Text
httpStatus :: Int
requestId :: Maybe Text
policy :: Maybe Text
$sel:httpStatus:GetComponentPolicyResponse' :: GetComponentPolicyResponse -> Int
$sel:requestId:GetComponentPolicyResponse' :: GetComponentPolicyResponse -> Maybe Text
$sel:policy:GetComponentPolicyResponse' :: GetComponentPolicyResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
policy
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