{-# 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.LexV2Models.DeleteExport
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes a previous export and the associated files stored in an S3
-- bucket.
module Amazonka.LexV2Models.DeleteExport
  ( -- * Creating a Request
    DeleteExport (..),
    newDeleteExport,

    -- * Request Lenses
    deleteExport_exportId,

    -- * Destructuring the Response
    DeleteExportResponse (..),
    newDeleteExportResponse,

    -- * Response Lenses
    deleteExportResponse_exportId,
    deleteExportResponse_exportStatus,
    deleteExportResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteExport' smart constructor.
data DeleteExport = DeleteExport'
  { -- | The unique identifier of the export to delete.
    DeleteExport -> Text
exportId :: Prelude.Text
  }
  deriving (DeleteExport -> DeleteExport -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteExport -> DeleteExport -> Bool
$c/= :: DeleteExport -> DeleteExport -> Bool
== :: DeleteExport -> DeleteExport -> Bool
$c== :: DeleteExport -> DeleteExport -> Bool
Prelude.Eq, ReadPrec [DeleteExport]
ReadPrec DeleteExport
Int -> ReadS DeleteExport
ReadS [DeleteExport]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteExport]
$creadListPrec :: ReadPrec [DeleteExport]
readPrec :: ReadPrec DeleteExport
$creadPrec :: ReadPrec DeleteExport
readList :: ReadS [DeleteExport]
$creadList :: ReadS [DeleteExport]
readsPrec :: Int -> ReadS DeleteExport
$creadsPrec :: Int -> ReadS DeleteExport
Prelude.Read, Int -> DeleteExport -> ShowS
[DeleteExport] -> ShowS
DeleteExport -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteExport] -> ShowS
$cshowList :: [DeleteExport] -> ShowS
show :: DeleteExport -> String
$cshow :: DeleteExport -> String
showsPrec :: Int -> DeleteExport -> ShowS
$cshowsPrec :: Int -> DeleteExport -> ShowS
Prelude.Show, forall x. Rep DeleteExport x -> DeleteExport
forall x. DeleteExport -> Rep DeleteExport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteExport x -> DeleteExport
$cfrom :: forall x. DeleteExport -> Rep DeleteExport x
Prelude.Generic)

-- |
-- Create a value of 'DeleteExport' 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:
--
-- 'exportId', 'deleteExport_exportId' - The unique identifier of the export to delete.
newDeleteExport ::
  -- | 'exportId'
  Prelude.Text ->
  DeleteExport
newDeleteExport :: Text -> DeleteExport
newDeleteExport Text
pExportId_ =
  DeleteExport' {$sel:exportId:DeleteExport' :: Text
exportId = Text
pExportId_}

-- | The unique identifier of the export to delete.
deleteExport_exportId :: Lens.Lens' DeleteExport Prelude.Text
deleteExport_exportId :: Lens' DeleteExport Text
deleteExport_exportId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteExport' {Text
exportId :: Text
$sel:exportId:DeleteExport' :: DeleteExport -> Text
exportId} -> Text
exportId) (\s :: DeleteExport
s@DeleteExport' {} Text
a -> DeleteExport
s {$sel:exportId:DeleteExport' :: Text
exportId = Text
a} :: DeleteExport)

instance Core.AWSRequest DeleteExport where
  type AWSResponse DeleteExport = DeleteExportResponse
  request :: (Service -> Service) -> DeleteExport -> Request DeleteExport
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 DeleteExport
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteExport)))
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 ExportStatus -> Int -> DeleteExportResponse
DeleteExportResponse'
            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
"exportId")
            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
"exportStatus")
            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 DeleteExport where
  hashWithSalt :: Int -> DeleteExport -> Int
hashWithSalt Int
_salt DeleteExport' {Text
exportId :: Text
$sel:exportId:DeleteExport' :: DeleteExport -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
exportId

instance Prelude.NFData DeleteExport where
  rnf :: DeleteExport -> ()
rnf DeleteExport' {Text
exportId :: Text
$sel:exportId:DeleteExport' :: DeleteExport -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
exportId

instance Data.ToHeaders DeleteExport where
  toHeaders :: DeleteExport -> 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.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteExport where
  toPath :: DeleteExport -> ByteString
toPath DeleteExport' {Text
exportId :: Text
$sel:exportId:DeleteExport' :: DeleteExport -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/exports/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
exportId, ByteString
"/"]

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

-- | /See:/ 'newDeleteExportResponse' smart constructor.
data DeleteExportResponse = DeleteExportResponse'
  { -- | The unique identifier of the deleted export.
    DeleteExportResponse -> Maybe Text
exportId :: Prelude.Maybe Prelude.Text,
    -- | The current status of the deletion. When the deletion is complete, the
    -- export will no longer be returned by the
    -- <https://docs.aws.amazon.com/lexv2/latest/dg/API_ListExports.html ListExports>
    -- operation and calls to the
    -- <https://docs.aws.amazon.com/lexv2/latest/dg/API_DescribeExport.html DescribeExport>
    -- operation with the export identifier will fail.
    DeleteExportResponse -> Maybe ExportStatus
exportStatus :: Prelude.Maybe ExportStatus,
    -- | The response's http status code.
    DeleteExportResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteExportResponse -> DeleteExportResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteExportResponse -> DeleteExportResponse -> Bool
$c/= :: DeleteExportResponse -> DeleteExportResponse -> Bool
== :: DeleteExportResponse -> DeleteExportResponse -> Bool
$c== :: DeleteExportResponse -> DeleteExportResponse -> Bool
Prelude.Eq, ReadPrec [DeleteExportResponse]
ReadPrec DeleteExportResponse
Int -> ReadS DeleteExportResponse
ReadS [DeleteExportResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteExportResponse]
$creadListPrec :: ReadPrec [DeleteExportResponse]
readPrec :: ReadPrec DeleteExportResponse
$creadPrec :: ReadPrec DeleteExportResponse
readList :: ReadS [DeleteExportResponse]
$creadList :: ReadS [DeleteExportResponse]
readsPrec :: Int -> ReadS DeleteExportResponse
$creadsPrec :: Int -> ReadS DeleteExportResponse
Prelude.Read, Int -> DeleteExportResponse -> ShowS
[DeleteExportResponse] -> ShowS
DeleteExportResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteExportResponse] -> ShowS
$cshowList :: [DeleteExportResponse] -> ShowS
show :: DeleteExportResponse -> String
$cshow :: DeleteExportResponse -> String
showsPrec :: Int -> DeleteExportResponse -> ShowS
$cshowsPrec :: Int -> DeleteExportResponse -> ShowS
Prelude.Show, forall x. Rep DeleteExportResponse x -> DeleteExportResponse
forall x. DeleteExportResponse -> Rep DeleteExportResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteExportResponse x -> DeleteExportResponse
$cfrom :: forall x. DeleteExportResponse -> Rep DeleteExportResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteExportResponse' 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:
--
-- 'exportId', 'deleteExportResponse_exportId' - The unique identifier of the deleted export.
--
-- 'exportStatus', 'deleteExportResponse_exportStatus' - The current status of the deletion. When the deletion is complete, the
-- export will no longer be returned by the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_ListExports.html ListExports>
-- operation and calls to the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_DescribeExport.html DescribeExport>
-- operation with the export identifier will fail.
--
-- 'httpStatus', 'deleteExportResponse_httpStatus' - The response's http status code.
newDeleteExportResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteExportResponse
newDeleteExportResponse :: Int -> DeleteExportResponse
newDeleteExportResponse Int
pHttpStatus_ =
  DeleteExportResponse'
    { $sel:exportId:DeleteExportResponse' :: Maybe Text
exportId = forall a. Maybe a
Prelude.Nothing,
      $sel:exportStatus:DeleteExportResponse' :: Maybe ExportStatus
exportStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteExportResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier of the deleted export.
deleteExportResponse_exportId :: Lens.Lens' DeleteExportResponse (Prelude.Maybe Prelude.Text)
deleteExportResponse_exportId :: Lens' DeleteExportResponse (Maybe Text)
deleteExportResponse_exportId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteExportResponse' {Maybe Text
exportId :: Maybe Text
$sel:exportId:DeleteExportResponse' :: DeleteExportResponse -> Maybe Text
exportId} -> Maybe Text
exportId) (\s :: DeleteExportResponse
s@DeleteExportResponse' {} Maybe Text
a -> DeleteExportResponse
s {$sel:exportId:DeleteExportResponse' :: Maybe Text
exportId = Maybe Text
a} :: DeleteExportResponse)

-- | The current status of the deletion. When the deletion is complete, the
-- export will no longer be returned by the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_ListExports.html ListExports>
-- operation and calls to the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_DescribeExport.html DescribeExport>
-- operation with the export identifier will fail.
deleteExportResponse_exportStatus :: Lens.Lens' DeleteExportResponse (Prelude.Maybe ExportStatus)
deleteExportResponse_exportStatus :: Lens' DeleteExportResponse (Maybe ExportStatus)
deleteExportResponse_exportStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteExportResponse' {Maybe ExportStatus
exportStatus :: Maybe ExportStatus
$sel:exportStatus:DeleteExportResponse' :: DeleteExportResponse -> Maybe ExportStatus
exportStatus} -> Maybe ExportStatus
exportStatus) (\s :: DeleteExportResponse
s@DeleteExportResponse' {} Maybe ExportStatus
a -> DeleteExportResponse
s {$sel:exportStatus:DeleteExportResponse' :: Maybe ExportStatus
exportStatus = Maybe ExportStatus
a} :: DeleteExportResponse)

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

instance Prelude.NFData DeleteExportResponse where
  rnf :: DeleteExportResponse -> ()
rnf DeleteExportResponse' {Int
Maybe Text
Maybe ExportStatus
httpStatus :: Int
exportStatus :: Maybe ExportStatus
exportId :: Maybe Text
$sel:httpStatus:DeleteExportResponse' :: DeleteExportResponse -> Int
$sel:exportStatus:DeleteExportResponse' :: DeleteExportResponse -> Maybe ExportStatus
$sel:exportId:DeleteExportResponse' :: DeleteExportResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
exportId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExportStatus
exportStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus