{-# 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.Glue.DeleteMLTransform
-- 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 an Glue machine learning transform. Machine learning transforms
-- are a special type of transform that use machine learning to learn the
-- details of the transformation to be performed by learning from examples
-- provided by humans. These transformations are then saved by Glue. If you
-- no longer need a transform, you can delete it by calling
-- @DeleteMLTransforms@. However, any Glue jobs that still reference the
-- deleted transform will no longer succeed.
module Amazonka.Glue.DeleteMLTransform
  ( -- * Creating a Request
    DeleteMLTransform (..),
    newDeleteMLTransform,

    -- * Request Lenses
    deleteMLTransform_transformId,

    -- * Destructuring the Response
    DeleteMLTransformResponse (..),
    newDeleteMLTransformResponse,

    -- * Response Lenses
    deleteMLTransformResponse_transformId,
    deleteMLTransformResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'DeleteMLTransform' 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:
--
-- 'transformId', 'deleteMLTransform_transformId' - The unique identifier of the transform to delete.
newDeleteMLTransform ::
  -- | 'transformId'
  Prelude.Text ->
  DeleteMLTransform
newDeleteMLTransform :: Text -> DeleteMLTransform
newDeleteMLTransform Text
pTransformId_ =
  DeleteMLTransform' :: Text -> DeleteMLTransform
DeleteMLTransform' {$sel:transformId:DeleteMLTransform' :: Text
transformId = Text
pTransformId_}

-- | The unique identifier of the transform to delete.
deleteMLTransform_transformId :: Lens.Lens' DeleteMLTransform Prelude.Text
deleteMLTransform_transformId :: (Text -> f Text) -> DeleteMLTransform -> f DeleteMLTransform
deleteMLTransform_transformId = (DeleteMLTransform -> Text)
-> (DeleteMLTransform -> Text -> DeleteMLTransform)
-> Lens DeleteMLTransform DeleteMLTransform Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMLTransform' {Text
transformId :: Text
$sel:transformId:DeleteMLTransform' :: DeleteMLTransform -> Text
transformId} -> Text
transformId) (\s :: DeleteMLTransform
s@DeleteMLTransform' {} Text
a -> DeleteMLTransform
s {$sel:transformId:DeleteMLTransform' :: Text
transformId = Text
a} :: DeleteMLTransform)

instance Core.AWSRequest DeleteMLTransform where
  type
    AWSResponse DeleteMLTransform =
      DeleteMLTransformResponse
  request :: DeleteMLTransform -> Request DeleteMLTransform
request = Service -> DeleteMLTransform -> Request DeleteMLTransform
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteMLTransform
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMLTransform)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteMLTransform))
-> Logger
-> Service
-> Proxy DeleteMLTransform
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMLTransform)))
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 Text -> Int -> DeleteMLTransformResponse
DeleteMLTransformResponse'
            (Maybe Text -> Int -> DeleteMLTransformResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteMLTransformResponse)
forall (f :: * -> *) a b. Functor 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
"TransformId")
            Either String (Int -> DeleteMLTransformResponse)
-> Either String Int -> Either String DeleteMLTransformResponse
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 DeleteMLTransform

instance Prelude.NFData DeleteMLTransform

instance Core.ToHeaders DeleteMLTransform where
  toHeaders :: DeleteMLTransform -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteMLTransform -> 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
"AWSGlue.DeleteMLTransform" :: 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 DeleteMLTransform where
  toJSON :: DeleteMLTransform -> Value
toJSON DeleteMLTransform' {Text
transformId :: Text
$sel:transformId:DeleteMLTransform' :: DeleteMLTransform -> 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
"TransformId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
transformId)]
      )

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

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

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

-- |
-- Create a value of 'DeleteMLTransformResponse' 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:
--
-- 'transformId', 'deleteMLTransformResponse_transformId' - The unique identifier of the transform that was deleted.
--
-- 'httpStatus', 'deleteMLTransformResponse_httpStatus' - The response's http status code.
newDeleteMLTransformResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteMLTransformResponse
newDeleteMLTransformResponse :: Int -> DeleteMLTransformResponse
newDeleteMLTransformResponse Int
pHttpStatus_ =
  DeleteMLTransformResponse' :: Maybe Text -> Int -> DeleteMLTransformResponse
DeleteMLTransformResponse'
    { $sel:transformId:DeleteMLTransformResponse' :: Maybe Text
transformId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteMLTransformResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier of the transform that was deleted.
deleteMLTransformResponse_transformId :: Lens.Lens' DeleteMLTransformResponse (Prelude.Maybe Prelude.Text)
deleteMLTransformResponse_transformId :: (Maybe Text -> f (Maybe Text))
-> DeleteMLTransformResponse -> f DeleteMLTransformResponse
deleteMLTransformResponse_transformId = (DeleteMLTransformResponse -> Maybe Text)
-> (DeleteMLTransformResponse
    -> Maybe Text -> DeleteMLTransformResponse)
-> Lens
     DeleteMLTransformResponse
     DeleteMLTransformResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMLTransformResponse' {Maybe Text
transformId :: Maybe Text
$sel:transformId:DeleteMLTransformResponse' :: DeleteMLTransformResponse -> Maybe Text
transformId} -> Maybe Text
transformId) (\s :: DeleteMLTransformResponse
s@DeleteMLTransformResponse' {} Maybe Text
a -> DeleteMLTransformResponse
s {$sel:transformId:DeleteMLTransformResponse' :: Maybe Text
transformId = Maybe Text
a} :: DeleteMLTransformResponse)

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

instance Prelude.NFData DeleteMLTransformResponse