{-# 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.IoT.DeleteDomainConfiguration
-- 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 the specified domain configuration.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteDomainConfiguration>
-- action.
module Amazonka.IoT.DeleteDomainConfiguration
  ( -- * Creating a Request
    DeleteDomainConfiguration (..),
    newDeleteDomainConfiguration,

    -- * Request Lenses
    deleteDomainConfiguration_domainConfigurationName,

    -- * Destructuring the Response
    DeleteDomainConfigurationResponse (..),
    newDeleteDomainConfigurationResponse,

    -- * Response Lenses
    deleteDomainConfigurationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteDomainConfiguration' smart constructor.
data DeleteDomainConfiguration = DeleteDomainConfiguration'
  { -- | The name of the domain configuration to be deleted.
    DeleteDomainConfiguration -> Text
domainConfigurationName :: Prelude.Text
  }
  deriving (DeleteDomainConfiguration -> DeleteDomainConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDomainConfiguration -> DeleteDomainConfiguration -> Bool
$c/= :: DeleteDomainConfiguration -> DeleteDomainConfiguration -> Bool
== :: DeleteDomainConfiguration -> DeleteDomainConfiguration -> Bool
$c== :: DeleteDomainConfiguration -> DeleteDomainConfiguration -> Bool
Prelude.Eq, ReadPrec [DeleteDomainConfiguration]
ReadPrec DeleteDomainConfiguration
Int -> ReadS DeleteDomainConfiguration
ReadS [DeleteDomainConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDomainConfiguration]
$creadListPrec :: ReadPrec [DeleteDomainConfiguration]
readPrec :: ReadPrec DeleteDomainConfiguration
$creadPrec :: ReadPrec DeleteDomainConfiguration
readList :: ReadS [DeleteDomainConfiguration]
$creadList :: ReadS [DeleteDomainConfiguration]
readsPrec :: Int -> ReadS DeleteDomainConfiguration
$creadsPrec :: Int -> ReadS DeleteDomainConfiguration
Prelude.Read, Int -> DeleteDomainConfiguration -> ShowS
[DeleteDomainConfiguration] -> ShowS
DeleteDomainConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDomainConfiguration] -> ShowS
$cshowList :: [DeleteDomainConfiguration] -> ShowS
show :: DeleteDomainConfiguration -> String
$cshow :: DeleteDomainConfiguration -> String
showsPrec :: Int -> DeleteDomainConfiguration -> ShowS
$cshowsPrec :: Int -> DeleteDomainConfiguration -> ShowS
Prelude.Show, forall x.
Rep DeleteDomainConfiguration x -> DeleteDomainConfiguration
forall x.
DeleteDomainConfiguration -> Rep DeleteDomainConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDomainConfiguration x -> DeleteDomainConfiguration
$cfrom :: forall x.
DeleteDomainConfiguration -> Rep DeleteDomainConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDomainConfiguration' 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:
--
-- 'domainConfigurationName', 'deleteDomainConfiguration_domainConfigurationName' - The name of the domain configuration to be deleted.
newDeleteDomainConfiguration ::
  -- | 'domainConfigurationName'
  Prelude.Text ->
  DeleteDomainConfiguration
newDeleteDomainConfiguration :: Text -> DeleteDomainConfiguration
newDeleteDomainConfiguration
  Text
pDomainConfigurationName_ =
    DeleteDomainConfiguration'
      { $sel:domainConfigurationName:DeleteDomainConfiguration' :: Text
domainConfigurationName =
          Text
pDomainConfigurationName_
      }

-- | The name of the domain configuration to be deleted.
deleteDomainConfiguration_domainConfigurationName :: Lens.Lens' DeleteDomainConfiguration Prelude.Text
deleteDomainConfiguration_domainConfigurationName :: Lens' DeleteDomainConfiguration Text
deleteDomainConfiguration_domainConfigurationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDomainConfiguration' {Text
domainConfigurationName :: Text
$sel:domainConfigurationName:DeleteDomainConfiguration' :: DeleteDomainConfiguration -> Text
domainConfigurationName} -> Text
domainConfigurationName) (\s :: DeleteDomainConfiguration
s@DeleteDomainConfiguration' {} Text
a -> DeleteDomainConfiguration
s {$sel:domainConfigurationName:DeleteDomainConfiguration' :: Text
domainConfigurationName = Text
a} :: DeleteDomainConfiguration)

instance Core.AWSRequest DeleteDomainConfiguration where
  type
    AWSResponse DeleteDomainConfiguration =
      DeleteDomainConfigurationResponse
  request :: (Service -> Service)
-> DeleteDomainConfiguration -> Request DeleteDomainConfiguration
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteDomainConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDomainConfiguration)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteDomainConfigurationResponse
DeleteDomainConfigurationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteDomainConfiguration where
  hashWithSalt :: Int -> DeleteDomainConfiguration -> Int
hashWithSalt Int
_salt DeleteDomainConfiguration' {Text
domainConfigurationName :: Text
$sel:domainConfigurationName:DeleteDomainConfiguration' :: DeleteDomainConfiguration -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainConfigurationName

instance Prelude.NFData DeleteDomainConfiguration where
  rnf :: DeleteDomainConfiguration -> ()
rnf DeleteDomainConfiguration' {Text
domainConfigurationName :: Text
$sel:domainConfigurationName:DeleteDomainConfiguration' :: DeleteDomainConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
domainConfigurationName

instance Data.ToHeaders DeleteDomainConfiguration where
  toHeaders :: DeleteDomainConfiguration -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DeleteDomainConfiguration where
  toPath :: DeleteDomainConfiguration -> ByteString
toPath DeleteDomainConfiguration' {Text
domainConfigurationName :: Text
$sel:domainConfigurationName:DeleteDomainConfiguration' :: DeleteDomainConfiguration -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/domainConfigurations/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
domainConfigurationName
      ]

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

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

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

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

instance
  Prelude.NFData
    DeleteDomainConfigurationResponse
  where
  rnf :: DeleteDomainConfigurationResponse -> ()
rnf DeleteDomainConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDomainConfigurationResponse' :: DeleteDomainConfigurationResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus