{-# 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.IVS.GetRecordingConfiguration
-- 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 the recording configuration for the specified ARN.
module Amazonka.IVS.GetRecordingConfiguration
  ( -- * Creating a Request
    GetRecordingConfiguration (..),
    newGetRecordingConfiguration,

    -- * Request Lenses
    getRecordingConfiguration_arn,

    -- * Destructuring the Response
    GetRecordingConfigurationResponse (..),
    newGetRecordingConfigurationResponse,

    -- * Response Lenses
    getRecordingConfigurationResponse_recordingConfiguration,
    getRecordingConfigurationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetRecordingConfiguration' smart constructor.
data GetRecordingConfiguration = GetRecordingConfiguration'
  { -- | ARN of the recording configuration to be retrieved.
    GetRecordingConfiguration -> Text
arn :: Prelude.Text
  }
  deriving (GetRecordingConfiguration -> GetRecordingConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecordingConfiguration -> GetRecordingConfiguration -> Bool
$c/= :: GetRecordingConfiguration -> GetRecordingConfiguration -> Bool
== :: GetRecordingConfiguration -> GetRecordingConfiguration -> Bool
$c== :: GetRecordingConfiguration -> GetRecordingConfiguration -> Bool
Prelude.Eq, ReadPrec [GetRecordingConfiguration]
ReadPrec GetRecordingConfiguration
Int -> ReadS GetRecordingConfiguration
ReadS [GetRecordingConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecordingConfiguration]
$creadListPrec :: ReadPrec [GetRecordingConfiguration]
readPrec :: ReadPrec GetRecordingConfiguration
$creadPrec :: ReadPrec GetRecordingConfiguration
readList :: ReadS [GetRecordingConfiguration]
$creadList :: ReadS [GetRecordingConfiguration]
readsPrec :: Int -> ReadS GetRecordingConfiguration
$creadsPrec :: Int -> ReadS GetRecordingConfiguration
Prelude.Read, Int -> GetRecordingConfiguration -> ShowS
[GetRecordingConfiguration] -> ShowS
GetRecordingConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecordingConfiguration] -> ShowS
$cshowList :: [GetRecordingConfiguration] -> ShowS
show :: GetRecordingConfiguration -> String
$cshow :: GetRecordingConfiguration -> String
showsPrec :: Int -> GetRecordingConfiguration -> ShowS
$cshowsPrec :: Int -> GetRecordingConfiguration -> ShowS
Prelude.Show, forall x.
Rep GetRecordingConfiguration x -> GetRecordingConfiguration
forall x.
GetRecordingConfiguration -> Rep GetRecordingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRecordingConfiguration x -> GetRecordingConfiguration
$cfrom :: forall x.
GetRecordingConfiguration -> Rep GetRecordingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'GetRecordingConfiguration' 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:
--
-- 'arn', 'getRecordingConfiguration_arn' - ARN of the recording configuration to be retrieved.
newGetRecordingConfiguration ::
  -- | 'arn'
  Prelude.Text ->
  GetRecordingConfiguration
newGetRecordingConfiguration :: Text -> GetRecordingConfiguration
newGetRecordingConfiguration Text
pArn_ =
  GetRecordingConfiguration' {$sel:arn:GetRecordingConfiguration' :: Text
arn = Text
pArn_}

-- | ARN of the recording configuration to be retrieved.
getRecordingConfiguration_arn :: Lens.Lens' GetRecordingConfiguration Prelude.Text
getRecordingConfiguration_arn :: Lens' GetRecordingConfiguration Text
getRecordingConfiguration_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecordingConfiguration' {Text
arn :: Text
$sel:arn:GetRecordingConfiguration' :: GetRecordingConfiguration -> Text
arn} -> Text
arn) (\s :: GetRecordingConfiguration
s@GetRecordingConfiguration' {} Text
a -> GetRecordingConfiguration
s {$sel:arn:GetRecordingConfiguration' :: Text
arn = Text
a} :: GetRecordingConfiguration)

instance Core.AWSRequest GetRecordingConfiguration where
  type
    AWSResponse GetRecordingConfiguration =
      GetRecordingConfigurationResponse
  request :: (Service -> Service)
-> GetRecordingConfiguration -> Request GetRecordingConfiguration
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 GetRecordingConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRecordingConfiguration)))
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 RecordingConfiguration
-> Int -> GetRecordingConfigurationResponse
GetRecordingConfigurationResponse'
            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
"recordingConfiguration")
            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 GetRecordingConfiguration where
  hashWithSalt :: Int -> GetRecordingConfiguration -> Int
hashWithSalt Int
_salt GetRecordingConfiguration' {Text
arn :: Text
$sel:arn:GetRecordingConfiguration' :: GetRecordingConfiguration -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

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

instance Data.ToHeaders GetRecordingConfiguration where
  toHeaders :: GetRecordingConfiguration -> 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.ToJSON GetRecordingConfiguration where
  toJSON :: GetRecordingConfiguration -> Value
toJSON GetRecordingConfiguration' {Text
arn :: Text
$sel:arn:GetRecordingConfiguration' :: GetRecordingConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)]
      )

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

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

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

-- |
-- Create a value of 'GetRecordingConfigurationResponse' 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:
--
-- 'recordingConfiguration', 'getRecordingConfigurationResponse_recordingConfiguration' -
--
-- 'httpStatus', 'getRecordingConfigurationResponse_httpStatus' - The response's http status code.
newGetRecordingConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetRecordingConfigurationResponse
newGetRecordingConfigurationResponse :: Int -> GetRecordingConfigurationResponse
newGetRecordingConfigurationResponse Int
pHttpStatus_ =
  GetRecordingConfigurationResponse'
    { $sel:recordingConfiguration:GetRecordingConfigurationResponse' :: Maybe RecordingConfiguration
recordingConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetRecordingConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

getRecordingConfigurationResponse_recordingConfiguration :: Lens.Lens' GetRecordingConfigurationResponse (Prelude.Maybe RecordingConfiguration)
getRecordingConfigurationResponse_recordingConfiguration :: Lens'
  GetRecordingConfigurationResponse (Maybe RecordingConfiguration)
getRecordingConfigurationResponse_recordingConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecordingConfigurationResponse' {Maybe RecordingConfiguration
recordingConfiguration :: Maybe RecordingConfiguration
$sel:recordingConfiguration:GetRecordingConfigurationResponse' :: GetRecordingConfigurationResponse -> Maybe RecordingConfiguration
recordingConfiguration} -> Maybe RecordingConfiguration
recordingConfiguration) (\s :: GetRecordingConfigurationResponse
s@GetRecordingConfigurationResponse' {} Maybe RecordingConfiguration
a -> GetRecordingConfigurationResponse
s {$sel:recordingConfiguration:GetRecordingConfigurationResponse' :: Maybe RecordingConfiguration
recordingConfiguration = Maybe RecordingConfiguration
a} :: GetRecordingConfigurationResponse)

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

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