{-# 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.QuickSight.CancelIngestion
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Cancels an ongoing ingestion of data into SPICE.
module Amazonka.QuickSight.CancelIngestion
  ( -- * Creating a Request
    CancelIngestion (..),
    newCancelIngestion,

    -- * Request Lenses
    cancelIngestion_awsAccountId,
    cancelIngestion_dataSetId,
    cancelIngestion_ingestionId,

    -- * Destructuring the Response
    CancelIngestionResponse (..),
    newCancelIngestionResponse,

    -- * Response Lenses
    cancelIngestionResponse_arn,
    cancelIngestionResponse_ingestionId,
    cancelIngestionResponse_requestId,
    cancelIngestionResponse_status,
  )
where

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

-- | /See:/ 'newCancelIngestion' smart constructor.
data CancelIngestion = CancelIngestion'
  { -- | The Amazon Web Services account ID.
    CancelIngestion -> Text
awsAccountId :: Prelude.Text,
    -- | The ID of the dataset used in the ingestion.
    CancelIngestion -> Text
dataSetId :: Prelude.Text,
    -- | An ID for the ingestion.
    CancelIngestion -> Text
ingestionId :: Prelude.Text
  }
  deriving (CancelIngestion -> CancelIngestion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelIngestion -> CancelIngestion -> Bool
$c/= :: CancelIngestion -> CancelIngestion -> Bool
== :: CancelIngestion -> CancelIngestion -> Bool
$c== :: CancelIngestion -> CancelIngestion -> Bool
Prelude.Eq, ReadPrec [CancelIngestion]
ReadPrec CancelIngestion
Int -> ReadS CancelIngestion
ReadS [CancelIngestion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelIngestion]
$creadListPrec :: ReadPrec [CancelIngestion]
readPrec :: ReadPrec CancelIngestion
$creadPrec :: ReadPrec CancelIngestion
readList :: ReadS [CancelIngestion]
$creadList :: ReadS [CancelIngestion]
readsPrec :: Int -> ReadS CancelIngestion
$creadsPrec :: Int -> ReadS CancelIngestion
Prelude.Read, Int -> CancelIngestion -> ShowS
[CancelIngestion] -> ShowS
CancelIngestion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelIngestion] -> ShowS
$cshowList :: [CancelIngestion] -> ShowS
show :: CancelIngestion -> String
$cshow :: CancelIngestion -> String
showsPrec :: Int -> CancelIngestion -> ShowS
$cshowsPrec :: Int -> CancelIngestion -> ShowS
Prelude.Show, forall x. Rep CancelIngestion x -> CancelIngestion
forall x. CancelIngestion -> Rep CancelIngestion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelIngestion x -> CancelIngestion
$cfrom :: forall x. CancelIngestion -> Rep CancelIngestion x
Prelude.Generic)

-- |
-- Create a value of 'CancelIngestion' 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:
--
-- 'awsAccountId', 'cancelIngestion_awsAccountId' - The Amazon Web Services account ID.
--
-- 'dataSetId', 'cancelIngestion_dataSetId' - The ID of the dataset used in the ingestion.
--
-- 'ingestionId', 'cancelIngestion_ingestionId' - An ID for the ingestion.
newCancelIngestion ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'dataSetId'
  Prelude.Text ->
  -- | 'ingestionId'
  Prelude.Text ->
  CancelIngestion
newCancelIngestion :: Text -> Text -> Text -> CancelIngestion
newCancelIngestion
  Text
pAwsAccountId_
  Text
pDataSetId_
  Text
pIngestionId_ =
    CancelIngestion'
      { $sel:awsAccountId:CancelIngestion' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:dataSetId:CancelIngestion' :: Text
dataSetId = Text
pDataSetId_,
        $sel:ingestionId:CancelIngestion' :: Text
ingestionId = Text
pIngestionId_
      }

-- | The Amazon Web Services account ID.
cancelIngestion_awsAccountId :: Lens.Lens' CancelIngestion Prelude.Text
cancelIngestion_awsAccountId :: Lens' CancelIngestion Text
cancelIngestion_awsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelIngestion' {Text
awsAccountId :: Text
$sel:awsAccountId:CancelIngestion' :: CancelIngestion -> Text
awsAccountId} -> Text
awsAccountId) (\s :: CancelIngestion
s@CancelIngestion' {} Text
a -> CancelIngestion
s {$sel:awsAccountId:CancelIngestion' :: Text
awsAccountId = Text
a} :: CancelIngestion)

