{-# 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.ManagedBlockChain.RejectInvitation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Rejects an invitation to join a network. This action can be called by a
-- principal in an Amazon Web Services account that has received an
-- invitation to create a member and join a network.
--
-- Applies only to Hyperledger Fabric.
module Amazonka.ManagedBlockChain.RejectInvitation
  ( -- * Creating a Request
    RejectInvitation (..),
    newRejectInvitation,

    -- * Request Lenses
    rejectInvitation_invitationId,

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

    -- * Response Lenses
    rejectInvitationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ManagedBlockChain.Types
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 unique identifier of the invitation to reject.
    RejectInvitation -> Text
invitationId :: Prelude.Text
  }
  deriving (RejectInvitation -> RejectInvitation -> Bool
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]
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
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. 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:
--
-- 'invitationId', 'rejectInvitation_invitationId' - The unique identifier of the invitation to reject.
newRejectInvitation ::
  -- | 'invitationId'
  Prelude.Text ->
  RejectInvitation
newRejectInvitation :: Text -> RejectInvitation
newRejectInvitation Text
pInvitationId_ =
  RejectInvitation' {$sel:invitationId:RejectInvitation' :: Text
invitationId = Text
pInvitationId_}

-- | The unique identifier of the invitation to reject.
rejectInvitation_invitationId :: Lens.Lens' RejectInvitation Prelude.Text
rejectInvitation_invitationId :: Lens' RejectInvitation Text
rejectInvitation_invitationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectInvitation' {Text
invitationId :: Text
$sel:invitationId:RejectInvitation' :: RejectInvitation -> Text
invitationId} -> Text
invitationId) (\s :: RejectInvitation
s@RejectInvitation' {} Text
a -> RejectInvitation
s {$sel:invitationId:RejectInvitation' :: Text
invitationId = Text
a} :: RejectInvitation)

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

instance Prelude.NFData RejectInvitation where
  rnf :: RejectInvitation -> ()
rnf RejectInvitation' {Text
invitationId :: Text
$sel:invitationId:RejectInvitation' :: RejectInvitation -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
invitationId

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

instance Data.ToPath RejectInvitation where
  toPath :: RejectInvitation -> ByteString
toPath RejectInvitation' {Text
invitationId :: Text
$sel:invitationId:RejectInvitation' :: RejectInvitation -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/invitations/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
invitationId]

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

-- | /See:/ 'newRejectInvitationResponse' smart constructor.
data RejectInvitationResponse = RejectInvitationResponse'
  { -- | The response's http status code.
    RejectInvitationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RejectInvitationResponse -> RejectInvitationResponse -> Bool
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]
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
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.
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.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'rejectInvitationResponse_httpStatus' - The response's http status code.
newRejectInvitationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RejectInvitationResponse
newRejectInvitationResponse :: Int -> RejectInvitationResponse
newRejectInvitationResponse Int
pHttpStatus_ =
  RejectInvitationResponse'
    { $sel:httpStatus:RejectInvitationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

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