{-# 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.SmsVoice.GetConfigurationSetEventDestinations
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Obtain information about an event destination, including the types of
-- events it reports, the Amazon Resource Name (ARN) of the destination,
-- and the name of the event destination.
module Amazonka.SmsVoice.GetConfigurationSetEventDestinations
  ( -- * Creating a Request
    GetConfigurationSetEventDestinations (..),
    newGetConfigurationSetEventDestinations,

    -- * Request Lenses
    getConfigurationSetEventDestinations_configurationSetName,

    -- * Destructuring the Response
    GetConfigurationSetEventDestinationsResponse (..),
    newGetConfigurationSetEventDestinationsResponse,

    -- * Response Lenses
    getConfigurationSetEventDestinationsResponse_eventDestinations,
    getConfigurationSetEventDestinationsResponse_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.SmsVoice.Types

-- | /See:/ 'newGetConfigurationSetEventDestinations' smart constructor.
data GetConfigurationSetEventDestinations = GetConfigurationSetEventDestinations'
  { -- | ConfigurationSetName
    GetConfigurationSetEventDestinations -> Text
configurationSetName :: Prelude.Text
  }
  deriving (GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
$c/= :: GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
== :: GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
$c== :: GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
Prelude.Eq, ReadPrec [GetConfigurationSetEventDestinations]
ReadPrec GetConfigurationSetEventDestinations
Int -> ReadS GetConfigurationSetEventDestinations
ReadS [GetConfigurationSetEventDestinations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConfigurationSetEventDestinations]
$creadListPrec :: ReadPrec [GetConfigurationSetEventDestinations]
readPrec :: ReadPrec GetConfigurationSetEventDestinations
$creadPrec :: ReadPrec GetConfigurationSetEventDestinations
readList :: ReadS [GetConfigurationSetEventDestinations]
$creadList :: ReadS [GetConfigurationSetEventDestinations]
readsPrec :: Int -> ReadS GetConfigurationSetEventDestinations
$creadsPrec :: Int -> ReadS GetConfigurationSetEventDestinations
Prelude.Read, Int -> GetConfigurationSetEventDestinations -> ShowS
[GetConfigurationSetEventDestinations] -> ShowS
GetConfigurationSetEventDestinations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConfigurationSetEventDestinations] -> ShowS
$cshowList :: [GetConfigurationSetEventDestinations] -> ShowS
show :: GetConfigurationSetEventDestinations -> String
$cshow :: GetConfigurationSetEventDestinations -> String
showsPrec :: Int -> GetConfigurationSetEventDestinations -> ShowS
$cshowsPrec :: Int -> GetConfigurationSetEventDestinations -> ShowS
Prelude.Show, forall x.
Rep GetConfigurationSetEventDestinations x
-> GetConfigurationSetEventDestinations
forall x.
GetConfigurationSetEventDestinations
-> Rep GetConfigurationSetEventDestinations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConfigurationSetEventDestinations x
-> GetConfigurationSetEventDestinations
$cfrom :: forall x.
GetConfigurationSetEventDestinations
-> Rep GetConfigurationSetEventDestinations x
Prelude.Generic)

-- |
-- Create a value of 'GetConfigurationSetEventDestinations' 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:
--
-- 'configurationSetName', 'getConfigurationSetEventDestinations_configurationSetName' - ConfigurationSetName
newGetConfigurationSetEventDestinations ::
  -- | 'configurationSetName'
  Prelude.Text ->
  GetConfigurationSetEventDestinations
newGetConfigurationSetEventDestinations :: Text -> GetConfigurationSetEventDestinations
newGetConfigurationSetEventDestinations
  Text
pConfigurationSetName_ =
    GetConfigurationSetEventDestinations'
      { $sel:configurationSetName:GetConfigurationSetEventDestinations' :: Text
configurationSetName =
          Text
pConfigurationSetName_
      }

-- | ConfigurationSetName
getConfigurationSetEventDestinations_configurationSetName :: Lens.Lens' GetConfigurationSetEventDestinations Prelude.Text
getConfigurationSetEventDestinations_configurationSetName :: Lens' GetConfigurationSetEventDestinations Text
getConfigurationSetEventDestinations_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfigurationSetEventDestinations' {Text
configurationSetName :: Text
$sel:configurationSetName:GetConfigurationSetEventDestinations' :: GetConfigurationSetEventDestinations -> Text
configurationSetName} -> Text
configurationSetName) (\s :: GetConfigurationSetEventDestinations
s@GetConfigurationSetEventDestinations' {} Text
a -> GetConfigurationSetEventDestinations
s {$sel:configurationSetName:GetConfigurationSetEventDestinations' :: Text
configurationSetName = Text
a} :: GetConfigurationSetEventDestinations)

instance
  Core.AWSRequest
    GetConfigurationSetEventDestinations
  where
  type
    AWSResponse GetConfigurationSetEventDestinations =
      GetConfigurationSetEventDestinationsResponse
  request :: (Service -> Service)
-> GetConfigurationSetEventDestinations
-> Request GetConfigurationSetEventDestinations
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetConfigurationSetEventDestinations
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetConfigurationSetEventDestinations)))
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 [EventDestination]
-> Int -> GetConfigurationSetEventDestinationsResponse
GetConfigurationSetEventDestinationsResponse'
            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
"EventDestinations"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            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
    GetConfigurationSetEventDestinations
  where
  hashWithSalt :: Int -> GetConfigurationSetEventDestinations -> Int
hashWithSalt
    Int
_salt
    GetConfigurationSetEventDestinations' {Text
configurationSetName :: Text
$sel:configurationSetName:GetConfigurationSetEventDestinations' :: GetConfigurationSetEventDestinations -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configurationSetName

instance
  Prelude.NFData
    GetConfigurationSetEventDestinations
  where
  rnf :: GetConfigurationSetEventDestinations -> ()
rnf GetConfigurationSetEventDestinations' {Text
configurationSetName :: Text
$sel:configurationSetName:GetConfigurationSetEventDestinations' :: GetConfigurationSetEventDestinations -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
configurationSetName

instance
  Data.ToHeaders
    GetConfigurationSetEventDestinations
  where
  toHeaders :: GetConfigurationSetEventDestinations -> 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.ToPath
    GetConfigurationSetEventDestinations
  where
  toPath :: GetConfigurationSetEventDestinations -> ByteString
toPath GetConfigurationSetEventDestinations' {Text
configurationSetName :: Text
$sel:configurationSetName:GetConfigurationSetEventDestinations' :: GetConfigurationSetEventDestinations -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/sms-voice/configuration-sets/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
configurationSetName,
        ByteString
"/event-destinations"
      ]

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

-- | An object that contains information about an event destination.
--
-- /See:/ 'newGetConfigurationSetEventDestinationsResponse' smart constructor.
data GetConfigurationSetEventDestinationsResponse = GetConfigurationSetEventDestinationsResponse'
  { GetConfigurationSetEventDestinationsResponse
-> Maybe [EventDestination]
eventDestinations :: Prelude.Maybe [EventDestination],
    -- | The response's http status code.
    GetConfigurationSetEventDestinationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
$c/= :: GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
== :: GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
$c== :: GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
Prelude.Eq, ReadPrec [GetConfigurationSetEventDestinationsResponse]
ReadPrec GetConfigurationSetEventDestinationsResponse
Int -> ReadS GetConfigurationSetEventDestinationsResponse
ReadS [GetConfigurationSetEventDestinationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConfigurationSetEventDestinationsResponse]
$creadListPrec :: ReadPrec [GetConfigurationSetEventDestinationsResponse]
readPrec :: ReadPrec GetConfigurationSetEventDestinationsResponse
$creadPrec :: ReadPrec GetConfigurationSetEventDestinationsResponse
readList :: ReadS [GetConfigurationSetEventDestinationsResponse]
$creadList :: ReadS [GetConfigurationSetEventDestinationsResponse]
readsPrec :: Int -> ReadS GetConfigurationSetEventDestinationsResponse
$creadsPrec :: Int -> ReadS GetConfigurationSetEventDestinationsResponse
Prelude.Read, Int -> GetConfigurationSetEventDestinationsResponse -> ShowS
[GetConfigurationSetEventDestinationsResponse] -> ShowS
GetConfigurationSetEventDestinationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConfigurationSetEventDestinationsResponse] -> ShowS
$cshowList :: [GetConfigurationSetEventDestinationsResponse] -> ShowS
show :: GetConfigurationSetEventDestinationsResponse -> String
$cshow :: GetConfigurationSetEventDestinationsResponse -> String
showsPrec :: Int -> GetConfigurationSetEventDestinationsResponse -> ShowS
$cshowsPrec :: Int -> GetConfigurationSetEventDestinationsResponse -> ShowS
Prelude.Show, forall x.
Rep GetConfigurationSetEventDestinationsResponse x
-> GetConfigurationSetEventDestinationsResponse
forall x.
GetConfigurationSetEventDestinationsResponse
-> Rep GetConfigurationSetEventDestinationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConfigurationSetEventDestinationsResponse x
-> GetConfigurationSetEventDestinationsResponse
$cfrom :: forall x.
GetConfigurationSetEventDestinationsResponse
-> Rep GetConfigurationSetEventDestinationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetConfigurationSetEventDestinationsResponse' 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:
--
-- 'eventDestinations', 'getConfigurationSetEventDestinationsResponse_eventDestinations' - Undocumented member.
--
-- 'httpStatus', 'getConfigurationSetEventDestinationsResponse_httpStatus' - The response's http status code.
newGetConfigurationSetEventDestinationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetConfigurationSetEventDestinationsResponse
newGetConfigurationSetEventDestinationsResponse :: Int -> GetConfigurationSetEventDestinationsResponse
newGetConfigurationSetEventDestinationsResponse
  Int
pHttpStatus_ =
    GetConfigurationSetEventDestinationsResponse'
      { $sel:eventDestinations:GetConfigurationSetEventDestinationsResponse' :: Maybe [EventDestination]
eventDestinations =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetConfigurationSetEventDestinationsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Undocumented member.
getConfigurationSetEventDestinationsResponse_eventDestinations :: Lens.Lens' GetConfigurationSetEventDestinationsResponse (Prelude.Maybe [EventDestination])
getConfigurationSetEventDestinationsResponse_eventDestinations :: Lens'
  GetConfigurationSetEventDestinationsResponse
  (Maybe [EventDestination])
getConfigurationSetEventDestinationsResponse_eventDestinations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfigurationSetEventDestinationsResponse' {Maybe [EventDestination]
eventDestinations :: Maybe [EventDestination]
$sel:eventDestinations:GetConfigurationSetEventDestinationsResponse' :: GetConfigurationSetEventDestinationsResponse
-> Maybe [EventDestination]
eventDestinations} -> Maybe [EventDestination]
eventDestinations) (\s :: GetConfigurationSetEventDestinationsResponse
s@GetConfigurationSetEventDestinationsResponse' {} Maybe [EventDestination]
a -> GetConfigurationSetEventDestinationsResponse
s {$sel:eventDestinations:GetConfigurationSetEventDestinationsResponse' :: Maybe [EventDestination]
eventDestinations = Maybe [EventDestination]
a} :: GetConfigurationSetEventDestinationsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetConfigurationSetEventDestinationsResponse
  where
  rnf :: GetConfigurationSetEventDestinationsResponse -> ()
rnf GetConfigurationSetEventDestinationsResponse' {Int
Maybe [EventDestination]
httpStatus :: Int
eventDestinations :: Maybe [EventDestination]
$sel:httpStatus:GetConfigurationSetEventDestinationsResponse' :: GetConfigurationSetEventDestinationsResponse -> Int
$sel:eventDestinations:GetConfigurationSetEventDestinationsResponse' :: GetConfigurationSetEventDestinationsResponse
-> Maybe [EventDestination]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [EventDestination]
eventDestinations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus