{-# 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-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 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.Lens as Lens
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 SSO 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 Amazon Web Services Service Namespaces>
    -- in the /Amazon Web Services 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
(DeletePermissionSet -> DeletePermissionSet -> Bool)
-> (DeletePermissionSet -> DeletePermissionSet -> Bool)
-> Eq DeletePermissionSet
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]
(Int -> ReadS DeletePermissionSet)
-> ReadS [DeletePermissionSet]
-> ReadPrec DeletePermissionSet
-> ReadPrec [DeletePermissionSet]
-> Read 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
(Int -> DeletePermissionSet -> ShowS)
-> (DeletePermissionSet -> String)
-> ([DeletePermissionSet] -> ShowS)
-> Show DeletePermissionSet
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. DeletePermissionSet -> Rep DeletePermissionSet x)
-> (forall x. Rep DeletePermissionSet x -> DeletePermissionSet)
-> Generic DeletePermissionSet
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 SSO 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 Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services 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' :: Text -> Text -> DeletePermissionSet
DeletePermissionSet'
      { $sel:instanceArn:DeletePermissionSet' :: Text
instanceArn = Text
pInstanceArn_,
        $sel:permissionSetArn:DeletePermissionSet' :: Text
permissionSetArn = Text
pPermissionSetArn_
      }

-- | The ARN of the SSO 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 Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
deletePermissionSet_instanceArn :: Lens.Lens' DeletePermissionSet Prelude.Text
deletePermissionSet_instanceArn :: (Text -> f Text) -> DeletePermissionSet -> f DeletePermissionSet
deletePermissionSet_instanceArn = (DeletePermissionSet -> Text)
-> (DeletePermissionSet -> Text -> DeletePermissionSet)
-> Lens DeletePermissionSet DeletePermissionSet Text Text
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 :: (Text -> f Text) -> DeletePermissionSet -> f DeletePermissionSet
deletePermissionSet_permissionSetArn = (DeletePermissionSet -> Text)
-> (DeletePermissionSet -> Text -> DeletePermissionSet)
-> Lens DeletePermissionSet DeletePermissionSet Text Text
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 :: DeletePermissionSet -> Request DeletePermissionSet
request = Service -> DeletePermissionSet -> Request DeletePermissionSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeletePermissionSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePermissionSet)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeletePermissionSet))
-> Logger
-> Service
-> Proxy DeletePermissionSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePermissionSet)))
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 -> DeletePermissionSetResponse
DeletePermissionSetResponse'
            (Int -> DeletePermissionSetResponse)
-> Either String Int -> Either String DeletePermissionSetResponse
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 DeletePermissionSet

instance Prelude.NFData DeletePermissionSet

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

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PermissionSetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
permissionSetArn)
          ]
      )

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

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

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