{-# 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.GetStudio
(
GetStudio (..),
newGetStudio,
getStudio_studioId,
GetStudioResponse (..),
newGetStudioResponse,
getStudioResponse_studio,
getStudioResponse_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 GetStudio = GetStudio'
{
GetStudio -> Text
studioId :: Prelude.Text
}
deriving (GetStudio -> GetStudio -> Bool
(GetStudio -> GetStudio -> Bool)
-> (GetStudio -> GetStudio -> Bool) -> Eq GetStudio
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStudio -> GetStudio -> Bool
$c/= :: GetStudio -> GetStudio -> Bool
== :: GetStudio -> GetStudio -> Bool
$c== :: GetStudio -> GetStudio -> Bool
Prelude.Eq, ReadPrec [GetStudio]
ReadPrec GetStudio
Int -> ReadS GetStudio
ReadS [GetStudio]
(Int -> ReadS GetStudio)
-> ReadS [GetStudio]
-> ReadPrec GetStudio
-> ReadPrec [GetStudio]
-> Read GetStudio
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStudio]
$creadListPrec :: ReadPrec [GetStudio]
readPrec :: ReadPrec GetStudio
$creadPrec :: ReadPrec GetStudio
readList :: ReadS [GetStudio]
$creadList :: ReadS [GetStudio]
readsPrec :: Int -> ReadS GetStudio
$creadsPrec :: Int -> ReadS GetStudio
Prelude.Read, Int -> GetStudio -> ShowS
[GetStudio] -> ShowS
GetStudio -> String
(Int -> GetStudio -> ShowS)
-> (GetStudio -> String)
-> ([GetStudio] -> ShowS)
-> Show GetStudio
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStudio] -> ShowS
$cshowList :: [GetStudio] -> ShowS
show :: GetStudio -> String
$cshow :: GetStudio -> String
showsPrec :: Int -> GetStudio -> ShowS
$cshowsPrec :: Int -> GetStudio -> ShowS
Prelude.Show, (forall x. GetStudio -> Rep GetStudio x)
-> (forall x. Rep GetStudio x -> GetStudio) -> Generic GetStudio
forall x. Rep GetStudio x -> GetStudio
forall x. GetStudio -> Rep GetStudio x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStudio x -> GetStudio
$cfrom :: forall x. GetStudio -> Rep GetStudio x
Prelude.Generic)
newGetStudio ::
Prelude.Text ->
GetStudio
newGetStudio :: Text -> GetStudio
newGetStudio Text
pStudioId_ =
GetStudio' :: Text -> GetStudio
GetStudio' {$sel:studioId:GetStudio' :: Text
studioId = Text
pStudioId_}
getStudio_studioId :: Lens.Lens' GetStudio Prelude.Text
getStudio_studioId :: (Text -> f Text) -> GetStudio -> f GetStudio
getStudio_studioId = (GetStudio -> Text)
-> (GetStudio -> Text -> GetStudio)
-> Lens GetStudio GetStudio Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStudio' {Text
studioId :: Text
$sel:studioId:GetStudio' :: GetStudio -> Text
studioId} -> Text
studioId) (\s :: GetStudio
s@GetStudio' {} Text
a -> GetStudio
s {$sel:studioId:GetStudio' :: Text
studioId = Text
a} :: GetStudio)
instance Core.AWSRequest GetStudio where
type AWSResponse GetStudio = GetStudioResponse
request :: GetStudio -> Request GetStudio
request = Service -> GetStudio -> Request GetStudio
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetStudio
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStudio)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetStudio))
-> Logger
-> Service
-> Proxy GetStudio
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStudio)))
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 Studio -> Int -> GetStudioResponse
GetStudioResponse'
(Maybe Studio -> Int -> GetStudioResponse)
-> Either String (Maybe Studio)
-> Either String (Int -> GetStudioResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Studio)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"studio")
Either String (Int -> GetStudioResponse)
-> Either String Int -> Either String GetStudioResponse
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 GetStudio
instance Prelude.NFData GetStudio
instance Core.ToHeaders GetStudio where
toHeaders :: GetStudio -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetStudio -> 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 GetStudio where
toPath :: GetStudio -> ByteString
toPath GetStudio' {Text
studioId :: Text
$sel:studioId:GetStudio' :: GetStudio -> 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]
instance Core.ToQuery GetStudio where
toQuery :: GetStudio -> QueryString
toQuery = QueryString -> GetStudio -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetStudioResponse = GetStudioResponse'
{
GetStudioResponse -> Maybe Studio
studio :: Prelude.Maybe Studio,
GetStudioResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetStudioResponse -> GetStudioResponse -> Bool
(GetStudioResponse -> GetStudioResponse -> Bool)
-> (GetStudioResponse -> GetStudioResponse -> Bool)
-> Eq GetStudioResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStudioResponse -> GetStudioResponse -> Bool
$c/= :: GetStudioResponse -> GetStudioResponse -> Bool
== :: GetStudioResponse -> GetStudioResponse -> Bool
$c== :: GetStudioResponse -> GetStudioResponse -> Bool
Prelude.Eq, ReadPrec [GetStudioResponse]
ReadPrec GetStudioResponse
Int -> ReadS GetStudioResponse
ReadS [GetStudioResponse]
(Int -> ReadS GetStudioResponse)
-> ReadS [GetStudioResponse]
-> ReadPrec GetStudioResponse
-> ReadPrec [GetStudioResponse]
-> Read GetStudioResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStudioResponse]
$creadListPrec :: ReadPrec [GetStudioResponse]
readPrec :: ReadPrec GetStudioResponse
$creadPrec :: ReadPrec GetStudioResponse
readList :: ReadS [GetStudioResponse]
$creadList :: ReadS [GetStudioResponse]
readsPrec :: Int -> ReadS GetStudioResponse
$creadsPrec :: Int -> ReadS GetStudioResponse
Prelude.Read, Int -> GetStudioResponse -> ShowS
[GetStudioResponse] -> ShowS
GetStudioResponse -> String
(Int -> GetStudioResponse -> ShowS)
-> (GetStudioResponse -> String)
-> ([GetStudioResponse] -> ShowS)
-> Show GetStudioResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStudioResponse] -> ShowS
$cshowList :: [GetStudioResponse] -> ShowS
show :: GetStudioResponse -> String
$cshow :: GetStudioResponse -> String
showsPrec :: Int -> GetStudioResponse -> ShowS
$cshowsPrec :: Int -> GetStudioResponse -> ShowS
Prelude.Show, (forall x. GetStudioResponse -> Rep GetStudioResponse x)
-> (forall x. Rep GetStudioResponse x -> GetStudioResponse)
-> Generic GetStudioResponse
forall x. Rep GetStudioResponse x -> GetStudioResponse
forall x. GetStudioResponse -> Rep GetStudioResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStudioResponse x -> GetStudioResponse
$cfrom :: forall x. GetStudioResponse -> Rep GetStudioResponse x
Prelude.Generic)
newGetStudioResponse ::
Prelude.Int ->
GetStudioResponse
newGetStudioResponse :: Int -> GetStudioResponse
newGetStudioResponse Int
pHttpStatus_ =
GetStudioResponse' :: Maybe Studio -> Int -> GetStudioResponse
GetStudioResponse'
{ $sel:studio:GetStudioResponse' :: Maybe Studio
studio = Maybe Studio
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStudioResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStudioResponse_studio :: Lens.Lens' GetStudioResponse (Prelude.Maybe Studio)
getStudioResponse_studio :: (Maybe Studio -> f (Maybe Studio))
-> GetStudioResponse -> f GetStudioResponse
getStudioResponse_studio = (GetStudioResponse -> Maybe Studio)
-> (GetStudioResponse -> Maybe Studio -> GetStudioResponse)
-> Lens
GetStudioResponse GetStudioResponse (Maybe Studio) (Maybe Studio)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStudioResponse' {Maybe Studio
studio :: Maybe Studio
$sel:studio:GetStudioResponse' :: GetStudioResponse -> Maybe Studio
studio} -> Maybe Studio
studio) (\s :: GetStudioResponse
s@GetStudioResponse' {} Maybe Studio
a -> GetStudioResponse
s {$sel:studio:GetStudioResponse' :: Maybe Studio
studio = Maybe Studio
a} :: GetStudioResponse)
getStudioResponse_httpStatus :: Lens.Lens' GetStudioResponse Prelude.Int
getStudioResponse_httpStatus :: (Int -> f Int) -> GetStudioResponse -> f GetStudioResponse
getStudioResponse_httpStatus = (GetStudioResponse -> Int)
-> (GetStudioResponse -> Int -> GetStudioResponse)
-> Lens GetStudioResponse GetStudioResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStudioResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetStudioResponse' :: GetStudioResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetStudioResponse
s@GetStudioResponse' {} Int
a -> GetStudioResponse
s {$sel:httpStatus:GetStudioResponse' :: Int
httpStatus = Int
a} :: GetStudioResponse)
instance Prelude.NFData GetStudioResponse