{-# 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.DeprecateFlowTemplate
-- 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)
--
-- Deprecates the specified workflow. This action marks the workflow for
-- deletion. Deprecated flows can\'t be deployed, but existing deployments
-- will continue to run.
module Amazonka.IoTThingsGraph.DeprecateFlowTemplate
  ( -- * Creating a Request
    DeprecateFlowTemplate (..),
    newDeprecateFlowTemplate,

    -- * Request Lenses
    deprecateFlowTemplate_id,

    -- * Destructuring the Response
    DeprecateFlowTemplateResponse (..),
    newDeprecateFlowTemplateResponse,

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

-- |
-- Create a value of 'DeprecateFlowTemplate' 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', 'deprecateFlowTemplate_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@
newDeprecateFlowTemplate ::
  -- | 'id'
  Prelude.Text ->
  DeprecateFlowTemplate
newDeprecateFlowTemplate :: Text -> DeprecateFlowTemplate
newDeprecateFlowTemplate Text
pId_ =
  DeprecateFlowTemplate' :: Text -> DeprecateFlowTemplate
DeprecateFlowTemplate' {$sel:id:DeprecateFlowTemplate' :: 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@
deprecateFlowTemplate_id :: Lens.Lens' DeprecateFlowTemplate Prelude.Text
deprecateFlowTemplate_id :: (Text -> f Text)
-> DeprecateFlowTemplate -> f DeprecateFlowTemplate
deprecateFlowTemplate_id = (DeprecateFlowTemplate -> Text)
-> (DeprecateFlowTemplate -> Text -> DeprecateFlowTemplate)
-> Lens DeprecateFlowTemplate DeprecateFlowTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeprecateFlowTemplate' {Text
id :: Text
$sel:id:DeprecateFlowTemplate' :: DeprecateFlowTemplate -> Text
id} -> Text
id) (\s :: DeprecateFlowTemplate
s@DeprecateFlowTemplate' {} Text
a -> DeprecateFlowTemplate
s {$sel:id:DeprecateFlowTemplate' :: Text
id = Text
a} :: DeprecateFlowTemplate)

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

instance Prelude.NFData DeprecateFlowTemplate

instance Core.ToHeaders DeprecateFlowTemplate where
  toHeaders :: DeprecateFlowTemplate -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeprecateFlowTemplate -> 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.DeprecateFlowTemplate" ::
                          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 DeprecateFlowTemplate where
  toJSON :: DeprecateFlowTemplate -> Value
toJSON DeprecateFlowTemplate' {Text
id :: Text
$sel:id:DeprecateFlowTemplate' :: DeprecateFlowTemplate -> 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 DeprecateFlowTemplate where
  toPath :: DeprecateFlowTemplate -> ByteString
toPath = ByteString -> DeprecateFlowTemplate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData DeprecateFlowTemplateResponse