{-# 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.EMR.DescribeStudio
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns details for the specified Amazon EMR Studio including ID, Name,
-- VPC, Studio access URL, and so on.
module Amazonka.EMR.DescribeStudio
  ( -- * Creating a Request
    DescribeStudio (..),
    newDescribeStudio,

    -- * Request Lenses
    describeStudio_studioId,

    -- * Destructuring the Response
    DescribeStudioResponse (..),
    newDescribeStudioResponse,

    -- * Response Lenses
    describeStudioResponse_studio,
    describeStudioResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMR.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeStudio' smart constructor.
data DescribeStudio = DescribeStudio'
  { -- | The Amazon EMR Studio ID.
    DescribeStudio -> Text
studioId :: Prelude.Text
  }
  deriving (DescribeStudio -> DescribeStudio -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStudio -> DescribeStudio -> Bool
$c/= :: DescribeStudio -> DescribeStudio -> Bool
== :: DescribeStudio -> DescribeStudio -> Bool
$c== :: DescribeStudio -> DescribeStudio -> Bool
Prelude.Eq, ReadPrec [DescribeStudio]
ReadPrec DescribeStudio
Int -> ReadS DescribeStudio
ReadS [DescribeStudio]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStudio]
$creadListPrec :: ReadPrec [DescribeStudio]
readPrec :: ReadPrec DescribeStudio
$creadPrec :: ReadPrec DescribeStudio
readList :: ReadS [DescribeStudio]
$creadList :: ReadS [DescribeStudio]
readsPrec :: Int -> ReadS DescribeStudio
$creadsPrec :: Int -> ReadS DescribeStudio
Prelude.Read, Int -> DescribeStudio -> ShowS
[DescribeStudio] -> ShowS
DescribeStudio -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStudio] -> ShowS
$cshowList :: [DescribeStudio] -> ShowS
show :: DescribeStudio -> String
$cshow :: DescribeStudio -> String
showsPrec :: Int -> DescribeStudio -> ShowS
$cshowsPrec :: Int -> DescribeStudio -> ShowS
Prelude.Show, forall x. Rep DescribeStudio x -> DescribeStudio
forall x. DescribeStudio -> Rep DescribeStudio x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeStudio x -> DescribeStudio
$cfrom :: forall x. DescribeStudio -> Rep DescribeStudio x
Prelude.Generic)

-- |
-- Create a value of 'DescribeStudio' 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', 'describeStudio_studioId' - The Amazon EMR Studio ID.
newDescribeStudio ::
  -- | 'studioId'
  Prelude.Text ->
  DescribeStudio
newDescribeStudio :: Text -> DescribeStudio
newDescribeStudio Text
pStudioId_ =
  DescribeStudio' {$sel:studioId:DescribeStudio' :: Text
studioId = Text
pStudioId_}

-- | The Amazon EMR Studio ID.
describeStudio_studioId :: Lens.Lens' DescribeStudio Prelude.Text
describeStudio_studioId :: Lens' DescribeStudio Text
describeStudio_studioId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStudio' {Text
studioId :: Text
$sel:studioId:DescribeStudio' :: DescribeStudio -> Text
studioId} -> Text
studioId) (\s :: DescribeStudio
s@DescribeStudio' {} Text
a -> DescribeStudio
s {$sel:studioId:DescribeStudio' :: Text
studioId = Text
a} :: DescribeStudio)

instance Core.AWSRequest DescribeStudio where
  type
    AWSResponse DescribeStudio =
      DescribeStudioResponse
  request :: (Service -> Service) -> DescribeStudio -> Request DescribeStudio
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeStudio
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeStudio)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Studio -> Int -> DescribeStudioResponse
DescribeStudioResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Studio")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeStudio where
  hashWithSalt :: Int -> DescribeStudio -> Int
hashWithSalt Int
_salt DescribeStudio' {Text
studioId :: Text
$sel:studioId:DescribeStudio' :: DescribeStudio -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
studioId

instance Prelude.NFData DescribeStudio where
  rnf :: DescribeStudio -> ()
rnf DescribeStudio' {Text
studioId :: Text
$sel:studioId:DescribeStudio' :: DescribeStudio -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
studioId

instance Data.ToHeaders DescribeStudio where
  toHeaders :: DescribeStudio -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"ElasticMapReduce.DescribeStudio" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DescribeStudio where
  toJSON :: DescribeStudio -> Value
toJSON DescribeStudio' {Text
studioId :: Text
$sel:studioId:DescribeStudio' :: DescribeStudio -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"StudioId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
studioId)]
      )

instance Data.ToPath DescribeStudio where
  toPath :: DescribeStudio -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery DescribeStudio where
  toQuery :: DescribeStudio -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeStudioResponse' smart constructor.
data DescribeStudioResponse = DescribeStudioResponse'
  { -- | The Amazon EMR Studio details.
    DescribeStudioResponse -> Maybe Studio
studio :: Prelude.Maybe Studio,
    -- | The response's http status code.
    DescribeStudioResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeStudioResponse -> DescribeStudioResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStudioResponse -> DescribeStudioResponse -> Bool
$c/= :: DescribeStudioResponse -> DescribeStudioResponse -> Bool
== :: DescribeStudioResponse -> DescribeStudioResponse -> Bool
$c== :: DescribeStudioResponse -> DescribeStudioResponse -> Bool
Prelude.Eq, ReadPrec [DescribeStudioResponse]
ReadPrec DescribeStudioResponse
Int -> ReadS DescribeStudioResponse
ReadS [DescribeStudioResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStudioResponse]
$creadListPrec :: ReadPrec [DescribeStudioResponse]
readPrec :: ReadPrec DescribeStudioResponse
$creadPrec :: ReadPrec DescribeStudioResponse
readList :: ReadS [DescribeStudioResponse]
$creadList :: ReadS [DescribeStudioResponse]
readsPrec :: Int -> ReadS DescribeStudioResponse
$creadsPrec :: Int -> ReadS DescribeStudioResponse
Prelude.Read, Int -> DescribeStudioResponse -> ShowS
[DescribeStudioResponse] -> ShowS
DescribeStudioResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStudioResponse] -> ShowS
$cshowList :: [DescribeStudioResponse] -> ShowS
show :: DescribeStudioResponse -> String
$cshow :: DescribeStudioResponse -> String
showsPrec :: Int -> DescribeStudioResponse -> ShowS
$cshowsPrec :: Int -> DescribeStudioResponse -> ShowS
Prelude.Show, forall x. Rep DescribeStudioResponse x -> DescribeStudioResponse
forall x. DescribeStudioResponse -> Rep DescribeStudioResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeStudioResponse x -> DescribeStudioResponse
$cfrom :: forall x. DescribeStudioResponse -> Rep DescribeStudioResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeStudioResponse' 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', 'describeStudioResponse_studio' - The Amazon EMR Studio details.
--
-- 'httpStatus', 'describeStudioResponse_httpStatus' - The response's http status code.
newDescribeStudioResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeStudioResponse
newDescribeStudioResponse :: Int -> DescribeStudioResponse
newDescribeStudioResponse Int
pHttpStatus_ =
  DescribeStudioResponse'
    { $sel:studio:DescribeStudioResponse' :: Maybe Studio
studio = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeStudioResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon EMR Studio details.
describeStudioResponse_studio :: Lens.Lens' DescribeStudioResponse (Prelude.Maybe Studio)
describeStudioResponse_studio :: Lens' DescribeStudioResponse (Maybe Studio)
describeStudioResponse_studio = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStudioResponse' {Maybe Studio
studio :: Maybe Studio
$sel:studio:DescribeStudioResponse' :: DescribeStudioResponse -> Maybe Studio
studio} -> Maybe Studio
studio) (\s :: DescribeStudioResponse
s@DescribeStudioResponse' {} Maybe Studio
a -> DescribeStudioResponse
s {$sel:studio:DescribeStudioResponse' :: Maybe Studio
studio = Maybe Studio
a} :: DescribeStudioResponse)

-- | The response's http status code.
describeStudioResponse_httpStatus :: Lens.Lens' DescribeStudioResponse Prelude.Int
describeStudioResponse_httpStatus :: Lens' DescribeStudioResponse Int
describeStudioResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStudioResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeStudioResponse' :: DescribeStudioResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeStudioResponse
s@DescribeStudioResponse' {} Int
a -> DescribeStudioResponse
s {$sel:httpStatus:DescribeStudioResponse' :: Int
httpStatus = Int
a} :: DescribeStudioResponse)

instance Prelude.NFData DescribeStudioResponse where
  rnf :: DescribeStudioResponse -> ()
rnf DescribeStudioResponse' {Int
Maybe Studio
httpStatus :: Int
studio :: Maybe Studio
$sel:httpStatus:DescribeStudioResponse' :: DescribeStudioResponse -> Int
$sel:studio:DescribeStudioResponse' :: DescribeStudioResponse -> Maybe Studio
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Studio
studio
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus