amazonka-m2-2.0: gen/Amazonka/M2/DeleteEnvironment.hs
{-# 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.M2.DeleteEnvironment
-- Copyright : (c) 2013-2023 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a specific runtime environment. The environment cannot contain
-- deployed applications. If it does, you must delete those applications
-- before you delete the environment.
module Amazonka.M2.DeleteEnvironment
( -- * Creating a Request
DeleteEnvironment (..),
newDeleteEnvironment,
-- * Request Lenses
deleteEnvironment_environmentId,
-- * Destructuring the Response
DeleteEnvironmentResponse (..),
newDeleteEnvironmentResponse,
-- * Response Lenses
deleteEnvironmentResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types
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 unique identifier of the runtime environment you want to delete.
environmentId :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, 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:
--
-- 'environmentId', 'deleteEnvironment_environmentId' - The unique identifier of the runtime environment you want to delete.
newDeleteEnvironment ::
-- | 'environmentId'
Prelude.Text ->
DeleteEnvironment
newDeleteEnvironment pEnvironmentId_ =
DeleteEnvironment' {environmentId = pEnvironmentId_}
-- | The unique identifier of the runtime environment you want to delete.
deleteEnvironment_environmentId :: Lens.Lens' DeleteEnvironment Prelude.Text
deleteEnvironment_environmentId = Lens.lens (\DeleteEnvironment' {environmentId} -> environmentId) (\s@DeleteEnvironment' {} a -> s {environmentId = a} :: DeleteEnvironment)
instance Core.AWSRequest DeleteEnvironment where
type
AWSResponse DeleteEnvironment =
DeleteEnvironmentResponse
request overrides =
Request.delete (overrides defaultService)
response =
Response.receiveEmpty
( \s h x ->
DeleteEnvironmentResponse'
Prelude.<$> (Prelude.pure (Prelude.fromEnum s))
)
instance Prelude.Hashable DeleteEnvironment where
hashWithSalt _salt DeleteEnvironment' {..} =
_salt `Prelude.hashWithSalt` environmentId
instance Prelude.NFData DeleteEnvironment where
rnf DeleteEnvironment' {..} =
Prelude.rnf environmentId
instance Data.ToHeaders DeleteEnvironment where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "Content-Type"
Data.=# ( "application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath DeleteEnvironment where
toPath DeleteEnvironment' {..} =
Prelude.mconcat
["/environments/", Data.toBS environmentId]
instance Data.ToQuery DeleteEnvironment where
toQuery = Prelude.const Prelude.mempty
-- | /See:/ 'newDeleteEnvironmentResponse' smart constructor.
data DeleteEnvironmentResponse = DeleteEnvironmentResponse'
{ -- | The response's http status code.
httpStatus :: Prelude.Int
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, 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.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'deleteEnvironmentResponse_httpStatus' - The response's http status code.
newDeleteEnvironmentResponse ::
-- | 'httpStatus'
Prelude.Int ->
DeleteEnvironmentResponse
newDeleteEnvironmentResponse pHttpStatus_ =
DeleteEnvironmentResponse'
{ httpStatus =
pHttpStatus_
}
-- | The response's http status code.
deleteEnvironmentResponse_httpStatus :: Lens.Lens' DeleteEnvironmentResponse Prelude.Int
deleteEnvironmentResponse_httpStatus = Lens.lens (\DeleteEnvironmentResponse' {httpStatus} -> httpStatus) (\s@DeleteEnvironmentResponse' {} a -> s {httpStatus = a} :: DeleteEnvironmentResponse)
instance Prelude.NFData DeleteEnvironmentResponse where
rnf DeleteEnvironmentResponse' {..} =
Prelude.rnf httpStatus