{-# 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.DevOpsGuru.GetCostEstimation
-- 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)
--
-- Returns an estimate of the monthly cost for DevOps Guru to analyze your
-- AWS resources. For more information, see
-- <https://docs.aws.amazon.com/devops-guru/latest/userguide/cost-estimate.html Estimate your Amazon DevOps Guru costs>
-- and
-- <http://aws.amazon.com/devops-guru/pricing/ Amazon DevOps Guru pricing>.
--
-- This operation returns paginated results.
module Amazonka.DevOpsGuru.GetCostEstimation
  ( -- * Creating a Request
    GetCostEstimation (..),
    newGetCostEstimation,

    -- * Request Lenses
    getCostEstimation_nextToken,

    -- * Destructuring the Response
    GetCostEstimationResponse (..),
    newGetCostEstimationResponse,

    -- * Response Lenses
    getCostEstimationResponse_status,
    getCostEstimationResponse_resourceCollection,
    getCostEstimationResponse_timeRange,
    getCostEstimationResponse_costs,
    getCostEstimationResponse_nextToken,
    getCostEstimationResponse_totalCost,
    getCostEstimationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DevOpsGuru.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:/ 'newGetCostEstimation' smart constructor.
data GetCostEstimation = GetCostEstimation'
  { -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If this value is null, it retrieves the first page.
    GetCostEstimation -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (GetCostEstimation -> GetCostEstimation -> Bool
(GetCostEstimation -> GetCostEstimation -> Bool)
-> (GetCostEstimation -> GetCostEstimation -> Bool)
-> Eq GetCostEstimation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCostEstimation -> GetCostEstimation -> Bool
$c/= :: GetCostEstimation -> GetCostEstimation -> Bool
== :: GetCostEstimation -> GetCostEstimation -> Bool
$c== :: GetCostEstimation -> GetCostEstimation -> Bool
Prelude.Eq, ReadPrec [GetCostEstimation]
ReadPrec GetCostEstimation
Int -> ReadS GetCostEstimation
ReadS [GetCostEstimation]
(Int -> ReadS GetCostEstimation)
-> ReadS [GetCostEstimation]
-> ReadPrec GetCostEstimation
-> ReadPrec [GetCostEstimation]
-> Read GetCostEstimation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCostEstimation]
$creadListPrec :: ReadPrec [GetCostEstimation]
readPrec :: ReadPrec GetCostEstimation
$creadPrec :: ReadPrec GetCostEstimation
readList :: ReadS [GetCostEstimation]
$creadList :: ReadS [GetCostEstimation]
readsPrec :: Int -> ReadS GetCostEstimation
$creadsPrec :: Int -> ReadS GetCostEstimation
Prelude.Read, Int -> GetCostEstimation -> ShowS
[GetCostEstimation] -> ShowS
GetCostEstimation -> String
(Int -> GetCostEstimation -> ShowS)
-> (GetCostEstimation -> String)
-> ([GetCostEstimation] -> ShowS)
-> Show GetCostEstimation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCostEstimation] -> ShowS
$cshowList :: [GetCostEstimation] -> ShowS
show :: GetCostEstimation -> String
$cshow :: GetCostEstimation -> String
showsPrec :: Int -> GetCostEstimation -> ShowS
$cshowsPrec :: Int -> GetCostEstimation -> ShowS
Prelude.Show, (forall x. GetCostEstimation -> Rep GetCostEstimation x)
-> (forall x. Rep GetCostEstimation x -> GetCostEstimation)
-> Generic GetCostEstimation
forall x. Rep GetCostEstimation x -> GetCostEstimation
forall x. GetCostEstimation -> Rep GetCostEstimation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCostEstimation x -> GetCostEstimation
$cfrom :: forall x. GetCostEstimation -> Rep GetCostEstimation x
Prelude.Generic)

-- |
-- Create a value of 'GetCostEstimation' 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:
--
-- 'nextToken', 'getCostEstimation_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
newGetCostEstimation ::
  GetCostEstimation
newGetCostEstimation :: GetCostEstimation
newGetCostEstimation =
  GetCostEstimation' :: Maybe Text -> GetCostEstimation
GetCostEstimation' {$sel:nextToken:GetCostEstimation' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
getCostEstimation_nextToken :: Lens.Lens' GetCostEstimation (Prelude.Maybe Prelude.Text)
getCostEstimation_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetCostEstimation -> f GetCostEstimation
getCostEstimation_nextToken = (GetCostEstimation -> Maybe Text)
-> (GetCostEstimation -> Maybe Text -> GetCostEstimation)
-> Lens
     GetCostEstimation GetCostEstimation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostEstimation' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetCostEstimation' :: GetCostEstimation -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetCostEstimation
s@GetCostEstimation' {} Maybe Text
a -> GetCostEstimation
s {$sel:nextToken:GetCostEstimation' :: Maybe Text
nextToken = Maybe Text
a} :: GetCostEstimation)

instance Core.AWSPager GetCostEstimation where
  page :: GetCostEstimation
-> AWSResponse GetCostEstimation -> Maybe GetCostEstimation
page GetCostEstimation
rq AWSResponse GetCostEstimation
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetCostEstimation
GetCostEstimationResponse
rs
            GetCostEstimationResponse
-> Getting (First Text) GetCostEstimationResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetCostEstimationResponse
-> Const (First Text) GetCostEstimationResponse
Lens' GetCostEstimationResponse (Maybe Text)
getCostEstimationResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetCostEstimationResponse
 -> Const (First Text) GetCostEstimationResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetCostEstimationResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetCostEstimation
forall a. Maybe a
Prelude.Nothing
    | Maybe [ServiceResourceCost] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetCostEstimation
GetCostEstimationResponse
rs
            GetCostEstimationResponse
-> Getting
     (First [ServiceResourceCost])
     GetCostEstimationResponse
     [ServiceResourceCost]
-> Maybe [ServiceResourceCost]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ServiceResourceCost]
 -> Const
      (First [ServiceResourceCost]) (Maybe [ServiceResourceCost]))
-> GetCostEstimationResponse
-> Const (First [ServiceResourceCost]) GetCostEstimationResponse
Lens' GetCostEstimationResponse (Maybe [ServiceResourceCost])
getCostEstimationResponse_costs ((Maybe [ServiceResourceCost]
  -> Const
       (First [ServiceResourceCost]) (Maybe [ServiceResourceCost]))
 -> GetCostEstimationResponse
 -> Const (First [ServiceResourceCost]) GetCostEstimationResponse)
-> (([ServiceResourceCost]
     -> Const (First [ServiceResourceCost]) [ServiceResourceCost])
    -> Maybe [ServiceResourceCost]
    -> Const
         (First [ServiceResourceCost]) (Maybe [ServiceResourceCost]))
-> Getting
     (First [ServiceResourceCost])
     GetCostEstimationResponse
     [ServiceResourceCost]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ServiceResourceCost]
 -> Const (First [ServiceResourceCost]) [ServiceResourceCost])
-> Maybe [ServiceResourceCost]
-> Const
     (First [ServiceResourceCost]) (Maybe [ServiceResourceCost])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetCostEstimation
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetCostEstimation -> Maybe GetCostEstimation
forall a. a -> Maybe a
Prelude.Just (GetCostEstimation -> Maybe GetCostEstimation)
-> GetCostEstimation -> Maybe GetCostEstimation
forall a b. (a -> b) -> a -> b
Prelude.$
        GetCostEstimation
rq
          GetCostEstimation
-> (GetCostEstimation -> GetCostEstimation) -> GetCostEstimation
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetCostEstimation -> Identity GetCostEstimation
Lens GetCostEstimation GetCostEstimation (Maybe Text) (Maybe Text)
getCostEstimation_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetCostEstimation -> Identity GetCostEstimation)
-> Maybe Text -> GetCostEstimation -> GetCostEstimation
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetCostEstimation
GetCostEstimationResponse
rs
          GetCostEstimationResponse
-> Getting (First Text) GetCostEstimationResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetCostEstimationResponse
-> Const (First Text) GetCostEstimationResponse
Lens' GetCostEstimationResponse (Maybe Text)
getCostEstimationResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetCostEstimationResponse
 -> Const (First Text) GetCostEstimationResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetCostEstimationResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest GetCostEstimation where
  type
    AWSResponse GetCostEstimation =
      GetCostEstimationResponse
  request :: GetCostEstimation -> Request GetCostEstimation
request = Service -> GetCostEstimation -> Request GetCostEstimation
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetCostEstimation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCostEstimation)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetCostEstimation))
-> Logger
-> Service
-> Proxy GetCostEstimation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCostEstimation)))
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 CostEstimationStatus
-> Maybe CostEstimationResourceCollectionFilter
-> Maybe CostEstimationTimeRange
-> Maybe [ServiceResourceCost]
-> Maybe Text
-> Maybe Double
-> Int
-> GetCostEstimationResponse
GetCostEstimationResponse'
            (Maybe CostEstimationStatus
 -> Maybe CostEstimationResourceCollectionFilter
 -> Maybe CostEstimationTimeRange
 -> Maybe [ServiceResourceCost]
 -> Maybe Text
 -> Maybe Double
 -> Int
 -> GetCostEstimationResponse)
-> Either String (Maybe CostEstimationStatus)
-> Either
     String
     (Maybe CostEstimationResourceCollectionFilter
      -> Maybe CostEstimationTimeRange
      -> Maybe [ServiceResourceCost]
      -> Maybe Text
      -> Maybe Double
      -> Int
      -> GetCostEstimationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CostEstimationStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
            Either
  String
  (Maybe CostEstimationResourceCollectionFilter
   -> Maybe CostEstimationTimeRange
   -> Maybe [ServiceResourceCost]
   -> Maybe Text
   -> Maybe Double
   -> Int
   -> GetCostEstimationResponse)
-> Either String (Maybe CostEstimationResourceCollectionFilter)
-> Either
     String
     (Maybe CostEstimationTimeRange
      -> Maybe [ServiceResourceCost]
      -> Maybe Text
      -> Maybe Double
      -> Int
      -> GetCostEstimationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Either String (Maybe CostEstimationResourceCollectionFilter)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceCollection")
            Either
  String
  (Maybe CostEstimationTimeRange
   -> Maybe [ServiceResourceCost]
   -> Maybe Text
   -> Maybe Double
   -> Int
   -> GetCostEstimationResponse)
-> Either String (Maybe CostEstimationTimeRange)
-> Either
     String
     (Maybe [ServiceResourceCost]
      -> Maybe Text -> Maybe Double -> Int -> GetCostEstimationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe CostEstimationTimeRange)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TimeRange")
            Either
  String
  (Maybe [ServiceResourceCost]
   -> Maybe Text -> Maybe Double -> Int -> GetCostEstimationResponse)
-> Either String (Maybe [ServiceResourceCost])
-> Either
     String
     (Maybe Text -> Maybe Double -> Int -> GetCostEstimationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [ServiceResourceCost]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Costs" Either String (Maybe (Maybe [ServiceResourceCost]))
-> Maybe [ServiceResourceCost]
-> Either String (Maybe [ServiceResourceCost])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ServiceResourceCost]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text -> Maybe Double -> Int -> GetCostEstimationResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Double -> Int -> GetCostEstimationResponse)
forall (f :: * -> *) a b. Applicative f => 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
"NextToken")
            Either String (Maybe Double -> Int -> GetCostEstimationResponse)
-> Either String (Maybe Double)
-> Either String (Int -> GetCostEstimationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Double)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TotalCost")
            Either String (Int -> GetCostEstimationResponse)
-> Either String Int -> Either String GetCostEstimationResponse
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 GetCostEstimation

instance Prelude.NFData GetCostEstimation

instance Core.ToHeaders GetCostEstimation where
  toHeaders :: GetCostEstimation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetCostEstimation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetCostEstimation where
  toPath :: GetCostEstimation -> ByteString
toPath = ByteString -> GetCostEstimation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/cost-estimation"

instance Core.ToQuery GetCostEstimation where
  toQuery :: GetCostEstimation -> QueryString
toQuery GetCostEstimation' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetCostEstimation' :: GetCostEstimation -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken]

-- | /See:/ 'newGetCostEstimationResponse' smart constructor.
data GetCostEstimationResponse = GetCostEstimationResponse'
  { -- | The status of creating this cost estimate. If it\'s still in progress,
    -- the status @ONGOING@ is returned. If it is finished, the status
    -- @COMPLETED@ is returned.
    GetCostEstimationResponse -> Maybe CostEstimationStatus
status :: Prelude.Maybe CostEstimationStatus,
    -- | The collection of the AWS resources used to create your monthly DevOps
    -- Guru cost estimate.
    GetCostEstimationResponse
-> Maybe CostEstimationResourceCollectionFilter
resourceCollection :: Prelude.Maybe CostEstimationResourceCollectionFilter,
    -- | The start and end time of the cost estimation.
    GetCostEstimationResponse -> Maybe CostEstimationTimeRange
timeRange :: Prelude.Maybe CostEstimationTimeRange,
    -- | An array of @ResourceCost@ objects that each contains details about the
    -- monthly cost estimate to analyze one of your AWS resources.
    GetCostEstimationResponse -> Maybe [ServiceResourceCost]
costs :: Prelude.Maybe [ServiceResourceCost],
    -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If there are no more pages, this value is null.
    GetCostEstimationResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The estimated monthly cost to analyze the AWS resources. This value is
    -- the sum of the estimated costs to analyze each resource in the @Costs@
    -- object in this response.
    GetCostEstimationResponse -> Maybe Double
totalCost :: Prelude.Maybe Prelude.Double,
    -- | The response's http status code.
    GetCostEstimationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetCostEstimationResponse -> GetCostEstimationResponse -> Bool
(GetCostEstimationResponse -> GetCostEstimationResponse -> Bool)
-> (GetCostEstimationResponse -> GetCostEstimationResponse -> Bool)
-> Eq GetCostEstimationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCostEstimationResponse -> GetCostEstimationResponse -> Bool
$c/= :: GetCostEstimationResponse -> GetCostEstimationResponse -> Bool
== :: GetCostEstimationResponse -> GetCostEstimationResponse -> Bool
$c== :: GetCostEstimationResponse -> GetCostEstimationResponse -> Bool
Prelude.Eq, ReadPrec [GetCostEstimationResponse]
ReadPrec GetCostEstimationResponse
Int -> ReadS GetCostEstimationResponse
ReadS [GetCostEstimationResponse]
(Int -> ReadS GetCostEstimationResponse)
-> ReadS [GetCostEstimationResponse]
-> ReadPrec GetCostEstimationResponse
-> ReadPrec [GetCostEstimationResponse]
-> Read GetCostEstimationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCostEstimationResponse]
$creadListPrec :: ReadPrec [GetCostEstimationResponse]
readPrec :: ReadPrec GetCostEstimationResponse
$creadPrec :: ReadPrec GetCostEstimationResponse
readList :: ReadS [GetCostEstimationResponse]
$creadList :: ReadS [GetCostEstimationResponse]
readsPrec :: Int -> ReadS GetCostEstimationResponse
$creadsPrec :: Int -> ReadS GetCostEstimationResponse
Prelude.Read, Int -> GetCostEstimationResponse -> ShowS
[GetCostEstimationResponse] -> ShowS
GetCostEstimationResponse -> String
(Int -> GetCostEstimationResponse -> ShowS)
-> (GetCostEstimationResponse -> String)
-> ([GetCostEstimationResponse] -> ShowS)
-> Show GetCostEstimationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCostEstimationResponse] -> ShowS
$cshowList :: [GetCostEstimationResponse] -> ShowS
show :: GetCostEstimationResponse -> String
$cshow :: GetCostEstimationResponse -> String
showsPrec :: Int -> GetCostEstimationResponse -> ShowS
$cshowsPrec :: Int -> GetCostEstimationResponse -> ShowS
Prelude.Show, (forall x.
 GetCostEstimationResponse -> Rep GetCostEstimationResponse x)
-> (forall x.
    Rep GetCostEstimationResponse x -> GetCostEstimationResponse)
-> Generic GetCostEstimationResponse
forall x.
Rep GetCostEstimationResponse x -> GetCostEstimationResponse
forall x.
GetCostEstimationResponse -> Rep GetCostEstimationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCostEstimationResponse x -> GetCostEstimationResponse
$cfrom :: forall x.
GetCostEstimationResponse -> Rep GetCostEstimationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetCostEstimationResponse' 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:
--
-- 'status', 'getCostEstimationResponse_status' - The status of creating this cost estimate. If it\'s still in progress,
-- the status @ONGOING@ is returned. If it is finished, the status
-- @COMPLETED@ is returned.
--
-- 'resourceCollection', 'getCostEstimationResponse_resourceCollection' - The collection of the AWS resources used to create your monthly DevOps
-- Guru cost estimate.
--
-- 'timeRange', 'getCostEstimationResponse_timeRange' - The start and end time of the cost estimation.
--
-- 'costs', 'getCostEstimationResponse_costs' - An array of @ResourceCost@ objects that each contains details about the
-- monthly cost estimate to analyze one of your AWS resources.
--
-- 'nextToken', 'getCostEstimationResponse_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
--
-- 'totalCost', 'getCostEstimationResponse_totalCost' - The estimated monthly cost to analyze the AWS resources. This value is
-- the sum of the estimated costs to analyze each resource in the @Costs@
-- object in this response.
--
-- 'httpStatus', 'getCostEstimationResponse_httpStatus' - The response's http status code.
newGetCostEstimationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCostEstimationResponse
newGetCostEstimationResponse :: Int -> GetCostEstimationResponse
newGetCostEstimationResponse Int
pHttpStatus_ =
  GetCostEstimationResponse' :: Maybe CostEstimationStatus
-> Maybe CostEstimationResourceCollectionFilter
-> Maybe CostEstimationTimeRange
-> Maybe [ServiceResourceCost]
-> Maybe Text
-> Maybe Double
-> Int
-> GetCostEstimationResponse
GetCostEstimationResponse'
    { $sel:status:GetCostEstimationResponse' :: Maybe CostEstimationStatus
status =
        Maybe CostEstimationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceCollection:GetCostEstimationResponse' :: Maybe CostEstimationResourceCollectionFilter
resourceCollection = Maybe CostEstimationResourceCollectionFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:timeRange:GetCostEstimationResponse' :: Maybe CostEstimationTimeRange
timeRange = Maybe CostEstimationTimeRange
forall a. Maybe a
Prelude.Nothing,
      $sel:costs:GetCostEstimationResponse' :: Maybe [ServiceResourceCost]
costs = Maybe [ServiceResourceCost]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetCostEstimationResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:totalCost:GetCostEstimationResponse' :: Maybe Double
totalCost = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetCostEstimationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of creating this cost estimate. If it\'s still in progress,
-- the status @ONGOING@ is returned. If it is finished, the status
-- @COMPLETED@ is returned.
getCostEstimationResponse_status :: Lens.Lens' GetCostEstimationResponse (Prelude.Maybe CostEstimationStatus)
getCostEstimationResponse_status :: (Maybe CostEstimationStatus -> f (Maybe CostEstimationStatus))
-> GetCostEstimationResponse -> f GetCostEstimationResponse
getCostEstimationResponse_status = (GetCostEstimationResponse -> Maybe CostEstimationStatus)
-> (GetCostEstimationResponse
    -> Maybe CostEstimationStatus -> GetCostEstimationResponse)
-> Lens
     GetCostEstimationResponse
     GetCostEstimationResponse
     (Maybe CostEstimationStatus)
     (Maybe CostEstimationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostEstimationResponse' {Maybe CostEstimationStatus
status :: Maybe CostEstimationStatus
$sel:status:GetCostEstimationResponse' :: GetCostEstimationResponse -> Maybe CostEstimationStatus
status} -> Maybe CostEstimationStatus
status) (\s :: GetCostEstimationResponse
s@GetCostEstimationResponse' {} Maybe CostEstimationStatus
a -> GetCostEstimationResponse
s {$sel:status:GetCostEstimationResponse' :: Maybe CostEstimationStatus
status = Maybe CostEstimationStatus
a} :: GetCostEstimationResponse)

-- | The collection of the AWS resources used to create your monthly DevOps
-- Guru cost estimate.
getCostEstimationResponse_resourceCollection :: Lens.Lens' GetCostEstimationResponse (Prelude.Maybe CostEstimationResourceCollectionFilter)
getCostEstimationResponse_resourceCollection :: (Maybe CostEstimationResourceCollectionFilter
 -> f (Maybe CostEstimationResourceCollectionFilter))
-> GetCostEstimationResponse -> f GetCostEstimationResponse
getCostEstimationResponse_resourceCollection = (GetCostEstimationResponse
 -> Maybe CostEstimationResourceCollectionFilter)
-> (GetCostEstimationResponse
    -> Maybe CostEstimationResourceCollectionFilter
    -> GetCostEstimationResponse)
-> Lens
     GetCostEstimationResponse
     GetCostEstimationResponse
     (Maybe CostEstimationResourceCollectionFilter)
     (Maybe CostEstimationResourceCollectionFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostEstimationResponse' {Maybe CostEstimationResourceCollectionFilter
resourceCollection :: Maybe CostEstimationResourceCollectionFilter
$sel:resourceCollection:GetCostEstimationResponse' :: GetCostEstimationResponse
-> Maybe CostEstimationResourceCollectionFilter
resourceCollection} -> Maybe CostEstimationResourceCollectionFilter
resourceCollection) (\s :: GetCostEstimationResponse
s@GetCostEstimationResponse' {} Maybe CostEstimationResourceCollectionFilter
a -> GetCostEstimationResponse
s {$sel:resourceCollection:GetCostEstimationResponse' :: Maybe CostEstimationResourceCollectionFilter
resourceCollection = Maybe CostEstimationResourceCollectionFilter
a} :: GetCostEstimationResponse)

-- | The start and end time of the cost estimation.
getCostEstimationResponse_timeRange :: Lens.Lens' GetCostEstimationResponse (Prelude.Maybe CostEstimationTimeRange)
getCostEstimationResponse_timeRange :: (Maybe CostEstimationTimeRange
 -> f (Maybe CostEstimationTimeRange))
-> GetCostEstimationResponse -> f GetCostEstimationResponse
getCostEstimationResponse_timeRange = (GetCostEstimationResponse -> Maybe CostEstimationTimeRange)
-> (GetCostEstimationResponse
    -> Maybe CostEstimationTimeRange -> GetCostEstimationResponse)
-> Lens
     GetCostEstimationResponse
     GetCostEstimationResponse
     (Maybe CostEstimationTimeRange)
     (Maybe CostEstimationTimeRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostEstimationResponse' {Maybe CostEstimationTimeRange
timeRange :: Maybe CostEstimationTimeRange
$sel:timeRange:GetCostEstimationResponse' :: GetCostEstimationResponse -> Maybe CostEstimationTimeRange
timeRange} -> Maybe CostEstimationTimeRange
timeRange) (\s :: GetCostEstimationResponse
s@GetCostEstimationResponse' {} Maybe CostEstimationTimeRange
a -> GetCostEstimationResponse
s {$sel:timeRange:GetCostEstimationResponse' :: Maybe CostEstimationTimeRange
timeRange = Maybe CostEstimationTimeRange
a} :: GetCostEstimationResponse)

-- | An array of @ResourceCost@ objects that each contains details about the
-- monthly cost estimate to analyze one of your AWS resources.
getCostEstimationResponse_costs :: Lens.Lens' GetCostEstimationResponse (Prelude.Maybe [ServiceResourceCost])
getCostEstimationResponse_costs :: (Maybe [ServiceResourceCost] -> f (Maybe [ServiceResourceCost]))
-> GetCostEstimationResponse -> f GetCostEstimationResponse
getCostEstimationResponse_costs = (GetCostEstimationResponse -> Maybe [ServiceResourceCost])
-> (GetCostEstimationResponse
    -> Maybe [ServiceResourceCost] -> GetCostEstimationResponse)
-> Lens' GetCostEstimationResponse (Maybe [ServiceResourceCost])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostEstimationResponse' {Maybe [ServiceResourceCost]
costs :: Maybe [ServiceResourceCost]
$sel:costs:GetCostEstimationResponse' :: GetCostEstimationResponse -> Maybe [ServiceResourceCost]
costs} -> Maybe [ServiceResourceCost]
costs) (\s :: GetCostEstimationResponse
s@GetCostEstimationResponse' {} Maybe [ServiceResourceCost]
a -> GetCostEstimationResponse
s {$sel:costs:GetCostEstimationResponse' :: Maybe [ServiceResourceCost]
costs = Maybe [ServiceResourceCost]
a} :: GetCostEstimationResponse) ((Maybe [ServiceResourceCost] -> f (Maybe [ServiceResourceCost]))
 -> GetCostEstimationResponse -> f GetCostEstimationResponse)
-> ((Maybe [ServiceResourceCost]
     -> f (Maybe [ServiceResourceCost]))
    -> Maybe [ServiceResourceCost] -> f (Maybe [ServiceResourceCost]))
-> (Maybe [ServiceResourceCost] -> f (Maybe [ServiceResourceCost]))
-> GetCostEstimationResponse
-> f GetCostEstimationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ServiceResourceCost]
  [ServiceResourceCost]
  [ServiceResourceCost]
  [ServiceResourceCost]
-> Iso
     (Maybe [ServiceResourceCost])
     (Maybe [ServiceResourceCost])
     (Maybe [ServiceResourceCost])
     (Maybe [ServiceResourceCost])
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
  [ServiceResourceCost]
  [ServiceResourceCost]
  [ServiceResourceCost]
  [ServiceResourceCost]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
getCostEstimationResponse_nextToken :: Lens.Lens' GetCostEstimationResponse (Prelude.Maybe Prelude.Text)
getCostEstimationResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetCostEstimationResponse -> f GetCostEstimationResponse
getCostEstimationResponse_nextToken = (GetCostEstimationResponse -> Maybe Text)
-> (GetCostEstimationResponse
    -> Maybe Text -> GetCostEstimationResponse)
-> Lens' GetCostEstimationResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostEstimationResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetCostEstimationResponse' :: GetCostEstimationResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetCostEstimationResponse
s@GetCostEstimationResponse' {} Maybe Text
a -> GetCostEstimationResponse
s {$sel:nextToken:GetCostEstimationResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetCostEstimationResponse)

-- | The estimated monthly cost to analyze the AWS resources. This value is
-- the sum of the estimated costs to analyze each resource in the @Costs@
-- object in this response.
getCostEstimationResponse_totalCost :: Lens.Lens' GetCostEstimationResponse (Prelude.Maybe Prelude.Double)
getCostEstimationResponse_totalCost :: (Maybe Double -> f (Maybe Double))
-> GetCostEstimationResponse -> f GetCostEstimationResponse
getCostEstimationResponse_totalCost = (GetCostEstimationResponse -> Maybe Double)
-> (GetCostEstimationResponse
    -> Maybe Double -> GetCostEstimationResponse)
-> Lens
     GetCostEstimationResponse
     GetCostEstimationResponse
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostEstimationResponse' {Maybe Double
totalCost :: Maybe Double
$sel:totalCost:GetCostEstimationResponse' :: GetCostEstimationResponse -> Maybe Double
totalCost} -> Maybe Double
totalCost) (\s :: GetCostEstimationResponse
s@GetCostEstimationResponse' {} Maybe Double
a -> GetCostEstimationResponse
s {$sel:totalCost:GetCostEstimationResponse' :: Maybe Double
totalCost = Maybe Double
a} :: GetCostEstimationResponse)

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

instance Prelude.NFData GetCostEstimationResponse