-- | The ID of the dataset used in the ingestion.
cancelIngestion_dataSetId :: Lens.Lens' CancelIngestion Prelude.Text
cancelIngestion_dataSetId :: Lens' CancelIngestion Text
cancelIngestion_dataSetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelIngestion' {Text
dataSetId :: Text
$sel:dataSetId:CancelIngestion' :: CancelIngestion -> Text
dataSetId} -> Text
dataSetId) (\s :: CancelIngestion
s@CancelIngestion' {} Text
a -> CancelIngestion
s {$sel:dataSetId:CancelIngestion' :: Text
dataSetId = Text
a} :: CancelIngestion)

-- | An ID for the ingestion.
cancelIngestion_ingestionId :: Lens.Lens' CancelIngestion Prelude.Text
cancelIngestion_ingestionId :: Lens' CancelIngestion Text
cancelIngestion_ingestionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelIngestion' {Text
ingestionId :: Text
$sel:ingestionId:CancelIngestion' :: CancelIngestion -> Text
ingestionId} -> Text
ingestionId) (\s :: CancelIngestion
s@CancelIngestion' {} Text
a -> CancelIngestion
s {$sel:ingestionId:CancelIngestion' :: Text
ingestionId = Text
a} :: CancelIngestion)

instance Core.AWSRequest CancelIngestion where
  type
    AWSResponse CancelIngestion =
      CancelIngestionResponse
  request :: (Service -> Service) -> CancelIngestion -> Request CancelIngestion
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CancelIngestion
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelIngestion)))
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 ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Int -> CancelIngestionResponse
CancelIngestionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"IngestionId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RequestId")
            forall (f :: * -> *) a b. Applicative f => 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 CancelIngestion where
  hashWithSalt :: Int -> CancelIngestion -> Int
hashWithSalt Int
_salt CancelIngestion' {Text
ingestionId :: Text
dataSetId :: Text
awsAccountId :: Text
$sel:ingestionId:CancelIngestion' :: CancelIngestion -> Text
$sel:dataSetId:CancelIngestion' :: CancelIngestion -> Text
$sel:awsAccountId:CancelIngestion' :: CancelIngestion -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
awsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataSetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ingestionId

instance Prelude.NFData CancelIngestion where
  rnf :: CancelIngestion -> ()
rnf CancelIngestion' {Text
ingestionId :: Text
dataSetId :: Text
awsAccountId :: Text
$sel:ingestionId:CancelIngestion' :: CancelIngestion -> Text
$sel:dataSetId:CancelIngestion' :: CancelIngestion -> Text
$sel:awsAccountId:CancelIngestion' :: CancelIngestion -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
awsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dataSetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ingestionId

instance Data.ToHeaders CancelIngestion where
  toHeaders :: CancelIngestion -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath CancelIngestion where
  toPath :: CancelIngestion -> ByteString
toPath CancelIngestion' {Text
ingestionId :: Text
dataSetId :: Text
awsAccountId :: Text
$sel:ingestionId:CancelIngestion' :: CancelIngestion -> Text
$sel:dataSetId:CancelIngestion' :: CancelIngestion -> Text
$sel:awsAccountId:CancelIngestion' :: CancelIngestion -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
awsAccountId,
        ByteString
"/data-sets/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
dataSetId,
        ByteString
"/ingestions/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
ingestionId
      ]

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

-- | /See:/ 'newCancelIngestionResponse' smart constructor.
data CancelIngestionResponse = CancelIngestionResponse'
  { -- | The Amazon Resource Name (ARN) for the data ingestion.
    CancelIngestionResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | An ID for the ingestion.
    CancelIngestionResponse -> Maybe Text
ingestionId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services request ID for this operation.
    CancelIngestionResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    CancelIngestionResponse -> Int
status :: Prelude.Int
  }
  deriving (CancelIngestionResponse -> CancelIngestionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelIngestionResponse -> CancelIngestionResponse -> Bool
$c/= :: CancelIngestionResponse -> CancelIngestionResponse -> Bool
== :: CancelIngestionResponse -> CancelIngestionResponse -> Bool
$c== :: CancelIngestionResponse -> CancelIngestionResponse -> Bool
Prelude.Eq, ReadPrec [CancelIngestionResponse]
ReadPrec CancelIngestionResponse
Int -> ReadS CancelIngestionResponse
ReadS [CancelIngestionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelIngestionResponse]
$creadListPrec :: ReadPrec [CancelIngestionResponse]
readPrec :: ReadPrec CancelIngestionResponse
$creadPrec :: ReadPrec CancelIngestionResponse
readList :: ReadS [CancelIngestionResponse]
$creadList :: ReadS [CancelIngestionResponse]
readsPrec :: Int -> ReadS CancelIngestionResponse
$creadsPrec :: Int -> ReadS CancelIngestionResponse
Prelude.Read, Int -> CancelIngestionResponse -> ShowS
[CancelIngestionResponse] -> ShowS
CancelIngestionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelIngestionResponse] -> ShowS
$cshowList :: [CancelIngestionResponse] -> ShowS
show :: CancelIngestionResponse -> String
$cshow :: CancelIngestionResponse -> String
showsPrec :: Int -> CancelIngestionResponse -> ShowS
$cshowsPrec :: Int -> CancelIngestionResponse -> ShowS
Prelude.Show, forall x. Rep CancelIngestionResponse x -> CancelIngestionResponse
forall x. CancelIngestionResponse -> Rep CancelIngestionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelIngestionResponse x -> CancelIngestionResponse
$cfrom :: forall x. CancelIngestionResponse -> Rep CancelIngestionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CancelIngestionResponse' 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:
--
-- 'arn', 'cancelIngestionResponse_arn' - The Amazon Resource Name (ARN) for the data ingestion.
--
-- 'ingestionId', 'cancelIngestionResponse_ingestionId' - An ID for the ingestion.
--
-- 'requestId', 'cancelIngestionResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'status', 'cancelIngestionResponse_status' - The HTTP status of the request.
newCancelIngestionResponse ::
  -- | 'status'
  Prelude.Int ->
  CancelIngestionResponse
newCancelIngestionResponse :: Int -> CancelIngestionResponse
newCancelIngestionResponse Int
pStatus_ =
  CancelIngestionResponse'
    { $sel:arn:CancelIngestionResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:ingestionId:CancelIngestionResponse' :: Maybe Text
ingestionId = forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:CancelIngestionResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:CancelIngestionResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Resource Name (ARN) for the data ingestion.
cancelIngestionResponse_arn :: Lens.Lens' CancelIngestionResponse (Prelude.Maybe Prelude.Text)
cancelIngestionResponse_arn :: Lens' CancelIngestionResponse (Maybe Text)
cancelIngestionResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelIngestionResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CancelIngestionResponse' :: CancelIngestionResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CancelIngestionResponse
s@CancelIngestionResponse' {} Maybe Text
a -> CancelIngestionResponse
s {$sel:arn:CancelIngestionResponse' :: Maybe Text
arn = Maybe Text
a} :: CancelIngestionResponse)

-- | An ID for the ingestion.
cancelIngestionResponse_ingestionId :: Lens.Lens' CancelIngestionResponse (Prelude.Maybe Prelude.Text)
cancelIngestionResponse_ingestionId :: Lens' CancelIngestionResponse (Maybe Text)
cancelIngestionResponse_ingestionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelIngestionResponse' {Maybe Text
ingestionId :: Maybe Text
$sel:ingestionId:CancelIngestionResponse' :: CancelIngestionResponse -> Maybe Text
ingestionId} -> Maybe Text
ingestionId) (\s :: CancelIngestionResponse
s@CancelIngestionResponse' {} Maybe Text
a -> CancelIngestionResponse
s {$sel:ingestionId:CancelIngestionResponse' :: Maybe Text
ingestionId = Maybe Text
a} :: CancelIngestionResponse)

-- | The Amazon Web Services request ID for this operation.
cancelIngestionResponse_requestId :: Lens.Lens' CancelIngestionResponse (Prelude.Maybe Prelude.Text)
cancelIngestionResponse_requestId :: Lens' CancelIngestionResponse (Maybe Text)
cancelIngestionResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelIngestionResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:CancelIngestionResponse' :: CancelIngestionResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: CancelIngestionResponse
s@CancelIngestionResponse' {} Maybe Text
a -> CancelIngestionResponse
s {$sel:requestId:CancelIngestionResponse' :: Maybe Text
requestId = Maybe Text
a} :: CancelIngestionResponse)

-- | The HTTP status of the request.
cancelIngestionResponse_status :: Lens.Lens' CancelIngestionResponse Prelude.Int
cancelIngestionResponse_status :: Lens' CancelIngestionResponse Int
cancelIngestionResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelIngestionResponse' {Int
status :: Int
$sel:status:CancelIngestionResponse' :: CancelIngestionResponse -> Int
status} -> Int
status) (\s :: CancelIngestionResponse
s@CancelIngestionResponse' {} Int
a -> CancelIngestionResponse
s {$sel:status:CancelIngestionResponse' :: Int
status = Int
a} :: CancelIngestionResponse)

instance Prelude.NFData CancelIngestionResponse where
  rnf :: CancelIngestionResponse -> ()
rnf CancelIngestionResponse' {Int
Maybe Text
status :: Int
requestId :: Maybe Text
ingestionId :: Maybe Text
arn :: Maybe Text
$sel:status:CancelIngestionResponse' :: CancelIngestionResponse -> Int
$sel:requestId:CancelIngestionResponse' :: CancelIngestionResponse -> Maybe Text
$sel:ingestionId:CancelIngestionResponse' :: CancelIngestionResponse -> Maybe Text
$sel:arn:CancelIngestionResponse' :: CancelIngestionResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ingestionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
status