{-# 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.WellArchitected.UpdateShareInvitation
-- 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)
--
-- Update a workload invitation.
module Amazonka.WellArchitected.UpdateShareInvitation
  ( -- * Creating a Request
    UpdateShareInvitation (..),
    newUpdateShareInvitation,

    -- * Request Lenses
    updateShareInvitation_shareInvitationId,
    updateShareInvitation_shareInvitationAction,

    -- * Destructuring the Response
    UpdateShareInvitationResponse (..),
    newUpdateShareInvitationResponse,

    -- * Response Lenses
    updateShareInvitationResponse_shareInvitation,
    updateShareInvitationResponse_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.WellArchitected.Types

-- | Input for Update Share Invitation
--
-- /See:/ 'newUpdateShareInvitation' smart constructor.
data UpdateShareInvitation = UpdateShareInvitation'
  { -- | The ID assigned to the share invitation.
    UpdateShareInvitation -> Text
shareInvitationId :: Prelude.Text,
    UpdateShareInvitation -> ShareInvitationAction
shareInvitationAction :: ShareInvitationAction
  }
  deriving (UpdateShareInvitation -> UpdateShareInvitation -> Bool
(UpdateShareInvitation -> UpdateShareInvitation -> Bool)
-> (UpdateShareInvitation -> UpdateShareInvitation -> Bool)
-> Eq UpdateShareInvitation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateShareInvitation -> UpdateShareInvitation -> Bool
$c/= :: UpdateShareInvitation -> UpdateShareInvitation -> Bool
== :: UpdateShareInvitation -> UpdateShareInvitation -> Bool
$c== :: UpdateShareInvitation -> UpdateShareInvitation -> Bool
Prelude.Eq, ReadPrec [UpdateShareInvitation]
ReadPrec UpdateShareInvitation
Int -> ReadS UpdateShareInvitation
ReadS [UpdateShareInvitation]
(Int -> ReadS UpdateShareInvitation)
-> ReadS [UpdateShareInvitation]
-> ReadPrec UpdateShareInvitation
-> ReadPrec [UpdateShareInvitation]
-> Read UpdateShareInvitation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateShareInvitation]
$creadListPrec :: ReadPrec [UpdateShareInvitation]
readPrec :: ReadPrec UpdateShareInvitation
$creadPrec :: ReadPrec UpdateShareInvitation
readList :: ReadS [UpdateShareInvitation]
$creadList :: ReadS [UpdateShareInvitation]
readsPrec :: Int -> ReadS UpdateShareInvitation
$creadsPrec :: Int -> ReadS UpdateShareInvitation
Prelude.Read, Int -> UpdateShareInvitation -> ShowS
[UpdateShareInvitation] -> ShowS
UpdateShareInvitation -> String
(Int -> UpdateShareInvitation -> ShowS)
-> (UpdateShareInvitation -> String)
-> ([UpdateShareInvitation] -> ShowS)
-> Show UpdateShareInvitation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateShareInvitation] -> ShowS
$cshowList :: [UpdateShareInvitation] -> ShowS
show :: UpdateShareInvitation -> String
$cshow :: UpdateShareInvitation -> String
showsPrec :: Int -> UpdateShareInvitation -> ShowS
$cshowsPrec :: Int -> UpdateShareInvitation -> ShowS
Prelude.Show, (forall x. UpdateShareInvitation -> Rep UpdateShareInvitation x)
-> (forall x. Rep UpdateShareInvitation x -> UpdateShareInvitation)
-> Generic UpdateShareInvitation
forall x. Rep UpdateShareInvitation x -> UpdateShareInvitation
forall x. UpdateShareInvitation -> Rep UpdateShareInvitation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateShareInvitation x -> UpdateShareInvitation
$cfrom :: forall x. UpdateShareInvitation -> Rep UpdateShareInvitation x
Prelude.Generic)

-- |
-- Create a value of 'UpdateShareInvitation' 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:
--
-- 'shareInvitationId', 'updateShareInvitation_shareInvitationId' - The ID assigned to the share invitation.
--
-- 'shareInvitationAction', 'updateShareInvitation_shareInvitationAction' - Undocumented member.
newUpdateShareInvitation ::
  -- | 'shareInvitationId'
  Prelude.Text ->
  -- | 'shareInvitationAction'
  ShareInvitationAction ->
  UpdateShareInvitation
newUpdateShareInvitation :: Text -> ShareInvitationAction -> UpdateShareInvitation
newUpdateShareInvitation
  Text
pShareInvitationId_
  ShareInvitationAction
pShareInvitationAction_ =
    UpdateShareInvitation' :: Text -> ShareInvitationAction -> UpdateShareInvitation
UpdateShareInvitation'
      { $sel:shareInvitationId:UpdateShareInvitation' :: Text
shareInvitationId =
          Text
pShareInvitationId_,
        $sel:shareInvitationAction:UpdateShareInvitation' :: ShareInvitationAction
shareInvitationAction = ShareInvitationAction
pShareInvitationAction_
      }

-- | The ID assigned to the share invitation.
updateShareInvitation_shareInvitationId :: Lens.Lens' UpdateShareInvitation Prelude.Text
updateShareInvitation_shareInvitationId :: (Text -> f Text)
-> UpdateShareInvitation -> f UpdateShareInvitation
updateShareInvitation_shareInvitationId = (UpdateShareInvitation -> Text)
-> (UpdateShareInvitation -> Text -> UpdateShareInvitation)
-> Lens UpdateShareInvitation UpdateShareInvitation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShareInvitation' {Text
shareInvitationId :: Text
$sel:shareInvitationId:UpdateShareInvitation' :: UpdateShareInvitation -> Text
shareInvitationId} -> Text
shareInvitationId) (\s :: UpdateShareInvitation
s@UpdateShareInvitation' {} Text
a -> UpdateShareInvitation
s {$sel:shareInvitationId:UpdateShareInvitation' :: Text
shareInvitationId = Text
a} :: UpdateShareInvitation)

-- | Undocumented member.
updateShareInvitation_shareInvitationAction :: Lens.Lens' UpdateShareInvitation ShareInvitationAction
updateShareInvitation_shareInvitationAction :: (ShareInvitationAction -> f ShareInvitationAction)
-> UpdateShareInvitation -> f UpdateShareInvitation
updateShareInvitation_shareInvitationAction = (UpdateShareInvitation -> ShareInvitationAction)
-> (UpdateShareInvitation
    -> ShareInvitationAction -> UpdateShareInvitation)
-> Lens
     UpdateShareInvitation
     UpdateShareInvitation
     ShareInvitationAction
     ShareInvitationAction
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShareInvitation' {ShareInvitationAction
shareInvitationAction :: ShareInvitationAction
$sel:shareInvitationAction:UpdateShareInvitation' :: UpdateShareInvitation -> ShareInvitationAction
shareInvitationAction} -> ShareInvitationAction
shareInvitationAction) (\s :: UpdateShareInvitation
s@UpdateShareInvitation' {} ShareInvitationAction
a -> UpdateShareInvitation
s {$sel:shareInvitationAction:UpdateShareInvitation' :: ShareInvitationAction
shareInvitationAction = ShareInvitationAction
a} :: UpdateShareInvitation)

instance Core.AWSRequest UpdateShareInvitation where
  type
    AWSResponse UpdateShareInvitation =
      UpdateShareInvitationResponse
  request :: UpdateShareInvitation -> Request UpdateShareInvitation
request = Service -> UpdateShareInvitation -> Request UpdateShareInvitation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateShareInvitation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateShareInvitation)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateShareInvitation))
-> Logger
-> Service
-> Proxy UpdateShareInvitation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateShareInvitation)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ShareInvitation -> Int -> UpdateShareInvitationResponse
UpdateShareInvitationResponse'
            (Maybe ShareInvitation -> Int -> UpdateShareInvitationResponse)
