{-# 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.IAM.DeleteGroupPolicy
-- 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 inline policy that is embedded in the specified
-- IAM group.
--
-- A group can also have managed policies attached to it. To detach a
-- managed policy from a group, use DetachGroupPolicy. For more information
-- about policies, refer to
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html Managed policies and inline policies>
-- in the /IAM User Guide/.
module Amazonka.IAM.DeleteGroupPolicy
  ( -- * Creating a Request
    DeleteGroupPolicy (..),
    newDeleteGroupPolicy,

    -- * Request Lenses
    deleteGroupPolicy_groupName,
    deleteGroupPolicy_policyName,

    -- * Destructuring the Response
    DeleteGroupPolicyResponse (..),
    newDeleteGroupPolicyResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IAM.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:/ 'newDeleteGroupPolicy' smart constructor.
data DeleteGroupPolicy = DeleteGroupPolicy'
  { -- | The name (friendly name, not ARN) identifying the group that the policy
    -- is embedded in.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: _+=,.\@-
    DeleteGroupPolicy -> Text
groupName :: Prelude.Text,
    -- | The name identifying the policy document to delete.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: _+=,.\@-
    DeleteGroupPolicy -> Text
policyName :: Prelude.Text
  }
  deriving (DeleteGroupPolicy -> DeleteGroupPolicy -> Bool
(DeleteGroupPolicy -> DeleteGroupPolicy -> Bool)
-> (DeleteGroupPolicy -> DeleteGroupPolicy -> Bool)
-> Eq DeleteGroupPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteGroupPolicy -> DeleteGroupPolicy -> Bool
$c/= :: DeleteGroupPolicy -> DeleteGroupPolicy -> Bool
== :: DeleteGroupPolicy -> DeleteGroupPolicy -> Bool
$c== :: DeleteGroupPolicy -> DeleteGroupPolicy -> Bool
Prelude.Eq, ReadPrec [DeleteGroupPolicy]
ReadPrec DeleteGroupPolicy
Int -> ReadS DeleteGroupPolicy
ReadS [DeleteGroupPolicy]
(Int -> ReadS DeleteGroupPolicy)
-> ReadS [DeleteGroupPolicy]
-> ReadPrec DeleteGroupPolicy
-> ReadPrec [DeleteGroupPolicy]
-> Read DeleteGroupPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteGroupPolicy]
$creadListPrec :: ReadPrec [DeleteGroupPolicy]
readPrec :: ReadPrec DeleteGroupPolicy
$creadPrec :: ReadPrec DeleteGroupPolicy
readList :: ReadS [DeleteGroupPolicy]
$creadList :: ReadS [DeleteGroupPolicy]
readsPrec :: Int -> ReadS DeleteGroupPolicy
$creadsPrec :: Int -> ReadS DeleteGroupPolicy
Prelude.Read, Int -> DeleteGroupPolicy -> ShowS
[DeleteGroupPolicy] -> ShowS
DeleteGroupPolicy -> String
(Int -> DeleteGroupPolicy -> ShowS)
-> (DeleteGroupPolicy -> String)
-> ([DeleteGroupPolicy] -> ShowS)
-> Show DeleteGroupPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteGroupPolicy] -> ShowS
$cshowList :: [DeleteGroupPolicy] -> ShowS
show :: DeleteGroupPolicy -> String
$cshow :: DeleteGroupPolicy -> String
showsPrec :: Int -> DeleteGroupPolicy -> ShowS
$cshowsPrec :: Int -> DeleteGroupPolicy -> ShowS
Prelude.Show, (forall x. DeleteGroupPolicy -> Rep DeleteGroupPolicy x)
-> (forall x. Rep DeleteGroupPolicy x -> DeleteGroupPolicy)
-> Generic DeleteGroupPolicy
forall x. Rep DeleteGroupPolicy x -> DeleteGroupPolicy
forall x. DeleteGroupPolicy -> Rep DeleteGroupPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteGroupPolicy x -> DeleteGroupPolicy
$cfrom :: forall x. DeleteGroupPolicy -> Rep DeleteGroupPolicy x
Prelude.Generic)

-- |
-- Create a value of 'DeleteGroupPolicy' 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:
--
-- 'groupName', 'deleteGroupPolicy_groupName' - The name (friendly name, not ARN) identifying the group that the policy
-- is embedded in.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
--
-- 'policyName', 'deleteGroupPolicy_policyName' - The name identifying the policy document to delete.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
newDeleteGroupPolicy ::
  -- | 'groupName'
  Prelude.Text ->
  -- | 'policyName'
  Prelude.Text ->
  DeleteGroupPolicy
newDeleteGroupPolicy :: Text -> Text -> DeleteGroupPolicy
newDeleteGroupPolicy Text
pGroupName_ Text
pPolicyName_ =
  DeleteGroupPolicy' :: Text -> Text -> DeleteGroupPolicy
DeleteGroupPolicy'
    { $sel:groupName:DeleteGroupPolicy' :: Text
groupName = Text
pGroupName_,
      $sel:policyName:DeleteGroupPolicy' :: Text
policyName = Text
pPolicyName_
    }

-- | The name (friendly name, not ARN) identifying the group that the policy
-- is embedded in.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
deleteGroupPolicy_groupName :: Lens.Lens' DeleteGroupPolicy Prelude.Text
deleteGroupPolicy_groupName :: (Text -> f Text) -> DeleteGroupPolicy -> f DeleteGroupPolicy
deleteGroupPolicy_groupName = (DeleteGroupPolicy -> Text)
-> (DeleteGroupPolicy -> Text -> DeleteGroupPolicy)
-> Lens DeleteGroupPolicy DeleteGroupPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroupPolicy' {Text
groupName :: Text
$sel:groupName:DeleteGroupPolicy' :: DeleteGroupPolicy -> Text
groupName} -> Text
groupName) (\s :: DeleteGroupPolicy
s@DeleteGroupPolicy' {} Text
a -> DeleteGroupPolicy
s {$sel:groupName:DeleteGroupPolicy' :: Text
groupName = Text
a} :: DeleteGroupPolicy)

-- | The name identifying the policy document to delete.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
deleteGroupPolicy_policyName :: Lens.Lens' DeleteGroupPolicy Prelude.Text
deleteGroupPolicy_policyName :: (Text -> f Text) -> DeleteGroupPolicy -> f DeleteGroupPolicy
deleteGroupPolicy_policyName = (DeleteGroupPolicy -> Text)
-> (DeleteGroupPolicy -> Text -> DeleteGroupPolicy)
-> Lens DeleteGroupPolicy DeleteGroupPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroupPolicy' {Text
policyName :: Text
$sel:policyName:DeleteGroupPolicy' :: DeleteGroupPolicy -> Text
policyName} -> Text
policyName) (\s :: DeleteGroupPolicy
s@DeleteGroupPolicy' {} Text
a -> DeleteGroupPolicy
s {$sel:policyName:DeleteGroupPolicy' :: Text
policyName = Text
a} :: DeleteGroupPolicy)

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

instance Prelude.Hashable DeleteGroupPolicy

instance Prelude.NFData DeleteGroupPolicy

instance Core.ToHeaders DeleteGroupPolicy where
  toHeaders :: DeleteGroupPolicy -> [Header]
toHeaders = [Header] -> DeleteGroupPolicy -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DeleteGroupPolicy where
  toQuery :: DeleteGroupPolicy -> QueryString
toQuery DeleteGroupPolicy' {Text
policyName :: Text
groupName :: Text
$sel:policyName:DeleteGroupPolicy' :: DeleteGroupPolicy -> Text
$sel:groupName:DeleteGroupPolicy' :: DeleteGroupPolicy -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteGroupPolicy" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"GroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
groupName,
        ByteString
"PolicyName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
policyName
      ]

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

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

instance Prelude.NFData DeleteGroupPolicyResponse