{-# 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.Translate.DeleteParallelData
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a parallel data resource in Amazon Translate.
module Amazonka.Translate.DeleteParallelData
  ( -- * Creating a Request
    DeleteParallelData (..),
    newDeleteParallelData,

    -- * Request Lenses
    deleteParallelData_name,

    -- * Destructuring the Response
    DeleteParallelDataResponse (..),
    newDeleteParallelDataResponse,

    -- * Response Lenses
    deleteParallelDataResponse_status,
    deleteParallelDataResponse_name,
    deleteParallelDataResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Translate.Types

-- | /See:/ 'newDeleteParallelData' smart constructor.
data DeleteParallelData = DeleteParallelData'
  { -- | The name of the parallel data resource that is being deleted.
    DeleteParallelData -> Text
name :: Prelude.Text
  }
  deriving (DeleteParallelData -> DeleteParallelData -> Bool
(DeleteParallelData -> DeleteParallelData -> Bool)
-> (DeleteParallelData -> DeleteParallelData -> Bool)
-> Eq DeleteParallelData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteParallelData -> DeleteParallelData -> Bool
$c/= :: DeleteParallelData -> DeleteParallelData -> Bool
== :: DeleteParallelData -> DeleteParallelData -> Bool
$c== :: DeleteParallelData -> DeleteParallelData -> Bool
Prelude.Eq, ReadPrec [DeleteParallelData]
ReadPrec DeleteParallelData
Int -> ReadS DeleteParallelData
ReadS [DeleteParallelData]
(Int -> ReadS DeleteParallelData)
-> ReadS [DeleteParallelData]
-> ReadPrec DeleteParallelData
-> ReadPrec [DeleteParallelData]
-> Read DeleteParallelData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteParallelData]
$creadListPrec :: ReadPrec [DeleteParallelData]
readPrec :: ReadPrec DeleteParallelData
$creadPrec :: ReadPrec DeleteParallelData
readList :: ReadS [DeleteParallelData]
$creadList :: ReadS [DeleteParallelData]
readsPrec :: Int -> ReadS DeleteParallelData
$creadsPrec :: Int -> ReadS DeleteParallelData
Prelude.Read, Int -> DeleteParallelData -> ShowS
[DeleteParallelData] -> ShowS
DeleteParallelData -> String
(Int -> DeleteParallelData -> ShowS)
-> (DeleteParallelData -> String)
-> ([DeleteParallelData] -> ShowS)
-> Show DeleteParallelData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteParallelData] -> ShowS
$cshowList :: [DeleteParallelData] -> ShowS
show :: DeleteParallelData -> String
$cshow :: DeleteParallelData -> String
showsPrec :: Int -> DeleteParallelData -> ShowS
$cshowsPrec :: Int -> DeleteParallelData -> ShowS
Prelude.Show, (forall x. DeleteParallelData -> Rep DeleteParallelData x)
-> (forall x. Rep DeleteParallelData x -> DeleteParallelData)
-> Generic DeleteParallelData
forall x. Rep DeleteParallelData x -> DeleteParallelData
forall x. DeleteParallelData -> Rep DeleteParallelData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteParallelData x -> DeleteParallelData
$cfrom :: forall x. DeleteParallelData -> Rep DeleteParallelData x
Prelude.Generic)

-- |
-- Create a value of 'DeleteParallelData' 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:
--
-- 'name', 'deleteParallelData_name' - The name of the parallel data resource that is being deleted.
newDeleteParallelData ::
  -- | 'name'
  Prelude.Text ->
  DeleteParallelData
newDeleteParallelData :: Text -> DeleteParallelData
newDeleteParallelData Text
pName_ =
  DeleteParallelData' :: Text -> DeleteParallelData
DeleteParallelData' {$sel:name:DeleteParallelData' :: Text
name = Text
pName_}

-- | The name of the parallel data resource that is being deleted.
deleteParallelData_name :: Lens.Lens' DeleteParallelData Prelude.Text
deleteParallelData_name :: (Text -> f Text) -> DeleteParallelData -> f DeleteParallelData
deleteParallelData_name = (DeleteParallelData -> Text)
-> (DeleteParallelData -> Text -> DeleteParallelData)
-> Lens DeleteParallelData DeleteParallelData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteParallelData' {Text
name :: Text
$sel:name:DeleteParallelData' :: DeleteParallelData -> Text
name} -> Text
name) (\s :: DeleteParallelData
s@DeleteParallelData' {} Text
a -> DeleteParallelData
s {$sel:name:DeleteParallelData' :: Text
name = Text
a} :: DeleteParallelData)

instance Core.AWSRequest DeleteParallelData where
  type
    AWSResponse DeleteParallelData =
      DeleteParallelDataResponse
  request :: DeleteParallelData -> Request DeleteParallelData
request = Service -> DeleteParallelData -> Request DeleteParallelData
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteParallelData
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteParallelData)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteParallelData))
-> Logger
-> Service
-> Proxy DeleteParallelData
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteParallelData)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ParallelDataStatus
-> Maybe Text -> Int -> DeleteParallelDataResponse
DeleteParallelDataResponse'
            (Maybe ParallelDataStatus
 -> Maybe Text -> Int -> DeleteParallelDataResponse)
-> Either String (Maybe ParallelDataStatus)
-> Either String (Maybe Text -> Int -> DeleteParallelDataResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ParallelDataStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
            Either String (Maybe Text -> Int -> DeleteParallelDataResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteParallelDataResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Name")
            Either String (Int -> DeleteParallelDataResponse)
-> Either String Int -> Either String DeleteParallelDataResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteParallelData

instance Prelude.NFData DeleteParallelData

instance Core.ToHeaders DeleteParallelData where
  toHeaders :: DeleteParallelData -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteParallelData -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSShineFrontendService_20170701.DeleteParallelData" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteParallelData where
  toJSON :: DeleteParallelData -> Value
toJSON DeleteParallelData' {Text
name :: Text
$sel:name:DeleteParallelData' :: DeleteParallelData -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )

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

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

-- | /See:/ 'newDeleteParallelDataResponse' smart constructor.
data DeleteParallelDataResponse = DeleteParallelDataResponse'
  { -- | The status of the parallel data deletion.
    DeleteParallelDataResponse -> Maybe ParallelDataStatus
status :: Prelude.Maybe ParallelDataStatus,
    -- | The name of the parallel data resource that is being deleted.
    DeleteParallelDataResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteParallelDataResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteParallelDataResponse -> DeleteParallelDataResponse -> Bool
(DeleteParallelDataResponse -> DeleteParallelDataResponse -> Bool)
-> (DeleteParallelDataResponse
    -> DeleteParallelDataResponse -> Bool)
-> Eq DeleteParallelDataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteParallelDataResponse -> DeleteParallelDataResponse -> Bool
$c/= :: DeleteParallelDataResponse -> DeleteParallelDataResponse -> Bool
== :: DeleteParallelDataResponse -> DeleteParallelDataResponse -> Bool
$c== :: DeleteParallelDataResponse -> DeleteParallelDataResponse -> Bool
Prelude.Eq, ReadPrec [DeleteParallelDataResponse]
ReadPrec DeleteParallelDataResponse
Int -> ReadS DeleteParallelDataResponse
ReadS [DeleteParallelDataResponse]
(Int -> ReadS DeleteParallelDataResponse)
-> ReadS [DeleteParallelDataResponse]
-> ReadPrec DeleteParallelDataResponse
-> ReadPrec [DeleteParallelDataResponse]
-> Read DeleteParallelDataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteParallelDataResponse]
$creadListPrec :: ReadPrec [DeleteParallelDataResponse]
readPrec :: ReadPrec DeleteParallelDataResponse
$creadPrec :: ReadPrec DeleteParallelDataResponse
readList :: ReadS [DeleteParallelDataResponse]
$creadList :: ReadS [DeleteParallelDataResponse]
readsPrec :: Int -> ReadS DeleteParallelDataResponse
$creadsPrec :: Int -> ReadS DeleteParallelDataResponse
Prelude.Read, Int -> DeleteParallelDataResponse -> ShowS
[DeleteParallelDataResponse] -> ShowS
DeleteParallelDataResponse -> String
(Int -> DeleteParallelDataResponse -> ShowS)
-> (DeleteParallelDataResponse -> String)
-> ([DeleteParallelDataResponse] -> ShowS)
-> Show DeleteParallelDataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteParallelDataResponse] -> ShowS
$cshowList :: [DeleteParallelDataResponse] -> ShowS
show :: DeleteParallelDataResponse -> String
$cshow :: DeleteParallelDataResponse -> String
showsPrec :: Int -> DeleteParallelDataResponse -> ShowS
$cshowsPrec :: Int -> DeleteParallelDataResponse -> ShowS
Prelude.Show, (forall x.
 DeleteParallelDataResponse -> Rep DeleteParallelDataResponse x)
-> (forall x.
    Rep DeleteParallelDataResponse x -> DeleteParallelDataResponse)
-> Generic DeleteParallelDataResponse
forall x.
Rep DeleteParallelDataResponse x -> DeleteParallelDataResponse
forall x.
DeleteParallelDataResponse -> Rep DeleteParallelDataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteParallelDataResponse x -> DeleteParallelDataResponse
$cfrom :: forall x.
DeleteParallelDataResponse -> Rep DeleteParallelDataResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteParallelDataResponse' 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:
--
-- 'status', 'deleteParallelDataResponse_status' - The status of the parallel data deletion.
--
-- 'name', 'deleteParallelDataResponse_name' - The name of the parallel data resource that is being deleted.
--
-- 'httpStatus', 'deleteParallelDataResponse_httpStatus' - The response's http status code.
newDeleteParallelDataResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteParallelDataResponse
newDeleteParallelDataResponse :: Int -> DeleteParallelDataResponse
newDeleteParallelDataResponse Int
pHttpStatus_ =
  DeleteParallelDataResponse' :: Maybe ParallelDataStatus
-> Maybe Text -> Int -> DeleteParallelDataResponse
DeleteParallelDataResponse'
    { $sel:status:DeleteParallelDataResponse' :: Maybe ParallelDataStatus
status =
        Maybe ParallelDataStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DeleteParallelDataResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteParallelDataResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of the parallel data deletion.
deleteParallelDataResponse_status :: Lens.Lens' DeleteParallelDataResponse (Prelude.Maybe ParallelDataStatus)
deleteParallelDataResponse_status :: (Maybe ParallelDataStatus -> f (Maybe ParallelDataStatus))
-> DeleteParallelDataResponse -> f DeleteParallelDataResponse
deleteParallelDataResponse_status = (DeleteParallelDataResponse -> Maybe ParallelDataStatus)
-> (DeleteParallelDataResponse
    -> Maybe ParallelDataStatus -> DeleteParallelDataResponse)
-> Lens
     DeleteParallelDataResponse
     DeleteParallelDataResponse
     (Maybe ParallelDataStatus)
     (Maybe ParallelDataStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteParallelDataResponse' {Maybe ParallelDataStatus
status :: Maybe ParallelDataStatus
$sel:status:DeleteParallelDataResponse' :: DeleteParallelDataResponse -> Maybe ParallelDataStatus
status} -> Maybe ParallelDataStatus
status) (\s :: DeleteParallelDataResponse
s@DeleteParallelDataResponse' {} Maybe ParallelDataStatus
a -> DeleteParallelDataResponse
s {$sel:status:DeleteParallelDataResponse' :: Maybe ParallelDataStatus
status = Maybe ParallelDataStatus
a} :: DeleteParallelDataResponse)

-- | The name of the parallel data resource that is being deleted.
deleteParallelDataResponse_name :: Lens.Lens' DeleteParallelDataResponse (Prelude.Maybe Prelude.Text)
deleteParallelDataResponse_name :: (Maybe Text -> f (Maybe Text))
-> DeleteParallelDataResponse -> f DeleteParallelDataResponse
deleteParallelDataResponse_name = (DeleteParallelDataResponse -> Maybe Text)
-> (DeleteParallelDataResponse
    -> Maybe Text -> DeleteParallelDataResponse)
-> Lens
     DeleteParallelDataResponse
     DeleteParallelDataResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteParallelDataResponse' {Maybe Text
name :: Maybe Text
$sel:name:DeleteParallelDataResponse' :: DeleteParallelDataResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: DeleteParallelDataResponse
s@DeleteParallelDataResponse' {} Maybe Text
a -> DeleteParallelDataResponse
s {$sel:name:DeleteParallelDataResponse' :: Maybe Text
name = Maybe Text
a} :: DeleteParallelDataResponse)

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

instance Prelude.NFData DeleteParallelDataResponse