{-# 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.FIS.DeleteExperimentTemplate
-- 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 experiment template.
module Amazonka.FIS.DeleteExperimentTemplate
  ( -- * Creating a Request
    DeleteExperimentTemplate (..),
    newDeleteExperimentTemplate,

    -- * Request Lenses
    deleteExperimentTemplate_id,

    -- * Destructuring the Response
    DeleteExperimentTemplateResponse (..),
    newDeleteExperimentTemplateResponse,

    -- * Response Lenses
    deleteExperimentTemplateResponse_experimentTemplate,
    deleteExperimentTemplateResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.FIS.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:/ 'newDeleteExperimentTemplate' smart constructor.
data DeleteExperimentTemplate = DeleteExperimentTemplate'
  { -- | The ID of the experiment template.
    DeleteExperimentTemplate -> Text
id :: Prelude.Text
  }
  deriving (DeleteExperimentTemplate -> DeleteExperimentTemplate -> Bool
(DeleteExperimentTemplate -> DeleteExperimentTemplate -> Bool)
-> (DeleteExperimentTemplate -> DeleteExperimentTemplate -> Bool)
-> Eq DeleteExperimentTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteExperimentTemplate -> DeleteExperimentTemplate -> Bool
$c/= :: DeleteExperimentTemplate -> DeleteExperimentTemplate -> Bool
== :: DeleteExperimentTemplate -> DeleteExperimentTemplate -> Bool
$c== :: DeleteExperimentTemplate -> DeleteExperimentTemplate -> Bool
Prelude.Eq, ReadPrec [DeleteExperimentTemplate]
ReadPrec DeleteExperimentTemplate
Int -> ReadS DeleteExperimentTemplate
ReadS [DeleteExperimentTemplate]
(Int -> ReadS DeleteExperimentTemplate)
-> ReadS [DeleteExperimentTemplate]
-> ReadPrec DeleteExperimentTemplate
-> ReadPrec [DeleteExperimentTemplate]
-> Read DeleteExperimentTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteExperimentTemplate]
$creadListPrec :: ReadPrec [DeleteExperimentTemplate]
readPrec :: ReadPrec DeleteExperimentTemplate
$creadPrec :: ReadPrec DeleteExperimentTemplate
readList :: ReadS [DeleteExperimentTemplate]
$creadList :: ReadS [DeleteExperimentTemplate]
readsPrec :: Int -> ReadS DeleteExperimentTemplate
$creadsPrec :: Int -> ReadS DeleteExperimentTemplate
Prelude.Read, Int -> DeleteExperimentTemplate -> ShowS
[DeleteExperimentTemplate] -> ShowS
DeleteExperimentTemplate -> String
(Int -> DeleteExperimentTemplate -> ShowS)
-> (DeleteExperimentTemplate -> String)
-> ([DeleteExperimentTemplate] -> ShowS)
-> Show DeleteExperimentTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteExperimentTemplate] -> ShowS
$cshowList :: [DeleteExperimentTemplate] -> ShowS
show :: DeleteExperimentTemplate -> String
$cshow :: DeleteExperimentTemplate -> String
showsPrec :: Int -> DeleteExperimentTemplate -> ShowS
$cshowsPrec :: Int -> DeleteExperimentTemplate -> ShowS
Prelude.Show, (forall x.
 DeleteExperimentTemplate -> Rep DeleteExperimentTemplate x)
-> (forall x.
    Rep DeleteExperimentTemplate x -> DeleteExperimentTemplate)
-> Generic DeleteExperimentTemplate
forall x.
Rep DeleteExperimentTemplate x -> DeleteExperimentTemplate
forall x.
DeleteExperimentTemplate -> Rep DeleteExperimentTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteExperimentTemplate x -> DeleteExperimentTemplate
$cfrom :: forall x.
DeleteExperimentTemplate -> Rep DeleteExperimentTemplate x
Prelude.Generic)

-- |
-- Create a value of 'DeleteExperimentTemplate' 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', 'deleteExperimentTemplate_id' - The ID of the experiment template.
newDeleteExperimentTemplate ::
  -- | 'id'
  Prelude.Text ->
  DeleteExperimentTemplate
newDeleteExperimentTemplate :: Text -> DeleteExperimentTemplate
newDeleteExperimentTemplate Text
pId_ =
  DeleteExperimentTemplate' :: Text -> DeleteExperimentTemplate
DeleteExperimentTemplate' {$sel:id:DeleteExperimentTemplate' :: Text
id = Text
pId_}

-- | The ID of the experiment template.
deleteExperimentTemplate_id :: Lens.Lens' DeleteExperimentTemplate Prelude.Text
deleteExperimentTemplate_id :: (Text -> f Text)
-> DeleteExperimentTemplate -> f DeleteExperimentTemplate
deleteExperimentTemplate_id = (DeleteExperimentTemplate -> Text)
-> (DeleteExperimentTemplate -> Text -> DeleteExperimentTemplate)
-> Lens DeleteExperimentTemplate DeleteExperimentTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteExperimentTemplate' {Text
id :: Text
$sel:id:DeleteExperimentTemplate' :: DeleteExperimentTemplate -> Text
id} -> Text
id) (\s :: DeleteExperimentTemplate
s@DeleteExperimentTemplate' {} Text
a -> DeleteExperimentTemplate
s {$sel:id:DeleteExperimentTemplate' :: Text
id = Text
a} :: DeleteExperimentTemplate)

instance Core.AWSRequest DeleteExperimentTemplate where
  type
    AWSResponse DeleteExperimentTemplate =
      DeleteExperimentTemplateResponse
  request :: DeleteExperimentTemplate -> Request DeleteExperimentTemplate
request = Service
-> DeleteExperimentTemplate -> Request DeleteExperimentTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteExperimentTemplate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteExperimentTemplate)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteExperimentTemplate))
-> Logger
-> Service
-> Proxy DeleteExperimentTemplate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteExperimentTemplate)))
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 ExperimentTemplate -> Int -> DeleteExperimentTemplateResponse
DeleteExperimentTemplateResponse'
            (Maybe ExperimentTemplate
 -> Int -> DeleteExperimentTemplateResponse)
-> Either String (Maybe ExperimentTemplate)
-> Either String (Int -> DeleteExperimentTemplateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ExperimentTemplate)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"experimentTemplate")
            Either String (Int -> DeleteExperimentTemplateResponse)
-> Either String Int
-> Either String DeleteExperimentTemplateResponse
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 DeleteExperimentTemplate

instance Prelude.NFData DeleteExperimentTemplate

instance Core.ToHeaders DeleteExperimentTemplate where
  toHeaders :: DeleteExperimentTemplate -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteExperimentTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteExperimentTemplate where
  toPath :: DeleteExperimentTemplate -> ByteString
toPath DeleteExperimentTemplate' {Text
id :: Text
$sel:id:DeleteExperimentTemplate' :: DeleteExperimentTemplate -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/experimentTemplates/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]

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

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

-- |
-- Create a value of 'DeleteExperimentTemplateResponse' 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:
--
-- 'experimentTemplate', 'deleteExperimentTemplateResponse_experimentTemplate' - Information about the experiment template.
--
-- 'httpStatus', 'deleteExperimentTemplateResponse_httpStatus' - The response's http status code.
newDeleteExperimentTemplateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteExperimentTemplateResponse
newDeleteExperimentTemplateResponse :: Int -> DeleteExperimentTemplateResponse
newDeleteExperimentTemplateResponse Int
pHttpStatus_ =
  DeleteExperimentTemplateResponse' :: Maybe ExperimentTemplate -> Int -> DeleteExperimentTemplateResponse
DeleteExperimentTemplateResponse'
    { $sel:experimentTemplate:DeleteExperimentTemplateResponse' :: Maybe ExperimentTemplate
experimentTemplate =
        Maybe ExperimentTemplate
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteExperimentTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the experiment template.
deleteExperimentTemplateResponse_experimentTemplate :: Lens.Lens' DeleteExperimentTemplateResponse (Prelude.Maybe ExperimentTemplate)
deleteExperimentTemplateResponse_experimentTemplate :: (Maybe ExperimentTemplate -> f (Maybe ExperimentTemplate))
-> DeleteExperimentTemplateResponse
-> f DeleteExperimentTemplateResponse
deleteExperimentTemplateResponse_experimentTemplate = (DeleteExperimentTemplateResponse -> Maybe ExperimentTemplate)
-> (DeleteExperimentTemplateResponse
    -> Maybe ExperimentTemplate -> DeleteExperimentTemplateResponse)
-> Lens
     DeleteExperimentTemplateResponse
     DeleteExperimentTemplateResponse
     (Maybe ExperimentTemplate)
     (Maybe ExperimentTemplate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteExperimentTemplateResponse' {Maybe ExperimentTemplate
experimentTemplate :: Maybe ExperimentTemplate
$sel:experimentTemplate:DeleteExperimentTemplateResponse' :: DeleteExperimentTemplateResponse -> Maybe ExperimentTemplate
experimentTemplate} -> Maybe ExperimentTemplate
experimentTemplate) (\s :: DeleteExperimentTemplateResponse
s@DeleteExperimentTemplateResponse' {} Maybe ExperimentTemplate
a -> DeleteExperimentTemplateResponse
s {$sel:experimentTemplate:DeleteExperimentTemplateResponse' :: Maybe ExperimentTemplate
experimentTemplate = Maybe ExperimentTemplate
a} :: DeleteExperimentTemplateResponse)

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

instance
  Prelude.NFData
    DeleteExperimentTemplateResponse