{-# 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.KinesisVideo.DescribeImageGenerationConfiguration
-- 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 @ImageGenerationConfiguration@ for a given Kinesis video
-- stream.
module Amazonka.KinesisVideo.DescribeImageGenerationConfiguration
  ( -- * Creating a Request
    DescribeImageGenerationConfiguration (..),
    newDescribeImageGenerationConfiguration,

    -- * Request Lenses
    describeImageGenerationConfiguration_streamARN,
    describeImageGenerationConfiguration_streamName,

    -- * Destructuring the Response
    DescribeImageGenerationConfigurationResponse (..),
    newDescribeImageGenerationConfigurationResponse,

    -- * Response Lenses
    describeImageGenerationConfigurationResponse_imageGenerationConfiguration,
    describeImageGenerationConfigurationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeImageGenerationConfiguration' smart constructor.
data DescribeImageGenerationConfiguration = DescribeImageGenerationConfiguration'
  { -- | The Amazon Resource Name (ARN) of the Kinesis video stream from which to
    -- retrieve the image generation configuration. You must specify either the
    -- @StreamName@ or the @StreamARN@.
    DescribeImageGenerationConfiguration -> Maybe Text
streamARN :: Prelude.Maybe Prelude.Text,
    -- | The name of the stream from which to retrieve the image generation
    -- configuration. You must specify either the @StreamName@ or the
    -- @StreamARN@.
    DescribeImageGenerationConfiguration -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeImageGenerationConfiguration
-> DescribeImageGenerationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeImageGenerationConfiguration
-> DescribeImageGenerationConfiguration -> Bool
$c/= :: DescribeImageGenerationConfiguration
-> DescribeImageGenerationConfiguration -> Bool
== :: DescribeImageGenerationConfiguration
-> DescribeImageGenerationConfiguration -> Bool
$c== :: DescribeImageGenerationConfiguration
-> DescribeImageGenerationConfiguration -> Bool
Prelude.Eq, ReadPrec [DescribeImageGenerationConfiguration]
ReadPrec DescribeImageGenerationConfiguration
Int -> ReadS DescribeImageGenerationConfiguration
ReadS [DescribeImageGenerationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeImageGenerationConfiguration]
$creadListPrec :: ReadPrec [DescribeImageGenerationConfiguration]
readPrec :: ReadPrec DescribeImageGenerationConfiguration
$creadPrec :: ReadPrec DescribeImageGenerationConfiguration
readList :: ReadS [DescribeImageGenerationConfiguration]
$creadList :: ReadS [DescribeImageGenerationConfiguration]
readsPrec :: Int -> ReadS DescribeImageGenerationConfiguration
$creadsPrec :: Int -> ReadS DescribeImageGenerationConfiguration
Prelude.Read, Int -> DescribeImageGenerationConfiguration -> ShowS
[DescribeImageGenerationConfiguration] -> ShowS
DescribeImageGenerationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeImageGenerationConfiguration] -> ShowS
$cshowList :: [DescribeImageGenerationConfiguration] -> ShowS
show :: DescribeImageGenerationConfiguration -> String
$cshow :: DescribeImageGenerationConfiguration -> String
showsPrec :: Int -> DescribeImageGenerationConfiguration -> ShowS
$cshowsPrec :: Int -> DescribeImageGenerationConfiguration -> ShowS
Prelude.Show, forall x.
Rep DescribeImageGenerationConfiguration x
-> DescribeImageGenerationConfiguration
forall x.
DescribeImageGenerationConfiguration
-> Rep DescribeImageGenerationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeImageGenerationConfiguration x
-> DescribeImageGenerationConfiguration
$cfrom :: forall x.
DescribeImageGenerationConfiguration
-> Rep DescribeImageGenerationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DescribeImageGenerationConfiguration' 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:
--
-- 'streamARN', 'describeImageGenerationConfiguration_streamARN' - The Amazon Resource Name (ARN) of the Kinesis video stream from which to
-- retrieve the image generation configuration. You must specify either the
-- @StreamName@ or the @StreamARN@.
--
-- 'streamName', 'describeImageGenerationConfiguration_streamName' - The name of the stream from which to retrieve the image generation
-- configuration. You must specify either the @StreamName@ or the
-- @StreamARN@.
newDescribeImageGenerationConfiguration ::
  DescribeImageGenerationConfiguration
newDescribeImageGenerationConfiguration :: DescribeImageGenerationConfiguration
newDescribeImageGenerationConfiguration =
  DescribeImageGenerationConfiguration'
    { $sel:streamARN:DescribeImageGenerationConfiguration' :: Maybe Text
streamARN =
        forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:DescribeImageGenerationConfiguration' :: Maybe Text
streamName = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the Kinesis video stream from which to
-- retrieve the image generation configuration. You must specify either the
-- @StreamName@ or the @StreamARN@.
describeImageGenerationConfiguration_streamARN :: Lens.Lens' DescribeImageGenerationConfiguration (Prelude.Maybe Prelude.Text)
describeImageGenerationConfiguration_streamARN :: Lens' DescribeImageGenerationConfiguration (Maybe Text)
describeImageGenerationConfiguration_streamARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeImageGenerationConfiguration' {Maybe Text
streamARN :: Maybe Text
$sel:streamARN:DescribeImageGenerationConfiguration' :: DescribeImageGenerationConfiguration -> Maybe Text
streamARN} -> Maybe Text
streamARN) (\s :: DescribeImageGenerationConfiguration
s@DescribeImageGenerationConfiguration' {} Maybe Text
a -> DescribeImageGenerationConfiguration
s {$sel:streamARN:DescribeImageGenerationConfiguration' :: Maybe Text
streamARN = Maybe Text
a} :: DescribeImageGenerationConfiguration)

-- | The name of the stream from which to retrieve the image generation
-- configuration. You must specify either the @StreamName@ or the
-- @StreamARN@.
describeImageGenerationConfiguration_streamName :: Lens.Lens' DescribeImageGenerationConfiguration (Prelude.Maybe Prelude.Text)
describeImageGenerationConfiguration_streamName :: Lens' DescribeImageGenerationConfiguration (Maybe Text)
describeImageGenerationConfiguration_streamName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeImageGenerationConfiguration' {Maybe Text
streamName :: Maybe Text
$sel:streamName:DescribeImageGenerationConfiguration' :: DescribeImageGenerationConfiguration -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: DescribeImageGenerationConfiguration
s@DescribeImageGenerationConfiguration' {} Maybe Text
a -> DescribeImageGenerationConfiguration
s {$sel:streamName:DescribeImageGenerationConfiguration' :: Maybe Text
streamName = Maybe Text
a} :: DescribeImageGenerationConfiguration)

instance
  Core.AWSRequest
    DescribeImageGenerationConfiguration
  where
  type
    AWSResponse DescribeImageGenerationConfiguration =
      DescribeImageGenerationConfigurationResponse
  request :: (Service -> Service)
-> DescribeImageGenerationConfiguration
-> Request DescribeImageGenerationConfiguration
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 DescribeImageGenerationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeImageGenerationConfiguration)))
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 ImageGenerationConfiguration
-> Int -> DescribeImageGenerationConfigurationResponse
DescribeImageGenerationConfigurationResponse'
            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
"ImageGenerationConfiguration")
            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
    DescribeImageGenerationConfiguration
  where
  hashWithSalt :: Int -> DescribeImageGenerationConfiguration -> Int
hashWithSalt
    Int
_salt
    DescribeImageGenerationConfiguration' {Maybe Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:streamName:DescribeImageGenerationConfiguration' :: DescribeImageGenerationConfiguration -> Maybe Text
$sel:streamARN:DescribeImageGenerationConfiguration' :: DescribeImageGenerationConfiguration -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamARN
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamName

instance
  Prelude.NFData
    DescribeImageGenerationConfiguration
  where
  rnf :: DescribeImageGenerationConfiguration -> ()
rnf DescribeImageGenerationConfiguration' {Maybe Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:streamName:DescribeImageGenerationConfiguration' :: DescribeImageGenerationConfiguration -> Maybe Text
$sel:streamARN:DescribeImageGenerationConfiguration' :: DescribeImageGenerationConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamName

instance
  Data.ToHeaders
    DescribeImageGenerationConfiguration
  where
  toHeaders :: DescribeImageGenerationConfiguration -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance
  Data.ToJSON
    DescribeImageGenerationConfiguration
  where
  toJSON :: DescribeImageGenerationConfiguration -> Value
toJSON DescribeImageGenerationConfiguration' {Maybe Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:streamName:DescribeImageGenerationConfiguration' :: DescribeImageGenerationConfiguration -> Maybe Text
$sel:streamARN:DescribeImageGenerationConfiguration' :: DescribeImageGenerationConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"StreamARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamARN,
            (Key
"StreamName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamName
          ]
      )

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

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

-- | /See:/ 'newDescribeImageGenerationConfigurationResponse' smart constructor.
data DescribeImageGenerationConfigurationResponse = DescribeImageGenerationConfigurationResponse'
  { -- | The structure that contains the information required for the Kinesis
    -- video stream (KVS) images delivery. If this structure is null, the
    -- configuration will be deleted from the stream.
    DescribeImageGenerationConfigurationResponse
-> Maybe ImageGenerationConfiguration
imageGenerationConfiguration :: Prelude.Maybe ImageGenerationConfiguration,
    -- | The response's http status code.
    DescribeImageGenerationConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeImageGenerationConfigurationResponse
-> DescribeImageGenerationConfigurationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeImageGenerationConfigurationResponse
-> DescribeImageGenerationConfigurationResponse -> Bool
$c/= :: DescribeImageGenerationConfigurationResponse
-> DescribeImageGenerationConfigurationResponse -> Bool
== :: DescribeImageGenerationConfigurationResponse
-> DescribeImageGenerationConfigurationResponse -> Bool
$c== :: DescribeImageGenerationConfigurationResponse
-> DescribeImageGenerationConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [DescribeImageGenerationConfigurationResponse]
ReadPrec DescribeImageGenerationConfigurationResponse
Int -> ReadS DescribeImageGenerationConfigurationResponse
ReadS [DescribeImageGenerationConfigurationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeImageGenerationConfigurationResponse]
$creadListPrec :: ReadPrec [DescribeImageGenerationConfigurationResponse]
readPrec :: ReadPrec DescribeImageGenerationConfigurationResponse
$creadPrec :: ReadPrec DescribeImageGenerationConfigurationResponse
readList :: ReadS [DescribeImageGenerationConfigurationResponse]
$creadList :: ReadS [DescribeImageGenerationConfigurationResponse]
readsPrec :: Int -> ReadS DescribeImageGenerationConfigurationResponse
$creadsPrec :: Int -> ReadS DescribeImageGenerationConfigurationResponse
Prelude.Read, Int -> DescribeImageGenerationConfigurationResponse -> ShowS
[DescribeImageGenerationConfigurationResponse] -> ShowS
DescribeImageGenerationConfigurationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeImageGenerationConfigurationResponse] -> ShowS
$cshowList :: [DescribeImageGenerationConfigurationResponse] -> ShowS
show :: DescribeImageGenerationConfigurationResponse -> String
$cshow :: DescribeImageGenerationConfigurationResponse -> String
showsPrec :: Int -> DescribeImageGenerationConfigurationResponse -> ShowS
$cshowsPrec :: Int -> DescribeImageGenerationConfigurationResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeImageGenerationConfigurationResponse x
-> DescribeImageGenerationConfigurationResponse
forall x.
DescribeImageGenerationConfigurationResponse
-> Rep DescribeImageGenerationConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeImageGenerationConfigurationResponse x
-> DescribeImageGenerationConfigurationResponse
$cfrom :: forall x.
DescribeImageGenerationConfigurationResponse
-> Rep DescribeImageGenerationConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeImageGenerationConfigurationResponse' 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:
--
-- 'imageGenerationConfiguration', 'describeImageGenerationConfigurationResponse_imageGenerationConfiguration' - The structure that contains the information required for the Kinesis
-- video stream (KVS) images delivery. If this structure is null, the
-- configuration will be deleted from the stream.
--
-- 'httpStatus', 'describeImageGenerationConfigurationResponse_httpStatus' - The response's http status code.
newDescribeImageGenerationConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeImageGenerationConfigurationResponse
newDescribeImageGenerationConfigurationResponse :: Int -> DescribeImageGenerationConfigurationResponse
newDescribeImageGenerationConfigurationResponse
  Int
pHttpStatus_ =
    DescribeImageGenerationConfigurationResponse'
      { $sel:imageGenerationConfiguration:DescribeImageGenerationConfigurationResponse' :: Maybe ImageGenerationConfiguration
imageGenerationConfiguration =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeImageGenerationConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The structure that contains the information required for the Kinesis
-- video stream (KVS) images delivery. If this structure is null, the
-- configuration will be deleted from the stream.
describeImageGenerationConfigurationResponse_imageGenerationConfiguration :: Lens.Lens' DescribeImageGenerationConfigurationResponse (Prelude.Maybe ImageGenerationConfiguration)
describeImageGenerationConfigurationResponse_imageGenerationConfiguration :: Lens'
  DescribeImageGenerationConfigurationResponse
  (Maybe ImageGenerationConfiguration)
describeImageGenerationConfigurationResponse_imageGenerationConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeImageGenerationConfigurationResponse' {Maybe ImageGenerationConfiguration
imageGenerationConfiguration :: Maybe ImageGenerationConfiguration
$sel:imageGenerationConfiguration:DescribeImageGenerationConfigurationResponse' :: DescribeImageGenerationConfigurationResponse
-> Maybe ImageGenerationConfiguration
imageGenerationConfiguration} -> Maybe ImageGenerationConfiguration
imageGenerationConfiguration) (\s :: DescribeImageGenerationConfigurationResponse
s@DescribeImageGenerationConfigurationResponse' {} Maybe ImageGenerationConfiguration
a -> DescribeImageGenerationConfigurationResponse
s {$sel:imageGenerationConfiguration:DescribeImageGenerationConfigurationResponse' :: Maybe ImageGenerationConfiguration
imageGenerationConfiguration = Maybe ImageGenerationConfiguration
a} :: DescribeImageGenerationConfigurationResponse)

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

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