-> Either String (Maybe ShareInvitation)
-> Either String (Int -> UpdateShareInvitationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ShareInvitation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ShareInvitation")
            Either String (Int -> UpdateShareInvitationResponse)
-> Either String Int -> Either String UpdateShareInvitationResponse
forall (f :: * -> *) a b. Applicative f => 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 UpdateShareInvitation

instance Prelude.NFData UpdateShareInvitation

instance Core.ToHeaders UpdateShareInvitation where
  toHeaders :: UpdateShareInvitation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateShareInvitation -> 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.ToJSON UpdateShareInvitation where
  toJSON :: UpdateShareInvitation -> Value
toJSON UpdateShareInvitation' {Text
ShareInvitationAction
shareInvitationAction :: ShareInvitationAction
shareInvitationId :: Text
$sel:shareInvitationAction:UpdateShareInvitation' :: UpdateShareInvitation -> ShareInvitationAction
$sel:shareInvitationId:UpdateShareInvitation' :: UpdateShareInvitation -> 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
"ShareInvitationAction"
                  Text -> ShareInvitationAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ShareInvitationAction
shareInvitationAction
              )
          ]
      )

instance Core.ToPath UpdateShareInvitation where
  toPath :: UpdateShareInvitation -> ByteString
toPath UpdateShareInvitation' {Text
ShareInvitationAction
shareInvitationAction :: ShareInvitationAction
shareInvitationId :: Text
$sel:shareInvitationAction:UpdateShareInvitation' :: UpdateShareInvitation -> ShareInvitationAction
$sel:shareInvitationId:UpdateShareInvitation' :: UpdateShareInvitation -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/shareInvitations/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
shareInvitationId]

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

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

-- |
-- Create a value of 'UpdateShareInvitationResponse' 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:
--
-- 'shareInvitation', 'updateShareInvitationResponse_shareInvitation' - The updated workload share invitation.
--
-- 'httpStatus', 'updateShareInvitationResponse_httpStatus' - The response's http status code.
newUpdateShareInvitationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateShareInvitationResponse
newUpdateShareInvitationResponse :: Int -> UpdateShareInvitationResponse
newUpdateShareInvitationResponse Int
pHttpStatus_ =
  UpdateShareInvitationResponse' :: Maybe ShareInvitation -> Int -> UpdateShareInvitationResponse
UpdateShareInvitationResponse'
    { $sel:shareInvitation:UpdateShareInvitationResponse' :: Maybe ShareInvitation
shareInvitation =
        Maybe ShareInvitation
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateShareInvitationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The updated workload share invitation.
updateShareInvitationResponse_shareInvitation :: Lens.Lens' UpdateShareInvitationResponse (Prelude.Maybe ShareInvitation)
updateShareInvitationResponse_shareInvitation :: (Maybe ShareInvitation -> f (Maybe ShareInvitation))
-> UpdateShareInvitationResponse -> f UpdateShareInvitationResponse
updateShareInvitationResponse_shareInvitation = (UpdateShareInvitationResponse -> Maybe ShareInvitation)
-> (UpdateShareInvitationResponse
    -> Maybe ShareInvitation -> UpdateShareInvitationResponse)
-> Lens
     UpdateShareInvitationResponse
     UpdateShareInvitationResponse
     (Maybe ShareInvitation)
     (Maybe ShareInvitation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateShareInvitationResponse' {Maybe ShareInvitation
shareInvitation :: Maybe ShareInvitation
$sel:shareInvitation:UpdateShareInvitationResponse' :: UpdateShareInvitationResponse -> Maybe ShareInvitation
shareInvitation} -> Maybe ShareInvitation
shareInvitation) (\s :: UpdateShareInvitationResponse
s@UpdateShareInvitationResponse' {} Maybe ShareInvitation
a -> UpdateShareInvitationResponse
s {$sel:shareInvitation:UpdateShareInvitationResponse' :: Maybe ShareInvitation
shareInvitation = Maybe ShareInvitation
a} :: UpdateShareInvitationResponse)

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

instance Prelude.NFData UpdateShareInvitationResponse