{-# 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.CostExplorer.UpdateAnomalySubscription
-- 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 an existing cost anomaly monitor subscription.
module Amazonka.CostExplorer.UpdateAnomalySubscription
  ( -- * Creating a Request
    UpdateAnomalySubscription (..),
    newUpdateAnomalySubscription,

    -- * Request Lenses
    updateAnomalySubscription_subscriptionName,
    updateAnomalySubscription_frequency,
    updateAnomalySubscription_threshold,
    updateAnomalySubscription_monitorArnList,
    updateAnomalySubscription_subscribers,
    updateAnomalySubscription_subscriptionArn,

    -- * Destructuring the Response
    UpdateAnomalySubscriptionResponse (..),
    newUpdateAnomalySubscriptionResponse,

    -- * Response Lenses
    updateAnomalySubscriptionResponse_httpStatus,
    updateAnomalySubscriptionResponse_subscriptionArn,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateAnomalySubscription' smart constructor.
data UpdateAnomalySubscription = UpdateAnomalySubscription'
  { -- | The new name of the subscription.
    UpdateAnomalySubscription -> Maybe Text
subscriptionName :: Prelude.Maybe Prelude.Text,
    -- | The update to the frequency value that subscribers receive
    -- notifications.
    UpdateAnomalySubscription -> Maybe AnomalySubscriptionFrequency
frequency :: Prelude.Maybe AnomalySubscriptionFrequency,
    -- | The update to the threshold value for receiving notifications.
    UpdateAnomalySubscription -> Maybe Double
threshold :: Prelude.Maybe Prelude.Double,
    -- | A list of cost anomaly monitor ARNs.
    UpdateAnomalySubscription -> Maybe [Text]
monitorArnList :: Prelude.Maybe [Prelude.Text],
    -- | The update to the subscriber list.
    UpdateAnomalySubscription -> Maybe [Subscriber]
subscribers :: Prelude.Maybe [Subscriber],
    -- | A cost anomaly subscription Amazon Resource Name (ARN).
    UpdateAnomalySubscription -> Text
subscriptionArn :: Prelude.Text
  }
  deriving (UpdateAnomalySubscription -> UpdateAnomalySubscription -> Bool
(UpdateAnomalySubscription -> UpdateAnomalySubscription -> Bool)
-> (UpdateAnomalySubscription -> UpdateAnomalySubscription -> Bool)
-> Eq UpdateAnomalySubscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAnomalySubscription -> UpdateAnomalySubscription -> Bool
$c/= :: UpdateAnomalySubscription -> UpdateAnomalySubscription -> Bool
== :: UpdateAnomalySubscription -> UpdateAnomalySubscription -> Bool
$c== :: UpdateAnomalySubscription -> UpdateAnomalySubscription -> Bool
Prelude.Eq, ReadPrec [UpdateAnomalySubscription]
ReadPrec UpdateAnomalySubscription
Int -> ReadS UpdateAnomalySubscription
ReadS [UpdateAnomalySubscription]
(Int -> ReadS UpdateAnomalySubscription)
-> ReadS [UpdateAnomalySubscription]
-> ReadPrec UpdateAnomalySubscription
-> ReadPrec [UpdateAnomalySubscription]
-> Read UpdateAnomalySubscription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAnomalySubscription]
$creadListPrec :: ReadPrec [UpdateAnomalySubscription]
readPrec :: ReadPrec UpdateAnomalySubscription
$creadPrec :: ReadPrec UpdateAnomalySubscription
readList :: ReadS [UpdateAnomalySubscription]
$creadList :: ReadS [UpdateAnomalySubscription]
readsPrec :: Int -> ReadS UpdateAnomalySubscription
$creadsPrec :: Int -> ReadS UpdateAnomalySubscription
Prelude.Read, Int -> UpdateAnomalySubscription -> ShowS
[UpdateAnomalySubscription] -> ShowS
UpdateAnomalySubscription -> String
(Int -> UpdateAnomalySubscription -> ShowS)
-> (UpdateAnomalySubscription -> String)
-> ([UpdateAnomalySubscription] -> ShowS)
-> Show UpdateAnomalySubscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAnomalySubscription] -> ShowS
$cshowList :: [UpdateAnomalySubscription] -> ShowS
show :: UpdateAnomalySubscription -> String
$cshow :: UpdateAnomalySubscription -> String
showsPrec :: Int -> UpdateAnomalySubscription -> ShowS
$cshowsPrec :: Int -> UpdateAnomalySubscription -> ShowS
Prelude.Show, (forall x.
 UpdateAnomalySubscription -> Rep UpdateAnomalySubscription x)
-> (forall x.
    Rep UpdateAnomalySubscription x -> UpdateAnomalySubscription)
-> Generic UpdateAnomalySubscription
forall x.
Rep UpdateAnomalySubscription x -> UpdateAnomalySubscription
forall x.
UpdateAnomalySubscription -> Rep UpdateAnomalySubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateAnomalySubscription x -> UpdateAnomalySubscription
$cfrom :: forall x.
UpdateAnomalySubscription -> Rep UpdateAnomalySubscription x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAnomalySubscription' 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:
--
-- 'subscriptionName', 'updateAnomalySubscription_subscriptionName' - The new name of the subscription.
--
-- 'frequency', 'updateAnomalySubscription_frequency' - The update to the frequency value that subscribers receive
-- notifications.
--
-- 'threshold', 'updateAnomalySubscription_threshold' - The update to the threshold value for receiving notifications.
--
-- 'monitorArnList', 'updateAnomalySubscription_monitorArnList' - A list of cost anomaly monitor ARNs.
--
-- 'subscribers', 'updateAnomalySubscription_subscribers' - The update to the subscriber list.
--
-- 'subscriptionArn', 'updateAnomalySubscription_subscriptionArn' - A cost anomaly subscription Amazon Resource Name (ARN).
newUpdateAnomalySubscription ::
  -- | 'subscriptionArn'
  Prelude.Text ->
  UpdateAnomalySubscription
newUpdateAnomalySubscription :: Text -> UpdateAnomalySubscription
newUpdateAnomalySubscription Text
pSubscriptionArn_ =
  UpdateAnomalySubscription' :: Maybe Text
-> Maybe AnomalySubscriptionFrequency
-> Maybe Double
-> Maybe [Text]
-> Maybe [Subscriber]
-> Text
-> UpdateAnomalySubscription
UpdateAnomalySubscription'
    { $sel:subscriptionName:UpdateAnomalySubscription' :: Maybe Text
subscriptionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:frequency:UpdateAnomalySubscription' :: Maybe AnomalySubscriptionFrequency
frequency = Maybe AnomalySubscriptionFrequency
forall a. Maybe a
Prelude.Nothing,
      $sel:threshold:UpdateAnomalySubscription' :: Maybe Double
threshold = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:monitorArnList:UpdateAnomalySubscription' :: Maybe [Text]
monitorArnList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subscribers:UpdateAnomalySubscription' :: Maybe [Subscriber]
subscribers = Maybe [Subscriber]
forall a. Maybe a
Prelude.Nothing,
      $sel:subscriptionArn:UpdateAnomalySubscription' :: Text
subscriptionArn = Text
pSubscriptionArn_
    }

-- | The new name of the subscription.
updateAnomalySubscription_subscriptionName :: Lens.Lens' UpdateAnomalySubscription (Prelude.Maybe Prelude.Text)
updateAnomalySubscription_subscriptionName :: (Maybe Text -> f (Maybe Text))
-> UpdateAnomalySubscription -> f UpdateAnomalySubscription
updateAnomalySubscription_subscriptionName = (UpdateAnomalySubscription -> Maybe Text)
-> (UpdateAnomalySubscription
    -> Maybe Text -> UpdateAnomalySubscription)
-> Lens
     UpdateAnomalySubscription
     UpdateAnomalySubscription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnomalySubscription' {Maybe Text
subscriptionName :: Maybe Text
$sel:subscriptionName:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe Text
subscriptionName} -> Maybe Text
subscriptionName) (\s :: UpdateAnomalySubscription
s@UpdateAnomalySubscription' {} Maybe Text
a -> UpdateAnomalySubscription
s {$sel:subscriptionName:UpdateAnomalySubscription' :: Maybe Text
subscriptionName = Maybe Text
a} :: UpdateAnomalySubscription)

