{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Nimble.GetStudio
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Get a Studio resource.
module Amazonka.Nimble.GetStudio
  ( -- * Creating a Request
    GetStudio (..),
    newGetStudio,

    -- * Request Lenses
    getStudio_studioId,

    -- * Destructuring the Response
    GetStudioResponse (..),
    newGetStudioResponse,

    -- * Response Lenses
    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

-- | /See:/ 'newGetStudio' smart constructor.
data GetStudio = GetStudio'
  { -- | The studio ID.
    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)

-- |
-- Create a value of 'GetStudio' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'studioId', 'getStudio_studioId' - The studio ID.
newGetStudio ::
  -- | 'studioId'
  Prelude.Text ->
  GetStudio
newGetStudio :: Text -> GetStudio
newGetStudio Text
pStudioId_ =
  GetStudio' :: Text -> GetStudio
GetStudio' {$sel:studioId:GetStudio' :: Text
studioId = Text
pStudioId_}

-- | The studio ID.
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

-- | /See:/ 'newGetStudioResponse' smart constructor.
data GetStudioResponse = GetStudioResponse'
  { -- | Information about a studio.
    GetStudioResponse -> Maybe Studio
studio :: Prelude.Maybe Studio,
    -- | The response's http status code.
    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)

-- |
-- Create a value of 'GetStudioResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'studio', 'getStudioResponse_studio' - Information about a studio.
--
-- 'httpStatus', 'getStudioResponse_httpStatus' - The response's http status code.
newGetStudioResponse ::
  -- | 'httpStatus'
  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_
    }

-- | Information about a studio.
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)

-- | The response's http status code.
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