{-# 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.DeleteSystemTemplate
-- 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 system. New deployments can\'t contain the system after its
-- deletion. Existing deployments that contain the system will continue to
-- work because they use a snapshot of the system that is taken when it is
-- deployed.
module Amazonka.IoTThingsGraph.DeleteSystemTemplate
  ( -- * Creating a Request
    DeleteSystemTemplate (..),
    newDeleteSystemTemplate,

    -- * Request Lenses
    deleteSystemTemplate_id,

    -- * Destructuring the Response
    DeleteSystemTemplateResponse (..),
    newDeleteSystemTemplateResponse,

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

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

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

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

instance Prelude.NFData DeleteSystemTemplate

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

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

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

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

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

instance Prelude.NFData DeleteSystemTemplateResponse