{-# 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.AppConfig.DeleteEnvironment
-- 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)
--
-- Delete an environment. Deleting an environment does not delete a
-- configuration from a host.
module Amazonka.AppConfig.DeleteEnvironment
  ( -- * Creating a Request
    DeleteEnvironment (..),
    newDeleteEnvironment,

    -- * Request Lenses
    deleteEnvironment_applicationId,
    deleteEnvironment_environmentId,

    -- * Destructuring the Response
    DeleteEnvironmentResponse (..),
    newDeleteEnvironmentResponse,
  )
where

import Amazonka.AppConfig.Types
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

-- | /See:/ 'newDeleteEnvironment' smart constructor.
data DeleteEnvironment = DeleteEnvironment'
  { -- | The application ID that includes the environment you want to delete.
    DeleteEnvironment -> Text
applicationId :: Prelude.Text,
    -- | The ID of the environment you want to delete.
    DeleteEnvironment -> Text
environmentId :: Prelude.Text
  }
  deriving (DeleteEnvironment -> DeleteEnvironment -> Bool
(DeleteEnvironment -> DeleteEnvironment -> Bool)
-> (DeleteEnvironment -> DeleteEnvironment -> Bool)
-> Eq DeleteEnvironment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEnvironment -> DeleteEnvironment -> Bool
$c/= :: DeleteEnvironment -> DeleteEnvironment -> Bool
== :: DeleteEnvironment -> DeleteEnvironment -> Bool
$c== :: DeleteEnvironment -> DeleteEnvironment -> Bool
Prelude.Eq, ReadPrec [DeleteEnvironment]
ReadPrec DeleteEnvironment
Int -> ReadS DeleteEnvironment
ReadS [DeleteEnvironment]
(Int -> ReadS DeleteEnvironment)
-> ReadS [DeleteEnvironment]
-> ReadPrec DeleteEnvironment
-> ReadPrec [DeleteEnvironment]
-> Read DeleteEnvironment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEnvironment]
$creadListPrec :: ReadPrec [DeleteEnvironment]
readPrec :: ReadPrec DeleteEnvironment
$creadPrec :: ReadPrec DeleteEnvironment
readList :: ReadS [DeleteEnvironment]
$creadList :: ReadS [DeleteEnvironment]
readsPrec :: Int -> ReadS DeleteEnvironment
$creadsPrec :: Int -> ReadS DeleteEnvironment
Prelude.Read, Int -> DeleteEnvironment -> ShowS
[DeleteEnvironment] -> ShowS
DeleteEnvironment -> String
(Int -> DeleteEnvironment -> ShowS)
-> (DeleteEnvironment -> String)
-> ([DeleteEnvironment] -> ShowS)
-> Show DeleteEnvironment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEnvironment] -> ShowS
$cshowList :: [DeleteEnvironment] -> ShowS
show :: DeleteEnvironment -> String
$cshow :: DeleteEnvironment -> String
showsPrec :: Int -> DeleteEnvironment -> ShowS
$cshowsPrec :: Int -> DeleteEnvironment -> ShowS
Prelude.Show, (forall x. DeleteEnvironment -> Rep DeleteEnvironment x)
-> (forall x. Rep DeleteEnvironment x -> DeleteEnvironment)
-> Generic DeleteEnvironment
forall x. Rep DeleteEnvironment x -> DeleteEnvironment
forall x. DeleteEnvironment -> Rep DeleteEnvironment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEnvironment x -> DeleteEnvironment
$cfrom :: forall x. DeleteEnvironment -> Rep DeleteEnvironment x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEnvironment' 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:
--
-- 'applicationId', 'deleteEnvironment_applicationId' - The application ID that includes the environment you want to delete.
--
-- 'environmentId', 'deleteEnvironment_environmentId' - The ID of the environment you want to delete.
newDeleteEnvironment ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'environmentId'
  Prelude.Text ->
  DeleteEnvironment
newDeleteEnvironment :: Text -> Text -> DeleteEnvironment
newDeleteEnvironment Text
pApplicationId_ Text
pEnvironmentId_ =
  DeleteEnvironment' :: Text -> Text -> DeleteEnvironment
DeleteEnvironment'
    { $sel:applicationId:DeleteEnvironment' :: Text
applicationId = Text
pApplicationId_,
      $sel:environmentId:DeleteEnvironment' :: Text
environmentId = Text
pEnvironmentId_
    }

-- | The application ID that includes the environment you want to delete.
deleteEnvironment_applicationId :: Lens.Lens' DeleteEnvironment Prelude.Text
deleteEnvironment_applicationId :: (Text -> f Text) -> DeleteEnvironment -> f DeleteEnvironment
deleteEnvironment_applicationId = (DeleteEnvironment -> Text)
-> (DeleteEnvironment -> Text -> DeleteEnvironment)
-> Lens DeleteEnvironment DeleteEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEnvironment' {Text
applicationId :: Text
$sel:applicationId:DeleteEnvironment' :: DeleteEnvironment -> Text
applicationId} -> Text
applicationId) (\s :: DeleteEnvironment
s@DeleteEnvironment' {} Text
a -> DeleteEnvironment
s {$sel:applicationId:DeleteEnvironment' :: Text
applicationId = Text
a} :: DeleteEnvironment)

-- | The ID of the environment you want to delete.
deleteEnvironment_environmentId :: Lens.Lens' DeleteEnvironment Prelude.Text
deleteEnvironment_environmentId :: (Text -> f Text) -> DeleteEnvironment -> f DeleteEnvironment
deleteEnvironment_environmentId = (DeleteEnvironment -> Text)
-> (DeleteEnvironment -> Text -> DeleteEnvironment)
-> Lens DeleteEnvironment DeleteEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEnvironment' {Text
environmentId :: Text
$sel:environmentId:DeleteEnvironment' :: DeleteEnvironment -> Text
environmentId} -> Text
environmentId) (\s :: DeleteEnvironment
s@DeleteEnvironment' {} Text
a -> DeleteEnvironment
s {$sel:environmentId:DeleteEnvironment' :: Text
environmentId = Text
a} :: DeleteEnvironment)

instance Core.AWSRequest DeleteEnvironment where
  type
    AWSResponse DeleteEnvironment =
      DeleteEnvironmentResponse
  request :: DeleteEnvironment -> Request DeleteEnvironment
request = Service -> DeleteEnvironment -> Request DeleteEnvironment
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEnvironment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEnvironment)))
response =
    AWSResponse DeleteEnvironment
-> Logger
-> Service
-> Proxy DeleteEnvironment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEnvironment)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteEnvironment
DeleteEnvironmentResponse
DeleteEnvironmentResponse'

instance Prelude.Hashable DeleteEnvironment

instance Prelude.NFData DeleteEnvironment

instance Core.ToHeaders DeleteEnvironment where
  toHeaders :: DeleteEnvironment -> [Header]
toHeaders =
    [Header] -> DeleteEnvironment -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DeleteEnvironment where
  toPath :: DeleteEnvironment -> ByteString
toPath DeleteEnvironment' {Text
environmentId :: Text
applicationId :: Text
$sel:environmentId:DeleteEnvironment' :: DeleteEnvironment -> Text
$sel:applicationId:DeleteEnvironment' :: DeleteEnvironment -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/applications/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
        ByteString
"/environments/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
environmentId
      ]

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

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

-- |
-- Create a value of 'DeleteEnvironmentResponse' 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.
newDeleteEnvironmentResponse ::
  DeleteEnvironmentResponse
newDeleteEnvironmentResponse :: DeleteEnvironmentResponse
newDeleteEnvironmentResponse =
  DeleteEnvironmentResponse
DeleteEnvironmentResponse'

instance Prelude.NFData DeleteEnvironmentResponse