-- | The update to the frequency value that subscribers receive
-- notifications.
updateAnomalySubscription_frequency :: Lens.Lens' UpdateAnomalySubscription (Prelude.Maybe AnomalySubscriptionFrequency)
updateAnomalySubscription_frequency :: (Maybe AnomalySubscriptionFrequency
 -> f (Maybe AnomalySubscriptionFrequency))
-> UpdateAnomalySubscription -> f UpdateAnomalySubscription
updateAnomalySubscription_frequency = (UpdateAnomalySubscription -> Maybe AnomalySubscriptionFrequency)
-> (UpdateAnomalySubscription
    -> Maybe AnomalySubscriptionFrequency -> UpdateAnomalySubscription)
-> Lens
     UpdateAnomalySubscription
     UpdateAnomalySubscription
     (Maybe AnomalySubscriptionFrequency)
     (Maybe AnomalySubscriptionFrequency)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnomalySubscription' {Maybe AnomalySubscriptionFrequency
frequency :: Maybe AnomalySubscriptionFrequency
$sel:frequency:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe AnomalySubscriptionFrequency
frequency} -> Maybe AnomalySubscriptionFrequency
frequency) (\s :: UpdateAnomalySubscription
s@UpdateAnomalySubscription' {} Maybe AnomalySubscriptionFrequency
a -> UpdateAnomalySubscription
s {$sel:frequency:UpdateAnomalySubscription' :: Maybe AnomalySubscriptionFrequency
frequency = Maybe AnomalySubscriptionFrequency
a} :: UpdateAnomalySubscription)

-- | The update to the threshold value for receiving notifications.
updateAnomalySubscription_threshold :: Lens.Lens' UpdateAnomalySubscription (Prelude.Maybe Prelude.Double)
updateAnomalySubscription_threshold :: (Maybe Double -> f (Maybe Double))
-> UpdateAnomalySubscription -> f UpdateAnomalySubscription
updateAnomalySubscription_threshold = (UpdateAnomalySubscription -> Maybe Double)
-> (UpdateAnomalySubscription
    -> Maybe Double -> UpdateAnomalySubscription)
-> Lens
     UpdateAnomalySubscription
     UpdateAnomalySubscription
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnomalySubscription' {Maybe Double
threshold :: Maybe Double
$sel:threshold:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe Double
threshold} -> Maybe Double
threshold) (\s :: UpdateAnomalySubscription
s@UpdateAnomalySubscription' {} Maybe Double
a -> UpdateAnomalySubscription
s {$sel:threshold:UpdateAnomalySubscription' :: Maybe Double
threshold = Maybe Double
a} :: UpdateAnomalySubscription)

-- | A list of cost anomaly monitor ARNs.
updateAnomalySubscription_monitorArnList :: Lens.Lens' UpdateAnomalySubscription (Prelude.Maybe [Prelude.Text])
updateAnomalySubscription_monitorArnList :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateAnomalySubscription -> f UpdateAnomalySubscription
updateAnomalySubscription_monitorArnList = (UpdateAnomalySubscription -> Maybe [Text])
-> (UpdateAnomalySubscription
    -> Maybe [Text] -> UpdateAnomalySubscription)
-> Lens
     UpdateAnomalySubscription
     UpdateAnomalySubscription
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnomalySubscription' {Maybe [Text]
monitorArnList :: Maybe [Text]
$sel:monitorArnList:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe [Text]
monitorArnList} -> Maybe [Text]
monitorArnList) (\s :: UpdateAnomalySubscription
s@UpdateAnomalySubscription' {} Maybe [Text]
a -> UpdateAnomalySubscription
s {$sel:monitorArnList:UpdateAnomalySubscription' :: Maybe [Text]
monitorArnList = Maybe [Text]
a} :: UpdateAnomalySubscription) ((Maybe [Text] -> f (Maybe [Text]))
 -> UpdateAnomalySubscription -> f UpdateAnomalySubscription)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateAnomalySubscription
-> f UpdateAnomalySubscription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The update to the subscriber list.
updateAnomalySubscription_subscribers :: Lens.Lens' UpdateAnomalySubscription (Prelude.Maybe [Subscriber])
updateAnomalySubscription_subscribers :: (Maybe [Subscriber] -> f (Maybe [Subscriber]))
-> UpdateAnomalySubscription -> f UpdateAnomalySubscription
updateAnomalySubscription_subscribers = (UpdateAnomalySubscription -> Maybe [Subscriber])
-> (UpdateAnomalySubscription
    -> Maybe [Subscriber] -> UpdateAnomalySubscription)
-> Lens
     UpdateAnomalySubscription
     UpdateAnomalySubscription
     (Maybe [Subscriber])
     (Maybe [Subscriber])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnomalySubscription' {Maybe [Subscriber]
subscribers :: Maybe [Subscriber]
$sel:subscribers:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe [Subscriber]
subscribers} -> Maybe [Subscriber]
subscribers) (\s :: UpdateAnomalySubscription
s@UpdateAnomalySubscription' {} Maybe [Subscriber]
a -> UpdateAnomalySubscription
s {$sel:subscribers:UpdateAnomalySubscription' :: Maybe [Subscriber]
subscribers = Maybe [Subscriber]
a} :: UpdateAnomalySubscription) ((Maybe [Subscriber] -> f (Maybe [Subscriber]))
 -> UpdateAnomalySubscription -> f UpdateAnomalySubscription)
-> ((Maybe [Subscriber] -> f (Maybe [Subscriber]))
    -> Maybe [Subscriber] -> f (Maybe [Subscriber]))
-> (Maybe [Subscriber] -> f (Maybe [Subscriber]))
-> UpdateAnomalySubscription
-> f UpdateAnomalySubscription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Subscriber] [Subscriber] [Subscriber] [Subscriber]
-> Iso
     (Maybe [Subscriber])
     (Maybe [Subscriber])
     (Maybe [Subscriber])
     (Maybe [Subscriber])
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 [Subscriber] [Subscriber] [Subscriber] [Subscriber]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A cost anomaly subscription Amazon Resource Name (ARN).
updateAnomalySubscription_subscriptionArn :: Lens.Lens' UpdateAnomalySubscription Prelude.Text
updateAnomalySubscription_subscriptionArn :: (Text -> f Text)
-> UpdateAnomalySubscription -> f UpdateAnomalySubscription
updateAnomalySubscription_subscriptionArn = (UpdateAnomalySubscription -> Text)
-> (UpdateAnomalySubscription -> Text -> UpdateAnomalySubscription)
-> Lens
     UpdateAnomalySubscription UpdateAnomalySubscription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnomalySubscription' {Text
subscriptionArn :: Text
$sel:subscriptionArn:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Text
subscriptionArn} -> Text
subscriptionArn) (\s :: UpdateAnomalySubscription
s@UpdateAnomalySubscription' {} Text
a -> UpdateAnomalySubscription
s {$sel:subscriptionArn:UpdateAnomalySubscription' :: Text
subscriptionArn = Text
a} :: UpdateAnomalySubscription)

instance Core.AWSRequest UpdateAnomalySubscription where
  type
    AWSResponse UpdateAnomalySubscription =
      UpdateAnomalySubscriptionResponse
  request :: UpdateAnomalySubscription -> Request UpdateAnomalySubscription
request = Service
-> UpdateAnomalySubscription -> Request UpdateAnomalySubscription
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateAnomalySubscription
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAnomalySubscription)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateAnomalySubscription))
-> Logger
-> Service
-> Proxy UpdateAnomalySubscription
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAnomalySubscription)))
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 ->
          Int -> Text -> UpdateAnomalySubscriptionResponse
UpdateAnomalySubscriptionResponse'
            (Int -> Text -> UpdateAnomalySubscriptionResponse)
-> Either String Int
-> Either String (Text -> UpdateAnomalySubscriptionResponse)
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))
            Either String (Text -> UpdateAnomalySubscriptionResponse)
-> Either String Text
-> Either String UpdateAnomalySubscriptionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"SubscriptionArn")
      )

instance Prelude.Hashable UpdateAnomalySubscription

instance Prelude.NFData UpdateAnomalySubscription

instance Core.ToHeaders UpdateAnomalySubscription where
  toHeaders :: UpdateAnomalySubscription -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateAnomalySubscription -> 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
"AWSInsightsIndexService.UpdateAnomalySubscription" ::
                          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 UpdateAnomalySubscription where
  toJSON :: UpdateAnomalySubscription -> Value
toJSON UpdateAnomalySubscription' {Maybe Double
Maybe [Text]
Maybe [Subscriber]
Maybe Text
Maybe AnomalySubscriptionFrequency
Text
subscriptionArn :: Text
subscribers :: Maybe [Subscriber]
monitorArnList :: Maybe [Text]
threshold :: Maybe Double
frequency :: Maybe AnomalySubscriptionFrequency
subscriptionName :: Maybe Text
$sel:subscriptionArn:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Text
$sel:subscribers:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe [Subscriber]
$sel:monitorArnList:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe [Text]
$sel:threshold:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe Double
$sel:frequency:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe AnomalySubscriptionFrequency
$sel:subscriptionName:UpdateAnomalySubscription' :: UpdateAnomalySubscription -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SubscriptionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
subscriptionName,
            (Text
"Frequency" Text -> AnomalySubscriptionFrequency -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AnomalySubscriptionFrequency -> Pair)
-> Maybe AnomalySubscriptionFrequency -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AnomalySubscriptionFrequency
frequency,
            (Text
"Threshold" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
threshold,
            (Text
"MonitorArnList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
monitorArnList,
            (Text
"Subscribers" Text -> [Subscriber] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Subscriber] -> Pair) -> Maybe [Subscriber] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Subscriber]
subscribers,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SubscriptionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
subscriptionArn)
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateAnomalySubscriptionResponse' 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', 'updateAnomalySubscriptionResponse_httpStatus' - The response's http status code.
--
-- 'subscriptionArn', 'updateAnomalySubscriptionResponse_subscriptionArn' - A cost anomaly subscription ARN.
newUpdateAnomalySubscriptionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'subscriptionArn'
  Prelude.Text ->
  UpdateAnomalySubscriptionResponse
newUpdateAnomalySubscriptionResponse :: Int -> Text -> UpdateAnomalySubscriptionResponse
newUpdateAnomalySubscriptionResponse
  Int
pHttpStatus_
  Text
pSubscriptionArn_ =
    UpdateAnomalySubscriptionResponse' :: Int -> Text -> UpdateAnomalySubscriptionResponse
UpdateAnomalySubscriptionResponse'
      { $sel:httpStatus:UpdateAnomalySubscriptionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:subscriptionArn:UpdateAnomalySubscriptionResponse' :: Text
subscriptionArn = Text
pSubscriptionArn_
      }

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

-- | A cost anomaly subscription ARN.
updateAnomalySubscriptionResponse_subscriptionArn :: Lens.Lens' UpdateAnomalySubscriptionResponse Prelude.Text
updateAnomalySubscriptionResponse_subscriptionArn :: (Text -> f Text)
-> UpdateAnomalySubscriptionResponse
-> f UpdateAnomalySubscriptionResponse
updateAnomalySubscriptionResponse_subscriptionArn = (UpdateAnomalySubscriptionResponse -> Text)
-> (UpdateAnomalySubscriptionResponse
    -> Text -> UpdateAnomalySubscriptionResponse)
-> Lens
     UpdateAnomalySubscriptionResponse
     UpdateAnomalySubscriptionResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAnomalySubscriptionResponse' {Text
subscriptionArn :: Text
$sel:subscriptionArn:UpdateAnomalySubscriptionResponse' :: UpdateAnomalySubscriptionResponse -> Text
subscriptionArn} -> Text
subscriptionArn) (\s :: UpdateAnomalySubscriptionResponse
s@UpdateAnomalySubscriptionResponse' {} Text
a -> UpdateAnomalySubscriptionResponse
s {$sel:subscriptionArn:UpdateAnomalySubscriptionResponse' :: Text
subscriptionArn = Text
a} :: UpdateAnomalySubscriptionResponse)

instance
  Prelude.NFData
    UpdateAnomalySubscriptionResponse