{-# 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.DeleteImport
-- 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 import and the associated file stored in an S3
-- bucket.
module Amazonka.LexV2Models.DeleteImport
  ( -- * Creating a Request
    DeleteImport (..),
    newDeleteImport,

    -- * Request Lenses
    deleteImport_importId,

    -- * Destructuring the Response
    DeleteImportResponse (..),
    newDeleteImportResponse,

    -- * Response Lenses
    deleteImportResponse_importId,
    deleteImportResponse_importStatus,
    deleteImportResponse_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:/ 'newDeleteImport' smart constructor.
data DeleteImport = DeleteImport'
  { -- | The unique identifier of the import to delete.
    DeleteImport -> Text
importId :: Prelude.Text
  }
  deriving (DeleteImport -> DeleteImport -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteImport -> DeleteImport -> Bool
$c/= :: DeleteImport -> DeleteImport -> Bool
== :: DeleteImport -> DeleteImport -> Bool
$c== :: DeleteImport -> DeleteImport -> Bool
Prelude.Eq, ReadPrec [DeleteImport]
ReadPrec DeleteImport
Int -> ReadS DeleteImport
ReadS [DeleteImport]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteImport]
$creadListPrec :: ReadPrec [DeleteImport]
readPrec :: ReadPrec DeleteImport
$creadPrec :: ReadPrec DeleteImport
readList :: ReadS [DeleteImport]
$creadList :: ReadS [DeleteImport]
readsPrec :: Int -> ReadS DeleteImport
$creadsPrec :: Int -> ReadS DeleteImport
Prelude.Read, Int -> DeleteImport -> ShowS
[DeleteImport] -> ShowS
DeleteImport -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteImport] -> ShowS
$cshowList :: [DeleteImport] -> ShowS
show :: DeleteImport -> String
$cshow :: DeleteImport -> String
showsPrec :: Int -> DeleteImport -> ShowS
$cshowsPrec :: Int -> DeleteImport -> ShowS
Prelude.Show, forall x. Rep DeleteImport x -> DeleteImport
forall x. DeleteImport -> Rep DeleteImport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteImport x -> DeleteImport
$cfrom :: forall x. DeleteImport -> Rep DeleteImport x
Prelude.Generic)

-- |
-- Create a value of 'DeleteImport' 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:
--
-- 'importId', 'deleteImport_importId' - The unique identifier of the import to delete.
newDeleteImport ::
  -- | 'importId'
  Prelude.Text ->
  DeleteImport
newDeleteImport :: Text -> DeleteImport
newDeleteImport Text
pImportId_ =
  DeleteImport' {$sel:importId:DeleteImport' :: Text
importId = Text
pImportId_}

-- | The unique identifier of the import to delete.
deleteImport_importId :: Lens.Lens' DeleteImport Prelude.Text
deleteImport_importId :: Lens' DeleteImport Text
deleteImport_importId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteImport' {Text
importId :: Text
$sel:importId:DeleteImport' :: DeleteImport -> Text
importId} -> Text
importId) (\s :: DeleteImport
s@DeleteImport' {} Text
a -> DeleteImport
s {$sel:importId:DeleteImport' :: Text
importId = Text
a} :: DeleteImport)

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

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

instance Data.ToHeaders DeleteImport where
  toHeaders :: DeleteImport -> 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 DeleteImport where
  toPath :: DeleteImport -> ByteString
toPath DeleteImport' {Text
importId :: Text
$sel:importId:DeleteImport' :: DeleteImport -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/imports/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
importId, ByteString
"/"]

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

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

-- |
-- Create a value of 'DeleteImportResponse' 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:
--
-- 'importId', 'deleteImportResponse_importId' - The unique identifier of the deleted import.
--
-- 'importStatus', 'deleteImportResponse_importStatus' - The current status of the deletion. When the deletion is complete, the
-- import will no longer be returned by the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_ListImports.html ListImports>
-- operation and calls to the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_DescribeImport.html DescribeImport>
-- operation with the import identifier will fail.
--
-- 'httpStatus', 'deleteImportResponse_httpStatus' - The response's http status code.
newDeleteImportResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteImportResponse
newDeleteImportResponse :: Int -> DeleteImportResponse
newDeleteImportResponse Int
pHttpStatus_ =
  DeleteImportResponse'
    { $sel:importId:DeleteImportResponse' :: Maybe Text
importId = forall a. Maybe a
Prelude.Nothing,
      $sel:importStatus:DeleteImportResponse' :: Maybe ImportStatus
importStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteImportResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier of the deleted import.
deleteImportResponse_importId :: Lens.Lens' DeleteImportResponse (Prelude.Maybe Prelude.Text)
deleteImportResponse_importId :: Lens' DeleteImportResponse (Maybe Text)
deleteImportResponse_importId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteImportResponse' {Maybe Text
importId :: Maybe Text
$sel:importId:DeleteImportResponse' :: DeleteImportResponse -> Maybe Text
importId} -> Maybe Text
importId) (\s :: DeleteImportResponse
s@DeleteImportResponse' {} Maybe Text
a -> DeleteImportResponse
s {$sel:importId:DeleteImportResponse' :: Maybe Text
importId = Maybe Text
a} :: DeleteImportResponse)

-- | The current status of the deletion. When the deletion is complete, the
-- import will no longer be returned by the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_ListImports.html ListImports>
-- operation and calls to the
-- <https://docs.aws.amazon.com/lexv2/latest/dg/API_DescribeImport.html DescribeImport>
-- operation with the import identifier will fail.
deleteImportResponse_importStatus :: Lens.Lens' DeleteImportResponse (Prelude.Maybe ImportStatus)
deleteImportResponse_importStatus :: Lens' DeleteImportResponse (Maybe ImportStatus)
deleteImportResponse_importStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteImportResponse' {Maybe ImportStatus
importStatus :: Maybe ImportStatus
$sel:importStatus:DeleteImportResponse' :: DeleteImportResponse -> Maybe ImportStatus
importStatus} -> Maybe ImportStatus
importStatus) (\s :: DeleteImportResponse
s@DeleteImportResponse' {} Maybe ImportStatus
a -> DeleteImportResponse
s {$sel:importStatus:DeleteImportResponse' :: Maybe ImportStatus
importStatus = Maybe ImportStatus
a} :: DeleteImportResponse)

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

instance Prelude.NFData DeleteImportResponse where
  rnf :: DeleteImportResponse -> ()
rnf DeleteImportResponse' {Int
Maybe Text
Maybe ImportStatus
httpStatus :: Int
importStatus :: Maybe ImportStatus
importId :: Maybe Text
$sel:httpStatus:DeleteImportResponse' :: DeleteImportResponse -> Int
$sel:importStatus:DeleteImportResponse' :: DeleteImportResponse -> Maybe ImportStatus
$sel:importId:DeleteImportResponse' :: DeleteImportResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
importId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ImportStatus
importStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus