{-# 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.IoTThingsGraph.DeleteFlowTemplate
-- 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 workflow. Any new system or deployment that contains this
-- workflow will fail to update or deploy. Existing deployments that
-- contain the workflow will continue to run (since they use a snapshot of
-- the workflow taken at the time of deployment).
module Amazonka.IoTThingsGraph.DeleteFlowTemplate
  ( -- * Creating a Request
    DeleteFlowTemplate (..),
    newDeleteFlowTemplate,

    -- * Request Lenses
    deleteFlowTemplate_id,

    -- * Destructuring the Response
    DeleteFlowTemplateResponse (..),
    newDeleteFlowTemplateResponse,

    -- * Response Lenses
    deleteFlowTemplateResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTThingsGraph.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:/ 'newDeleteFlowTemplate' smart constructor.
data DeleteFlowTemplate = DeleteFlowTemplate'
  { -- | The ID of the workflow to be deleted.
    --
    -- The ID should be in the following format.
    --
    -- @urn:tdm:REGION\/ACCOUNT ID\/default:workflow:WORKFLOWNAME@
    DeleteFlowTemplate -> Text
id :: Prelude.Text
  }
  deriving (DeleteFlowTemplate -> DeleteFlowTemplate -> Bool
(DeleteFlowTemplate -> DeleteFlowTemplate -> Bool)
-> (DeleteFlowTemplate -> DeleteFlowTemplate -> Bool)
-> Eq DeleteFlowTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFlowTemplate -> DeleteFlowTemplate -> Bool
$c/= :: DeleteFlowTemplate -> DeleteFlowTemplate -> Bool
== :: DeleteFlowTemplate -> DeleteFlowTemplate -> Bool
$c== :: DeleteFlowTemplate -> DeleteFlowTemplate -> Bool
Prelude.Eq, ReadPrec [DeleteFlowTemplate]
ReadPrec DeleteFlowTemplate
Int -> ReadS DeleteFlowTemplate
ReadS [DeleteFlowTemplate]
(Int -> ReadS DeleteFlowTemplate)
-> ReadS [DeleteFlowTemplate]
-> ReadPrec DeleteFlowTemplate
-> ReadPrec [DeleteFlowTemplate]
-> Read DeleteFlowTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFlowTemplate]
$creadListPrec :: ReadPrec [DeleteFlowTemplate]
readPrec :: ReadPrec DeleteFlowTemplate
$creadPrec :: ReadPrec DeleteFlowTemplate
readList :: ReadS [DeleteFlowTemplate]
$creadList :: ReadS [DeleteFlowTemplate]
readsPrec :: Int -> ReadS DeleteFlowTemplate
$creadsPrec :: Int -> ReadS DeleteFlowTemplate
Prelude.Read, Int -> DeleteFlowTemplate -> ShowS
[DeleteFlowTemplate] -> ShowS
DeleteFlowTemplate -> String
(Int -> DeleteFlowTemplate -> ShowS)
-> (DeleteFlowTemplate -> String)
-> ([DeleteFlowTemplate] -> ShowS)
-> Show DeleteFlowTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFlowTemplate] -> ShowS
$cshowList :: [DeleteFlowTemplate] -> ShowS
show :: DeleteFlowTemplate -> String
$cshow :: DeleteFlowTemplate -> String
showsPrec :: Int -> DeleteFlowTemplate -> ShowS
$cshowsPrec :: Int -> DeleteFlowTemplate -> ShowS
Prelude.Show, (forall x. DeleteFlowTemplate -> Rep DeleteFlowTemplate x)
-> (forall x. Rep DeleteFlowTemplate x -> DeleteFlowTemplate)
-> Generic DeleteFlowTemplate
forall x. Rep DeleteFlowTemplate x -> DeleteFlowTemplate
forall x. DeleteFlowTemplate -> Rep DeleteFlowTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFlowTemplate x -> DeleteFlowTemplate
$cfrom :: forall x. DeleteFlowTemplate -> Rep DeleteFlowTemplate x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFlowTemplate' 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:
--
-- 'id', 'deleteFlowTemplate_id' - The ID of the workflow to be deleted.
--
-- The ID should be in the following format.
--
-- @urn:tdm:REGION\/ACCOUNT ID\/default:workflow:WORKFLOWNAME@
newDeleteFlowTemplate ::
  -- | 'id'
  Prelude.Text ->
  DeleteFlowTemplate
newDeleteFlowTemplate :: Text -> DeleteFlowTemplate
newDeleteFlowTemplate Text
pId_ =
  DeleteFlowTemplate' :: Text -> DeleteFlowTemplate
DeleteFlowTemplate' {$sel:id:DeleteFlowTemplate' :: Text
id = Text
pId_}

-- | The ID of the workflow to be deleted.
--
-- The ID should be in the following format.
--
-- @urn:tdm:REGION\/ACCOUNT ID\/default:workflow:WORKFLOWNAME@
deleteFlowTemplate_id :: Lens.Lens' DeleteFlowTemplate Prelude.Text
deleteFlowTemplate_id :: (Text -> f Text) -> DeleteFlowTemplate -> f DeleteFlowTemplate
deleteFlowTemplate_id = (DeleteFlowTemplate -> Text)
-> (DeleteFlowTemplate -> Text -> DeleteFlowTemplate)
-> Lens DeleteFlowTemplate DeleteFlowTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFlowTemplate' {Text
id :: Text
$sel:id:DeleteFlowTemplate' :: DeleteFlowTemplate -> Text
id} -> Text
id) (\s :: DeleteFlowTemplate
s@DeleteFlowTemplate' {} Text
a -> DeleteFlowTemplate
s {$sel:id:DeleteFlowTemplate' :: Text
id = Text
a} :: DeleteFlowTemplate)

instance Core.AWSRequest DeleteFlowTemplate where
  type
    AWSResponse DeleteFlowTemplate =
      DeleteFlowTemplateResponse
  request :: DeleteFlowTemplate -> Request DeleteFlowTemplate
request = Service -> DeleteFlowTemplate -> Request DeleteFlowTemplate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteFlowTemplate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFlowTemplate)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteFlowTemplate))
-> Logger
-> Service
-> Proxy DeleteFlowTemplate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFlowTemplate)))
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 -> DeleteFlowTemplateResponse
DeleteFlowTemplateResponse'
            (Int -> DeleteFlowTemplateResponse)
-> Either String Int -> Either String DeleteFlowTemplateResponse
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 DeleteFlowTemplate

instance Prelude.NFData DeleteFlowTemplate

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

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

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

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

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

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

instance Prelude.NFData DeleteFlowTemplateResponse