{-# 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.Config.DeleteResourceConfig
-- 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)
--
-- Records the configuration state for a custom resource that has been
-- deleted. This API records a new ConfigurationItem with a ResourceDeleted
-- status. You can retrieve the ConfigurationItems recorded for this
-- resource in your Config History.
module Amazonka.Config.DeleteResourceConfig
  ( -- * Creating a Request
    DeleteResourceConfig (..),
    newDeleteResourceConfig,

    -- * Request Lenses
    deleteResourceConfig_resourceType,
    deleteResourceConfig_resourceId,

    -- * Destructuring the Response
    DeleteResourceConfigResponse (..),
    newDeleteResourceConfigResponse,
  )
where

import Amazonka.Config.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:/ 'newDeleteResourceConfig' smart constructor.
data DeleteResourceConfig = DeleteResourceConfig'
  { -- | The type of the resource.
    DeleteResourceConfig -> Text
resourceType :: Prelude.Text,
    -- | Unique identifier of the resource.
    DeleteResourceConfig -> Text
resourceId :: Prelude.Text
  }
  deriving (DeleteResourceConfig -> DeleteResourceConfig -> Bool
(DeleteResourceConfig -> DeleteResourceConfig -> Bool)
-> (DeleteResourceConfig -> DeleteResourceConfig -> Bool)
-> Eq DeleteResourceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourceConfig -> DeleteResourceConfig -> Bool
$c/= :: DeleteResourceConfig -> DeleteResourceConfig -> Bool
== :: DeleteResourceConfig -> DeleteResourceConfig -> Bool
$c== :: DeleteResourceConfig -> DeleteResourceConfig -> Bool
Prelude.Eq, ReadPrec [DeleteResourceConfig]
ReadPrec DeleteResourceConfig
Int -> ReadS DeleteResourceConfig
ReadS [DeleteResourceConfig]
(Int -> ReadS DeleteResourceConfig)
-> ReadS [DeleteResourceConfig]
-> ReadPrec DeleteResourceConfig
-> ReadPrec [DeleteResourceConfig]
-> Read DeleteResourceConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResourceConfig]
$creadListPrec :: ReadPrec [DeleteResourceConfig]
readPrec :: ReadPrec DeleteResourceConfig
$creadPrec :: ReadPrec DeleteResourceConfig
readList :: ReadS [DeleteResourceConfig]
$creadList :: ReadS [DeleteResourceConfig]
readsPrec :: Int -> ReadS DeleteResourceConfig
$creadsPrec :: Int -> ReadS DeleteResourceConfig
Prelude.Read, Int -> DeleteResourceConfig -> ShowS
[DeleteResourceConfig] -> ShowS
DeleteResourceConfig -> String
(Int -> DeleteResourceConfig -> ShowS)
-> (DeleteResourceConfig -> String)
-> ([DeleteResourceConfig] -> ShowS)
-> Show DeleteResourceConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourceConfig] -> ShowS
$cshowList :: [DeleteResourceConfig] -> ShowS
show :: DeleteResourceConfig -> String
$cshow :: DeleteResourceConfig -> String
showsPrec :: Int -> DeleteResourceConfig -> ShowS
$cshowsPrec :: Int -> DeleteResourceConfig -> ShowS
Prelude.Show, (forall x. DeleteResourceConfig -> Rep DeleteResourceConfig x)
-> (forall x. Rep DeleteResourceConfig x -> DeleteResourceConfig)
-> Generic DeleteResourceConfig
forall x. Rep DeleteResourceConfig x -> DeleteResourceConfig
forall x. DeleteResourceConfig -> Rep DeleteResourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResourceConfig x -> DeleteResourceConfig
$cfrom :: forall x. DeleteResourceConfig -> Rep DeleteResourceConfig x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResourceConfig' 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:
--
-- 'resourceType', 'deleteResourceConfig_resourceType' - The type of the resource.
--
-- 'resourceId', 'deleteResourceConfig_resourceId' - Unique identifier of the resource.
newDeleteResourceConfig ::
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'resourceId'
  Prelude.Text ->
  DeleteResourceConfig
newDeleteResourceConfig :: Text -> Text -> DeleteResourceConfig
newDeleteResourceConfig Text
pResourceType_ Text
pResourceId_ =
  DeleteResourceConfig' :: Text -> Text -> DeleteResourceConfig
DeleteResourceConfig'
    { $sel:resourceType:DeleteResourceConfig' :: Text
resourceType =
        Text
pResourceType_,
      $sel:resourceId:DeleteResourceConfig' :: Text
resourceId = Text
pResourceId_
    }

-- | The type of the resource.
deleteResourceConfig_resourceType :: Lens.Lens' DeleteResourceConfig Prelude.Text
deleteResourceConfig_resourceType :: (Text -> f Text) -> DeleteResourceConfig -> f DeleteResourceConfig
deleteResourceConfig_resourceType = (DeleteResourceConfig -> Text)
-> (DeleteResourceConfig -> Text -> DeleteResourceConfig)
-> Lens DeleteResourceConfig DeleteResourceConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceConfig' {Text
resourceType :: Text
$sel:resourceType:DeleteResourceConfig' :: DeleteResourceConfig -> Text
resourceType} -> Text
resourceType) (\s :: DeleteResourceConfig
s@DeleteResourceConfig' {} Text
a -> DeleteResourceConfig
s {$sel:resourceType:DeleteResourceConfig' :: Text
resourceType = Text
a} :: DeleteResourceConfig)

-- | Unique identifier of the resource.
deleteResourceConfig_resourceId :: Lens.Lens' DeleteResourceConfig Prelude.Text
deleteResourceConfig_resourceId :: (Text -> f Text) -> DeleteResourceConfig -> f DeleteResourceConfig
deleteResourceConfig_resourceId = (DeleteResourceConfig -> Text)
-> (DeleteResourceConfig -> Text -> DeleteResourceConfig)
-> Lens DeleteResourceConfig DeleteResourceConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceConfig' {Text
resourceId :: Text
$sel:resourceId:DeleteResourceConfig' :: DeleteResourceConfig -> Text
resourceId} -> Text
resourceId) (\s :: DeleteResourceConfig
s@DeleteResourceConfig' {} Text
a -> DeleteResourceConfig
s {$sel:resourceId:DeleteResourceConfig' :: Text
resourceId = Text
a} :: DeleteResourceConfig)

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

instance Prelude.Hashable DeleteResourceConfig

instance Prelude.NFData DeleteResourceConfig

instance Core.ToHeaders DeleteResourceConfig where
  toHeaders :: DeleteResourceConfig -> [Header]
toHeaders =
    [Header] -> DeleteResourceConfig -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"StarlingDoveService.DeleteResourceConfig" ::
                          Prelude.ByteString
                      ),
            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.ToJSON DeleteResourceConfig where
  toJSON :: DeleteResourceConfig -> Value
toJSON DeleteResourceConfig' {Text
resourceId :: Text
resourceType :: Text
$sel:resourceId:DeleteResourceConfig' :: DeleteResourceConfig -> Text
$sel:resourceType:DeleteResourceConfig' :: DeleteResourceConfig -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId)
          ]
      )

instance Core.ToPath DeleteResourceConfig where
  toPath :: DeleteResourceConfig -> ByteString
toPath = ByteString -> DeleteResourceConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

instance Prelude.NFData DeleteResourceConfigResponse