{-# 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.GetComponent
(
GetComponent (..),
newGetComponent,
getComponent_componentBuildVersionArn,
GetComponentResponse (..),
newGetComponentResponse,
getComponentResponse_requestId,
getComponentResponse_component,
getComponentResponse_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 GetComponent = GetComponent'
{
GetComponent -> Text
componentBuildVersionArn :: Prelude.Text
}
deriving (GetComponent -> GetComponent -> Bool
(GetComponent -> GetComponent -> Bool)
-> (GetComponent -> GetComponent -> Bool) -> Eq GetComponent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetComponent -> GetComponent -> Bool
$c/= :: GetComponent -> GetComponent -> Bool
== :: GetComponent -> GetComponent -> Bool
$c== :: GetComponent -> GetComponent -> Bool
Prelude.Eq, ReadPrec [GetComponent]
ReadPrec GetComponent
Int -> ReadS GetComponent
ReadS [GetComponent]
(Int -> ReadS GetComponent)
-> ReadS [GetComponent]
-> ReadPrec GetComponent
-> ReadPrec [GetComponent]
-> Read GetComponent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetComponent]
$creadListPrec :: ReadPrec [GetComponent]
readPrec :: ReadPrec GetComponent
$creadPrec :: ReadPrec GetComponent
readList :: ReadS [GetComponent]
$creadList :: ReadS [GetComponent]
readsPrec :: Int -> ReadS GetComponent
$creadsPrec :: Int -> ReadS GetComponent
Prelude.Read, Int -> GetComponent -> ShowS
[GetComponent] -> ShowS
GetComponent -> String
(Int -> GetComponent -> ShowS)
-> (GetComponent -> String)
-> ([GetComponent] -> ShowS)
-> Show GetComponent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetComponent] -> ShowS
$cshowList :: [GetComponent] -> ShowS
show :: GetComponent -> String
$cshow :: GetComponent -> String
showsPrec :: Int -> GetComponent -> ShowS
$cshowsPrec :: Int -> GetComponent -> ShowS
Prelude.Show, (forall x. GetComponent -> Rep GetComponent x)
-> (forall x. Rep GetComponent x -> GetComponent)
-> Generic GetComponent
forall x. Rep GetComponent x -> GetComponent
forall x. GetComponent -> Rep GetComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetComponent x -> GetComponent
$cfrom :: forall x. GetComponent -> Rep GetComponent x
Prelude.Generic)
newGetComponent ::
Prelude.Text ->
GetComponent
newGetComponent :: Text -> GetComponent
newGetComponent Text
pComponentBuildVersionArn_ =
GetComponent' :: Text -> GetComponent
GetComponent'
{ $sel:componentBuildVersionArn:GetComponent' :: Text
componentBuildVersionArn =
Text
pComponentBuildVersionArn_
}
getComponent_componentBuildVersionArn :: Lens.Lens' GetComponent Prelude.Text
getComponent_componentBuildVersionArn :: (Text -> f Text) -> GetComponent -> f GetComponent
getComponent_componentBuildVersionArn = (GetComponent -> Text)
-> (GetComponent -> Text -> GetComponent)
-> Lens GetComponent GetComponent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponent' {Text
componentBuildVersionArn :: Text
$sel:componentBuildVersionArn:GetComponent' :: GetComponent -> Text
componentBuildVersionArn} -> Text
componentBuildVersionArn) (\s :: GetComponent
s@GetComponent' {} Text
a -> GetComponent
s {$sel:componentBuildVersionArn:GetComponent' :: Text
componentBuildVersionArn = Text
a} :: GetComponent)
instance Core.AWSRequest GetComponent where
type AWSResponse GetComponent = GetComponentResponse
request :: GetComponent -> Request GetComponent
request = Service -> GetComponent -> Request GetComponent
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetComponent)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetComponent))
-> Logger
-> Service
-> Proxy GetComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetComponent)))
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 Component -> Int -> GetComponentResponse
GetComponentResponse'
(Maybe Text -> Maybe Component -> Int -> GetComponentResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Component -> Int -> GetComponentResponse)
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 Component -> Int -> GetComponentResponse)
-> Either String (Maybe Component)
-> Either String (Int -> GetComponentResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Component)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"component")
Either String (Int -> GetComponentResponse)
-> Either String Int -> Either String GetComponentResponse
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 GetComponent
instance Prelude.NFData GetComponent
instance Core.ToHeaders GetComponent where
toHeaders :: GetComponent -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetComponent -> 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 GetComponent where
toPath :: GetComponent -> ByteString
toPath = ByteString -> GetComponent -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/GetComponent"
instance Core.ToQuery GetComponent where
toQuery :: GetComponent -> QueryString
toQuery GetComponent' {Text
componentBuildVersionArn :: Text
$sel:componentBuildVersionArn:GetComponent' :: GetComponent -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"componentBuildVersionArn"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
componentBuildVersionArn
]
data GetComponentResponse = GetComponentResponse'
{
GetComponentResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
GetComponentResponse -> Maybe Component
component :: Prelude.Maybe Component,
GetComponentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetComponentResponse -> GetComponentResponse -> Bool
(GetComponentResponse -> GetComponentResponse -> Bool)
-> (GetComponentResponse -> GetComponentResponse -> Bool)
-> Eq GetComponentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetComponentResponse -> GetComponentResponse -> Bool
$c/= :: GetComponentResponse -> GetComponentResponse -> Bool
== :: GetComponentResponse -> GetComponentResponse -> Bool
$c== :: GetComponentResponse -> GetComponentResponse -> Bool
Prelude.Eq, ReadPrec [GetComponentResponse]
ReadPrec GetComponentResponse
Int -> ReadS GetComponentResponse
ReadS [GetComponentResponse]
(Int -> ReadS GetComponentResponse)
-> ReadS [GetComponentResponse]
-> ReadPrec GetComponentResponse
-> ReadPrec [GetComponentResponse]
-> Read GetComponentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetComponentResponse]
$creadListPrec :: ReadPrec [GetComponentResponse]
readPrec :: ReadPrec GetComponentResponse
$creadPrec :: ReadPrec GetComponentResponse
readList :: ReadS [GetComponentResponse]
$creadList :: ReadS [GetComponentResponse]
readsPrec :: Int -> ReadS GetComponentResponse
$creadsPrec :: Int -> ReadS GetComponentResponse
Prelude.Read, Int -> GetComponentResponse -> ShowS
[GetComponentResponse] -> ShowS
GetComponentResponse -> String
(Int -> GetComponentResponse -> ShowS)
-> (GetComponentResponse -> String)
-> ([GetComponentResponse] -> ShowS)
-> Show GetComponentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetComponentResponse] -> ShowS
$cshowList :: [GetComponentResponse] -> ShowS
show :: GetComponentResponse -> String
$cshow :: GetComponentResponse -> String
showsPrec :: Int -> GetComponentResponse -> ShowS
$cshowsPrec :: Int -> GetComponentResponse -> ShowS
Prelude.Show, (forall x. GetComponentResponse -> Rep GetComponentResponse x)
-> (forall x. Rep GetComponentResponse x -> GetComponentResponse)
-> Generic GetComponentResponse
forall x. Rep GetComponentResponse x -> GetComponentResponse
forall x. GetComponentResponse -> Rep GetComponentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetComponentResponse x -> GetComponentResponse
$cfrom :: forall x. GetComponentResponse -> Rep GetComponentResponse x
Prelude.Generic)
newGetComponentResponse ::
Prelude.Int ->
GetComponentResponse
newGetComponentResponse :: Int -> GetComponentResponse
newGetComponentResponse Int
pHttpStatus_ =
GetComponentResponse' :: Maybe Text -> Maybe Component -> Int -> GetComponentResponse
GetComponentResponse'
{ $sel:requestId:GetComponentResponse' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:component:GetComponentResponse' :: Maybe Component
component = Maybe Component
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetComponentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getComponentResponse_requestId :: Lens.Lens' GetComponentResponse (Prelude.Maybe Prelude.Text)
getComponentResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> GetComponentResponse -> f GetComponentResponse
getComponentResponse_requestId = (GetComponentResponse -> Maybe Text)
-> (GetComponentResponse -> Maybe Text -> GetComponentResponse)
-> Lens
GetComponentResponse GetComponentResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:GetComponentResponse' :: GetComponentResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: GetComponentResponse
s@GetComponentResponse' {} Maybe Text
a -> GetComponentResponse
s {$sel:requestId:GetComponentResponse' :: Maybe Text
requestId = Maybe Text
a} :: GetComponentResponse)
getComponentResponse_component :: Lens.Lens' GetComponentResponse (Prelude.Maybe Component)
getComponentResponse_component :: (Maybe Component -> f (Maybe Component))
-> GetComponentResponse -> f GetComponentResponse
getComponentResponse_component = (GetComponentResponse -> Maybe Component)
-> (GetComponentResponse
-> Maybe Component -> GetComponentResponse)
-> Lens
GetComponentResponse
GetComponentResponse
(Maybe Component)
(Maybe Component)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentResponse' {Maybe Component
component :: Maybe Component
$sel:component:GetComponentResponse' :: GetComponentResponse -> Maybe Component
component} -> Maybe Component
component) (\s :: GetComponentResponse
s@GetComponentResponse' {} Maybe Component
a -> GetComponentResponse
s {$sel:component:GetComponentResponse' :: Maybe Component
component = Maybe Component
a} :: GetComponentResponse)
getComponentResponse_httpStatus :: Lens.Lens' GetComponentResponse Prelude.Int
getComponentResponse_httpStatus :: (Int -> f Int) -> GetComponentResponse -> f GetComponentResponse
getComponentResponse_httpStatus = (GetComponentResponse -> Int)
-> (GetComponentResponse -> Int -> GetComponentResponse)
-> Lens GetComponentResponse GetComponentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetComponentResponse' :: GetComponentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetComponentResponse
s@GetComponentResponse' {} Int
a -> GetComponentResponse
s {$sel:httpStatus:GetComponentResponse' :: Int
httpStatus = Int
a} :: GetComponentResponse)
instance Prelude.NFData GetComponentResponse