{-# 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.DeleteApplicationSnapshot
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a snapshot of application state.
module Amazonka.KinesisAnalyticsV2.DeleteApplicationSnapshot
  ( -- * Creating a Request
    DeleteApplicationSnapshot (..),
    newDeleteApplicationSnapshot,

    -- * Request Lenses
    deleteApplicationSnapshot_applicationName,
    deleteApplicationSnapshot_snapshotName,
    deleteApplicationSnapshot_snapshotCreationTimestamp,

    -- * Destructuring the Response
    DeleteApplicationSnapshotResponse (..),
    newDeleteApplicationSnapshotResponse,

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

-- |
-- Create a value of 'DeleteApplicationSnapshot' 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', 'deleteApplicationSnapshot_applicationName' - The name of an existing application.
--
-- 'snapshotName', 'deleteApplicationSnapshot_snapshotName' - The identifier for the snapshot delete.
--
-- 'snapshotCreationTimestamp', 'deleteApplicationSnapshot_snapshotCreationTimestamp' - The creation timestamp of the application snapshot to delete. You can
-- retrieve this value using or .
newDeleteApplicationSnapshot ::
  -- | 'applicationName'
  Prelude.Text ->
  -- | 'snapshotName'
  Prelude.Text ->
  -- | 'snapshotCreationTimestamp'
  Prelude.UTCTime ->
  DeleteApplicationSnapshot
newDeleteApplicationSnapshot :: Text -> Text -> UTCTime -> DeleteApplicationSnapshot
newDeleteApplicationSnapshot
  Text
pApplicationName_
  Text
pSnapshotName_
  UTCTime
pSnapshotCreationTimestamp_ =
    DeleteApplicationSnapshot'
      { $sel:applicationName:DeleteApplicationSnapshot' :: Text
applicationName =
          Text
pApplicationName_,
        $sel:snapshotName:DeleteApplicationSnapshot' :: Text
snapshotName = Text
pSnapshotName_,
        $sel:snapshotCreationTimestamp:DeleteApplicationSnapshot' :: POSIX
snapshotCreationTimestamp =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pSnapshotCreationTimestamp_
      }

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

-- | The identifier for the snapshot delete.
deleteApplicationSnapshot_snapshotName :: Lens.Lens' DeleteApplicationSnapshot Prelude.Text
deleteApplicationSnapshot_snapshotName :: Lens' DeleteApplicationSnapshot Text
deleteApplicationSnapshot_snapshotName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteApplicationSnapshot' {Text
snapshotName :: Text
$sel:snapshotName:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> Text
snapshotName} -> Text
snapshotName) (\s :: DeleteApplicationSnapshot
s@DeleteApplicationSnapshot' {} Text
a -> DeleteApplicationSnapshot
s {$sel:snapshotName:DeleteApplicationSnapshot' :: Text
snapshotName = Text
a} :: DeleteApplicationSnapshot)

-- | The creation timestamp of the application snapshot to delete. You can
-- retrieve this value using or .
deleteApplicationSnapshot_snapshotCreationTimestamp :: Lens.Lens' DeleteApplicationSnapshot Prelude.UTCTime
deleteApplicationSnapshot_snapshotCreationTimestamp :: Lens' DeleteApplicationSnapshot UTCTime
deleteApplicationSnapshot_snapshotCreationTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteApplicationSnapshot' {POSIX
snapshotCreationTimestamp :: POSIX
$sel:snapshotCreationTimestamp:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> POSIX
snapshotCreationTimestamp} -> POSIX
snapshotCreationTimestamp) (\s :: DeleteApplicationSnapshot
s@DeleteApplicationSnapshot' {} POSIX
a -> DeleteApplicationSnapshot
s {$sel:snapshotCreationTimestamp:DeleteApplicationSnapshot' :: POSIX
snapshotCreationTimestamp = POSIX
a} :: DeleteApplicationSnapshot) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Core.AWSRequest DeleteApplicationSnapshot where
  type
    AWSResponse DeleteApplicationSnapshot =
      DeleteApplicationSnapshotResponse
  request :: (Service -> Service)
-> DeleteApplicationSnapshot -> Request DeleteApplicationSnapshot
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 DeleteApplicationSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteApplicationSnapshot)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteApplicationSnapshotResponse
DeleteApplicationSnapshotResponse'
            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))
      )

instance Prelude.Hashable DeleteApplicationSnapshot where
  hashWithSalt :: Int -> DeleteApplicationSnapshot -> Int
hashWithSalt Int
_salt DeleteApplicationSnapshot' {Text
POSIX
snapshotCreationTimestamp :: POSIX
snapshotName :: Text
applicationName :: Text
$sel:snapshotCreationTimestamp:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> POSIX
$sel:snapshotName:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> Text
$sel:applicationName:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> 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
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
snapshotCreationTimestamp

instance Prelude.NFData DeleteApplicationSnapshot where
  rnf :: DeleteApplicationSnapshot -> ()
rnf DeleteApplicationSnapshot' {Text
POSIX
snapshotCreationTimestamp :: POSIX
snapshotName :: Text
applicationName :: Text
$sel:snapshotCreationTimestamp:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> POSIX
$sel:snapshotName:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> Text
$sel:applicationName:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> 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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
snapshotCreationTimestamp

instance Data.ToHeaders DeleteApplicationSnapshot where
  toHeaders :: DeleteApplicationSnapshot -> 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.DeleteApplicationSnapshot" ::
                          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 DeleteApplicationSnapshot where
  toJSON :: DeleteApplicationSnapshot -> Value
toJSON DeleteApplicationSnapshot' {Text
POSIX
snapshotCreationTimestamp :: POSIX
snapshotName :: Text
applicationName :: Text
$sel:snapshotCreationTimestamp:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> POSIX
$sel:snapshotName:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> Text
$sel:applicationName:DeleteApplicationSnapshot' :: DeleteApplicationSnapshot -> 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),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"SnapshotCreationTimestamp"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= POSIX
snapshotCreationTimestamp
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'DeleteApplicationSnapshotResponse' 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', 'deleteApplicationSnapshotResponse_httpStatus' - The response's http status code.
newDeleteApplicationSnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteApplicationSnapshotResponse
newDeleteApplicationSnapshotResponse :: Int -> DeleteApplicationSnapshotResponse
newDeleteApplicationSnapshotResponse Int
pHttpStatus_ =
  DeleteApplicationSnapshotResponse'
    { $sel:httpStatus:DeleteApplicationSnapshotResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    DeleteApplicationSnapshotResponse
  where
  rnf :: DeleteApplicationSnapshotResponse -> ()
rnf DeleteApplicationSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteApplicationSnapshotResponse' :: DeleteApplicationSnapshotResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus