{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Update a workload or custom lens share invitation.
--
-- This API operation can be called independently of any resource. Previous
-- documentation implied that a workload ARN must be specified.
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.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
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
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]
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
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. 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'
      { $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 :: Lens' UpdateShareInvitation Text
updateShareInvitation_shareInvitationId = 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 :: Lens' UpdateShareInvitation ShareInvitationAction
updateShareInvitation_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 :: (Service -> Service)
-> UpdateShareInvitation -> Request UpdateShareInvitation
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateShareInvitation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateShareInvitation)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ShareInvitation -> Int -> UpdateShareInvitationResponse
UpdateShareInvitationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ShareInvitation")
            forall (f :: * -> *) a b. Applicative f => 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 UpdateShareInvitation where
  hashWithSalt :: Int -> UpdateShareInvitation -> Int
hashWithSalt Int
_salt UpdateShareInvitation' {Text
ShareInvitationAction
shareInvitationAction :: ShareInvitationAction
shareInvitationId :: Text
$sel:shareInvitationAction:UpdateShareInvitation' :: UpdateShareInvitation -> ShareInvitationAction
$sel:shareInvitationId:UpdateShareInvitation' :: UpdateShareInvitation -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
shareInvitationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ShareInvitationAction
shareInvitationAction

instance Prelude.NFData UpdateShareInvitation where
  rnf :: UpdateShareInvitation -> ()
rnf UpdateShareInvitation' {Text
ShareInvitationAction
shareInvitationAction :: ShareInvitationAction
shareInvitationId :: Text
$sel:shareInvitationAction:UpdateShareInvitation' :: UpdateShareInvitation -> ShareInvitationAction
$sel:shareInvitationId:UpdateShareInvitation' :: UpdateShareInvitation -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
shareInvitationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ShareInvitationAction
shareInvitationAction

instance Data.ToHeaders UpdateShareInvitation where
  toHeaders :: UpdateShareInvitation -> 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.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"ShareInvitationAction"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ShareInvitationAction
shareInvitationAction
              )
          ]
      )

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

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

-- | /See:/ 'newUpdateShareInvitationResponse' smart constructor.
data UpdateShareInvitationResponse = UpdateShareInvitationResponse'
  { -- | The updated workload or custom lens share invitation.
    UpdateShareInvitationResponse -> Maybe ShareInvitation
shareInvitation :: Prelude.Maybe ShareInvitation,
    -- | The response's http status code.
    UpdateShareInvitationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateShareInvitationResponse
-> UpdateShareInvitationResponse -> Bool
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]
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
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.
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 or custom lens share invitation.
--
-- 'httpStatus', 'updateShareInvitationResponse_httpStatus' - The response's http status code.
newUpdateShareInvitationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateShareInvitationResponse
newUpdateShareInvitationResponse :: Int -> UpdateShareInvitationResponse
newUpdateShareInvitationResponse Int
pHttpStatus_ =
  UpdateShareInvitationResponse'
    { $sel:shareInvitation:UpdateShareInvitationResponse' :: Maybe ShareInvitation
shareInvitation =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateShareInvitationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The updated workload or custom lens share invitation.
updateShareInvitationResponse_shareInvitation :: Lens.Lens' UpdateShareInvitationResponse (Prelude.Maybe ShareInvitation)
updateShareInvitationResponse_shareInvitation :: Lens' UpdateShareInvitationResponse (Maybe ShareInvitation)
updateShareInvitationResponse_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 :: Lens' UpdateShareInvitationResponse Int
updateShareInvitationResponse_httpStatus = 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 where
  rnf :: UpdateShareInvitationResponse -> ()
rnf UpdateShareInvitationResponse' {Int
Maybe ShareInvitation
httpStatus :: Int
shareInvitation :: Maybe ShareInvitation
$sel:httpStatus:UpdateShareInvitationResponse' :: UpdateShareInvitationResponse -> Int
$sel:shareInvitation:UpdateShareInvitationResponse' :: UpdateShareInvitationResponse -> Maybe ShareInvitation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ShareInvitation
shareInvitation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus