{-# 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.GetAnomalies
-- 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)
--
-- Retrieves all of the cost anomalies detected on your account during the
-- time period that\'s specified by the @DateInterval@ object.
module Amazonka.CostExplorer.GetAnomalies
  ( -- * Creating a Request
    GetAnomalies (..),
    newGetAnomalies,

    -- * Request Lenses
    getAnomalies_nextPageToken,
    getAnomalies_totalImpact,
    getAnomalies_maxResults,
    getAnomalies_feedback,
    getAnomalies_monitorArn,
    getAnomalies_dateInterval,

    -- * Destructuring the Response
    GetAnomaliesResponse (..),
    newGetAnomaliesResponse,

    -- * Response Lenses
    getAnomaliesResponse_nextPageToken,
    getAnomaliesResponse_httpStatus,
    getAnomaliesResponse_anomalies,
  )
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:/ 'newGetAnomalies' smart constructor.
data GetAnomalies = GetAnomalies'
  { -- | The token to retrieve the next set of results. Amazon Web Services
    -- provides the token when the response from a previous call has more
    -- results than the maximum page size.
    GetAnomalies -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | Filters anomaly results by the total impact field on the anomaly object.
    -- For example, you can filter anomalies @GREATER_THAN 200.00@ to retrieve
    -- anomalies, with an estimated dollar impact greater than 200.
    GetAnomalies -> Maybe TotalImpactFilter
totalImpact :: Prelude.Maybe TotalImpactFilter,
    -- | The number of entries a paginated response contains.
    GetAnomalies -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | Filters anomaly results by the feedback field on the anomaly object.
    GetAnomalies -> Maybe AnomalyFeedbackType
feedback :: Prelude.Maybe AnomalyFeedbackType,
    -- | Retrieves all of the cost anomalies detected for a specific cost anomaly
    -- monitor Amazon Resource Name (ARN).
    GetAnomalies -> Maybe Text
monitorArn :: Prelude.Maybe Prelude.Text,
    -- | Assigns the start and end dates for retrieving cost anomalies. The
    -- returned anomaly object will have an @AnomalyEndDate@ in the specified
    -- time range.
    GetAnomalies -> AnomalyDateInterval
dateInterval :: AnomalyDateInterval
  }
  deriving (GetAnomalies -> GetAnomalies -> Bool
(GetAnomalies -> GetAnomalies -> Bool)
-> (GetAnomalies -> GetAnomalies -> Bool) -> Eq GetAnomalies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAnomalies -> GetAnomalies -> Bool
$c/= :: GetAnomalies -> GetAnomalies -> Bool
== :: GetAnomalies -> GetAnomalies -> Bool
$c== :: GetAnomalies -> GetAnomalies -> Bool
Prelude.Eq, ReadPrec [GetAnomalies]
ReadPrec GetAnomalies
Int -> ReadS GetAnomalies
ReadS [GetAnomalies]
(Int -> ReadS GetAnomalies)
-> ReadS [GetAnomalies]
-> ReadPrec GetAnomalies
-> ReadPrec [GetAnomalies]
-> Read GetAnomalies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAnomalies]
$creadListPrec :: ReadPrec [GetAnomalies]
readPrec :: ReadPrec GetAnomalies
$creadPrec :: ReadPrec GetAnomalies
readList :: ReadS [GetAnomalies]
$creadList :: ReadS [GetAnomalies]
readsPrec :: Int -> ReadS GetAnomalies
$creadsPrec :: Int -> ReadS GetAnomalies
Prelude.Read, Int -> GetAnomalies -> ShowS
[GetAnomalies] -> ShowS
GetAnomalies -> String
(Int -> GetAnomalies -> ShowS)
-> (GetAnomalies -> String)
-> ([GetAnomalies] -> ShowS)
-> Show GetAnomalies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAnomalies] -> ShowS
$cshowList :: [GetAnomalies] -> ShowS
show :: GetAnomalies -> String
$cshow :: GetAnomalies -> String
showsPrec :: Int -> GetAnomalies -> ShowS
$cshowsPrec :: Int -> GetAnomalies -> ShowS
Prelude.Show, (forall x. GetAnomalies -> Rep GetAnomalies x)
-> (forall x. Rep GetAnomalies x -> GetAnomalies)
-> Generic GetAnomalies
forall x. Rep GetAnomalies x -> GetAnomalies
forall x. GetAnomalies -> Rep GetAnomalies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAnomalies x -> GetAnomalies
$cfrom :: forall x. GetAnomalies -> Rep GetAnomalies x
Prelude.Generic)

-- |
-- Create a value of 'GetAnomalies' 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:
--
-- 'nextPageToken', 'getAnomalies_nextPageToken' - The token to retrieve the next set of results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
--
-- 'totalImpact', 'getAnomalies_totalImpact' - Filters anomaly results by the total impact field on the anomaly object.
-- For example, you can filter anomalies @GREATER_THAN 200.00@ to retrieve
-- anomalies, with an estimated dollar impact greater than 200.
--
-- 'maxResults', 'getAnomalies_maxResults' - The number of entries a paginated response contains.
--
-- 'feedback', 'getAnomalies_feedback' - Filters anomaly results by the feedback field on the anomaly object.
--
-- 'monitorArn', 'getAnomalies_monitorArn' - Retrieves all of the cost anomalies detected for a specific cost anomaly
-- monitor Amazon Resource Name (ARN).
--
-- 'dateInterval', 'getAnomalies_dateInterval' - Assigns the start and end dates for retrieving cost anomalies. The
-- returned anomaly object will have an @AnomalyEndDate@ in the specified
-- time range.
newGetAnomalies ::
  -- | 'dateInterval'
  AnomalyDateInterval ->
  GetAnomalies
newGetAnomalies :: AnomalyDateInterval -> GetAnomalies
newGetAnomalies AnomalyDateInterval
pDateInterval_ =
  GetAnomalies' :: Maybe Text
-> Maybe TotalImpactFilter
-> Maybe Int
-> Maybe AnomalyFeedbackType
-> Maybe Text
-> AnomalyDateInterval
-> GetAnomalies
GetAnomalies'
    { $sel:nextPageToken:GetAnomalies' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:totalImpact:GetAnomalies' :: Maybe TotalImpactFilter
totalImpact = Maybe TotalImpactFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetAnomalies' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:feedback:GetAnomalies' :: Maybe AnomalyFeedbackType
feedback = Maybe AnomalyFeedbackType
forall a. Maybe a
Prelude.Nothing,
      $sel:monitorArn:GetAnomalies' :: Maybe Text
monitorArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dateInterval:GetAnomalies' :: AnomalyDateInterval
dateInterval = AnomalyDateInterval
pDateInterval_
    }

-- | The token to retrieve the next set of results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
getAnomalies_nextPageToken :: Lens.Lens' GetAnomalies (Prelude.Maybe Prelude.Text)
getAnomalies_nextPageToken :: (Maybe Text -> f (Maybe Text)) -> GetAnomalies -> f GetAnomalies
getAnomalies_nextPageToken = (GetAnomalies -> Maybe Text)
-> (GetAnomalies -> Maybe Text -> GetAnomalies)
-> Lens GetAnomalies GetAnomalies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalies' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetAnomalies' :: GetAnomalies -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetAnomalies
s@GetAnomalies' {} Maybe Text
a -> GetAnomalies
s {$sel:nextPageToken:GetAnomalies' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetAnomalies)

-- | Filters anomaly results by the total impact field on the anomaly object.
-- For example, you can filter anomalies @GREATER_THAN 200.00@ to retrieve
-- anomalies, with an estimated dollar impact greater than 200.
getAnomalies_totalImpact :: Lens.Lens' GetAnomalies (Prelude.Maybe TotalImpactFilter)
getAnomalies_totalImpact :: (Maybe TotalImpactFilter -> f (Maybe TotalImpactFilter))
-> GetAnomalies -> f GetAnomalies
getAnomalies_totalImpact = (GetAnomalies -> Maybe TotalImpactFilter)
-> (GetAnomalies -> Maybe TotalImpactFilter -> GetAnomalies)
-> Lens
     GetAnomalies
     GetAnomalies
     (Maybe TotalImpactFilter)
     (Maybe TotalImpactFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalies' {Maybe TotalImpactFilter
totalImpact :: Maybe TotalImpactFilter
$sel:totalImpact:GetAnomalies' :: GetAnomalies -> Maybe TotalImpactFilter
totalImpact} -> Maybe TotalImpactFilter
totalImpact) (\s :: GetAnomalies
s@GetAnomalies' {} Maybe TotalImpactFilter
a -> GetAnomalies
s {$sel:totalImpact:GetAnomalies' :: Maybe TotalImpactFilter
totalImpact = Maybe TotalImpactFilter
a} :: GetAnomalies)

-- | The number of entries a paginated response contains.
getAnomalies_maxResults :: Lens.Lens' GetAnomalies (Prelude.Maybe Prelude.Int)
getAnomalies_maxResults :: (Maybe Int -> f (Maybe Int)) -> GetAnomalies -> f GetAnomalies
getAnomalies_maxResults = (GetAnomalies -> Maybe Int)
-> (GetAnomalies -> Maybe Int -> GetAnomalies)
-> Lens GetAnomalies GetAnomalies (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalies' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:GetAnomalies' :: GetAnomalies -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: GetAnomalies
s@GetAnomalies' {} Maybe Int
a -> GetAnomalies
s {$sel:maxResults:GetAnomalies' :: Maybe Int
maxResults = Maybe Int
a} :: GetAnomalies)

-- | Filters anomaly results by the feedback field on the anomaly object.
getAnomalies_feedback :: Lens.Lens' GetAnomalies (Prelude.Maybe AnomalyFeedbackType)
getAnomalies_feedback :: (Maybe AnomalyFeedbackType -> f (Maybe AnomalyFeedbackType))
-> GetAnomalies -> f GetAnomalies
getAnomalies_feedback = (GetAnomalies -> Maybe AnomalyFeedbackType)
-> (GetAnomalies -> Maybe AnomalyFeedbackType -> GetAnomalies)
-> Lens
     GetAnomalies
     GetAnomalies
     (Maybe AnomalyFeedbackType)
     (Maybe AnomalyFeedbackType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalies' {Maybe AnomalyFeedbackType
feedback :: Maybe AnomalyFeedbackType
$sel:feedback:GetAnomalies' :: GetAnomalies -> Maybe AnomalyFeedbackType
feedback} -> Maybe AnomalyFeedbackType
feedback) (\s :: GetAnomalies
s@GetAnomalies' {} Maybe AnomalyFeedbackType
a -> GetAnomalies
s {$sel:feedback:GetAnomalies' :: Maybe AnomalyFeedbackType
feedback = Maybe AnomalyFeedbackType
a} :: GetAnomalies)

-- | Retrieves all of the cost anomalies detected for a specific cost anomaly
-- monitor Amazon Resource Name (ARN).
getAnomalies_monitorArn :: Lens.Lens' GetAnomalies (Prelude.Maybe Prelude.Text)
getAnomalies_monitorArn :: (Maybe Text -> f (Maybe Text)) -> GetAnomalies -> f GetAnomalies
getAnomalies_monitorArn = (GetAnomalies -> Maybe Text)
-> (GetAnomalies -> Maybe Text -> GetAnomalies)
-> Lens GetAnomalies GetAnomalies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalies' {Maybe Text
monitorArn :: Maybe Text
$sel:monitorArn:GetAnomalies' :: GetAnomalies -> Maybe Text
monitorArn} -> Maybe Text
monitorArn) (\s :: GetAnomalies
s@GetAnomalies' {} Maybe Text
a -> GetAnomalies
s {$sel:monitorArn:GetAnomalies' :: Maybe Text
monitorArn = Maybe Text
a} :: GetAnomalies)

-- | Assigns the start and end dates for retrieving cost anomalies. The
-- returned anomaly object will have an @AnomalyEndDate@ in the specified
-- time range.
getAnomalies_dateInterval :: Lens.Lens' GetAnomalies AnomalyDateInterval
getAnomalies_dateInterval :: (AnomalyDateInterval -> f AnomalyDateInterval)
-> GetAnomalies -> f GetAnomalies
getAnomalies_dateInterval = (GetAnomalies -> AnomalyDateInterval)
-> (GetAnomalies -> AnomalyDateInterval -> GetAnomalies)
-> Lens
     GetAnomalies GetAnomalies AnomalyDateInterval AnomalyDateInterval
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomalies' {AnomalyDateInterval
dateInterval :: AnomalyDateInterval
$sel:dateInterval:GetAnomalies' :: GetAnomalies -> AnomalyDateInterval
dateInterval} -> AnomalyDateInterval
dateInterval) (\s :: GetAnomalies
s@GetAnomalies' {} AnomalyDateInterval
a -> GetAnomalies
s {$sel:dateInterval:GetAnomalies' :: AnomalyDateInterval
dateInterval = AnomalyDateInterval
a} :: GetAnomalies)

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

instance Prelude.Hashable GetAnomalies

instance Prelude.NFData GetAnomalies

instance Core.ToHeaders GetAnomalies where
  toHeaders :: GetAnomalies -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetAnomalies -> 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.GetAnomalies" ::
                          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 GetAnomalies where
  toJSON :: GetAnomalies -> Value
toJSON GetAnomalies' {Maybe Int
Maybe Text
Maybe AnomalyFeedbackType
Maybe TotalImpactFilter
AnomalyDateInterval
dateInterval :: AnomalyDateInterval
monitorArn :: Maybe Text
feedback :: Maybe AnomalyFeedbackType
maxResults :: Maybe Int
totalImpact :: Maybe TotalImpactFilter
nextPageToken :: Maybe Text
$sel:dateInterval:GetAnomalies' :: GetAnomalies -> AnomalyDateInterval
$sel:monitorArn:GetAnomalies' :: GetAnomalies -> Maybe Text
$sel:feedback:GetAnomalies' :: GetAnomalies -> Maybe AnomalyFeedbackType
$sel:maxResults:GetAnomalies' :: GetAnomalies -> Maybe Int
$sel:totalImpact:GetAnomalies' :: GetAnomalies -> Maybe TotalImpactFilter
$sel:nextPageToken:GetAnomalies' :: GetAnomalies -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextPageToken" 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
nextPageToken,
            (Text
"TotalImpact" Text -> TotalImpactFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TotalImpactFilter -> Pair)
-> Maybe TotalImpactFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TotalImpactFilter
totalImpact,
            (Text
"MaxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            (Text
"Feedback" Text -> AnomalyFeedbackType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AnomalyFeedbackType -> Pair)
-> Maybe AnomalyFeedbackType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AnomalyFeedbackType
feedback,
            (Text
"MonitorArn" 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
monitorArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DateInterval" Text -> AnomalyDateInterval -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AnomalyDateInterval
dateInterval)
          ]
      )

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

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

-- | /See:/ 'newGetAnomaliesResponse' smart constructor.
data GetAnomaliesResponse = GetAnomaliesResponse'
  { -- | The token to retrieve the next set of results. Amazon Web Services
    -- provides the token when the response from a previous call has more
    -- results than the maximum page size.
    GetAnomaliesResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetAnomaliesResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of cost anomalies.
    GetAnomaliesResponse -> [Anomaly]
anomalies :: [Anomaly]
  }
  deriving (GetAnomaliesResponse -> GetAnomaliesResponse -> Bool
(GetAnomaliesResponse -> GetAnomaliesResponse -> Bool)
-> (GetAnomaliesResponse -> GetAnomaliesResponse -> Bool)
-> Eq GetAnomaliesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAnomaliesResponse -> GetAnomaliesResponse -> Bool
$c/= :: GetAnomaliesResponse -> GetAnomaliesResponse -> Bool
== :: GetAnomaliesResponse -> GetAnomaliesResponse -> Bool
$c== :: GetAnomaliesResponse -> GetAnomaliesResponse -> Bool
Prelude.Eq, ReadPrec [GetAnomaliesResponse]
ReadPrec GetAnomaliesResponse
Int -> ReadS GetAnomaliesResponse
ReadS [GetAnomaliesResponse]
(Int -> ReadS GetAnomaliesResponse)
-> ReadS [GetAnomaliesResponse]
-> ReadPrec GetAnomaliesResponse
-> ReadPrec [GetAnomaliesResponse]
-> Read GetAnomaliesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAnomaliesResponse]
$creadListPrec :: ReadPrec [GetAnomaliesResponse]
readPrec :: ReadPrec GetAnomaliesResponse
$creadPrec :: ReadPrec GetAnomaliesResponse
readList :: ReadS [GetAnomaliesResponse]
$creadList :: ReadS [GetAnomaliesResponse]
readsPrec :: Int -> ReadS GetAnomaliesResponse
$creadsPrec :: Int -> ReadS GetAnomaliesResponse
Prelude.Read, Int -> GetAnomaliesResponse -> ShowS
[GetAnomaliesResponse] -> ShowS
GetAnomaliesResponse -> String
(Int -> GetAnomaliesResponse -> ShowS)
-> (GetAnomaliesResponse -> String)
-> ([GetAnomaliesResponse] -> ShowS)
-> Show GetAnomaliesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAnomaliesResponse] -> ShowS
$cshowList :: [GetAnomaliesResponse] -> ShowS
show :: GetAnomaliesResponse -> String
$cshow :: GetAnomaliesResponse -> String
showsPrec :: Int -> GetAnomaliesResponse -> ShowS
$cshowsPrec :: Int -> GetAnomaliesResponse -> ShowS
Prelude.Show, (forall x. GetAnomaliesResponse -> Rep GetAnomaliesResponse x)
-> (forall x. Rep GetAnomaliesResponse x -> GetAnomaliesResponse)
-> Generic GetAnomaliesResponse
forall x. Rep GetAnomaliesResponse x -> GetAnomaliesResponse
forall x. GetAnomaliesResponse -> Rep GetAnomaliesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAnomaliesResponse x -> GetAnomaliesResponse
$cfrom :: forall x. GetAnomaliesResponse -> Rep GetAnomaliesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAnomaliesResponse' 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:
--
-- 'nextPageToken', 'getAnomaliesResponse_nextPageToken' - The token to retrieve the next set of results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
--
-- 'httpStatus', 'getAnomaliesResponse_httpStatus' - The response's http status code.
--
-- 'anomalies', 'getAnomaliesResponse_anomalies' - A list of cost anomalies.
newGetAnomaliesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAnomaliesResponse
newGetAnomaliesResponse :: Int -> GetAnomaliesResponse
newGetAnomaliesResponse Int
pHttpStatus_ =
  GetAnomaliesResponse' :: Maybe Text -> Int -> [Anomaly] -> GetAnomaliesResponse
