{-# 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.UpdateEmergencyContactSettings
-- 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)
--
-- Updates the details of the 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.UpdateEmergencyContactSettings
  ( -- * Creating a Request
    UpdateEmergencyContactSettings (..),
    newUpdateEmergencyContactSettings,

    -- * Request Lenses
    updateEmergencyContactSettings_emergencyContactList,

    -- * Destructuring the Response
    UpdateEmergencyContactSettingsResponse (..),
    newUpdateEmergencyContactSettingsResponse,

    -- * Response Lenses
    updateEmergencyContactSettingsResponse_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:/ 'newUpdateEmergencyContactSettings' smart constructor.
data UpdateEmergencyContactSettings = UpdateEmergencyContactSettings'
  { -- | 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.
    --
    -- If you have proactive engagement enabled, the contact list must include
    -- at least one phone number.
    UpdateEmergencyContactSettings -> Maybe [EmergencyContact]
emergencyContactList :: Prelude.Maybe [EmergencyContact]
  }
  deriving (UpdateEmergencyContactSettings
-> UpdateEmergencyContactSettings -> Bool
(UpdateEmergencyContactSettings
 -> UpdateEmergencyContactSettings -> Bool)
-> (UpdateEmergencyContactSettings
    -> UpdateEmergencyContactSettings -> Bool)
-> Eq UpdateEmergencyContactSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEmergencyContactSettings
-> UpdateEmergencyContactSettings -> Bool
$c/= :: UpdateEmergencyContactSettings
-> UpdateEmergencyContactSettings -> Bool
== :: UpdateEmergencyContactSettings
-> UpdateEmergencyContactSettings -> Bool
$c== :: UpdateEmergencyContactSettings
-> UpdateEmergencyContactSettings -> Bool
Prelude.Eq, ReadPrec [UpdateEmergencyContactSettings]
ReadPrec UpdateEmergencyContactSettings
Int -> ReadS UpdateEmergencyContactSettings
ReadS [UpdateEmergencyContactSettings]
(Int -> ReadS UpdateEmergencyContactSettings)
-> ReadS [UpdateEmergencyContactSettings]
-> ReadPrec UpdateEmergencyContactSettings
-> ReadPrec [UpdateEmergencyContactSettings]
-> Read UpdateEmergencyContactSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEmergencyContactSettings]
$creadListPrec :: ReadPrec [UpdateEmergencyContactSettings]
readPrec :: ReadPrec UpdateEmergencyContactSettings
$creadPrec :: ReadPrec UpdateEmergencyContactSettings
readList :: ReadS [UpdateEmergencyContactSettings]
$creadList :: ReadS [UpdateEmergencyContactSettings]
readsPrec :: Int -> ReadS UpdateEmergencyContactSettings
$creadsPrec :: Int -> ReadS UpdateEmergencyContactSettings
Prelude.Read, Int -> UpdateEmergencyContactSettings -> ShowS
[UpdateEmergencyContactSettings] -> ShowS
UpdateEmergencyContactSettings -> String
(Int -> UpdateEmergencyContactSettings -> ShowS)
-> (UpdateEmergencyContactSettings -> String)
-> ([UpdateEmergencyContactSettings] -> ShowS)
-> Show UpdateEmergencyContactSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEmergencyContactSettings] -> ShowS
$cshowList :: [UpdateEmergencyContactSettings] -> ShowS
show :: UpdateEmergencyContactSettings -> String
$cshow :: UpdateEmergencyContactSettings -> String
showsPrec :: Int -> UpdateEmergencyContactSettings -> ShowS
$cshowsPrec :: Int -> UpdateEmergencyContactSettings -> ShowS
Prelude.Show, (forall x.
 UpdateEmergencyContactSettings
 -> Rep UpdateEmergencyContactSettings x)
-> (forall x.
    Rep UpdateEmergencyContactSettings x
    -> UpdateEmergencyContactSettings)
-> Generic UpdateEmergencyContactSettings
forall x.
Rep UpdateEmergencyContactSettings x
-> UpdateEmergencyContactSettings
forall x.
UpdateEmergencyContactSettings
-> Rep UpdateEmergencyContactSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateEmergencyContactSettings x
-> UpdateEmergencyContactSettings
$cfrom :: forall x.
UpdateEmergencyContactSettings
-> Rep UpdateEmergencyContactSettings x
Prelude.Generic)

-- |
-- Create a value of 'UpdateEmergencyContactSettings' 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', 'updateEmergencyContactSettings_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.
--
-- If you have proactive engagement enabled, the contact list must include
-- at least one phone number.
newUpdateEmergencyContactSettings ::
  UpdateEmergencyContactSettings
newUpdateEmergencyContactSettings :: UpdateEmergencyContactSettings
newUpdateEmergencyContactSettings =
  UpdateEmergencyContactSettings' :: Maybe [EmergencyContact] -> UpdateEmergencyContactSettings
UpdateEmergencyContactSettings'
    { $sel:emergencyContactList:UpdateEmergencyContactSettings' :: Maybe [EmergencyContact]
emergencyContactList =
        Maybe [EmergencyContact]
forall a. Maybe a
Prelude.Nothing
    }

-- | 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.
--
-- If you have proactive engagement enabled, the contact list must include
-- at least one phone number.
updateEmergencyContactSettings_emergencyContactList :: Lens.Lens' UpdateEmergencyContactSettings (Prelude.Maybe [EmergencyContact])
updateEmergencyContactSettings_emergencyContactList :: (Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
-> UpdateEmergencyContactSettings
-> f UpdateEmergencyContactSettings
updateEmergencyContactSettings_emergencyContactList = (UpdateEmergencyContactSettings -> Maybe [EmergencyContact])
-> (UpdateEmergencyContactSettings
    -> Maybe [EmergencyContact] -> UpdateEmergencyContactSettings)
-> Lens
     UpdateEmergencyContactSettings
     UpdateEmergencyContactSettings
     (Maybe [EmergencyContact])
     (Maybe [EmergencyContact])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEmergencyContactSettings' {Maybe [EmergencyContact]
emergencyContactList :: Maybe [EmergencyContact]
$sel:emergencyContactList:UpdateEmergencyContactSettings' :: UpdateEmergencyContactSettings -> Maybe [EmergencyContact]
emergencyContactList} -> Maybe [EmergencyContact]
emergencyContactList) (\s :: UpdateEmergencyContactSettings
s@UpdateEmergencyContactSettings' {} Maybe [EmergencyContact]
a -> UpdateEmergencyContactSettings
s {$sel:emergencyContactList:UpdateEmergencyContactSettings' :: Maybe [EmergencyContact]
emergencyContactList = Maybe [EmergencyContact]
a} :: UpdateEmergencyContactSettings) ((Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
 -> UpdateEmergencyContactSettings
 -> f UpdateEmergencyContactSettings)
-> ((Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
    -> Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
-> (Maybe [EmergencyContact] -> f (Maybe [EmergencyContact]))
-> UpdateEmergencyContactSettings
-> f UpdateEmergencyContactSettings
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

instance
  Core.AWSRequest
    UpdateEmergencyContactSettings
  where
  type
    AWSResponse UpdateEmergencyContactSettings =
      UpdateEmergencyContactSettingsResponse
  request :: UpdateEmergencyContactSettings
-> Request UpdateEmergencyContactSettings
request = Service
-> UpdateEmergencyContactSettings
-> Request UpdateEmergencyContactSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateEmergencyContactSettings
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse UpdateEmergencyContactSettings)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateEmergencyContactSettings))
-> Logger
-> Service
-> Proxy UpdateEmergencyContactSettings
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse UpdateEmergencyContactSettings)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateEmergencyContactSettingsResponse
UpdateEmergencyContactSettingsResponse'
            (Int -> UpdateEmergencyContactSettingsResponse)
-> Either String Int
-> Either String UpdateEmergencyContactSettingsResponse
forall (f :: * -> *) a b. Functor 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
    UpdateEmergencyContactSettings

instance
  Prelude.NFData
    UpdateEmergencyContactSettings

instance
  Core.ToHeaders
    UpdateEmergencyContactSettings
  where
  toHeaders :: UpdateEmergencyContactSettings -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> UpdateEmergencyContactSettings -> 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.UpdateEmergencyContactSettings" ::
                          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 UpdateEmergencyContactSettings where
  toJSON :: UpdateEmergencyContactSettings -> Value
toJSON UpdateEmergencyContactSettings' {Maybe [EmergencyContact]
emergencyContactList :: Maybe [EmergencyContact]
$sel:emergencyContactList:UpdateEmergencyContactSettings' :: UpdateEmergencyContactSettings -> Maybe [EmergencyContact]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EmergencyContactList" Text -> [EmergencyContact] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([EmergencyContact] -> Pair)
-> Maybe [EmergencyContact] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EmergencyContact]
emergencyContactList
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    UpdateEmergencyContactSettingsResponse