{-# 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.Shield.DescribeEmergencyContactSettings
-- 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)
--
-- A list of email addresses and phone numbers that the Shield Response
-- Team (SRT) can use to contact you if you have proactive engagement
-- enabled, for escalations to the SRT and to initiate proactive customer
-- support.
module Amazonka.Shield.DescribeEmergencyContactSettings
  ( -- * Creating a Request
    DescribeEmergencyContactSettings (..),
    newDescribeEmergencyContactSettings,

    -- * Destructuring the Response
    DescribeEmergencyContactSettingsResponse (..),
    newDescribeEmergencyContactSettingsResponse,

    -- * Response Lenses
    describeEmergencyContactSettingsResponse_emergencyContactList,
    describeEmergencyContactSettingsResponse_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.Shield.Types

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

-- |
-- Create a value of 'DescribeEmergencyContactSettings' 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.
newDescribeEmergencyContactSettings ::
  DescribeEmergencyContactSettings
newDescribeEmergencyContactSettings :: DescribeEmergencyContactSettings
newDescribeEmergencyContactSettings =
  DescribeEmergencyContactSettings
DescribeEmergencyContactSettings'

instance
  Core.AWSRequest
    DescribeEmergencyContactSettings
  where
  type
    AWSResponse DescribeEmergencyContactSettings =
      DescribeEmergencyContactSettingsResponse
  request :: DescribeEmergencyContactSettings
-> Request DescribeEmergencyContactSettings
request = Service
-> DescribeEmergencyContactSettings
-> Request DescribeEmergencyContactSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeEmergencyContactSettings
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeEmergencyContactSettings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeEmergencyContactSettings))
-> Logger
-> Service
-> Proxy DescribeEmergencyContactSettings
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeEmergencyContactSettings)))
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 [EmergencyContact]
-> Int -> DescribeEmergencyContactSettingsResponse
DescribeEmergencyContactSettingsResponse'
            (Maybe [EmergencyContact]
 -> Int -> DescribeEmergencyContactSettingsResponse)
-> Either String (Maybe [EmergencyContact])
-> Either String (Int -> DescribeEmergencyContactSettingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Key -> Either String (Maybe (Maybe [EmergencyContact]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"EmergencyContactList"
                            Either String (Maybe (Maybe [EmergencyContact]))
-> Maybe [EmergencyContact]
-> Either String (Maybe [EmergencyContact])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EmergencyContact]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> DescribeEmergencyContactSettingsResponse)
-> Either String Int
-> Either String DescribeEmergencyContactSettingsResponse
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
    DescribeEmergencyContactSettings

instance
  Prelude.NFData
    DescribeEmergencyContactSettings

instance
  Core.ToHeaders
    DescribeEmergencyContactSettings
  where
  toHeaders :: DescribeEmergencyContactSettings -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeEmergencyContactSettings -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSShield_20160616.DescribeEmergencyContactSettings" ::
                          Prelude.ByteString
                      ),
            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 DescribeEmergencyContactSettings where
  toJSON :: DescribeEmergencyContactSettings -> Value
toJSON = Value -> DescribeEmergencyContactSettings -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newDescribeEmergencyContactSettingsResponse' smart constructor.
data DescribeEmergencyContactSettingsResponse = DescribeEmergencyContactSettingsResponse'
  { -- | A list of email addresses and phone numbers that the Shield Response
    -- Team (SRT) can use to contact you if you have proactive engagement
    -- enabled, for escalations to the SRT and to initiate proactive customer
    -- support.
    DescribeEmergencyContactSettingsResponse
-> Maybe [EmergencyContact]
emergencyContactList :: Prelude.Maybe [EmergencyContact],
    -- | The response's http status code.
    DescribeEmergencyContactSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeEmergencyContactSettingsResponse
-> DescribeEmergencyContactSettingsResponse -> Bool
(DescribeEmergencyContactSettingsResponse
 -> DescribeEmergencyContactSettingsResponse -> Bool)
-> (DescribeEmergencyContactSettingsResponse
    -> DescribeEmergencyContactSettingsResponse -> Bool)
-> Eq DescribeEmergencyContactSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEmergencyContactSettingsResponse
-> DescribeEmergencyContactSettingsResponse -> Bool
$c/= :: DescribeEmergencyContactSettingsResponse
-> DescribeEmergencyContactSettingsResponse -> Bool
== :: DescribeEmergencyContactSettingsResponse
-> DescribeEmergencyContactSettingsResponse -> Bool
$c== :: DescribeEmergencyContactSettingsResponse
-> DescribeEmergencyContactSettingsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEmergencyContactSettingsResponse]
ReadPrec DescribeEmergencyContactSettingsResponse
Int -> ReadS DescribeEmergencyContactSettingsResponse
ReadS [DescribeEmergencyContactSettingsResponse]
(Int -> ReadS DescribeEmergencyContactSettingsResponse)
-> ReadS [DescribeEmergencyContactSettingsResponse]
-> ReadPrec DescribeEmergencyContactSettingsResponse
-> ReadPrec [DescribeEmergencyContactSettingsResponse]
-> Read DescribeEmergencyContactSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEmergencyContactSettingsResponse]
$creadListPrec :: ReadPrec [DescribeEmergencyContactSettingsResponse]
readPrec :: ReadPrec DescribeEmergencyContactSettingsResponse
$creadPrec :: ReadPrec DescribeEmergencyContactSettingsResponse
readList :: ReadS [DescribeEmergencyContactSettingsResponse]
$creadList :: ReadS [DescribeEmergencyContactSettingsResponse]
readsPrec :: Int -> ReadS DescribeEmergencyContactSettingsResponse
$creadsPrec :: Int -> ReadS DescribeEmergencyContactSettingsResponse
Prelude.Read, Int -> DescribeEmergencyContactSettingsResponse -> ShowS
[DescribeEmergencyContactSettingsResponse] -> ShowS
DescribeEmergencyContactSettingsResponse -> String
(Int -> DescribeEmergencyContactSettingsResponse -> ShowS)
-> (DescribeEmergencyContactSettingsResponse -> String)
-> ([DescribeEmergencyContactSettingsResponse] -> ShowS)
-> Show DescribeEmergencyContactSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEmergencyContactSettingsResponse] -> ShowS
$cshowList :: [DescribeEmergencyContactSettingsResponse] -> ShowS
show :: DescribeEmergencyContactSettingsResponse -> String
$cshow :: DescribeEmergencyContactSettingsResponse -> String
showsPrec :: Int -> DescribeEmergencyContactSettingsResponse -> ShowS
$cshowsPrec :: Int -> DescribeEmergencyContactSettingsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeEmergencyContactSettingsResponse
 -> Rep DescribeEmergencyContactSettingsResponse x)
-> (forall x.
    Rep DescribeEmergencyContactSettingsResponse x
    -> DescribeEmergencyContactSettingsResponse)
-> Generic DescribeEmergencyContactSettingsResponse
forall x.
Rep DescribeEmergencyContactSettingsResponse x
-> DescribeEmergencyContactSettingsResponse
forall x.
DescribeEmergencyContactSettingsResponse
-> Rep DescribeEmergencyContactSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEmergencyContactSettingsResponse x
-> DescribeEmergencyContactSettingsResponse
$cfrom :: forall x.
DescribeEmergencyContactSettingsResponse
-> Rep DescribeEmergencyContactSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEmergencyContactSettingsResponse' 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:
--
-- 'emergencyContactList', 'describeEmergencyContactSettingsResponse_emergencyContactList' - A list of email addresses and phone numbers that the Shield Response
-- Team (SRT) can use to contact you if you have proactive engagement
-- enabled, for escalations to the SRT and to initiate proactive customer
-- support.
--
-- 'httpStatus', 'describeEmergencyContactSettingsResponse_httpStatus' - The response's http status code.
newDescribeEmergencyContactSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEmergencyContactSettingsResponse
newDescribeEmergencyContactSettingsResponse :: Int -> DescribeEmergencyContactSettingsResponse
newDescribeEmergencyContactSettingsResponse
  Int
pHttpStatus_ =
    DescribeEmergencyContactSettingsResponse' :: Maybe [EmergencyContact]
-> Int -> DescribeEmergencyContactSettingsResponse
DescribeEmergencyContactSettingsResponse'
      { $sel:emergencyContactList:DescribeEmergencyContactSettingsResponse' :: Maybe [EmergencyContact]
emergencyContactList =
          Maybe [EmergencyContact]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeEmergencyContactSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A list of email addresses and phone numbers that the Shield Response
-- Team (SRT) can use to contact you if you have proactive engagement
-- enabled, for escalations to the SRT and to initiate proactive customer
-- support.
describeEmergencyContactSettingsResponse_emergencyContactList :: Lens.Lens' DescribeEmergencyContactSettingsResponse (Prelude.Maybe [EmergencyContact])
describeEmergencyContactSettingsResponse_emergencyContactList :: (Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
-> DescribeEmergencyContactSettingsResponse
-> f DescribeEmergencyContactSettingsResponse
describeEmergencyContactSettingsResponse_emergencyContactList = (DescribeEmergencyContactSettingsResponse
 -> Maybe [EmergencyContact])
-> (DescribeEmergencyContactSettingsResponse
    -> Maybe [EmergencyContact]
    -> DescribeEmergencyContactSettingsResponse)
-> Lens
     DescribeEmergencyContactSettingsResponse
     DescribeEmergencyContactSettingsResponse
     (Maybe [EmergencyContact])
     (Maybe [EmergencyContact])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEmergencyContactSettingsResponse' {Maybe [EmergencyContact]
emergencyContactList :: Maybe [EmergencyContact]
$sel:emergencyContactList:DescribeEmergencyContactSettingsResponse' :: DescribeEmergencyContactSettingsResponse
-> Maybe [EmergencyContact]
emergencyContactList} -> Maybe [EmergencyContact]
emergencyContactList) (\s :: DescribeEmergencyContactSettingsResponse
s@DescribeEmergencyContactSettingsResponse' {} Maybe [EmergencyContact]
a -> DescribeEmergencyContactSettingsResponse
s {$sel:emergencyContactList:DescribeEmergencyContactSettingsResponse' :: Maybe [EmergencyContact]
emergencyContactList = Maybe [EmergencyContact]
a} :: DescribeEmergencyContactSettingsResponse) ((Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
 -> DescribeEmergencyContactSettingsResponse
 -> f DescribeEmergencyContactSettingsResponse)
-> ((Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
    -> Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
-> (Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
-> DescribeEmergencyContactSettingsResponse
-> f DescribeEmergencyContactSettingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EmergencyContact]
  [EmergencyContact]
  [EmergencyContact]
  [EmergencyContact]
-> Iso
     (Maybe [EmergencyContact])
     (Maybe [EmergencyContact])
     (Maybe [EmergencyContact])
     (Maybe [EmergencyContact])
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 AnIso
  [EmergencyContact]
  [EmergencyContact]
  [EmergencyContact]
  [EmergencyContact]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeEmergencyContactSettingsResponse