{-# 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.Nimble.GetStudioComponent
(
GetStudioComponent (..),
newGetStudioComponent,
getStudioComponent_studioId,
getStudioComponent_studioComponentId,
GetStudioComponentResponse (..),
newGetStudioComponentResponse,
getStudioComponentResponse_studioComponent,
getStudioComponentResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Nimble.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetStudioComponent = GetStudioComponent'
{
GetStudioComponent -> Text
studioId :: Prelude.Text,
GetStudioComponent -> Text
studioComponentId :: Prelude.Text
}
deriving (GetStudioComponent -> GetStudioComponent -> Bool
(GetStudioComponent -> GetStudioComponent -> Bool)
-> (GetStudioComponent -> GetStudioComponent -> Bool)
-> Eq GetStudioComponent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStudioComponent -> GetStudioComponent -> Bool
$c/= :: GetStudioComponent -> GetStudioComponent -> Bool
== :: GetStudioComponent -> GetStudioComponent -> Bool
$c== :: GetStudioComponent -> GetStudioComponent -> Bool
Prelude.Eq, ReadPrec [GetStudioComponent]
ReadPrec GetStudioComponent
Int -> ReadS GetStudioComponent
ReadS [GetStudioComponent]
(Int -> ReadS GetStudioComponent)
-> ReadS [GetStudioComponent]
-> ReadPrec GetStudioComponent
-> ReadPrec [GetStudioComponent]
-> Read GetStudioComponent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStudioComponent]
$creadListPrec :: ReadPrec [GetStudioComponent]
readPrec :: ReadPrec GetStudioComponent
$creadPrec :: ReadPrec GetStudioComponent
readList :: ReadS [GetStudioComponent]
$creadList :: ReadS [GetStudioComponent]
readsPrec :: Int -> ReadS GetStudioComponent
$creadsPrec :: Int -> ReadS GetStudioComponent
Prelude.Read, Int -> GetStudioComponent -> ShowS
[GetStudioComponent] -> ShowS
GetStudioComponent -> String
(Int -> GetStudioComponent -> ShowS)
-> (GetStudioComponent -> String)
-> ([GetStudioComponent] -> ShowS)
-> Show GetStudioComponent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStudioComponent] -> ShowS
$cshowList :: [GetStudioComponent] -> ShowS
show :: GetStudioComponent -> String
$cshow :: GetStudioComponent -> String
showsPrec :: Int -> GetStudioComponent -> ShowS
$cshowsPrec :: Int -> GetStudioComponent -> ShowS
Prelude.Show, (forall x. GetStudioComponent -> Rep GetStudioComponent x)
-> (forall x. Rep GetStudioComponent x -> GetStudioComponent)
-> Generic GetStudioComponent
forall x. Rep GetStudioComponent x -> GetStudioComponent
forall x. GetStudioComponent -> Rep GetStudioComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStudioComponent x -> GetStudioComponent
$cfrom :: forall x. GetStudioComponent -> Rep GetStudioComponent x
Prelude.Generic)
newGetStudioComponent ::
Prelude.Text ->
Prelude.Text ->
GetStudioComponent
newGetStudioComponent :: Text -> Text -> GetStudioComponent
newGetStudioComponent Text
pStudioId_ Text
pStudioComponentId_ =
GetStudioComponent' :: Text -> Text -> GetStudioComponent
GetStudioComponent'
{ $sel:studioId:GetStudioComponent' :: Text
studioId = Text
pStudioId_,
$sel:studioComponentId:GetStudioComponent' :: Text
studioComponentId = Text
pStudioComponentId_
}
getStudioComponent_studioId :: Lens.Lens' GetStudioComponent Prelude.Text
getStudioComponent_studioId :: (Text -> f Text) -> GetStudioComponent -> f GetStudioComponent
getStudioComponent_studioId = (GetStudioComponent -> Text)
-> (GetStudioComponent -> Text -> GetStudioComponent)
-> Lens GetStudioComponent GetStudioComponent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStudioComponent' {Text
studioId :: Text
$sel:studioId:GetStudioComponent' :: GetStudioComponent -> Text
studioId} -> Text
studioId) (\s :: GetStudioComponent
s@GetStudioComponent' {} Text
a -> GetStudioComponent
s {$sel:studioId:GetStudioComponent' :: Text
studioId = Text
a} :: GetStudioComponent)
getStudioComponent_studioComponentId :: Lens.Lens' GetStudioComponent Prelude.Text
getStudioComponent_studioComponentId :: (Text -> f Text) -> GetStudioComponent -> f GetStudioComponent
getStudioComponent_studioComponentId = (GetStudioComponent -> Text)
-> (GetStudioComponent -> Text -> GetStudioComponent)
-> Lens GetStudioComponent GetStudioComponent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStudioComponent' {Text
studioComponentId :: Text
$sel:studioComponentId:GetStudioComponent' :: GetStudioComponent -> Text
studioComponentId} -> Text
studioComponentId) (\s :: GetStudioComponent
s@GetStudioComponent' {} Text
a -> GetStudioComponent
s {$sel:studioComponentId:GetStudioComponent' :: Text
studioComponentId = Text
a} :: GetStudioComponent)
instance Core.AWSRequest GetStudioComponent where
type
AWSResponse GetStudioComponent =
GetStudioComponentResponse
request :: GetStudioComponent -> Request GetStudioComponent
request = Service -> GetStudioComponent -> Request GetStudioComponent
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetStudioComponent
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetStudioComponent)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetStudioComponent))
-> Logger
-> Service
-> Proxy GetStudioComponent
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetStudioComponent)))
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 StudioComponent -> Int -> GetStudioComponentResponse
GetStudioComponentResponse'
(Maybe StudioComponent -> Int -> GetStudioComponentResponse)
-> Either String (Maybe StudioComponent)
-> Either String (Int -> GetStudioComponentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe StudioComponent)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"studioComponent")
Either String (Int -> GetStudioComponentResponse)
-> Either String Int -> Either String GetStudioComponentResponse
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 GetStudioComponent
instance Prelude.NFData GetStudioComponent
instance Core.ToHeaders GetStudioComponent where
toHeaders :: GetStudioComponent -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetStudioComponent -> 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 GetStudioComponent where
toPath :: GetStudioComponent -> ByteString
toPath GetStudioComponent' {Text
studioComponentId :: Text
studioId :: Text
$sel:studioComponentId:GetStudioComponent' :: GetStudioComponent -> Text
$sel:studioId:GetStudioComponent' :: GetStudioComponent -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-08-01/studios/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
studioId,
ByteString
"/studio-components/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
studioComponentId
]
instance Core.ToQuery GetStudioComponent where
toQuery :: GetStudioComponent -> QueryString
toQuery = QueryString -> GetStudioComponent -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetStudioComponentResponse = GetStudioComponentResponse'
{
GetStudioComponentResponse -> Maybe StudioComponent
studioComponent :: Prelude.Maybe StudioComponent,
GetStudioComponentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetStudioComponentResponse -> GetStudioComponentResponse -> Bool
(GetStudioComponentResponse -> GetStudioComponentResponse -> Bool)
-> (GetStudioComponentResponse
-> GetStudioComponentResponse -> Bool)
-> Eq GetStudioComponentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStudioComponentResponse -> GetStudioComponentResponse -> Bool
$c/= :: GetStudioComponentResponse -> GetStudioComponentResponse -> Bool
== :: GetStudioComponentResponse -> GetStudioComponentResponse -> Bool
$c== :: GetStudioComponentResponse -> GetStudioComponentResponse -> Bool
Prelude.Eq, ReadPrec [GetStudioComponentResponse]
ReadPrec GetStudioComponentResponse
Int -> ReadS GetStudioComponentResponse
ReadS [GetStudioComponentResponse]
(Int -> ReadS GetStudioComponentResponse)
-> ReadS [GetStudioComponentResponse]
-> ReadPrec GetStudioComponentResponse
-> ReadPrec [GetStudioComponentResponse]
-> Read GetStudioComponentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStudioComponentResponse]
$creadListPrec :: ReadPrec [GetStudioComponentResponse]
readPrec :: ReadPrec GetStudioComponentResponse
$creadPrec :: ReadPrec GetStudioComponentResponse
readList :: ReadS [GetStudioComponentResponse]
$creadList :: ReadS [GetStudioComponentResponse]
readsPrec :: Int -> ReadS GetStudioComponentResponse
$creadsPrec :: Int -> ReadS GetStudioComponentResponse
Prelude.Read, Int -> GetStudioComponentResponse -> ShowS
[GetStudioComponentResponse] -> ShowS
GetStudioComponentResponse -> String
(Int -> GetStudioComponentResponse -> ShowS)
-> (GetStudioComponentResponse -> String)
-> ([GetStudioComponentResponse] -> ShowS)
-> Show GetStudioComponentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStudioComponentResponse] -> ShowS
$cshowList :: [GetStudioComponentResponse] -> ShowS
show :: GetStudioComponentResponse -> String
$cshow :: GetStudioComponentResponse -> String
showsPrec :: Int -> GetStudioComponentResponse -> ShowS
$cshowsPrec :: Int -> GetStudioComponentResponse -> ShowS
Prelude.Show, (forall x.
GetStudioComponentResponse -> Rep GetStudioComponentResponse x)
-> (forall x.
Rep GetStudioComponentResponse x -> GetStudioComponentResponse)
-> Generic GetStudioComponentResponse
forall x.
Rep GetStudioComponentResponse x -> GetStudioComponentResponse
forall x.
GetStudioComponentResponse -> Rep GetStudioComponentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetStudioComponentResponse x -> GetStudioComponentResponse
$cfrom :: forall x.
GetStudioComponentResponse -> Rep GetStudioComponentResponse x
Prelude.Generic)
newGetStudioComponentResponse ::
Prelude.Int ->
GetStudioComponentResponse
newGetStudioComponentResponse :: Int -> GetStudioComponentResponse
newGetStudioComponentResponse Int
pHttpStatus_ =
GetStudioComponentResponse' :: Maybe StudioComponent -> Int -> GetStudioComponentResponse
GetStudioComponentResponse'
{ $sel:studioComponent:GetStudioComponentResponse' :: Maybe StudioComponent
studioComponent =
Maybe StudioComponent
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStudioComponentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStudioComponentResponse_studioComponent :: Lens.Lens' GetStudioComponentResponse (Prelude.Maybe StudioComponent)
getStudioComponentResponse_studioComponent :: (Maybe StudioComponent -> f (Maybe StudioComponent))
-> GetStudioComponentResponse -> f GetStudioComponentResponse
getStudioComponentResponse_studioComponent = (GetStudioComponentResponse -> Maybe StudioComponent)
-> (GetStudioComponentResponse
-> Maybe StudioComponent -> GetStudioComponentResponse)
-> Lens
GetStudioComponentResponse
GetStudioComponentResponse
(Maybe StudioComponent)
(Maybe StudioComponent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStudioComponentResponse' {Maybe StudioComponent
studioComponent :: Maybe StudioComponent
$sel:studioComponent:GetStudioComponentResponse' :: GetStudioComponentResponse -> Maybe StudioComponent
studioComponent} -> Maybe StudioComponent
studioComponent) (\s :: GetStudioComponentResponse
s@GetStudioComponentResponse' {} Maybe StudioComponent
a -> GetStudioComponentResponse
s {$sel:studioComponent:GetStudioComponentResponse' :: Maybe StudioComponent
studioComponent = Maybe StudioComponent
a} :: GetStudioComponentResponse)
getStudioComponentResponse_httpStatus :: Lens.Lens' GetStudioComponentResponse Prelude.Int
getStudioComponentResponse_httpStatus :: (Int -> f Int)
-> GetStudioComponentResponse -> f GetStudioComponentResponse
getStudioComponentResponse_httpStatus = (GetStudioComponentResponse -> Int)
-> (GetStudioComponentResponse
-> Int -> GetStudioComponentResponse)
-> Lens
GetStudioComponentResponse GetStudioComponentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStudioComponentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetStudioComponentResponse' :: GetStudioComponentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetStudioComponentResponse
s@GetStudioComponentResponse' {} Int
a -> GetStudioComponentResponse
s {$sel:httpStatus:GetStudioComponentResponse' :: Int
httpStatus = Int
a} :: GetStudioComponentResponse)
instance Prelude.NFData GetStudioComponentResponse