{-# 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-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)
--
-- 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 Amazonka.IVS.Types
import qualified Amazonka.Lens as Lens
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
(GetRecordingConfiguration -> GetRecordingConfiguration -> Bool)
-> (GetRecordingConfiguration -> GetRecordingConfiguration -> Bool)
-> Eq GetRecordingConfiguration
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]
(Int -> ReadS GetRecordingConfiguration)
-> ReadS [GetRecordingConfiguration]
-> ReadPrec GetRecordingConfiguration
-> ReadPrec [GetRecordingConfiguration]
-> Read 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
(Int -> GetRecordingConfiguration -> ShowS)
-> (GetRecordingConfiguration -> String)
-> ([GetRecordingConfiguration] -> ShowS)
-> Show GetRecordingConfiguration
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.
 GetRecordingConfiguration -> Rep GetRecordingConfiguration x)
-> (forall x.
    Rep GetRecordingConfiguration x -> GetRecordingConfiguration)
-> Generic GetRecordingConfiguration
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' :: Text -> GetRecordingConfiguration
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 :: (Text -> f Text)
-> GetRecordingConfiguration -> f GetRecordingConfiguration
getRecordingConfiguration_arn = (GetRecordingConfiguration -> Text)
-> (GetRecordingConfiguration -> Text -> GetRecordingConfiguration)
-> Lens
     GetRecordingConfiguration GetRecordingConfiguration Text Text
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 :: GetRecordingConfiguration -> Request GetRecordingConfiguration
request = Service
-> GetRecordingConfiguration -> Request GetRecordingConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetRecordingConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRecordingConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetRecordingConfiguration))
-> Logger
-> Service
-> Proxy GetRecordingConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRecordingConfiguration)))
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 RecordingConfiguration
-> Int -> GetRecordingConfigurationResponse
GetRecordingConfigurationResponse'
            (Maybe RecordingConfiguration
 -> Int -> GetRecordingConfigurationResponse)
-> Either String (Maybe RecordingConfiguration)
-> Either String (Int -> GetRecordingConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RecordingConfiguration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"recordingConfiguration")
            Either String (Int -> GetRecordingConfigurationResponse)
-> Either String Int
-> Either String GetRecordingConfigurationResponse
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 GetRecordingConfiguration

instance Prelude.NFData GetRecordingConfiguration

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

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

instance Core.ToQuery GetRecordingConfiguration where
  toQuery :: GetRecordingConfiguration -> QueryString
toQuery = QueryString -> GetRecordingConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetRecordingConfigurationResponse
 -> GetRecordingConfigurationResponse -> Bool)
-> (GetRecordingConfigurationResponse
    -> GetRecordingConfigurationResponse -> Bool)
-> Eq GetRecordingConfigurationResponse
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]
(Int -> ReadS GetRecordingConfigurationResponse)
-> ReadS [GetRecordingConfigurationResponse]
-> ReadPrec GetRecordingConfigurationResponse
-> ReadPrec [GetRecordingConfigurationResponse]
-> Read 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
(Int -> GetRecordingConfigurationResponse -> ShowS)
-> (GetRecordingConfigurationResponse -> String)
-> ([GetRecordingConfigurationResponse] -> ShowS)
-> Show GetRecordingConfigurationResponse
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.
 GetRecordingConfigurationResponse
 -> Rep GetRecordingConfigurationResponse x)
-> (forall x.
    Rep GetRecordingConfigurationResponse x
    -> GetRecordingConfigurationResponse)
-> Generic GetRecordingConfigurationResponse
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' :: Maybe RecordingConfiguration
-> Int -> GetRecordingConfigurationResponse
GetRecordingConfigurationResponse'
    { $sel:recordingConfiguration:GetRecordingConfigurationResponse' :: Maybe RecordingConfiguration
recordingConfiguration =
        Maybe RecordingConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetRecordingConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- |
getRecordingConfigurationResponse_recordingConfiguration :: Lens.Lens' GetRecordingConfigurationResponse (Prelude.Maybe RecordingConfiguration)
getRecordingConfigurationResponse_recordingConfiguration :: (Maybe RecordingConfiguration -> f (Maybe RecordingConfiguration))
-> GetRecordingConfigurationResponse
-> f GetRecordingConfigurationResponse
getRecordingConfigurationResponse_recordingConfiguration = (GetRecordingConfigurationResponse -> Maybe RecordingConfiguration)
-> (GetRecordingConfigurationResponse
    -> Maybe RecordingConfiguration
    -> GetRecordingConfigurationResponse)
-> Lens
     GetRecordingConfigurationResponse
     GetRecordingConfigurationResponse
     (Maybe RecordingConfiguration)
     (Maybe 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 :: (Int -> f Int)
-> GetRecordingConfigurationResponse
-> f GetRecordingConfigurationResponse
getRecordingConfigurationResponse_httpStatus = (GetRecordingConfigurationResponse -> Int)
-> (GetRecordingConfigurationResponse
    -> Int -> GetRecordingConfigurationResponse)
-> Lens
     GetRecordingConfigurationResponse
     GetRecordingConfigurationResponse
     Int
     Int
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