{-# 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-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 join a network. This action can be called by a
-- principal in an AWS 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.Lens as Lens
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
(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:
--
-- 'invitationId', 'rejectInvitation_invitationId' - The unique identifier of the invitation to reject.
newRejectInvitation ::
  -- | 'invitationId'
  Prelude.Text ->
  RejectInvitation
newRejectInvitation :: Text -> RejectInvitation
newRejectInvitation Text
pInvitationId_ =
  RejectInvitation' :: Text -> RejectInvitation
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 :: (Text -> f Text) -> RejectInvitation -> f RejectInvitation
rejectInvitation_invitationId = (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
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 :: RejectInvitation -> Request RejectInvitation
request = Service -> RejectInvitation -> Request RejectInvitation
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy RejectInvitation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RejectInvitation)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse RejectInvitation))
-> Logger
-> Service
-> Proxy RejectInvitation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RejectInvitation)))
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 -> RejectInvitationResponse
RejectInvitationResponse'
            (Int -> RejectInvitationResponse)
-> Either String Int -> Either String RejectInvitationResponse
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 RejectInvitation

instance Prelude.NFData RejectInvitation

instance Core.ToHeaders RejectInvitation where
  toHeaders :: RejectInvitation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RejectInvitation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath RejectInvitation where
  toPath :: RejectInvitation -> ByteString
toPath RejectInvitation' {Text
invitationId :: Text
$sel:invitationId:RejectInvitation' :: RejectInvitation -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/invitations/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
invitationId]

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'
  { -- | The response's http status code.
    RejectInvitationResponse -> Int
httpStatus :: Prelude.Int
  }
  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.
--
-- 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' :: Int -> RejectInvitationResponse
RejectInvitationResponse'
    { $sel:httpStatus:RejectInvitationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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