{-# 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.SSOAdmin.DeletePermissionSet
-- 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 permission set.
module Amazonka.SSOAdmin.DeletePermissionSet
  ( -- * Creating a Request
    DeletePermissionSet (..),
    newDeletePermissionSet,

    -- * Request Lenses
    deletePermissionSet_instanceArn,
    deletePermissionSet_permissionSetArn,

    -- * Destructuring the Response
    DeletePermissionSetResponse (..),
    newDeletePermissionSetResponse,

    -- * Response Lenses
    deletePermissionSetResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeletePermissionSet' smart constructor.
data DeletePermissionSet = DeletePermissionSet'
  { -- | The ARN of the IAM Identity Center instance under which the operation
    -- will be executed. For more information about ARNs, see
    -- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and AWS Service Namespaces>
    -- in the /AWS General Reference/.
    DeletePermissionSet -> Text
instanceArn :: Prelude.Text,
    -- | The ARN of the permission set that should be deleted.
    DeletePermissionSet -> Text
permissionSetArn :: Prelude.Text
  }
  deriving (DeletePermissionSet -> DeletePermissionSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePermissionSet -> DeletePermissionSet -> Bool
$c/= :: DeletePermissionSet -> DeletePermissionSet -> Bool
== :: DeletePermissionSet -> DeletePermissionSet -> Bool
$c== :: DeletePermissionSet -> DeletePermissionSet -> Bool
Prelude.Eq, ReadPrec [DeletePermissionSet]
ReadPrec DeletePermissionSet
Int -> ReadS DeletePermissionSet
ReadS [DeletePermissionSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePermissionSet]
$creadListPrec :: ReadPrec [DeletePermissionSet]
readPrec :: ReadPrec DeletePermissionSet
$creadPrec :: ReadPrec DeletePermissionSet
readList :: ReadS [DeletePermissionSet]
$creadList :: ReadS [DeletePermissionSet]
readsPrec :: Int -> ReadS DeletePermissionSet
$creadsPrec :: Int -> ReadS DeletePermissionSet
Prelude.Read, Int -> DeletePermissionSet -> ShowS
[DeletePermissionSet] -> ShowS
DeletePermissionSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePermissionSet] -> ShowS
$cshowList :: [DeletePermissionSet] -> ShowS
show :: DeletePermissionSet -> String
$cshow :: DeletePermissionSet -> String
showsPrec :: Int -> DeletePermissionSet -> ShowS
$cshowsPrec :: Int -> DeletePermissionSet -> ShowS
Prelude.Show, forall x. Rep DeletePermissionSet x -> DeletePermissionSet
forall x. DeletePermissionSet -> Rep DeletePermissionSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePermissionSet x -> DeletePermissionSet
$cfrom :: forall x. DeletePermissionSet -> Rep DeletePermissionSet x
Prelude.Generic)

-- |
-- Create a value of 'DeletePermissionSet' 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:
--
-- 'instanceArn', 'deletePermissionSet_instanceArn' - The ARN of the IAM Identity Center instance under which the operation
-- will be executed. For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and AWS Service Namespaces>
-- in the /AWS General Reference/.
--
-- 'permissionSetArn', 'deletePermissionSet_permissionSetArn' - The ARN of the permission set that should be deleted.
newDeletePermissionSet ::
  -- | 'instanceArn'
  Prelude.Text ->
  -- | 'permissionSetArn'
  Prelude.Text ->
  DeletePermissionSet
newDeletePermissionSet :: Text -> Text -> DeletePermissionSet
newDeletePermissionSet
  Text
pInstanceArn_
  Text
pPermissionSetArn_ =
    DeletePermissionSet'
      { $sel:instanceArn:DeletePermissionSet' :: Text
instanceArn = Text
pInstanceArn_,
        $sel:permissionSetArn:DeletePermissionSet' :: Text
permissionSetArn = Text
pPermissionSetArn_
      }

-- | The ARN of the IAM Identity Center instance under which the operation
-- will be executed. For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and AWS Service Namespaces>
-- in the /AWS General Reference/.
deletePermissionSet_instanceArn :: Lens.Lens' DeletePermissionSet Prelude.Text
deletePermissionSet_instanceArn :: Lens' DeletePermissionSet Text
deletePermissionSet_instanceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePermissionSet' {Text
instanceArn :: Text
$sel:instanceArn:DeletePermissionSet' :: DeletePermissionSet -> Text
instanceArn} -> Text
instanceArn) (\s :: DeletePermissionSet
s@DeletePermissionSet' {} Text
a -> DeletePermissionSet
s {$sel:instanceArn:DeletePermissionSet' :: Text
instanceArn = Text
a} :: DeletePermissionSet)

-- | The ARN of the permission set that should be deleted.
deletePermissionSet_permissionSetArn :: Lens.Lens' DeletePermissionSet Prelude.Text
deletePermissionSet_permissionSetArn :: Lens' DeletePermissionSet Text
deletePermissionSet_permissionSetArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePermissionSet' {Text
permissionSetArn :: Text
$sel:permissionSetArn:DeletePermissionSet' :: DeletePermissionSet -> Text
permissionSetArn} -> Text
permissionSetArn) (\s :: DeletePermissionSet
s@DeletePermissionSet' {} Text
a -> DeletePermissionSet
s {$sel:permissionSetArn:DeletePermissionSet' :: Text
permissionSetArn = Text
a} :: DeletePermissionSet)

instance Core.AWSRequest DeletePermissionSet where
  type
    AWSResponse DeletePermissionSet =
      DeletePermissionSetResponse
  request :: (Service -> Service)
-> DeletePermissionSet -> Request DeletePermissionSet
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeletePermissionSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePermissionSet)))
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 -> DeletePermissionSetResponse
DeletePermissionSetResponse'
            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 DeletePermissionSet where
  hashWithSalt :: Int -> DeletePermissionSet -> Int
hashWithSalt Int
_salt DeletePermissionSet' {Text
permissionSetArn :: Text
instanceArn :: Text
$sel:permissionSetArn:DeletePermissionSet' :: DeletePermissionSet -> Text
$sel:instanceArn:DeletePermissionSet' :: DeletePermissionSet -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
permissionSetArn

instance Prelude.NFData DeletePermissionSet where
  rnf :: DeletePermissionSet -> ()
rnf DeletePermissionSet' {Text
permissionSetArn :: Text
instanceArn :: Text
$sel:permissionSetArn:DeletePermissionSet' :: DeletePermissionSet -> Text
$sel:instanceArn:DeletePermissionSet' :: DeletePermissionSet -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
instanceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
permissionSetArn

instance Data.ToHeaders DeletePermissionSet where
  toHeaders :: DeletePermissionSet -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"SWBExternalService.DeletePermissionSet" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeletePermissionSet where
  toJSON :: DeletePermissionSet -> Value
toJSON DeletePermissionSet' {Text
permissionSetArn :: Text
instanceArn :: Text
$sel:permissionSetArn:DeletePermissionSet' :: DeletePermissionSet -> Text
$sel:instanceArn:DeletePermissionSet' :: DeletePermissionSet -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"InstanceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceArn),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"PermissionSetArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
permissionSetArn)
          ]
      )

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

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

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

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

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

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