{-# 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.SecurityLake.UpdateDatalakeExceptionsSubscription
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the specified notification subscription in Amazon Security Lake
-- for the organization you specify.
module Amazonka.SecurityLake.UpdateDatalakeExceptionsSubscription
  ( -- * Creating a Request
    UpdateDatalakeExceptionsSubscription (..),
    newUpdateDatalakeExceptionsSubscription,

    -- * Request Lenses
    updateDatalakeExceptionsSubscription_notificationEndpoint,
    updateDatalakeExceptionsSubscription_subscriptionProtocol,

    -- * Destructuring the Response
    UpdateDatalakeExceptionsSubscriptionResponse (..),
    newUpdateDatalakeExceptionsSubscriptionResponse,

    -- * Response Lenses
    updateDatalakeExceptionsSubscriptionResponse_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.SecurityLake.Types

-- | /See:/ 'newUpdateDatalakeExceptionsSubscription' smart constructor.
data UpdateDatalakeExceptionsSubscription = UpdateDatalakeExceptionsSubscription'
  { -- | The account that is subscribed to receive exception notifications.
    UpdateDatalakeExceptionsSubscription -> Text
notificationEndpoint :: Prelude.Text,
    -- | The subscription protocol to which exception messages are posted.
    UpdateDatalakeExceptionsSubscription -> SubscriptionProtocolType
subscriptionProtocol :: SubscriptionProtocolType
  }
  deriving (UpdateDatalakeExceptionsSubscription
-> UpdateDatalakeExceptionsSubscription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDatalakeExceptionsSubscription
-> UpdateDatalakeExceptionsSubscription -> Bool
$c/= :: UpdateDatalakeExceptionsSubscription
-> UpdateDatalakeExceptionsSubscription -> Bool
== :: UpdateDatalakeExceptionsSubscription
-> UpdateDatalakeExceptionsSubscription -> Bool
$c== :: UpdateDatalakeExceptionsSubscription
-> UpdateDatalakeExceptionsSubscription -> Bool
Prelude.Eq, ReadPrec [UpdateDatalakeExceptionsSubscription]
ReadPrec UpdateDatalakeExceptionsSubscription
Int -> ReadS UpdateDatalakeExceptionsSubscription
ReadS [UpdateDatalakeExceptionsSubscription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDatalakeExceptionsSubscription]
$creadListPrec :: ReadPrec [UpdateDatalakeExceptionsSubscription]
readPrec :: ReadPrec UpdateDatalakeExceptionsSubscription
$creadPrec :: ReadPrec UpdateDatalakeExceptionsSubscription
readList :: ReadS [UpdateDatalakeExceptionsSubscription]
$creadList :: ReadS [UpdateDatalakeExceptionsSubscription]
readsPrec :: Int -> ReadS UpdateDatalakeExceptionsSubscription
$creadsPrec :: Int -> ReadS UpdateDatalakeExceptionsSubscription
Prelude.Read, Int -> UpdateDatalakeExceptionsSubscription -> ShowS
[UpdateDatalakeExceptionsSubscription] -> ShowS
UpdateDatalakeExceptionsSubscription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDatalakeExceptionsSubscription] -> ShowS
$cshowList :: [UpdateDatalakeExceptionsSubscription] -> ShowS
show :: UpdateDatalakeExceptionsSubscription -> String
$cshow :: UpdateDatalakeExceptionsSubscription -> String
showsPrec :: Int -> UpdateDatalakeExceptionsSubscription -> ShowS
$cshowsPrec :: Int -> UpdateDatalakeExceptionsSubscription -> ShowS
Prelude.Show, forall x.
Rep UpdateDatalakeExceptionsSubscription x
-> UpdateDatalakeExceptionsSubscription
forall x.
UpdateDatalakeExceptionsSubscription
-> Rep UpdateDatalakeExceptionsSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDatalakeExceptionsSubscription x
-> UpdateDatalakeExceptionsSubscription
$cfrom :: forall x.
UpdateDatalakeExceptionsSubscription
-> Rep UpdateDatalakeExceptionsSubscription x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDatalakeExceptionsSubscription' 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:
--
-- 'notificationEndpoint', 'updateDatalakeExceptionsSubscription_notificationEndpoint' - The account that is subscribed to receive exception notifications.
--
-- 'subscriptionProtocol', 'updateDatalakeExceptionsSubscription_subscriptionProtocol' - The subscription protocol to which exception messages are posted.
newUpdateDatalakeExceptionsSubscription ::
  -- | 'notificationEndpoint'
  Prelude.Text ->
  -- | 'subscriptionProtocol'
  SubscriptionProtocolType ->
  UpdateDatalakeExceptionsSubscription
newUpdateDatalakeExceptionsSubscription :: Text
-> SubscriptionProtocolType -> UpdateDatalakeExceptionsSubscription
newUpdateDatalakeExceptionsSubscription
  Text
pNotificationEndpoint_
  SubscriptionProtocolType
pSubscriptionProtocol_ =
    UpdateDatalakeExceptionsSubscription'
      { $sel:notificationEndpoint:UpdateDatalakeExceptionsSubscription' :: Text
notificationEndpoint =
          Text
pNotificationEndpoint_,
        $sel:subscriptionProtocol:UpdateDatalakeExceptionsSubscription' :: SubscriptionProtocolType
subscriptionProtocol =
          SubscriptionProtocolType
pSubscriptionProtocol_
      }

-- | The account that is subscribed to receive exception notifications.
updateDatalakeExceptionsSubscription_notificationEndpoint :: Lens.Lens' UpdateDatalakeExceptionsSubscription Prelude.Text
updateDatalakeExceptionsSubscription_notificationEndpoint :: Lens' UpdateDatalakeExceptionsSubscription Text
updateDatalakeExceptionsSubscription_notificationEndpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDatalakeExceptionsSubscription' {Text
notificationEndpoint :: Text
$sel:notificationEndpoint:UpdateDatalakeExceptionsSubscription' :: UpdateDatalakeExceptionsSubscription -> Text
notificationEndpoint} -> Text
notificationEndpoint) (\s :: UpdateDatalakeExceptionsSubscription
s@UpdateDatalakeExceptionsSubscription' {} Text
a -> UpdateDatalakeExceptionsSubscription
s {$sel:notificationEndpoint:UpdateDatalakeExceptionsSubscription' :: Text
notificationEndpoint = Text
a} :: UpdateDatalakeExceptionsSubscription)

