{-# 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.GreengrassV2.GetComponent
(
GetComponent (..),
newGetComponent,
getComponent_recipeOutputFormat,
getComponent_arn,
GetComponentResponse (..),
newGetComponentResponse,
getComponentResponse_tags,
getComponentResponse_httpStatus,
getComponentResponse_recipeOutputFormat,
getComponentResponse_recipe,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GreengrassV2.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 -> Maybe RecipeOutputFormat
recipeOutputFormat :: Prelude.Maybe RecipeOutputFormat,
GetComponent -> Text
arn :: 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
pArn_ =
GetComponent' :: Maybe RecipeOutputFormat -> Text -> GetComponent
GetComponent'
{ $sel:recipeOutputFormat:GetComponent' :: Maybe RecipeOutputFormat
recipeOutputFormat = Maybe RecipeOutputFormat
forall a. Maybe a
Prelude.Nothing,
$sel:arn:GetComponent' :: Text
arn = Text
pArn_
}
getComponent_recipeOutputFormat :: Lens.Lens' GetComponent (Prelude.Maybe RecipeOutputFormat)
getComponent_recipeOutputFormat :: (Maybe RecipeOutputFormat -> f (Maybe RecipeOutputFormat))
-> GetComponent -> f GetComponent
getComponent_recipeOutputFormat = (GetComponent -> Maybe RecipeOutputFormat)
-> (GetComponent -> Maybe RecipeOutputFormat -> GetComponent)
-> Lens
GetComponent
GetComponent
(Maybe RecipeOutputFormat)
(Maybe RecipeOutputFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponent' {Maybe RecipeOutputFormat
recipeOutputFormat :: Maybe RecipeOutputFormat
$sel:recipeOutputFormat:GetComponent' :: GetComponent -> Maybe RecipeOutputFormat
recipeOutputFormat} -> Maybe RecipeOutputFormat
recipeOutputFormat) (\s :: GetComponent
s@GetComponent' {} Maybe RecipeOutputFormat
a -> GetComponent
s {$sel:recipeOutputFormat:GetComponent' :: Maybe RecipeOutputFormat
recipeOutputFormat = Maybe RecipeOutputFormat
a} :: GetComponent)
getComponent_arn :: Lens.Lens' GetComponent Prelude.Text
getComponent_arn :: (Text -> f Text) -> GetComponent -> f GetComponent
getComponent_arn = (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
arn :: Text
$sel:arn:GetComponent' :: GetComponent -> Text
arn} -> Text
arn) (\s :: GetComponent
s@GetComponent' {} Text
a -> GetComponent
s {$sel:arn:GetComponent' :: Text
arn = 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 (HashMap Text Text)
-> Int -> RecipeOutputFormat -> Base64 -> GetComponentResponse
GetComponentResponse'
(Maybe (HashMap Text Text)
-> Int -> RecipeOutputFormat -> Base64 -> GetComponentResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either
String
(Int -> RecipeOutputFormat -> Base64 -> GetComponentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tags" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Either
String
(Int -> RecipeOutputFormat -> Base64 -> GetComponentResponse)
-> Either String Int
-> Either
String (RecipeOutputFormat -> Base64 -> 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))
Either
String (RecipeOutputFormat -> Base64 -> GetComponentResponse)
-> Either String RecipeOutputFormat
-> Either String (Base64 -> GetComponentResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String RecipeOutputFormat
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"recipeOutputFormat")
Either String (Base64 -> GetComponentResponse)
-> Either String Base64 -> Either String GetComponentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Base64
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"recipe")
)
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 GetComponent' {Maybe RecipeOutputFormat
Text
arn :: Text
recipeOutputFormat :: Maybe RecipeOutputFormat
$sel:arn:GetComponent' :: GetComponent -> Text
$sel:recipeOutputFormat:GetComponent' :: GetComponent -> Maybe RecipeOutputFormat
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/greengrass/v2/components/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
arn]
instance Core.ToQuery GetComponent where
toQuery :: GetComponent -> QueryString
toQuery GetComponent' {Maybe RecipeOutputFormat
Text
arn :: Text
recipeOutputFormat :: Maybe RecipeOutputFormat
$sel:arn:GetComponent' :: GetComponent -> Text
$sel:recipeOutputFormat:GetComponent' :: GetComponent -> Maybe RecipeOutputFormat
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"recipeOutputFormat" ByteString -> Maybe RecipeOutputFormat -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe RecipeOutputFormat
recipeOutputFormat]
data GetComponentResponse = GetComponentResponse'
{
GetComponentResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GetComponentResponse -> Int
httpStatus :: Prelude.Int,
GetComponentResponse -> RecipeOutputFormat
recipeOutputFormat :: RecipeOutputFormat,
GetComponentResponse -> Base64
recipe :: Core.Base64
}
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 ->
RecipeOutputFormat ->
Prelude.ByteString ->
GetComponentResponse
newGetComponentResponse :: Int -> RecipeOutputFormat -> ByteString -> GetComponentResponse
newGetComponentResponse
Int
pHttpStatus_
RecipeOutputFormat
pRecipeOutputFormat_
ByteString
pRecipe_ =
GetComponentResponse' :: Maybe (HashMap Text Text)
-> Int -> RecipeOutputFormat -> Base64 -> GetComponentResponse
GetComponentResponse'
{ $sel:tags:GetComponentResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetComponentResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:recipeOutputFormat:GetComponentResponse' :: RecipeOutputFormat
recipeOutputFormat = RecipeOutputFormat
pRecipeOutputFormat_,
$sel:recipe:GetComponentResponse' :: Base64
recipe = Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64 (Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64))
-> ByteString -> Base64
forall t b. AReview t b -> b -> t
Lens.# ByteString
pRecipe_
}
getComponentResponse_tags :: Lens.Lens' GetComponentResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getComponentResponse_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetComponentResponse -> f GetComponentResponse
getComponentResponse_tags = (GetComponentResponse -> Maybe (HashMap Text Text))
-> (GetComponentResponse
-> Maybe (HashMap Text Text) -> GetComponentResponse)
-> Lens
GetComponentResponse
GetComponentResponse
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:GetComponentResponse' :: GetComponentResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: GetComponentResponse
s@GetComponentResponse' {} Maybe (HashMap Text Text)
a -> GetComponentResponse
s {$sel:tags:GetComponentResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: GetComponentResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetComponentResponse -> f GetComponentResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetComponentResponse
-> f GetComponentResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
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)
getComponentResponse_recipeOutputFormat :: Lens.Lens' GetComponentResponse RecipeOutputFormat
getComponentResponse_recipeOutputFormat :: (RecipeOutputFormat -> f RecipeOutputFormat)
-> GetComponentResponse -> f GetComponentResponse
getComponentResponse_recipeOutputFormat = (GetComponentResponse -> RecipeOutputFormat)
-> (GetComponentResponse
-> RecipeOutputFormat -> GetComponentResponse)
-> Lens
GetComponentResponse
GetComponentResponse
RecipeOutputFormat
RecipeOutputFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentResponse' {RecipeOutputFormat
recipeOutputFormat :: RecipeOutputFormat
$sel:recipeOutputFormat:GetComponentResponse' :: GetComponentResponse -> RecipeOutputFormat
recipeOutputFormat} -> RecipeOutputFormat
recipeOutputFormat) (\s :: GetComponentResponse
s@GetComponentResponse' {} RecipeOutputFormat
a -> GetComponentResponse
s {$sel:recipeOutputFormat:GetComponentResponse' :: RecipeOutputFormat
recipeOutputFormat = RecipeOutputFormat
a} :: GetComponentResponse)
getComponentResponse_recipe :: Lens.Lens' GetComponentResponse Prelude.ByteString
getComponentResponse_recipe :: (ByteString -> f ByteString)
-> GetComponentResponse -> f GetComponentResponse
getComponentResponse_recipe = (GetComponentResponse -> Base64)
-> (GetComponentResponse -> Base64 -> GetComponentResponse)
-> Lens GetComponentResponse GetComponentResponse Base64 Base64
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetComponentResponse' {Base64
recipe :: Base64
$sel:recipe:GetComponentResponse' :: GetComponentResponse -> Base64
recipe} -> Base64
recipe) (\s :: GetComponentResponse
s@GetComponentResponse' {} Base64
a -> GetComponentResponse
s {$sel:recipe:GetComponentResponse' :: Base64
recipe = Base64
a} :: GetComponentResponse) ((Base64 -> f Base64)
-> GetComponentResponse -> f GetComponentResponse)
-> ((ByteString -> f ByteString) -> Base64 -> f Base64)
-> (ByteString -> f ByteString)
-> GetComponentResponse
-> f GetComponentResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ByteString -> f ByteString) -> Base64 -> f Base64
Iso' Base64 ByteString
Core._Base64
instance Prelude.NFData GetComponentResponse