{-# 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.KinesisAnalyticsV2.DescribeApplicationVersion
-- 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)
--
-- Provides a detailed description of a specified version of the
-- application. To see a list of all the versions of an application, invoke
-- the ListApplicationVersions operation.
--
-- This operation is supported only for Amazon Kinesis Data Analytics for
-- Apache Flink.
module Amazonka.KinesisAnalyticsV2.DescribeApplicationVersion
  ( -- * Creating a Request
    DescribeApplicationVersion (..),
    newDescribeApplicationVersion,

    -- * Request Lenses
    describeApplicationVersion_applicationName,
    describeApplicationVersion_applicationVersionId,

    -- * Destructuring the Response
    DescribeApplicationVersionResponse (..),
    newDescribeApplicationVersionResponse,

    -- * Response Lenses
    describeApplicationVersionResponse_applicationVersionDetail,
    describeApplicationVersionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.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:/ 'newDescribeApplicationVersion' smart constructor.
data DescribeApplicationVersion = DescribeApplicationVersion'
  { -- | The name of the application for which you want to get the version
    -- description.
    DescribeApplicationVersion -> Text
applicationName :: Prelude.Text,
    -- | The ID of the application version for which you want to get the
    -- description.
    DescribeApplicationVersion -> Natural
applicationVersionId :: Prelude.Natural
  }
  deriving (DescribeApplicationVersion -> DescribeApplicationVersion -> Bool
(DescribeApplicationVersion -> DescribeApplicationVersion -> Bool)
-> (DescribeApplicationVersion
    -> DescribeApplicationVersion -> Bool)
-> Eq DescribeApplicationVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeApplicationVersion -> DescribeApplicationVersion -> Bool
$c/= :: DescribeApplicationVersion -> DescribeApplicationVersion -> Bool
== :: DescribeApplicationVersion -> DescribeApplicationVersion -> Bool
$c== :: DescribeApplicationVersion -> DescribeApplicationVersion -> Bool
Prelude.Eq, ReadPrec [DescribeApplicationVersion]
ReadPrec DescribeApplicationVersion
Int -> ReadS DescribeApplicationVersion
ReadS [DescribeApplicationVersion]
(Int -> ReadS DescribeApplicationVersion)
-> ReadS [DescribeApplicationVersion]
-> ReadPrec DescribeApplicationVersion
-> ReadPrec [DescribeApplicationVersion]
-> Read DescribeApplicationVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeApplicationVersion]
$creadListPrec :: ReadPrec [DescribeApplicationVersion]
readPrec :: ReadPrec DescribeApplicationVersion
$creadPrec :: ReadPrec DescribeApplicationVersion
readList :: ReadS [DescribeApplicationVersion]
$creadList :: ReadS [DescribeApplicationVersion]
readsPrec :: Int -> ReadS DescribeApplicationVersion
$creadsPrec :: Int -> ReadS DescribeApplicationVersion
Prelude.Read, Int -> DescribeApplicationVersion -> ShowS
[DescribeApplicationVersion] -> ShowS
DescribeApplicationVersion -> String
(Int -> DescribeApplicationVersion -> ShowS)
-> (DescribeApplicationVersion -> String)
-> ([DescribeApplicationVersion] -> ShowS)
-> Show DescribeApplicationVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeApplicationVersion] -> ShowS
$cshowList :: [DescribeApplicationVersion] -> ShowS
show :: DescribeApplicationVersion -> String
$cshow :: DescribeApplicationVersion -> String
showsPrec :: Int -> DescribeApplicationVersion -> ShowS
$cshowsPrec :: Int -> DescribeApplicationVersion -> ShowS
Prelude.Show, (forall x.
 DescribeApplicationVersion -> Rep DescribeApplicationVersion x)
-> (forall x.
    Rep DescribeApplicationVersion x -> DescribeApplicationVersion)
-> Generic DescribeApplicationVersion
forall x.
Rep DescribeApplicationVersion x -> DescribeApplicationVersion
forall x.
DescribeApplicationVersion -> Rep DescribeApplicationVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeApplicationVersion x -> DescribeApplicationVersion
$cfrom :: forall x.
DescribeApplicationVersion -> Rep DescribeApplicationVersion x
Prelude.Generic)

-- |
-- Create a value of 'DescribeApplicationVersion' 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:
--
-- 'applicationName', 'describeApplicationVersion_applicationName' - The name of the application for which you want to get the version
-- description.
--
-- 'applicationVersionId', 'describeApplicationVersion_applicationVersionId' - The ID of the application version for which you want to get the
-- description.
newDescribeApplicationVersion ::
  -- | 'applicationName'
  Prelude.Text ->
  -- | 'applicationVersionId'
  Prelude.Natural ->
  DescribeApplicationVersion
newDescribeApplicationVersion :: Text -> Natural -> DescribeApplicationVersion
newDescribeApplicationVersion
  Text
pApplicationName_
  Natural
pApplicationVersionId_ =
    DescribeApplicationVersion' :: Text -> Natural -> DescribeApplicationVersion
DescribeApplicationVersion'
      { $sel:applicationName:DescribeApplicationVersion' :: Text
applicationName =
          Text
pApplicationName_,
        $sel:applicationVersionId:DescribeApplicationVersion' :: Natural
applicationVersionId = Natural
pApplicationVersionId_
      }

-- | The name of the application for which you want to get the version
-- description.
describeApplicationVersion_applicationName :: Lens.Lens' DescribeApplicationVersion Prelude.Text
describeApplicationVersion_applicationName :: (Text -> f Text)
-> DescribeApplicationVersion -> f DescribeApplicationVersion
describeApplicationVersion_applicationName = (DescribeApplicationVersion -> Text)
-> (DescribeApplicationVersion
    -> Text -> DescribeApplicationVersion)
-> Lens
     DescribeApplicationVersion DescribeApplicationVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationVersion' {Text
applicationName :: Text
$sel:applicationName:DescribeApplicationVersion' :: DescribeApplicationVersion -> Text
applicationName} -> Text
applicationName) (\s :: DescribeApplicationVersion
s@DescribeApplicationVersion' {} Text
a -> DescribeApplicationVersion
s {$sel:applicationName:DescribeApplicationVersion' :: Text
applicationName = Text
a} :: DescribeApplicationVersion)

-- | The ID of the application version for which you want to get the
-- description.
describeApplicationVersion_applicationVersionId :: Lens.Lens' DescribeApplicationVersion Prelude.Natural
describeApplicationVersion_applicationVersionId :: (Natural -> f Natural)
-> DescribeApplicationVersion -> f DescribeApplicationVersion
describeApplicationVersion_applicationVersionId = (DescribeApplicationVersion -> Natural)
-> (DescribeApplicationVersion
    -> Natural -> DescribeApplicationVersion)
-> Lens
     DescribeApplicationVersion
     DescribeApplicationVersion
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationVersion' {Natural
applicationVersionId :: Natural
$sel:applicationVersionId:DescribeApplicationVersion' :: DescribeApplicationVersion -> Natural
applicationVersionId} -> Natural
applicationVersionId) (\s :: DescribeApplicationVersion
s@DescribeApplicationVersion' {} Natural
a -> DescribeApplicationVersion
s {$sel:applicationVersionId:DescribeApplicationVersion' :: Natural
applicationVersionId = Natural
a} :: DescribeApplicationVersion)

instance Core.AWSRequest DescribeApplicationVersion where
  type
    AWSResponse DescribeApplicationVersion =
      DescribeApplicationVersionResponse
  request :: DescribeApplicationVersion -> Request DescribeApplicationVersion
request = Service
-> DescribeApplicationVersion -> Request DescribeApplicationVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeApplicationVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeApplicationVersion)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeApplicationVersion))
-> Logger
-> Service
-> Proxy DescribeApplicationVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeApplicationVersion)))
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 ApplicationDetail
-> Int -> DescribeApplicationVersionResponse
DescribeApplicationVersionResponse'
            (Maybe ApplicationDetail
 -> Int -> DescribeApplicationVersionResponse)
-> Either String (Maybe ApplicationDetail)
-> Either String (Int -> DescribeApplicationVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ApplicationDetail)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ApplicationVersionDetail")
            Either String (Int -> DescribeApplicationVersionResponse)
-> Either String Int
-> Either String DescribeApplicationVersionResponse
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 DescribeApplicationVersion

instance Prelude.NFData DescribeApplicationVersion

instance Core.ToHeaders DescribeApplicationVersion where
  toHeaders :: DescribeApplicationVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeApplicationVersion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"KinesisAnalytics_20180523.DescribeApplicationVersion" ::
                          Prelude.ByteString
                      ),
            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 DescribeApplicationVersion where
  toJSON :: DescribeApplicationVersion -> Value
toJSON DescribeApplicationVersion' {Natural
Text
applicationVersionId :: Natural
applicationName :: Text
$sel:applicationVersionId:DescribeApplicationVersion' :: DescribeApplicationVersion -> Natural
$sel:applicationName:DescribeApplicationVersion' :: DescribeApplicationVersion -> 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
"ApplicationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
applicationName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ApplicationVersionId"
                  Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
applicationVersionId
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeApplicationVersionResponse' 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:
--
-- 'applicationVersionDetail', 'describeApplicationVersionResponse_applicationVersionDetail' - Undocumented member.
--
-- 'httpStatus', 'describeApplicationVersionResponse_httpStatus' - The response's http status code.
newDescribeApplicationVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeApplicationVersionResponse
newDescribeApplicationVersionResponse :: Int -> DescribeApplicationVersionResponse
newDescribeApplicationVersionResponse Int
pHttpStatus_ =
  DescribeApplicationVersionResponse' :: Maybe ApplicationDetail
-> Int -> DescribeApplicationVersionResponse
DescribeApplicationVersionResponse'
    { $sel:applicationVersionDetail:DescribeApplicationVersionResponse' :: Maybe ApplicationDetail
applicationVersionDetail =
        Maybe ApplicationDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeApplicationVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
describeApplicationVersionResponse_applicationVersionDetail :: Lens.Lens' DescribeApplicationVersionResponse (Prelude.Maybe ApplicationDetail)
describeApplicationVersionResponse_applicationVersionDetail :: (Maybe ApplicationDetail -> f (Maybe ApplicationDetail))
-> DescribeApplicationVersionResponse
-> f DescribeApplicationVersionResponse
describeApplicationVersionResponse_applicationVersionDetail = (DescribeApplicationVersionResponse -> Maybe ApplicationDetail)
-> (DescribeApplicationVersionResponse
    -> Maybe ApplicationDetail -> DescribeApplicationVersionResponse)
-> Lens
     DescribeApplicationVersionResponse
     DescribeApplicationVersionResponse
     (Maybe ApplicationDetail)
     (Maybe ApplicationDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationVersionResponse' {Maybe ApplicationDetail
applicationVersionDetail :: Maybe ApplicationDetail
$sel:applicationVersionDetail:DescribeApplicationVersionResponse' :: DescribeApplicationVersionResponse -> Maybe ApplicationDetail
applicationVersionDetail} -> Maybe ApplicationDetail
applicationVersionDetail) (\s :: DescribeApplicationVersionResponse
s@DescribeApplicationVersionResponse' {} Maybe ApplicationDetail
a -> DescribeApplicationVersionResponse
s {$sel:applicationVersionDetail:DescribeApplicationVersionResponse' :: Maybe ApplicationDetail
applicationVersionDetail = Maybe ApplicationDetail
a} :: DescribeApplicationVersionResponse)

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

instance
  Prelude.NFData
    DescribeApplicationVersionResponse