GetAnomaliesResponse'
    { $sel:nextPageToken:GetAnomaliesResponse' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAnomaliesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:anomalies:GetAnomaliesResponse' :: [Anomaly]
anomalies = [Anomaly]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The token to retrieve the next set of results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
getAnomaliesResponse_nextPageToken :: Lens.Lens' GetAnomaliesResponse (Prelude.Maybe Prelude.Text)
getAnomaliesResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetAnomaliesResponse -> f GetAnomaliesResponse
getAnomaliesResponse_nextPageToken = (GetAnomaliesResponse -> Maybe Text)
-> (GetAnomaliesResponse -> Maybe Text -> GetAnomaliesResponse)
-> Lens
     GetAnomaliesResponse GetAnomaliesResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomaliesResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetAnomaliesResponse' :: GetAnomaliesResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetAnomaliesResponse
s@GetAnomaliesResponse' {} Maybe Text
a -> GetAnomaliesResponse
s {$sel:nextPageToken:GetAnomaliesResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetAnomaliesResponse)

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

-- | A list of cost anomalies.
getAnomaliesResponse_anomalies :: Lens.Lens' GetAnomaliesResponse [Anomaly]
getAnomaliesResponse_anomalies :: ([Anomaly] -> f [Anomaly])
-> GetAnomaliesResponse -> f GetAnomaliesResponse
getAnomaliesResponse_anomalies = (GetAnomaliesResponse -> [Anomaly])
-> (GetAnomaliesResponse -> [Anomaly] -> GetAnomaliesResponse)
-> Lens
     GetAnomaliesResponse GetAnomaliesResponse [Anomaly] [Anomaly]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnomaliesResponse' {[Anomaly]
anomalies :: [Anomaly]
$sel:anomalies:GetAnomaliesResponse' :: GetAnomaliesResponse -> [Anomaly]
anomalies} -> [Anomaly]
anomalies) (\s :: GetAnomaliesResponse
s@GetAnomaliesResponse' {} [Anomaly]
a -> GetAnomaliesResponse
s {$sel:anomalies:GetAnomaliesResponse' :: [Anomaly]
anomalies = [Anomaly]
a} :: GetAnomaliesResponse) (([Anomaly] -> f [Anomaly])
 -> GetAnomaliesResponse -> f GetAnomaliesResponse)
-> (([Anomaly] -> f [Anomaly]) -> [Anomaly] -> f [Anomaly])
-> ([Anomaly] -> f [Anomaly])
-> GetAnomaliesResponse
-> f GetAnomaliesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Anomaly] -> f [Anomaly]) -> [Anomaly] -> f [Anomaly]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData GetAnomaliesResponse