amazonka-opensearch-2.0: gen/Amazonka/OpenSearch/DeleteDomain.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.OpenSearch.DeleteDomain
-- 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 an Amazon OpenSearch Service domain and all of its data. You
-- can\'t recover a domain after you delete it.
module Amazonka.OpenSearch.DeleteDomain
( -- * Creating a Request
DeleteDomain (..),
newDeleteDomain,
-- * Request Lenses
deleteDomain_domainName,
-- * Destructuring the Response
DeleteDomainResponse (..),
newDeleteDomainResponse,
-- * Response Lenses
deleteDomainResponse_domainStatus,
deleteDomainResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpenSearch.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
-- | Container for the parameters to the @DeleteDomain@ operation.
--
-- /See:/ 'newDeleteDomain' smart constructor.
data DeleteDomain = DeleteDomain'
{ -- | The name of the domain you want to permanently delete.
domainName :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'DeleteDomain' 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:
--
-- 'domainName', 'deleteDomain_domainName' - The name of the domain you want to permanently delete.
newDeleteDomain ::
-- | 'domainName'
Prelude.Text ->
DeleteDomain
newDeleteDomain pDomainName_ =
DeleteDomain' {domainName = pDomainName_}
-- | The name of the domain you want to permanently delete.
deleteDomain_domainName :: Lens.Lens' DeleteDomain Prelude.Text
deleteDomain_domainName = Lens.lens (\DeleteDomain' {domainName} -> domainName) (\s@DeleteDomain' {} a -> s {domainName = a} :: DeleteDomain)
instance Core.AWSRequest DeleteDomain where
type AWSResponse DeleteDomain = DeleteDomainResponse
request overrides =
Request.delete (overrides defaultService)
response =
Response.receiveJSON
( \s h x ->
DeleteDomainResponse'
Prelude.<$> (x Data..?> "DomainStatus")
Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
)
instance Prelude.Hashable DeleteDomain where
hashWithSalt _salt DeleteDomain' {..} =
_salt `Prelude.hashWithSalt` domainName
instance Prelude.NFData DeleteDomain where
rnf DeleteDomain' {..} = Prelude.rnf domainName
instance Data.ToHeaders DeleteDomain where
toHeaders = Prelude.const Prelude.mempty
instance Data.ToPath DeleteDomain where
toPath DeleteDomain' {..} =
Prelude.mconcat
[ "/2021-01-01/opensearch/domain/",
Data.toBS domainName
]
instance Data.ToQuery DeleteDomain where
toQuery = Prelude.const Prelude.mempty
-- | The results of a @DeleteDomain@ request. Contains the status of the
-- pending deletion, or a \"domain not found\" error if the domain and all
-- of its resources have been deleted.
--
-- /See:/ 'newDeleteDomainResponse' smart constructor.
data DeleteDomainResponse = DeleteDomainResponse'
{ -- | The status of the domain being deleted.
domainStatus :: Prelude.Maybe DomainStatus,
-- | The response's http status code.
httpStatus :: Prelude.Int
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'DeleteDomainResponse' 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:
--
-- 'domainStatus', 'deleteDomainResponse_domainStatus' - The status of the domain being deleted.
--
-- 'httpStatus', 'deleteDomainResponse_httpStatus' - The response's http status code.
newDeleteDomainResponse ::
-- | 'httpStatus'
Prelude.Int ->
DeleteDomainResponse
newDeleteDomainResponse pHttpStatus_ =
DeleteDomainResponse'
{ domainStatus =
Prelude.Nothing,
httpStatus = pHttpStatus_
}
-- | The status of the domain being deleted.
deleteDomainResponse_domainStatus :: Lens.Lens' DeleteDomainResponse (Prelude.Maybe DomainStatus)
deleteDomainResponse_domainStatus = Lens.lens (\DeleteDomainResponse' {domainStatus} -> domainStatus) (\s@DeleteDomainResponse' {} a -> s {domainStatus = a} :: DeleteDomainResponse)
-- | The response's http status code.
deleteDomainResponse_httpStatus :: Lens.Lens' DeleteDomainResponse Prelude.Int
deleteDomainResponse_httpStatus = Lens.lens (\DeleteDomainResponse' {httpStatus} -> httpStatus) (\s@DeleteDomainResponse' {} a -> s {httpStatus = a} :: DeleteDomainResponse)
instance Prelude.NFData DeleteDomainResponse where
rnf DeleteDomainResponse' {..} =
Prelude.rnf domainStatus
`Prelude.seq` Prelude.rnf httpStatus