{-# 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.Detective.RejectInvitation
-- 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)
--
-- Rejects an invitation to contribute the account data to a behavior
-- graph. This operation must be called by a member account that has the
-- @INVITED@ status.
module Amazonka.Detective.RejectInvitation
  ( -- * Creating a Request
    RejectInvitation (..),
    newRejectInvitation,

    -- * Request Lenses
    rejectInvitation_graphArn,

    -- * Destructuring the Response
    RejectInvitationResponse (..),
    newRejectInvitationResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Detective.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:/ 'newRejectInvitation' smart constructor.
data RejectInvitation = RejectInvitation'
  { -- | The ARN of the behavior graph to reject the invitation to.
    --
    -- The member account\'s current member status in the behavior graph must
    -- be @INVITED@.
    RejectInvitation -> Text
graphArn :: Prelude.Text
  }
  deriving (RejectInvitation -> RejectInvitation -> Bool
(RejectInvitation -> RejectInvitation -> Bool)
-> (RejectInvitation -> RejectInvitation -> Bool)
-> Eq RejectInvitation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RejectInvitation -> RejectInvitation -> Bool
$c/= :: RejectInvitation -> RejectInvitation -> Bool
== :: RejectInvitation -> RejectInvitation -> Bool
$c== :: RejectInvitation -> RejectInvitation -> Bool
Prelude.Eq, ReadPrec [RejectInvitation]
ReadPrec RejectInvitation
Int -> ReadS RejectInvitation
ReadS [RejectInvitation]
(Int -> ReadS RejectInvitation)
-> ReadS [RejectInvitation]
-> ReadPrec RejectInvitation
-> ReadPrec [RejectInvitation]
-> Read RejectInvitation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RejectInvitation]
$creadListPrec :: ReadPrec [RejectInvitation]
readPrec :: ReadPrec RejectInvitation
$creadPrec :: ReadPrec RejectInvitation
readList :: ReadS [RejectInvitation]
$creadList :: ReadS [RejectInvitation]
readsPrec :: Int -> ReadS RejectInvitation
$creadsPrec :: Int -> ReadS RejectInvitation
Prelude.Read, Int -> RejectInvitation -> ShowS
[RejectInvitation] -> ShowS
RejectInvitation -> String
(Int -> RejectInvitation -> ShowS)
-> (RejectInvitation -> String)
-> ([RejectInvitation] -> ShowS)
-> Show RejectInvitation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RejectInvitation] -> ShowS
$cshowList :: [RejectInvitation] -> ShowS
show :: RejectInvitation -> String
$cshow :: RejectInvitation -> String
showsPrec :: Int -> RejectInvitation -> ShowS
$cshowsPrec :: Int -> RejectInvitation -> ShowS
Prelude.Show, (forall x. RejectInvitation -> Rep RejectInvitation x)
-> (forall x. Rep RejectInvitation x -> RejectInvitation)
-> Generic RejectInvitation
forall x. Rep RejectInvitation x -> RejectInvitation
forall x. RejectInvitation -> Rep RejectInvitation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RejectInvitation x -> RejectInvitation
$cfrom :: forall x. RejectInvitation -> Rep RejectInvitation x
Prelude.Generic)

-- |
-- Create a value of 'RejectInvitation' 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:
--
-- 'graphArn', 'rejectInvitation_graphArn' - The ARN of the behavior graph to reject the invitation to.
--
-- The member account\'s current member status in the behavior graph must
-- be @INVITED@.
newRejectInvitation ::
  -- | 'graphArn'
  Prelude.Text ->
  RejectInvitation
newRejectInvitation :: Text -> RejectInvitation
newRejectInvitation Text
pGraphArn_ =
  RejectInvitation' :: Text -> RejectInvitation
RejectInvitation' {$sel:graphArn:RejectInvitation' :: Text
graphArn = Text
pGraphArn_}

-- | The ARN of the behavior graph to reject the invitation to.
--
-- The member account\'s current member status in the behavior graph must
-- be @INVITED@.
rejectInvitation_graphArn :: Lens.Lens' RejectInvitation Prelude.Text
rejectInvitation_graphArn :: (Text -> f Text) -> RejectInvitation -> f RejectInvitation
rejectInvitation_graphArn = (RejectInvitation -> Text)
-> (RejectInvitation -> Text -> RejectInvitation)
-> Lens RejectInvitation RejectInvitation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectInvitation' {Text
graphArn :: Text
$sel:graphArn:RejectInvitation' :: RejectInvitation -> Text
graphArn} -> Text
graphArn) (\s :: RejectInvitation
s@RejectInvitation' {} Text
a -> RejectInvitation
s {$sel:graphArn:RejectInvitation' :: Text
graphArn = Text
a} :: RejectInvitation)

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

instance Prelude.Hashable RejectInvitation

instance Prelude.NFData RejectInvitation

instance Core.ToHeaders RejectInvitation where
  toHeaders :: RejectInvitation -> [Header]
toHeaders =
    [Header] -> RejectInvitation -> [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.ToJSON RejectInvitation where
  toJSON :: RejectInvitation -> Value
toJSON RejectInvitation' {Text
graphArn :: Text
$sel:graphArn:RejectInvitation' :: RejectInvitation -> 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
"GraphArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
graphArn)]
      )

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

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

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

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

instance Prelude.NFData RejectInvitationResponse