{-# 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.KinesisAnalytics.DeleteApplicationOutput
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This documentation is for version 1 of the Amazon Kinesis Data Analytics
-- API, which only supports SQL applications. Version 2 of the API supports
-- SQL and Java applications. For more information about version 2, see
-- </kinesisanalytics/latest/apiv2/Welcome.html Amazon Kinesis Data Analytics API V2 Documentation>.
--
-- Deletes output destination configuration from your application
-- configuration. Amazon Kinesis Analytics will no longer write data from
-- the corresponding in-application stream to the external output
-- destination.
--
-- This operation requires permissions to perform the
-- @kinesisanalytics:DeleteApplicationOutput@ action.
module Amazonka.KinesisAnalytics.DeleteApplicationOutput
  ( -- * Creating a Request
    DeleteApplicationOutput (..),
    newDeleteApplicationOutput,

    -- * Request Lenses
    deleteApplicationOutput_applicationName,
    deleteApplicationOutput_currentApplicationVersionId,
    deleteApplicationOutput_outputId,

    -- * Destructuring the Response
    DeleteApplicationOutputResponse (..),
    newDeleteApplicationOutputResponse,

    -- * Response Lenses
    deleteApplicationOutputResponse_httpStatus,
  )
where

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

-- |
--
-- /See:/ 'newDeleteApplicationOutput' smart constructor.
data DeleteApplicationOutput = DeleteApplicationOutput'
  { -- | Amazon Kinesis Analytics application name.
    DeleteApplicationOutput -> Text
applicationName :: Prelude.Text,
    -- | Amazon Kinesis Analytics application version. You can use the
    -- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html DescribeApplication>
    -- operation to get the current application version. If the version
    -- specified is not the current version, the
    -- @ConcurrentModificationException@ is returned.
    DeleteApplicationOutput -> Natural
currentApplicationVersionId :: Prelude.Natural,
    -- | The ID of the configuration to delete. Each output configuration that is
    -- added to the application, either when the application is created or
    -- later using the
    -- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_AddApplicationOutput.html AddApplicationOutput>
    -- operation, has a unique ID. You need to provide the ID to uniquely
    -- identify the output configuration that you want to delete from the
    -- application configuration. You can use the
    -- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html DescribeApplication>
    -- operation to get the specific @OutputId@.
    DeleteApplicationOutput -> Text
outputId :: Prelude.Text
  }
  deriving (DeleteApplicationOutput -> DeleteApplicationOutput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteApplicationOutput -> DeleteApplicationOutput -> Bool
$c/= :: DeleteApplicationOutput -> DeleteApplicationOutput -> Bool
== :: DeleteApplicationOutput -> DeleteApplicationOutput -> Bool
$c== :: DeleteApplicationOutput -> DeleteApplicationOutput -> Bool
Prelude.Eq, ReadPrec [DeleteApplicationOutput]
ReadPrec DeleteApplicationOutput
Int -> ReadS DeleteApplicationOutput
ReadS [DeleteApplicationOutput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteApplicationOutput]
$creadListPrec :: ReadPrec [DeleteApplicationOutput]
readPrec :: ReadPrec DeleteApplicationOutput
$creadPrec :: ReadPrec DeleteApplicationOutput
readList :: ReadS [DeleteApplicationOutput]
$creadList :: ReadS [DeleteApplicationOutput]
readsPrec :: Int -> ReadS DeleteApplicationOutput
$creadsPrec :: Int -> ReadS DeleteApplicationOutput
Prelude.Read, Int -> DeleteApplicationOutput -> ShowS
[DeleteApplicationOutput] -> ShowS
DeleteApplicationOutput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteApplicationOutput] -> ShowS
$cshowList :: [DeleteApplicationOutput] -> ShowS
show :: DeleteApplicationOutput -> String
$cshow :: DeleteApplicationOutput -> String
showsPrec :: Int -> DeleteApplicationOutput -> ShowS
$cshowsPrec :: Int -> DeleteApplicationOutput -> ShowS
Prelude.Show, forall x. Rep DeleteApplicationOutput x -> DeleteApplicationOutput
forall x. DeleteApplicationOutput -> Rep DeleteApplicationOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteApplicationOutput x -> DeleteApplicationOutput
$cfrom :: forall x. DeleteApplicationOutput -> Rep DeleteApplicationOutput x
Prelude.Generic)

-- |
-- Create a value of 'DeleteApplicationOutput' 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', 'deleteApplicationOutput_applicationName' - Amazon Kinesis Analytics application name.
--
-- 'currentApplicationVersionId', 'deleteApplicationOutput_currentApplicationVersionId' - Amazon Kinesis Analytics application version. You can use the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html DescribeApplication>
-- operation to get the current application version. If the version
-- specified is not the current version, the
-- @ConcurrentModificationException@ is returned.
--
-- 'outputId', 'deleteApplicationOutput_outputId' - The ID of the configuration to delete. Each output configuration that is
-- added to the application, either when the application is created or
-- later using the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_AddApplicationOutput.html AddApplicationOutput>
-- operation, has a unique ID. You need to provide the ID to uniquely
-- identify the output configuration that you want to delete from the
-- application configuration. You can use the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html DescribeApplication>
-- operation to get the specific @OutputId@.
newDeleteApplicationOutput ::
  -- | 'applicationName'
  Prelude.Text ->
  -- | 'currentApplicationVersionId'
  Prelude.Natural ->
  -- | 'outputId'
  Prelude.Text ->
  DeleteApplicationOutput
newDeleteApplicationOutput :: Text -> Natural -> Text -> DeleteApplicationOutput
newDeleteApplicationOutput
  Text
pApplicationName_
  Natural
pCurrentApplicationVersionId_
  Text
pOutputId_ =
    DeleteApplicationOutput'
      { $sel:applicationName:DeleteApplicationOutput' :: Text
applicationName =
          Text
pApplicationName_,
        $sel:currentApplicationVersionId:DeleteApplicationOutput' :: Natural
currentApplicationVersionId =
          Natural
pCurrentApplicationVersionId_,
        $sel:outputId:DeleteApplicationOutput' :: Text
outputId = Text
pOutputId_
      }

-- | Amazon Kinesis Analytics application name.
deleteApplicationOutput_applicationName :: Lens.Lens' DeleteApplicationOutput Prelude.Text
deleteApplicationOutput_applicationName :: Lens' DeleteApplicationOutput Text
deleteApplicationOutput_applicationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteApplicationOutput' {Text
applicationName :: Text
$sel:applicationName:DeleteApplicationOutput' :: DeleteApplicationOutput -> Text
applicationName} -> Text
applicationName) (\s :: DeleteApplicationOutput
s@DeleteApplicationOutput' {} Text
a -> DeleteApplicationOutput
s {$sel:applicationName:DeleteApplicationOutput' :: Text
applicationName = Text
a} :: DeleteApplicationOutput)

-- | Amazon Kinesis Analytics application version. You can use the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html DescribeApplication>
-- operation to get the current application version. If the version
-- specified is not the current version, the
-- @ConcurrentModificationException@ is returned.
deleteApplicationOutput_currentApplicationVersionId :: Lens.Lens' DeleteApplicationOutput Prelude.Natural
deleteApplicationOutput_currentApplicationVersionId :: Lens' DeleteApplicationOutput Natural
deleteApplicationOutput_currentApplicationVersionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteApplicationOutput' {Natural
currentApplicationVersionId :: Natural
$sel:currentApplicationVersionId:DeleteApplicationOutput' :: DeleteApplicationOutput -> Natural
currentApplicationVersionId} -> Natural
currentApplicationVersionId) (\s :: DeleteApplicationOutput
s@DeleteApplicationOutput' {} Natural
a -> DeleteApplicationOutput
s {$sel:currentApplicationVersionId:DeleteApplicationOutput' :: Natural
currentApplicationVersionId = Natural
a} :: DeleteApplicationOutput)

-- | The ID of the configuration to delete. Each output configuration that is
-- added to the application, either when the application is created or
-- later using the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_AddApplicationOutput.html AddApplicationOutput>
-- operation, has a unique ID. You need to provide the ID to uniquely
-- identify the output configuration that you want to delete from the
-- application configuration. You can use the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html DescribeApplication>
-- operation to get the specific @OutputId@.
deleteApplicationOutput_outputId :: Lens.Lens' DeleteApplicationOutput Prelude.Text
deleteApplicationOutput_outputId :: Lens' DeleteApplicationOutput Text
deleteApplicationOutput_outputId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteApplicationOutput' {Text
outputId :: Text
$sel:outputId:DeleteApplicationOutput' :: DeleteApplicationOutput -> Text
outputId} -> Text
outputId) (\s :: DeleteApplicationOutput
s@DeleteApplicationOutput' {} Text
a -> DeleteApplicationOutput
s {$sel:outputId:DeleteApplicationOutput' :: Text
outputId = Text
a} :: DeleteApplicationOutput)

instance Core.AWSRequest DeleteApplicationOutput where
  type
    AWSResponse DeleteApplicationOutput =
      DeleteApplicationOutputResponse
  request :: (Service -> Service)
-> DeleteApplicationOutput -> Request DeleteApplicationOutput
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 DeleteApplicationOutput
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteApplicationOutput)))
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 -> DeleteApplicationOutputResponse
DeleteApplicationOutputResponse'
            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 DeleteApplicationOutput where
  hashWithSalt :: Int -> DeleteApplicationOutput -> Int
hashWithSalt Int
_salt DeleteApplicationOutput' {Natural
Text
outputId :: Text
currentApplicationVersionId :: Natural
applicationName :: Text
$sel:outputId:DeleteApplicationOutput' :: DeleteApplicationOutput -> Text
$sel:currentApplicationVersionId:DeleteApplicationOutput' :: DeleteApplicationOutput -> Natural
$sel:applicationName:DeleteApplicationOutput' :: DeleteApplicationOutput -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
currentApplicationVersionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
outputId

instance Prelude.NFData DeleteApplicationOutput where
  rnf :: DeleteApplicationOutput -> ()
rnf DeleteApplicationOutput' {Natural
Text
outputId :: Text
currentApplicationVersionId :: Natural
applicationName :: Text
$sel:outputId:DeleteApplicationOutput' :: DeleteApplicationOutput -> Text
$sel:currentApplicationVersionId:DeleteApplicationOutput' :: DeleteApplicationOutput -> Natural
$sel:applicationName:DeleteApplicationOutput' :: DeleteApplicationOutput -> 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 Natural
currentApplicationVersionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
outputId

instance Data.ToHeaders DeleteApplicationOutput where
  toHeaders :: DeleteApplicationOutput -> 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_20150814.DeleteApplicationOutput" ::
                          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 DeleteApplicationOutput where
  toJSON :: DeleteApplicationOutput -> Value
toJSON DeleteApplicationOutput' {Natural
Text
outputId :: Text
currentApplicationVersionId :: Natural
applicationName :: Text
$sel:outputId:DeleteApplicationOutput' :: DeleteApplicationOutput -> Text
$sel:currentApplicationVersionId:DeleteApplicationOutput' :: DeleteApplicationOutput -> Natural
$sel:applicationName:DeleteApplicationOutput' :: DeleteApplicationOutput -> 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
"CurrentApplicationVersionId"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
currentApplicationVersionId
              ),
            forall a. a -> Maybe a
Prelude.Just (Key
"OutputId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
outputId)
          ]
      )

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

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

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

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

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

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