{-# 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.AlexaBusiness.RevokeInvitation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Revokes an invitation and invalidates the enrollment URL.
module Amazonka.AlexaBusiness.RevokeInvitation
  ( -- * Creating a Request
    RevokeInvitation (..),
    newRevokeInvitation,

    -- * Request Lenses
    revokeInvitation_enrollmentId,
    revokeInvitation_userArn,

    -- * Destructuring the Response
    RevokeInvitationResponse (..),
    newRevokeInvitationResponse,

    -- * Response Lenses
    revokeInvitationResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.Types
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

-- | /See:/ 'newRevokeInvitation' smart constructor.
data RevokeInvitation = RevokeInvitation'
  { -- | The ARN of the enrollment invitation to revoke. Required.
    RevokeInvitation -> Maybe Text
enrollmentId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the user for whom to revoke an enrollment invitation.
    -- Required.
    RevokeInvitation -> Maybe Text
userArn :: Prelude.Maybe Prelude.Text
  }
  deriving (RevokeInvitation -> RevokeInvitation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokeInvitation -> RevokeInvitation -> Bool
$c/= :: RevokeInvitation -> RevokeInvitation -> Bool
== :: RevokeInvitation -> RevokeInvitation -> Bool
$c== :: RevokeInvitation -> RevokeInvitation -> Bool
Prelude.Eq, ReadPrec [RevokeInvitation]
ReadPrec RevokeInvitation
Int -> ReadS RevokeInvitation
ReadS [RevokeInvitation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokeInvitation]
$creadListPrec :: ReadPrec [RevokeInvitation]
readPrec :: ReadPrec RevokeInvitation
$creadPrec :: ReadPrec RevokeInvitation
readList :: ReadS [RevokeInvitation]
$creadList :: ReadS [RevokeInvitation]
readsPrec :: Int -> ReadS RevokeInvitation
$creadsPrec :: Int -> ReadS RevokeInvitation
Prelude.Read, Int -> RevokeInvitation -> ShowS
[RevokeInvitation] -> ShowS
RevokeInvitation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokeInvitation] -> ShowS
$cshowList :: [RevokeInvitation] -> ShowS
show :: RevokeInvitation -> String
$cshow :: RevokeInvitation -> String
showsPrec :: Int -> RevokeInvitation -> ShowS
$cshowsPrec :: Int -> RevokeInvitation -> ShowS
Prelude.Show, forall x. Rep RevokeInvitation x -> RevokeInvitation
forall x. RevokeInvitation -> Rep RevokeInvitation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevokeInvitation x -> RevokeInvitation
$cfrom :: forall x. RevokeInvitation -> Rep RevokeInvitation x
Prelude.Generic)

-- |
-- Create a value of 'RevokeInvitation' 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:
--
-- 'enrollmentId', 'revokeInvitation_enrollmentId' - The ARN of the enrollment invitation to revoke. Required.
--
-- 'userArn', 'revokeInvitation_userArn' - The ARN of the user for whom to revoke an enrollment invitation.
-- Required.
newRevokeInvitation ::
  RevokeInvitation
newRevokeInvitation :: RevokeInvitation
newRevokeInvitation =
  RevokeInvitation'
    { $sel:enrollmentId:RevokeInvitation' :: Maybe Text
enrollmentId = forall a. Maybe a
Prelude.Nothing,
      $sel:userArn:RevokeInvitation' :: Maybe Text
userArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the enrollment invitation to revoke. Required.
revokeInvitation_enrollmentId :: Lens.Lens' RevokeInvitation (Prelude.Maybe Prelude.Text)
revokeInvitation_enrollmentId :: Lens' RevokeInvitation (Maybe Text)
revokeInvitation_enrollmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeInvitation' {Maybe Text
enrollmentId :: Maybe Text
$sel:enrollmentId:RevokeInvitation' :: RevokeInvitation -> Maybe Text
enrollmentId} -> Maybe Text
enrollmentId) (\s :: RevokeInvitation
s@RevokeInvitation' {} Maybe Text
a -> RevokeInvitation
s {$sel:enrollmentId:RevokeInvitation' :: Maybe Text
enrollmentId = Maybe Text
a} :: RevokeInvitation)

-- | The ARN of the user for whom to revoke an enrollment invitation.
-- Required.
revokeInvitation_userArn :: Lens.Lens' RevokeInvitation (Prelude.Maybe Prelude.Text)
revokeInvitation_userArn :: Lens' RevokeInvitation (Maybe Text)
revokeInvitation_userArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeInvitation' {Maybe Text
userArn :: Maybe Text
$sel:userArn:RevokeInvitation' :: RevokeInvitation -> Maybe Text
userArn} -> Maybe Text
userArn) (\s :: RevokeInvitation
s@RevokeInvitation' {} Maybe Text
a -> RevokeInvitation
s {$sel:userArn:RevokeInvitation' :: Maybe Text
userArn = Maybe Text
a} :: RevokeInvitation)

instance Core.AWSRequest RevokeInvitation where
  type
    AWSResponse RevokeInvitation =
      RevokeInvitationResponse
  request :: (Service -> Service)
-> RevokeInvitation -> Request RevokeInvitation
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 RevokeInvitation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RevokeInvitation)))
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 -> RevokeInvitationResponse
RevokeInvitationResponse'
            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 RevokeInvitation where
  hashWithSalt :: Int -> RevokeInvitation -> Int
hashWithSalt Int
_salt RevokeInvitation' {Maybe Text
userArn :: Maybe Text
enrollmentId :: Maybe Text
$sel:userArn:RevokeInvitation' :: RevokeInvitation -> Maybe Text
$sel:enrollmentId:RevokeInvitation' :: RevokeInvitation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
enrollmentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
userArn

instance Prelude.NFData RevokeInvitation where
  rnf :: RevokeInvitation -> ()
rnf RevokeInvitation' {Maybe Text
userArn :: Maybe Text
enrollmentId :: Maybe Text
$sel:userArn:RevokeInvitation' :: RevokeInvitation -> Maybe Text
$sel:enrollmentId:RevokeInvitation' :: RevokeInvitation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
enrollmentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
userArn

instance Data.ToHeaders RevokeInvitation where
  toHeaders :: RevokeInvitation -> 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
"AlexaForBusiness.RevokeInvitation" ::
                          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 RevokeInvitation where
  toJSON :: RevokeInvitation -> Value
toJSON RevokeInvitation' {Maybe Text
userArn :: Maybe Text
enrollmentId :: Maybe Text
$sel:userArn:RevokeInvitation' :: RevokeInvitation -> Maybe Text
$sel:enrollmentId:RevokeInvitation' :: RevokeInvitation -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"EnrollmentId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
enrollmentId,
            (Key
"UserArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
userArn
          ]
      )

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

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

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

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

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

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