{-# 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.GetStudioComponent
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets a studio component resource.
module Amazonka.Nimble.GetStudioComponent
  ( -- * Creating a Request
    GetStudioComponent (..),
    newGetStudioComponent,

    -- * Request Lenses
    getStudioComponent_studioComponentId,
    getStudioComponent_studioId,

    -- * Destructuring the Response
    GetStudioComponentResponse (..),
    newGetStudioComponentResponse,

    -- * Response Lenses
    getStudioComponentResponse_studioComponent,
    getStudioComponentResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetStudioComponent' smart constructor.
data GetStudioComponent = GetStudioComponent'
  { -- | The studio component ID.
    GetStudioComponent -> Text
studioComponentId :: Prelude.Text,
    -- | The studio ID.
    GetStudioComponent -> Text
studioId :: Prelude.Text
  }
  deriving (GetStudioComponent -> GetStudioComponent -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'GetStudioComponent' 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:
--
-- 'studioComponentId', 'getStudioComponent_studioComponentId' - The studio component ID.
--
-- 'studioId', 'getStudioComponent_studioId' - The studio ID.
newGetStudioComponent ::
  -- | 'studioComponentId'
  Prelude.Text ->
  -- | 'studioId'
  Prelude.Text ->
  GetStudioComponent
newGetStudioComponent :: Text -> Text -> GetStudioComponent
newGetStudioComponent Text
pStudioComponentId_ Text
pStudioId_ =
  GetStudioComponent'
    { $sel:studioComponentId:GetStudioComponent' :: Text
studioComponentId =
        Text
pStudioComponentId_,
      $sel:studioId:GetStudioComponent' :: Text
studioId = Text
pStudioId_
    }

-- | The studio component ID.
getStudioComponent_studioComponentId :: Lens.Lens' GetStudioComponent Prelude.Text
getStudioComponent_studioComponentId :: Lens' GetStudioComponent Text
getStudioComponent_studioComponentId = 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)

-- | The studio ID.
getStudioComponent_studioId :: Lens.Lens' GetStudioComponent Prelude.Text
getStudioComponent_studioId :: Lens' GetStudioComponent Text
getStudioComponent_studioId = 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)

instance Core.AWSRequest GetStudioComponent where
  type
    AWSResponse GetStudioComponent =
      GetStudioComponentResponse
  request :: (Service -> Service)
-> GetStudioComponent -> Request GetStudioComponent
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetStudioComponent
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetStudioComponent)))
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 StudioComponent -> Int -> GetStudioComponentResponse
GetStudioComponentResponse'
            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
"studioComponent")
            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 GetStudioComponent where
  hashWithSalt :: Int -> GetStudioComponent -> Int
hashWithSalt Int
_salt GetStudioComponent' {Text
studioId :: Text
studioComponentId :: Text
$sel:studioId:GetStudioComponent' :: GetStudioComponent -> Text
$sel:studioComponentId:GetStudioComponent' :: GetStudioComponent -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
studioComponentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
studioId

instance Prelude.NFData GetStudioComponent where
  rnf :: GetStudioComponent -> ()
rnf GetStudioComponent' {Text
studioId :: Text
studioComponentId :: Text
$sel:studioId:GetStudioComponent' :: GetStudioComponent -> Text
$sel:studioComponentId:GetStudioComponent' :: GetStudioComponent -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
studioComponentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
studioId

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

instance Data.ToPath GetStudioComponent where
  toPath :: GetStudioComponent -> ByteString
toPath GetStudioComponent' {Text
studioId :: Text
studioComponentId :: Text
$sel:studioId:GetStudioComponent' :: GetStudioComponent -> Text
$sel:studioComponentId:GetStudioComponent' :: GetStudioComponent -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-08-01/studios/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
studioId,
        ByteString
"/studio-components/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
studioComponentId
      ]

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

-- | /See:/ 'newGetStudioComponentResponse' smart constructor.
data GetStudioComponentResponse = GetStudioComponentResponse'
  { -- | Information about the studio component.
    GetStudioComponentResponse -> Maybe StudioComponent
studioComponent :: Prelude.Maybe StudioComponent,
    -- | The response's http status code.
    GetStudioComponentResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetStudioComponentResponse -> GetStudioComponentResponse -> Bool
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, Int -> GetStudioComponentResponse -> ShowS
[GetStudioComponentResponse] -> ShowS
GetStudioComponentResponse -> String
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.
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)

-- |
-- Create a value of 'GetStudioComponentResponse' 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:
--
-- 'studioComponent', 'getStudioComponentResponse_studioComponent' - Information about the studio component.
--
-- 'httpStatus', 'getStudioComponentResponse_httpStatus' - The response's http status code.
newGetStudioComponentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetStudioComponentResponse
newGetStudioComponentResponse :: Int -> GetStudioComponentResponse
newGetStudioComponentResponse Int
pHttpStatus_ =
  GetStudioComponentResponse'
    { $sel:studioComponent:GetStudioComponentResponse' :: Maybe StudioComponent
studioComponent =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetStudioComponentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the studio component.
getStudioComponentResponse_studioComponent :: Lens.Lens' GetStudioComponentResponse (Prelude.Maybe StudioComponent)
getStudioComponentResponse_studioComponent :: Lens' GetStudioComponentResponse (Maybe StudioComponent)
getStudioComponentResponse_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)

-- | The response's http status code.
getStudioComponentResponse_httpStatus :: Lens.Lens' GetStudioComponentResponse Prelude.Int
getStudioComponentResponse_httpStatus :: Lens' GetStudioComponentResponse Int
getStudioComponentResponse_httpStatus = 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 where
  rnf :: GetStudioComponentResponse -> ()
rnf GetStudioComponentResponse' {Int
Maybe StudioComponent
httpStatus :: Int
studioComponent :: Maybe StudioComponent
$sel:httpStatus:GetStudioComponentResponse' :: GetStudioComponentResponse -> Int
$sel:studioComponent:GetStudioComponentResponse' :: GetStudioComponentResponse -> Maybe StudioComponent
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe StudioComponent
studioComponent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus