{-# 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.SageMaker.DeleteFlowDefinition
-- 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 the specified flow definition.
module Amazonka.SageMaker.DeleteFlowDefinition
  ( -- * Creating a Request
    DeleteFlowDefinition (..),
    newDeleteFlowDefinition,

    -- * Request Lenses
    deleteFlowDefinition_flowDefinitionName,

    -- * Destructuring the Response
    DeleteFlowDefinitionResponse (..),
    newDeleteFlowDefinitionResponse,

    -- * Response Lenses
    deleteFlowDefinitionResponse_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.SageMaker.Types

-- | /See:/ 'newDeleteFlowDefinition' smart constructor.
data DeleteFlowDefinition = DeleteFlowDefinition'
  { -- | The name of the flow definition you are deleting.
    DeleteFlowDefinition -> Text
flowDefinitionName :: Prelude.Text
  }
  deriving (DeleteFlowDefinition -> DeleteFlowDefinition -> Bool
(DeleteFlowDefinition -> DeleteFlowDefinition -> Bool)
-> (DeleteFlowDefinition -> DeleteFlowDefinition -> Bool)
-> Eq DeleteFlowDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFlowDefinition -> DeleteFlowDefinition -> Bool
$c/= :: DeleteFlowDefinition -> DeleteFlowDefinition -> Bool
== :: DeleteFlowDefinition -> DeleteFlowDefinition -> Bool
$c== :: DeleteFlowDefinition -> DeleteFlowDefinition -> Bool
Prelude.Eq, ReadPrec [DeleteFlowDefinition]
ReadPrec DeleteFlowDefinition
Int -> ReadS DeleteFlowDefinition
ReadS [DeleteFlowDefinition]
(Int -> ReadS DeleteFlowDefinition)
-> ReadS [DeleteFlowDefinition]
-> ReadPrec DeleteFlowDefinition
-> ReadPrec [DeleteFlowDefinition]
-> Read DeleteFlowDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFlowDefinition]
$creadListPrec :: ReadPrec [DeleteFlowDefinition]
readPrec :: ReadPrec DeleteFlowDefinition
$creadPrec :: ReadPrec DeleteFlowDefinition
readList :: ReadS [DeleteFlowDefinition]
$creadList :: ReadS [DeleteFlowDefinition]
readsPrec :: Int -> ReadS DeleteFlowDefinition
$creadsPrec :: Int -> ReadS DeleteFlowDefinition
Prelude.Read, Int -> DeleteFlowDefinition -> ShowS
[DeleteFlowDefinition] -> ShowS
DeleteFlowDefinition -> String
(Int -> DeleteFlowDefinition -> ShowS)
-> (DeleteFlowDefinition -> String)
-> ([DeleteFlowDefinition] -> ShowS)
-> Show DeleteFlowDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFlowDefinition] -> ShowS
$cshowList :: [DeleteFlowDefinition] -> ShowS
show :: DeleteFlowDefinition -> String
$cshow :: DeleteFlowDefinition -> String
showsPrec :: Int -> DeleteFlowDefinition -> ShowS
$cshowsPrec :: Int -> DeleteFlowDefinition -> ShowS
Prelude.Show, (forall x. DeleteFlowDefinition -> Rep DeleteFlowDefinition x)
-> (forall x. Rep DeleteFlowDefinition x -> DeleteFlowDefinition)
-> Generic DeleteFlowDefinition
forall x. Rep DeleteFlowDefinition x -> DeleteFlowDefinition
forall x. DeleteFlowDefinition -> Rep DeleteFlowDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFlowDefinition x -> DeleteFlowDefinition
$cfrom :: forall x. DeleteFlowDefinition -> Rep DeleteFlowDefinition x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFlowDefinition' 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:
--
-- 'flowDefinitionName', 'deleteFlowDefinition_flowDefinitionName' - The name of the flow definition you are deleting.
newDeleteFlowDefinition ::
  -- | 'flowDefinitionName'
  Prelude.Text ->
  DeleteFlowDefinition
newDeleteFlowDefinition :: Text -> DeleteFlowDefinition
newDeleteFlowDefinition Text
pFlowDefinitionName_ =
  DeleteFlowDefinition' :: Text -> DeleteFlowDefinition
DeleteFlowDefinition'
    { $sel:flowDefinitionName:DeleteFlowDefinition' :: Text
flowDefinitionName =
        Text
pFlowDefinitionName_
    }

-- | The name of the flow definition you are deleting.
deleteFlowDefinition_flowDefinitionName :: Lens.Lens' DeleteFlowDefinition Prelude.Text
deleteFlowDefinition_flowDefinitionName :: (Text -> f Text) -> DeleteFlowDefinition -> f DeleteFlowDefinition
deleteFlowDefinition_flowDefinitionName = (DeleteFlowDefinition -> Text)
-> (DeleteFlowDefinition -> Text -> DeleteFlowDefinition)
-> Lens DeleteFlowDefinition DeleteFlowDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFlowDefinition' {Text
flowDefinitionName :: Text
$sel:flowDefinitionName:DeleteFlowDefinition' :: DeleteFlowDefinition -> Text
flowDefinitionName} -> Text
flowDefinitionName) (\s :: DeleteFlowDefinition
s@DeleteFlowDefinition' {} Text
a -> DeleteFlowDefinition
s {$sel:flowDefinitionName:DeleteFlowDefinition' :: Text
flowDefinitionName = Text
a} :: DeleteFlowDefinition)

instance Core.AWSRequest DeleteFlowDefinition where
  type
    AWSResponse DeleteFlowDefinition =
      DeleteFlowDefinitionResponse
  request :: DeleteFlowDefinition -> Request DeleteFlowDefinition
request = Service -> DeleteFlowDefinition -> Request DeleteFlowDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteFlowDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFlowDefinition)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteFlowDefinition))
-> Logger
-> Service
-> Proxy DeleteFlowDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFlowDefinition)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteFlowDefinitionResponse
DeleteFlowDefinitionResponse'
            (Int -> DeleteFlowDefinitionResponse)
-> Either String Int -> Either String DeleteFlowDefinitionResponse
forall (f :: * -> *) a b. Functor 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 DeleteFlowDefinition

instance Prelude.NFData DeleteFlowDefinition

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

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

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

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

-- |
-- Create a value of 'DeleteFlowDefinitionResponse' 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:
--
-- 'httpStatus', 'deleteFlowDefinitionResponse_httpStatus' - The response's http status code.
newDeleteFlowDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteFlowDefinitionResponse
newDeleteFlowDefinitionResponse :: Int -> DeleteFlowDefinitionResponse
newDeleteFlowDefinitionResponse Int
pHttpStatus_ =
  DeleteFlowDefinitionResponse' :: Int -> DeleteFlowDefinitionResponse
DeleteFlowDefinitionResponse'
    { $sel:httpStatus:DeleteFlowDefinitionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData DeleteFlowDefinitionResponse