{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KinesisAnalyticsV2.Types
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
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]
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
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.
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'
      { $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 :: Lens' DescribeApplicationSnapshot Text
describeApplicationSnapshot_applicationName = 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 :: Lens' DescribeApplicationSnapshot Text
describeApplicationSnapshot_snapshotName = 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 :: (Service -> Service)
-> DescribeApplicationSnapshot
-> Request DescribeApplicationSnapshot
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 DescribeApplicationSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeApplicationSnapshot)))
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 ->
          Int -> SnapshotDetails -> DescribeApplicationSnapshotResponse
DescribeApplicationSnapshotResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"SnapshotDetails")
      )

instance Prelude.Hashable DescribeApplicationSnapshot where
  hashWithSalt :: Int -> DescribeApplicationSnapshot -> Int
hashWithSalt Int
_salt DescribeApplicationSnapshot' {Text
snapshotName :: Text
applicationName :: Text
$sel:snapshotName:DescribeApplicationSnapshot' :: DescribeApplicationSnapshot -> Text
$sel:applicationName:DescribeApplicationSnapshot' :: DescribeApplicationSnapshot -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotName

instance Prelude.NFData DescribeApplicationSnapshot where
  rnf :: DescribeApplicationSnapshot -> ()
rnf DescribeApplicationSnapshot' {Text
snapshotName :: Text
applicationName :: Text
$sel:snapshotName:DescribeApplicationSnapshot' :: DescribeApplicationSnapshot -> Text
$sel:applicationName:DescribeApplicationSnapshot' :: DescribeApplicationSnapshot -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
applicationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
snapshotName

instance Data.ToHeaders DescribeApplicationSnapshot where
  toHeaders :: DescribeApplicationSnapshot -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"KinesisAnalytics_20180523.DescribeApplicationSnapshot" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ApplicationName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
applicationName),
            forall a. a -> Maybe a
Prelude.Just (Key
"SnapshotName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
snapshotName)
          ]
      )

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

instance Data.ToQuery DescribeApplicationSnapshot where
  toQuery :: DescribeApplicationSnapshot -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
      { $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 :: Lens' DescribeApplicationSnapshotResponse Int
describeApplicationSnapshotResponse_httpStatus = 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 :: Lens' DescribeApplicationSnapshotResponse SnapshotDetails
describeApplicationSnapshotResponse_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
  where
  rnf :: DescribeApplicationSnapshotResponse -> ()
rnf DescribeApplicationSnapshotResponse' {Int
SnapshotDetails
snapshotDetails :: SnapshotDetails
httpStatus :: Int
$sel:snapshotDetails:DescribeApplicationSnapshotResponse' :: DescribeApplicationSnapshotResponse -> SnapshotDetails
$sel:httpStatus:DescribeApplicationSnapshotResponse' :: DescribeApplicationSnapshotResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SnapshotDetails
snapshotDetails