{-# 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-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 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 Amazonka.IoT.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:/ 'newDeleteDomainConfiguration' smart constructor.
data DeleteDomainConfiguration = DeleteDomainConfiguration'
  { -- | The name of the domain configuration to be deleted.
    DeleteDomainConfiguration -> Text
domainConfigurationName :: Prelude.Text
  }
  deriving (DeleteDomainConfiguration -> DeleteDomainConfiguration -> Bool
(DeleteDomainConfiguration -> DeleteDomainConfiguration -> Bool)
-> (DeleteDomainConfiguration -> DeleteDomainConfiguration -> Bool)
-> Eq DeleteDomainConfiguration
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]
(Int -> ReadS DeleteDomainConfiguration)
-> ReadS [DeleteDomainConfiguration]
-> ReadPrec DeleteDomainConfiguration
-> ReadPrec [DeleteDomainConfiguration]
-> Read 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
(Int -> DeleteDomainConfiguration -> ShowS)
-> (DeleteDomainConfiguration -> String)
-> ([DeleteDomainConfiguration] -> ShowS)
-> Show DeleteDomainConfiguration
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.
 DeleteDomainConfiguration -> Rep DeleteDomainConfiguration x)
-> (forall x.
    Rep DeleteDomainConfiguration x -> DeleteDomainConfiguration)
-> Generic DeleteDomainConfiguration
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' :: Text -> DeleteDomainConfiguration
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 :: (Text -> f Text)
-> DeleteDomainConfiguration -> f DeleteDomainConfiguration
deleteDomainConfiguration_domainConfigurationName = (DeleteDomainConfiguration -> Text)
-> (DeleteDomainConfiguration -> Text -> DeleteDomainConfiguration)
-> Lens
     DeleteDomainConfiguration DeleteDomainConfiguration Text Text
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 :: DeleteDomainConfiguration -> Request DeleteDomainConfiguration
request = Service
-> DeleteDomainConfiguration -> Request DeleteDomainConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDomainConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDomainConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteDomainConfiguration))
-> Logger
-> Service
-> Proxy DeleteDomainConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDomainConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteDomainConfigurationResponse
DeleteDomainConfigurationResponse'
            (Int -> DeleteDomainConfigurationResponse)
-> Either String Int
-> Either String DeleteDomainConfigurationResponse
forall (f :: * -> *) a b. Functor 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 DeleteDomainConfiguration

instance Prelude.NFData DeleteDomainConfiguration

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

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

instance Core.ToQuery DeleteDomainConfiguration where
  toQuery :: DeleteDomainConfiguration -> QueryString
toQuery = QueryString -> DeleteDomainConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteDomainConfigurationResponse
 -> DeleteDomainConfigurationResponse -> Bool)
-> (DeleteDomainConfigurationResponse
    -> DeleteDomainConfigurationResponse -> Bool)
-> Eq DeleteDomainConfigurationResponse
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]
(Int -> ReadS DeleteDomainConfigurationResponse)
-> ReadS [DeleteDomainConfigurationResponse]
-> ReadPrec DeleteDomainConfigurationResponse
-> ReadPrec [DeleteDomainConfigurationResponse]
-> Read 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
(Int -> DeleteDomainConfigurationResponse -> ShowS)
-> (DeleteDomainConfigurationResponse -> String)
-> ([DeleteDomainConfigurationResponse] -> ShowS)
-> Show DeleteDomainConfigurationResponse
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.
 DeleteDomainConfigurationResponse
 -> Rep DeleteDomainConfigurationResponse x)
-> (forall x.
    Rep DeleteDomainConfigurationResponse x
    -> DeleteDomainConfigurationResponse)
-> Generic DeleteDomainConfigurationResponse
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' :: Int -> DeleteDomainConfigurationResponse
DeleteDomainConfigurationResponse'
    { $sel:httpStatus:DeleteDomainConfigurationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteDomainConfigurationResponse_httpStatus :: Lens.Lens' DeleteDomainConfigurationResponse Prelude.Int
deleteDomainConfigurationResponse_httpStatus :: (Int -> f Int)
-> DeleteDomainConfigurationResponse
-> f DeleteDomainConfigurationResponse
deleteDomainConfigurationResponse_httpStatus = (DeleteDomainConfigurationResponse -> Int)
-> (DeleteDomainConfigurationResponse
    -> Int -> DeleteDomainConfigurationResponse)
-> Lens
     DeleteDomainConfigurationResponse
     DeleteDomainConfigurationResponse
     Int
     Int
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