{-# 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.DescribeApplicationSnapshot
-- 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)
--
-- Returns information about a snapshot of application state data.
module Amazonka.KinesisAnalyticsV2.DescribeApplicationSnapshot
  ( -- * Creating a Request
    DescribeApplicationSnapshot (..),
    newDescribeApplicationSnapshot,

    -- * Request Lenses
    describeApplicationSnapshot_applicationName,
    describeApplicationSnapshot_snapshotName,

    -- * Destructuring the Response
    DescribeApplicationSnapshotResponse (..),
    newDescribeApplicationSnapshotResponse,

    -- * Response Lenses
    describeApplicationSnapshotResponse_httpStatus,
    describeApplicationSnapshotResponse_snapshotDetails,
  )
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:/ 'newDescribeApplicationSnapshot' smart constructor.
data DescribeApplicationSnapshot = DescribeApplicationSnapshot'
  { -- | The name of an existing application.
    DescribeApplicationSnapshot -> Text
applicationName :: Prelude.Text,
    -- | The identifier of an application snapshot. You can retrieve this value
    -- using .
    DescribeApplicationSnapshot -> Text
snapshotName :: Prelude.Text
  }
  deriving (DescribeApplicationSnapshot -> DescribeApplicationSnapshot -> Bool
(DescribeApplicationSnapshot
 -> DescribeApplicationSnapshot -> Bool)
-> (DescribeApplicationSnapshot
    -> DescribeApplicationSnapshot -> Bool)
-> Eq DescribeApplicationSnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeApplicationSnapshot -> DescribeApplicationSnapshot -> Bool
$c/= :: DescribeApplicationSnapshot -> DescribeApplicationSnapshot -> Bool
== :: DescribeApplicationSnapshot -> DescribeApplicationSnapshot -> Bool
$c== :: DescribeApplicationSnapshot -> DescribeApplicationSnapshot -> Bool
Prelude.Eq, ReadPrec [DescribeApplicationSnapshot]
ReadPrec DescribeApplicationSnapshot
Int -> ReadS DescribeApplicationSnapshot
ReadS [DescribeApplicationSnapshot]
(Int -> ReadS DescribeApplicationSnapshot)
-> ReadS [DescribeApplicationSnapshot]
-> ReadPrec DescribeApplicationSnapshot
-> ReadPrec [DescribeApplicationSnapshot]
-> Read DescribeApplicationSnapshot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeApplicationSnapshot]
$creadListPrec :: ReadPrec [DescribeApplicationSnapshot]
readPrec :: ReadPrec DescribeApplicationSnapshot
$creadPrec :: ReadPrec DescribeApplicationSnapshot
readList :: ReadS [DescribeApplicationSnapshot]
$creadList :: ReadS [DescribeApplicationSnapshot]
readsPrec :: Int -> ReadS DescribeApplicationSnapshot
$creadsPrec :: Int -> ReadS DescribeApplicationSnapshot
Prelude.Read, Int -> DescribeApplicationSnapshot -> ShowS
[DescribeApplicationSnapshot] -> ShowS
DescribeApplicationSnapshot -> String
(Int -> DescribeApplicationSnapshot -> ShowS)
-> (DescribeApplicationSnapshot -> String)
-> ([DescribeApplicationSnapshot] -> ShowS)
-> Show DescribeApplicationSnapshot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeApplicationSnapshot] -> ShowS
$cshowList :: [DescribeApplicationSnapshot] -> ShowS
show :: DescribeApplicationSnapshot -> String
$cshow :: DescribeApplicationSnapshot -> String
showsPrec :: Int -> DescribeApplicationSnapshot -> ShowS
$cshowsPrec :: Int -> DescribeApplicationSnapshot -> ShowS
Prelude.Show, (forall x.
 DescribeApplicationSnapshot -> Rep DescribeApplicationSnapshot x)
-> (forall x.
    Rep DescribeApplicationSnapshot x -> DescribeApplicationSnapshot)
-> Generic DescribeApplicationSnapshot
forall x.
Rep DescribeApplicationSnapshot x -> DescribeApplicationSnapshot
forall x.
DescribeApplicationSnapshot -> Rep DescribeApplicationSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeApplicationSnapshot x -> DescribeApplicationSnapshot
$cfrom :: forall x.
DescribeApplicationSnapshot -> Rep DescribeApplicationSnapshot x
Prelude.Generic)

-- |
-- Create a value of 'DescribeApplicationSnapshot' 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', 'describeApplicationSnapshot_applicationName' - The name of an existing application.
--
-- 'snapshotName', 'describeApplicationSnapshot_snapshotName' - The identifier of an application snapshot. You can retrieve this value
-- using .
newDescribeApplicationSnapshot ::
  -- | 'applicationName'
  Prelude.Text ->
  -- | 'snapshotName'
  Prelude.Text ->
  DescribeApplicationSnapshot
newDescribeApplicationSnapshot :: Text -> Text -> DescribeApplicationSnapshot
newDescribeApplicationSnapshot
  Text
pApplicationName_
  Text
pSnapshotName_ =
    DescribeApplicationSnapshot' :: Text -> Text -> DescribeApplicationSnapshot
DescribeApplicationSnapshot'
      { $sel:applicationName:DescribeApplicationSnapshot' :: Text
applicationName =
          Text
pApplicationName_,
        $sel:snapshotName:DescribeApplicationSnapshot' :: Text
snapshotName = Text
pSnapshotName_
      }

-- | The name of an existing application.
describeApplicationSnapshot_applicationName :: Lens.Lens' DescribeApplicationSnapshot Prelude.Text
describeApplicationSnapshot_applicationName :: (Text -> f Text)
-> DescribeApplicationSnapshot -> f DescribeApplicationSnapshot
describeApplicationSnapshot_applicationName = (DescribeApplicationSnapshot -> Text)
-> (DescribeApplicationSnapshot
    -> Text -> DescribeApplicationSnapshot)
-> Lens
     DescribeApplicationSnapshot DescribeApplicationSnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationSnapshot' {Text
applicationName :: Text
$sel:applicationName:DescribeApplicationSnapshot' :: DescribeApplicationSnapshot -> Text
applicationName} -> Text
applicationName) (\s :: DescribeApplicationSnapshot
s@DescribeApplicationSnapshot' {} Text
a -> DescribeApplicationSnapshot
s {$sel:applicationName:DescribeApplicationSnapshot' :: Text
applicationName = Text
a} :: DescribeApplicationSnapshot)

-- | The identifier of an application snapshot. You can retrieve this value
-- using .
describeApplicationSnapshot_snapshotName :: Lens.Lens' DescribeApplicationSnapshot Prelude.Text
describeApplicationSnapshot_snapshotName :: (Text -> f Text)
-> DescribeApplicationSnapshot -> f DescribeApplicationSnapshot
describeApplicationSnapshot_snapshotName = (DescribeApplicationSnapshot -> Text)
-> (DescribeApplicationSnapshot
    -> Text -> DescribeApplicationSnapshot)
-> Lens
     DescribeApplicationSnapshot DescribeApplicationSnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationSnapshot' {Text
snapshotName :: Text
$sel:snapshotName:DescribeApplicationSnapshot' :: DescribeApplicationSnapshot -> Text
snapshotName} -> Text
snapshotName) (\s :: DescribeApplicationSnapshot
s@DescribeApplicationSnapshot' {} Text
a -> DescribeApplicationSnapshot
s {$sel:snapshotName:DescribeApplicationSnapshot' :: Text
snapshotName = Text
a} :: DescribeApplicationSnapshot)

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

instance Prelude.Hashable DescribeApplicationSnapshot

instance Prelude.NFData DescribeApplicationSnapshot

instance Core.ToHeaders DescribeApplicationSnapshot where
  toHeaders :: DescribeApplicationSnapshot -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeApplicationSnapshot -> 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.DescribeApplicationSnapshot" ::
                          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 DescribeApplicationSnapshot where
  toJSON :: DescribeApplicationSnapshot -> Value
toJSON DescribeApplicationSnapshot' {Text
snapshotName :: Text
applicationName :: Text
$sel:snapshotName:DescribeApplicationSnapshot' :: DescribeApplicationSnapshot -> Text
$sel:applicationName:DescribeApplicationSnapshot' :: DescribeApplicationSnapshot -> 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
"SnapshotName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
snapshotName)
          ]
      )

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

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

-- | /See:/ 'newDescribeApplicationSnapshotResponse' smart constructor.
data DescribeApplicationSnapshotResponse = DescribeApplicationSnapshotResponse'
  { -- | The response's http status code.
    DescribeApplicationSnapshotResponse -> Int
httpStatus :: Prelude.Int,
    -- | An object containing information about the application snapshot.
    DescribeApplicationSnapshotResponse -> SnapshotDetails
snapshotDetails :: SnapshotDetails
  }
  deriving (DescribeApplicationSnapshotResponse
-> DescribeApplicationSnapshotResponse -> Bool
(DescribeApplicationSnapshotResponse
 -> DescribeApplicationSnapshotResponse -> Bool)
-> (DescribeApplicationSnapshotResponse
    -> DescribeApplicationSnapshotResponse -> Bool)
-> Eq DescribeApplicationSnapshotResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeApplicationSnapshotResponse
-> DescribeApplicationSnapshotResponse -> Bool
$c/= :: DescribeApplicationSnapshotResponse
-> DescribeApplicationSnapshotResponse -> Bool
== :: DescribeApplicationSnapshotResponse
-> DescribeApplicationSnapshotResponse -> Bool
$c== :: DescribeApplicationSnapshotResponse
-> DescribeApplicationSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [DescribeApplicationSnapshotResponse]
ReadPrec DescribeApplicationSnapshotResponse
Int -> ReadS DescribeApplicationSnapshotResponse
ReadS [DescribeApplicationSnapshotResponse]
(Int -> ReadS DescribeApplicationSnapshotResponse)
-> ReadS [DescribeApplicationSnapshotResponse]
-> ReadPrec DescribeApplicationSnapshotResponse
-> ReadPrec [DescribeApplicationSnapshotResponse]
-> Read DescribeApplicationSnapshotResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeApplicationSnapshotResponse]
$creadListPrec :: ReadPrec [DescribeApplicationSnapshotResponse]
readPrec :: ReadPrec DescribeApplicationSnapshotResponse
$creadPrec :: ReadPrec DescribeApplicationSnapshotResponse
readList :: ReadS [DescribeApplicationSnapshotResponse]
$creadList :: ReadS [DescribeApplicationSnapshotResponse]
readsPrec :: Int -> ReadS DescribeApplicationSnapshotResponse
$creadsPrec :: Int -> ReadS DescribeApplicationSnapshotResponse
Prelude.Read, Int -> DescribeApplicationSnapshotResponse -> ShowS
[DescribeApplicationSnapshotResponse] -> ShowS
DescribeApplicationSnapshotResponse -> String
(Int -> DescribeApplicationSnapshotResponse -> ShowS)
-> (DescribeApplicationSnapshotResponse -> String)
-> ([DescribeApplicationSnapshotResponse] -> ShowS)
-> Show DescribeApplicationSnapshotResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeApplicationSnapshotResponse] -> ShowS
$cshowList :: [DescribeApplicationSnapshotResponse] -> ShowS
show :: DescribeApplicationSnapshotResponse -> String
$cshow :: DescribeApplicationSnapshotResponse -> String
showsPrec :: Int -> DescribeApplicationSnapshotResponse -> ShowS
$cshowsPrec :: Int -> DescribeApplicationSnapshotResponse -> ShowS
Prelude.Show, (forall x.
 DescribeApplicationSnapshotResponse
 -> Rep DescribeApplicationSnapshotResponse x)
-> (forall x.
    Rep DescribeApplicationSnapshotResponse x
    -> DescribeApplicationSnapshotResponse)
-> Generic DescribeApplicationSnapshotResponse
forall x.
Rep DescribeApplicationSnapshotResponse x
-> DescribeApplicationSnapshotResponse
forall x.
DescribeApplicationSnapshotResponse
-> Rep DescribeApplicationSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeApplicationSnapshotResponse x
-> DescribeApplicationSnapshotResponse
$cfrom :: forall x.
DescribeApplicationSnapshotResponse
-> Rep DescribeApplicationSnapshotResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeApplicationSnapshotResponse' 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:
--
-- 'httpStatus', 'describeApplicationSnapshotResponse_httpStatus' - The response's http status code.
--
-- 'snapshotDetails', 'describeApplicationSnapshotResponse_snapshotDetails' - An object containing information about the application snapshot.
newDescribeApplicationSnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'snapshotDetails'
  SnapshotDetails ->
  DescribeApplicationSnapshotResponse
newDescribeApplicationSnapshotResponse :: Int -> SnapshotDetails -> DescribeApplicationSnapshotResponse
newDescribeApplicationSnapshotResponse
  Int
pHttpStatus_
  SnapshotDetails
pSnapshotDetails_ =
    DescribeApplicationSnapshotResponse' :: Int -> SnapshotDetails -> DescribeApplicationSnapshotResponse
DescribeApplicationSnapshotResponse'
      { $sel:httpStatus:DescribeApplicationSnapshotResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:snapshotDetails:DescribeApplicationSnapshotResponse' :: SnapshotDetails
snapshotDetails = SnapshotDetails
pSnapshotDetails_
      }

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

-- | An object containing information about the application snapshot.
describeApplicationSnapshotResponse_snapshotDetails :: Lens.Lens' DescribeApplicationSnapshotResponse SnapshotDetails
describeApplicationSnapshotResponse_snapshotDetails :: (SnapshotDetails -> f SnapshotDetails)
-> DescribeApplicationSnapshotResponse
-> f DescribeApplicationSnapshotResponse
describeApplicationSnapshotResponse_snapshotDetails = (DescribeApplicationSnapshotResponse -> SnapshotDetails)
-> (DescribeApplicationSnapshotResponse
    -> SnapshotDetails -> DescribeApplicationSnapshotResponse)
-> Lens
     DescribeApplicationSnapshotResponse
     DescribeApplicationSnapshotResponse
     SnapshotDetails
     SnapshotDetails
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationSnapshotResponse' {SnapshotDetails
snapshotDetails :: SnapshotDetails
$sel:snapshotDetails:DescribeApplicationSnapshotResponse' :: DescribeApplicationSnapshotResponse -> SnapshotDetails
snapshotDetails} -> SnapshotDetails
snapshotDetails) (\s :: DescribeApplicationSnapshotResponse
s@DescribeApplicationSnapshotResponse' {} SnapshotDetails
a -> DescribeApplicationSnapshotResponse
s {$sel:snapshotDetails:DescribeApplicationSnapshotResponse' :: SnapshotDetails
snapshotDetails = SnapshotDetails
a} :: DescribeApplicationSnapshotResponse)

instance
  Prelude.NFData
    DescribeApplicationSnapshotResponse