{-# 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.SES.GetIdentityNotificationAttributes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Given a list of verified identities (email addresses and\/or domains),
-- returns a structure describing identity notification attributes.
--
-- This operation is throttled at one request per second and can only get
-- notification attributes for up to 100 identities at a time.
--
-- For more information about using notifications with Amazon SES, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notifications.html Amazon SES Developer Guide>.
module Amazonka.SES.GetIdentityNotificationAttributes
  ( -- * Creating a Request
    GetIdentityNotificationAttributes (..),
    newGetIdentityNotificationAttributes,

    -- * Request Lenses
    getIdentityNotificationAttributes_identities,

    -- * Destructuring the Response
    GetIdentityNotificationAttributesResponse (..),
    newGetIdentityNotificationAttributesResponse,

    -- * Response Lenses
    getIdentityNotificationAttributesResponse_httpStatus,
    getIdentityNotificationAttributesResponse_notificationAttributes,
  )
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.SES.Types

-- | Represents a request to return the notification attributes for a list of
-- identities you verified with Amazon SES. For information about Amazon
-- SES notifications, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notifications.html Amazon SES Developer Guide>.
--
-- /See:/ 'newGetIdentityNotificationAttributes' smart constructor.
data GetIdentityNotificationAttributes = GetIdentityNotificationAttributes'
  { -- | A list of one or more identities. You can specify an identity by using
    -- its name or by using its Amazon Resource Name (ARN). Examples:
    -- @user\@example.com@, @example.com@,
    -- @arn:aws:ses:us-east-1:123456789012:identity\/example.com@.
    GetIdentityNotificationAttributes -> [Text]
identities :: [Prelude.Text]
  }
  deriving (GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
$c/= :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
== :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
$c== :: GetIdentityNotificationAttributes
-> GetIdentityNotificationAttributes -> Bool
Prelude.Eq, ReadPrec [GetIdentityNotificationAttributes]
ReadPrec GetIdentityNotificationAttributes
Int -> ReadS GetIdentityNotificationAttributes
ReadS [GetIdentityNotificationAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIdentityNotificationAttributes]
$creadListPrec :: ReadPrec [GetIdentityNotificationAttributes]
readPrec :: ReadPrec GetIdentityNotificationAttributes
$creadPrec :: ReadPrec GetIdentityNotificationAttributes
readList :: ReadS [GetIdentityNotificationAttributes]
$creadList :: ReadS [GetIdentityNotificationAttributes]
readsPrec :: Int -> ReadS GetIdentityNotificationAttributes
$creadsPrec :: Int -> ReadS GetIdentityNotificationAttributes
Prelude.Read, Int -> GetIdentityNotificationAttributes -> ShowS
[GetIdentityNotificationAttributes] -> ShowS
GetIdentityNotificationAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIdentityNotificationAttributes] -> ShowS
$cshowList :: [GetIdentityNotificationAttributes] -> ShowS
show :: GetIdentityNotificationAttributes -> String
$cshow :: GetIdentityNotificationAttributes -> String
showsPrec :: Int -> GetIdentityNotificationAttributes -> ShowS
$cshowsPrec :: Int -> GetIdentityNotificationAttributes -> ShowS
Prelude.Show, forall x.
Rep GetIdentityNotificationAttributes x
-> GetIdentityNotificationAttributes
forall x.
GetIdentityNotificationAttributes
-> Rep GetIdentityNotificationAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetIdentityNotificationAttributes x
-> GetIdentityNotificationAttributes
$cfrom :: forall x.
GetIdentityNotificationAttributes
-> Rep GetIdentityNotificationAttributes x
Prelude.Generic)

-- |
-- Create a value of 'GetIdentityNotificationAttributes' 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:
--
-- 'identities', 'getIdentityNotificationAttributes_identities' - A list of one or more identities. You can specify an identity by using
-- its name or by using its Amazon Resource Name (ARN). Examples:
-- @user\@example.com@, @example.com@,
-- @arn:aws:ses:us-east-1:123456789012:identity\/example.com@.
newGetIdentityNotificationAttributes ::
  GetIdentityNotificationAttributes
newGetIdentityNotificationAttributes :: GetIdentityNotificationAttributes
newGetIdentityNotificationAttributes =
  GetIdentityNotificationAttributes'
    { $sel:identities:GetIdentityNotificationAttributes' :: [Text]
identities =
        forall a. Monoid a => a
Prelude.mempty
    }

-- | A list of one or more identities. You can specify an identity by using
-- its name or by using its Amazon Resource Name (ARN). Examples:
-- @user\@example.com@, @example.com@,
-- @arn:aws:ses:us-east-1:123456789012:identity\/example.com@.
getIdentityNotificationAttributes_identities :: Lens.Lens' GetIdentityNotificationAttributes [Prelude.Text]
getIdentityNotificationAttributes_identities :: Lens' GetIdentityNotificationAttributes [Text]
getIdentityNotificationAttributes_identities = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIdentityNotificationAttributes' {[Text]
identities :: [Text]
$sel:identities:GetIdentityNotificationAttributes' :: GetIdentityNotificationAttributes -> [Text]
identities} -> [Text]
identities) (\s :: GetIdentityNotificationAttributes
s@GetIdentityNotificationAttributes' {} [Text]
a -> GetIdentityNotificationAttributes
s {$sel:identities:GetIdentityNotificationAttributes' :: [Text]
identities = [Text]
a} :: GetIdentityNotificationAttributes) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.AWSRequest
    GetIdentityNotificationAttributes
  where
  type
    AWSResponse GetIdentityNotificationAttributes =
      GetIdentityNotificationAttributesResponse
  request :: (Service -> Service)
-> GetIdentityNotificationAttributes
-> Request GetIdentityNotificationAttributes
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetIdentityNotificationAttributes
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetIdentityNotificationAttributes)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"GetIdentityNotificationAttributesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int
-> HashMap Text IdentityNotificationAttributes
-> GetIdentityNotificationAttributesResponse
GetIdentityNotificationAttributesResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NotificationAttributes"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall k v.
(Eq k, Hashable k, FromText k, FromXML v) =>
Text -> Text -> Text -> [Node] -> Either String (HashMap k v)
Data.parseXMLMap Text
"entry" Text
"key" Text
"value"
                        )
      )

instance
  Prelude.Hashable
    GetIdentityNotificationAttributes
  where
  hashWithSalt :: Int -> GetIdentityNotificationAttributes -> Int
hashWithSalt
    Int
_salt
    GetIdentityNotificationAttributes' {[Text]
identities :: [Text]
$sel:identities:GetIdentityNotificationAttributes' :: GetIdentityNotificationAttributes -> [Text]
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
identities

instance
  Prelude.NFData
    GetIdentityNotificationAttributes
  where
  rnf :: GetIdentityNotificationAttributes -> ()
rnf GetIdentityNotificationAttributes' {[Text]
identities :: [Text]
$sel:identities:GetIdentityNotificationAttributes' :: GetIdentityNotificationAttributes -> [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [Text]
identities

instance
  Data.ToHeaders
    GetIdentityNotificationAttributes
  where
  toHeaders :: GetIdentityNotificationAttributes -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance
  Data.ToPath
    GetIdentityNotificationAttributes
  where
  toPath :: GetIdentityNotificationAttributes -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Data.ToQuery
    GetIdentityNotificationAttributes
  where
  toQuery :: GetIdentityNotificationAttributes -> QueryString
toQuery GetIdentityNotificationAttributes' {[Text]
identities :: [Text]
$sel:identities:GetIdentityNotificationAttributes' :: GetIdentityNotificationAttributes -> [Text]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"GetIdentityNotificationAttributes" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"Identities"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" [Text]
identities
      ]

-- | Represents the notification attributes for a list of identities.
--
-- /See:/ 'newGetIdentityNotificationAttributesResponse' smart constructor.
data GetIdentityNotificationAttributesResponse = GetIdentityNotificationAttributesResponse'
  { -- | The response's http status code.
    GetIdentityNotificationAttributesResponse -> Int
httpStatus :: Prelude.Int,
    -- | A map of Identity to IdentityNotificationAttributes.
    GetIdentityNotificationAttributesResponse
-> HashMap Text IdentityNotificationAttributes
notificationAttributes :: Prelude.HashMap Prelude.Text IdentityNotificationAttributes
  }
  deriving (GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
$c/= :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
== :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
$c== :: GetIdentityNotificationAttributesResponse
-> GetIdentityNotificationAttributesResponse -> Bool
Prelude.Eq, ReadPrec [GetIdentityNotificationAttributesResponse]
ReadPrec GetIdentityNotificationAttributesResponse
Int -> ReadS GetIdentityNotificationAttributesResponse
ReadS [GetIdentityNotificationAttributesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIdentityNotificationAttributesResponse]
$creadListPrec :: ReadPrec [GetIdentityNotificationAttributesResponse]
readPrec :: ReadPrec GetIdentityNotificationAttributesResponse
$creadPrec :: ReadPrec GetIdentityNotificationAttributesResponse
readList :: ReadS [GetIdentityNotificationAttributesResponse]
$creadList :: ReadS [GetIdentityNotificationAttributesResponse]
readsPrec :: Int -> ReadS GetIdentityNotificationAttributesResponse
$creadsPrec :: Int -> ReadS GetIdentityNotificationAttributesResponse
Prelude.Read, Int -> GetIdentityNotificationAttributesResponse -> ShowS
[GetIdentityNotificationAttributesResponse] -> ShowS
GetIdentityNotificationAttributesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIdentityNotificationAttributesResponse] -> ShowS
$cshowList :: [GetIdentityNotificationAttributesResponse] -> ShowS
show :: GetIdentityNotificationAttributesResponse -> String
$cshow :: GetIdentityNotificationAttributesResponse -> String
showsPrec :: Int -> GetIdentityNotificationAttributesResponse -> ShowS
$cshowsPrec :: Int -> GetIdentityNotificationAttributesResponse -> ShowS
Prelude.Show, forall x.
Rep GetIdentityNotificationAttributesResponse x
-> GetIdentityNotificationAttributesResponse
forall x.
GetIdentityNotificationAttributesResponse
-> Rep GetIdentityNotificationAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetIdentityNotificationAttributesResponse x
-> GetIdentityNotificationAttributesResponse
$cfrom :: forall x.
GetIdentityNotificationAttributesResponse
-> Rep GetIdentityNotificationAttributesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetIdentityNotificationAttributesResponse' 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', 'getIdentityNotificationAttributesResponse_httpStatus' - The response's http status code.
--
-- 'notificationAttributes', 'getIdentityNotificationAttributesResponse_notificationAttributes' - A map of Identity to IdentityNotificationAttributes.
newGetIdentityNotificationAttributesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetIdentityNotificationAttributesResponse
newGetIdentityNotificationAttributesResponse :: Int -> GetIdentityNotificationAttributesResponse
newGetIdentityNotificationAttributesResponse
  Int
pHttpStatus_ =
    GetIdentityNotificationAttributesResponse'
      { $sel:httpStatus:GetIdentityNotificationAttributesResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:notificationAttributes:GetIdentityNotificationAttributesResponse' :: HashMap Text IdentityNotificationAttributes
notificationAttributes =
          forall a. Monoid a => a
Prelude.mempty
      }

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

-- | A map of Identity to IdentityNotificationAttributes.
getIdentityNotificationAttributesResponse_notificationAttributes :: Lens.Lens' GetIdentityNotificationAttributesResponse (Prelude.HashMap Prelude.Text IdentityNotificationAttributes)
getIdentityNotificationAttributesResponse_notificationAttributes :: Lens'
  GetIdentityNotificationAttributesResponse
  (HashMap Text IdentityNotificationAttributes)
getIdentityNotificationAttributesResponse_notificationAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIdentityNotificationAttributesResponse' {HashMap Text IdentityNotificationAttributes
notificationAttributes :: HashMap Text IdentityNotificationAttributes
$sel:notificationAttributes:GetIdentityNotificationAttributesResponse' :: GetIdentityNotificationAttributesResponse
-> HashMap Text IdentityNotificationAttributes
notificationAttributes} -> HashMap Text IdentityNotificationAttributes
notificationAttributes) (\s :: GetIdentityNotificationAttributesResponse
s@GetIdentityNotificationAttributesResponse' {} HashMap Text IdentityNotificationAttributes
a -> GetIdentityNotificationAttributesResponse
s {$sel:notificationAttributes:GetIdentityNotificationAttributesResponse' :: HashMap Text IdentityNotificationAttributes
notificationAttributes = HashMap Text IdentityNotificationAttributes
a} :: GetIdentityNotificationAttributesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    GetIdentityNotificationAttributesResponse
  where
  rnf :: GetIdentityNotificationAttributesResponse -> ()
rnf GetIdentityNotificationAttributesResponse' {Int
HashMap Text IdentityNotificationAttributes
notificationAttributes :: HashMap Text IdentityNotificationAttributes
httpStatus :: Int
$sel:notificationAttributes:GetIdentityNotificationAttributesResponse' :: GetIdentityNotificationAttributesResponse
-> HashMap Text IdentityNotificationAttributes
$sel:httpStatus:GetIdentityNotificationAttributesResponse' :: GetIdentityNotificationAttributesResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text IdentityNotificationAttributes
notificationAttributes