-- | The subscription protocol to which exception messages are posted.
updateDatalakeExceptionsSubscription_subscriptionProtocol :: Lens.Lens' UpdateDatalakeExceptionsSubscription SubscriptionProtocolType
updateDatalakeExceptionsSubscription_subscriptionProtocol :: Lens' UpdateDatalakeExceptionsSubscription SubscriptionProtocolType
updateDatalakeExceptionsSubscription_subscriptionProtocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDatalakeExceptionsSubscription' {SubscriptionProtocolType
subscriptionProtocol :: SubscriptionProtocolType
$sel:subscriptionProtocol:UpdateDatalakeExceptionsSubscription' :: UpdateDatalakeExceptionsSubscription -> SubscriptionProtocolType
subscriptionProtocol} -> SubscriptionProtocolType
subscriptionProtocol) (\s :: UpdateDatalakeExceptionsSubscription
s@UpdateDatalakeExceptionsSubscription' {} SubscriptionProtocolType
a -> UpdateDatalakeExceptionsSubscription
s {$sel:subscriptionProtocol:UpdateDatalakeExceptionsSubscription' :: SubscriptionProtocolType
subscriptionProtocol = SubscriptionProtocolType
a} :: UpdateDatalakeExceptionsSubscription)

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

instance
  Prelude.NFData
    UpdateDatalakeExceptionsSubscription
  where
  rnf :: UpdateDatalakeExceptionsSubscription -> ()
rnf UpdateDatalakeExceptionsSubscription' {Text
SubscriptionProtocolType
subscriptionProtocol :: SubscriptionProtocolType
notificationEndpoint :: Text
$sel:subscriptionProtocol:UpdateDatalakeExceptionsSubscription' :: UpdateDatalakeExceptionsSubscription -> SubscriptionProtocolType
$sel:notificationEndpoint:UpdateDatalakeExceptionsSubscription' :: UpdateDatalakeExceptionsSubscription -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
notificationEndpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SubscriptionProtocolType
subscriptionProtocol

instance
  Data.ToHeaders
    UpdateDatalakeExceptionsSubscription
  where
  toHeaders :: UpdateDatalakeExceptionsSubscription -> 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
    UpdateDatalakeExceptionsSubscription
  where
  toJSON :: UpdateDatalakeExceptionsSubscription -> Value
toJSON UpdateDatalakeExceptionsSubscription' {Text
SubscriptionProtocolType
subscriptionProtocol :: SubscriptionProtocolType
notificationEndpoint :: Text
$sel:subscriptionProtocol:UpdateDatalakeExceptionsSubscription' :: UpdateDatalakeExceptionsSubscription -> SubscriptionProtocolType
$sel:notificationEndpoint:UpdateDatalakeExceptionsSubscription' :: UpdateDatalakeExceptionsSubscription -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"notificationEndpoint"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
notificationEndpoint
              ),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"subscriptionProtocol"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SubscriptionProtocolType
subscriptionProtocol
              )
          ]
      )

instance
  Data.ToPath
    UpdateDatalakeExceptionsSubscription
  where
  toPath :: UpdateDatalakeExceptionsSubscription -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const
      ByteString
"/v1/datalake/exceptions/subscription"

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

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

-- |
-- Create a value of 'UpdateDatalakeExceptionsSubscriptionResponse' 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', 'updateDatalakeExceptionsSubscriptionResponse_httpStatus' - The response's http status code.
newUpdateDatalakeExceptionsSubscriptionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateDatalakeExceptionsSubscriptionResponse
newUpdateDatalakeExceptionsSubscriptionResponse :: Int -> UpdateDatalakeExceptionsSubscriptionResponse
newUpdateDatalakeExceptionsSubscriptionResponse
  Int
pHttpStatus_ =
    UpdateDatalakeExceptionsSubscriptionResponse'
      { $sel:httpStatus:UpdateDatalakeExceptionsSubscriptionResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

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

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