{-# 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.AccessAnalyzer.DeleteArchiveRule
-- 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 archive rule.
module Amazonka.AccessAnalyzer.DeleteArchiveRule
  ( -- * Creating a Request
    DeleteArchiveRule (..),
    newDeleteArchiveRule,

    -- * Request Lenses
    deleteArchiveRule_clientToken,
    deleteArchiveRule_analyzerName,
    deleteArchiveRule_ruleName,

    -- * Destructuring the Response
    DeleteArchiveRuleResponse (..),
    newDeleteArchiveRuleResponse,
  )
where

import Amazonka.AccessAnalyzer.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

-- | Deletes an archive rule.
--
-- /See:/ 'newDeleteArchiveRule' smart constructor.
data DeleteArchiveRule = DeleteArchiveRule'
  { -- | A client token.
    DeleteArchiveRule -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the analyzer that associated with the archive rule to
    -- delete.
    DeleteArchiveRule -> Text
analyzerName :: Prelude.Text,
    -- | The name of the rule to delete.
    DeleteArchiveRule -> Text
ruleName :: Prelude.Text
  }
  deriving (DeleteArchiveRule -> DeleteArchiveRule -> Bool
(DeleteArchiveRule -> DeleteArchiveRule -> Bool)
-> (DeleteArchiveRule -> DeleteArchiveRule -> Bool)
-> Eq DeleteArchiveRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteArchiveRule -> DeleteArchiveRule -> Bool
$c/= :: DeleteArchiveRule -> DeleteArchiveRule -> Bool
== :: DeleteArchiveRule -> DeleteArchiveRule -> Bool
$c== :: DeleteArchiveRule -> DeleteArchiveRule -> Bool
Prelude.Eq, ReadPrec [DeleteArchiveRule]
ReadPrec DeleteArchiveRule
Int -> ReadS DeleteArchiveRule
ReadS [DeleteArchiveRule]
(Int -> ReadS DeleteArchiveRule)
-> ReadS [DeleteArchiveRule]
-> ReadPrec DeleteArchiveRule
-> ReadPrec [DeleteArchiveRule]
-> Read DeleteArchiveRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteArchiveRule]
$creadListPrec :: ReadPrec [DeleteArchiveRule]
readPrec :: ReadPrec DeleteArchiveRule
$creadPrec :: ReadPrec DeleteArchiveRule
readList :: ReadS [DeleteArchiveRule]
$creadList :: ReadS [DeleteArchiveRule]
readsPrec :: Int -> ReadS DeleteArchiveRule
$creadsPrec :: Int -> ReadS DeleteArchiveRule
Prelude.Read, Int -> DeleteArchiveRule -> ShowS
[DeleteArchiveRule] -> ShowS
DeleteArchiveRule -> String
(Int -> DeleteArchiveRule -> ShowS)
-> (DeleteArchiveRule -> String)
-> ([DeleteArchiveRule] -> ShowS)
-> Show DeleteArchiveRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteArchiveRule] -> ShowS
$cshowList :: [DeleteArchiveRule] -> ShowS
show :: DeleteArchiveRule -> String
$cshow :: DeleteArchiveRule -> String
showsPrec :: Int -> DeleteArchiveRule -> ShowS
$cshowsPrec :: Int -> DeleteArchiveRule -> ShowS
Prelude.Show, (forall x. DeleteArchiveRule -> Rep DeleteArchiveRule x)
-> (forall x. Rep DeleteArchiveRule x -> DeleteArchiveRule)
-> Generic DeleteArchiveRule
forall x. Rep DeleteArchiveRule x -> DeleteArchiveRule
forall x. DeleteArchiveRule -> Rep DeleteArchiveRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteArchiveRule x -> DeleteArchiveRule
$cfrom :: forall x. DeleteArchiveRule -> Rep DeleteArchiveRule x
Prelude.Generic)

-- |
-- Create a value of 'DeleteArchiveRule' 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:
--
-- 'clientToken', 'deleteArchiveRule_clientToken' - A client token.
--
-- 'analyzerName', 'deleteArchiveRule_analyzerName' - The name of the analyzer that associated with the archive rule to
-- delete.
--
-- 'ruleName', 'deleteArchiveRule_ruleName' - The name of the rule to delete.
newDeleteArchiveRule ::
  -- | 'analyzerName'
  Prelude.Text ->
  -- | 'ruleName'
  Prelude.Text ->
  DeleteArchiveRule
newDeleteArchiveRule :: Text -> Text -> DeleteArchiveRule
newDeleteArchiveRule Text
pAnalyzerName_ Text
pRuleName_ =
  DeleteArchiveRule' :: Maybe Text -> Text -> Text -> DeleteArchiveRule
DeleteArchiveRule'
    { $sel:clientToken:DeleteArchiveRule' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:analyzerName:DeleteArchiveRule' :: Text
analyzerName = Text
pAnalyzerName_,
      $sel:ruleName:DeleteArchiveRule' :: Text
ruleName = Text
pRuleName_
    }

-- | A client token.
deleteArchiveRule_clientToken :: Lens.Lens' DeleteArchiveRule (Prelude.Maybe Prelude.Text)
deleteArchiveRule_clientToken :: (Maybe Text -> f (Maybe Text))
-> DeleteArchiveRule -> f DeleteArchiveRule
deleteArchiveRule_clientToken = (DeleteArchiveRule -> Maybe Text)
-> (DeleteArchiveRule -> Maybe Text -> DeleteArchiveRule)
-> Lens
     DeleteArchiveRule DeleteArchiveRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteArchiveRule' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteArchiveRule' :: DeleteArchiveRule -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteArchiveRule
s@DeleteArchiveRule' {} Maybe Text
a -> DeleteArchiveRule
s {$sel:clientToken:DeleteArchiveRule' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteArchiveRule)

-- | The name of the analyzer that associated with the archive rule to
-- delete.
deleteArchiveRule_analyzerName :: Lens.Lens' DeleteArchiveRule Prelude.Text
deleteArchiveRule_analyzerName :: (Text -> f Text) -> DeleteArchiveRule -> f DeleteArchiveRule
deleteArchiveRule_analyzerName = (DeleteArchiveRule -> Text)
-> (DeleteArchiveRule -> Text -> DeleteArchiveRule)
-> Lens DeleteArchiveRule DeleteArchiveRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteArchiveRule' {Text
analyzerName :: Text
$sel:analyzerName:DeleteArchiveRule' :: DeleteArchiveRule -> Text
analyzerName} -> Text
analyzerName) (\s :: DeleteArchiveRule
s@DeleteArchiveRule' {} Text
a -> DeleteArchiveRule
s {$sel:analyzerName:DeleteArchiveRule' :: Text
analyzerName = Text
a} :: DeleteArchiveRule)

-- | The name of the rule to delete.
deleteArchiveRule_ruleName :: Lens.Lens' DeleteArchiveRule Prelude.Text
deleteArchiveRule_ruleName :: (Text -> f Text) -> DeleteArchiveRule -> f DeleteArchiveRule
deleteArchiveRule_ruleName = (DeleteArchiveRule -> Text)
-> (DeleteArchiveRule -> Text -> DeleteArchiveRule)
-> Lens DeleteArchiveRule DeleteArchiveRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteArchiveRule' {Text
ruleName :: Text
$sel:ruleName:DeleteArchiveRule' :: DeleteArchiveRule -> Text
ruleName} -> Text
ruleName) (\s :: DeleteArchiveRule
s@DeleteArchiveRule' {} Text
a -> DeleteArchiveRule
s {$sel:ruleName:DeleteArchiveRule' :: Text
ruleName = Text
a} :: DeleteArchiveRule)

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

instance Prelude.Hashable DeleteArchiveRule

instance Prelude.NFData DeleteArchiveRule

instance Core.ToHeaders DeleteArchiveRule where
  toHeaders :: DeleteArchiveRule -> [Header]
toHeaders =
    [Header] -> DeleteArchiveRule -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteArchiveRule where
  toPath :: DeleteArchiveRule -> ByteString
toPath DeleteArchiveRule' {Maybe Text
Text
ruleName :: Text
analyzerName :: Text
clientToken :: Maybe Text
$sel:ruleName:DeleteArchiveRule' :: DeleteArchiveRule -> Text
$sel:analyzerName:DeleteArchiveRule' :: DeleteArchiveRule -> Text
$sel:clientToken:DeleteArchiveRule' :: DeleteArchiveRule -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/analyzer/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
analyzerName,
        ByteString
"/archive-rule/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
ruleName
      ]

instance Core.ToQuery DeleteArchiveRule where
  toQuery :: DeleteArchiveRule -> QueryString
toQuery DeleteArchiveRule' {Maybe Text
Text
ruleName :: Text
analyzerName :: Text
clientToken :: Maybe Text
$sel:ruleName:DeleteArchiveRule' :: DeleteArchiveRule -> Text
$sel:analyzerName:DeleteArchiveRule' :: DeleteArchiveRule -> Text
$sel:clientToken:DeleteArchiveRule' :: DeleteArchiveRule -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"clientToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clientToken]

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

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

instance Prelude.NFData DeleteArchiveRuleResponse