{-# 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.GetRightsizingRecommendation
-- 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)
--
-- Creates recommendations that help you save cost by identifying idle and
-- underutilized Amazon EC2 instances.
--
-- Recommendations are generated to either downsize or terminate instances,
-- along with providing savings detail and metrics. For details on
-- calculation and function, see
-- <https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/ce-rightsizing.html Optimizing Your Cost with Rightsizing Recommendations>
-- in the /Billing and Cost Management User Guide/.
module Amazonka.CostExplorer.GetRightsizingRecommendation
  ( -- * Creating a Request
    GetRightsizingRecommendation (..),
    newGetRightsizingRecommendation,

    -- * Request Lenses
    getRightsizingRecommendation_nextPageToken,
    getRightsizingRecommendation_configuration,
    getRightsizingRecommendation_filter,
    getRightsizingRecommendation_pageSize,
    getRightsizingRecommendation_service,

    -- * Destructuring the Response
    GetRightsizingRecommendationResponse (..),
    newGetRightsizingRecommendationResponse,

    -- * Response Lenses
    getRightsizingRecommendationResponse_summary,
    getRightsizingRecommendationResponse_nextPageToken,
    getRightsizingRecommendationResponse_rightsizingRecommendations,
    getRightsizingRecommendationResponse_metadata,
    getRightsizingRecommendationResponse_configuration,
    getRightsizingRecommendationResponse_httpStatus,
  )
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:/ 'newGetRightsizingRecommendation' smart constructor.
data GetRightsizingRecommendation = GetRightsizingRecommendation'
  { -- | The pagination token that indicates the next set of results that you
    -- want to retrieve.
    GetRightsizingRecommendation -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | Enables you to customize recommendations across two attributes. You can
    -- choose to view recommendations for instances within the same instance
    -- families or across different instance families. You can also choose to
    -- view your estimated savings associated with recommendations with
    -- consideration of existing Savings Plans or RI benefits, or neither.
    GetRightsizingRecommendation
-> Maybe RightsizingRecommendationConfiguration
configuration :: Prelude.Maybe RightsizingRecommendationConfiguration,
    GetRightsizingRecommendation -> Maybe Expression
filter' :: Prelude.Maybe Expression,
    -- | The number of recommendations that you want returned in a single
    -- response object.
    GetRightsizingRecommendation -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural,
    -- | The specific service that you want recommendations for. The only valid
    -- value for @GetRightsizingRecommendation@ is \"@AmazonEC2@\".
    GetRightsizingRecommendation -> Text
service :: Prelude.Text
  }
  deriving (GetRightsizingRecommendation
-> GetRightsizingRecommendation -> Bool
(GetRightsizingRecommendation
 -> GetRightsizingRecommendation -> Bool)
-> (GetRightsizingRecommendation
    -> GetRightsizingRecommendation -> Bool)
-> Eq GetRightsizingRecommendation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRightsizingRecommendation
-> GetRightsizingRecommendation -> Bool
$c/= :: GetRightsizingRecommendation
-> GetRightsizingRecommendation -> Bool
== :: GetRightsizingRecommendation
-> GetRightsizingRecommendation -> Bool
$c== :: GetRightsizingRecommendation
-> GetRightsizingRecommendation -> Bool
Prelude.Eq, ReadPrec [GetRightsizingRecommendation]
ReadPrec GetRightsizingRecommendation
Int -> ReadS GetRightsizingRecommendation
ReadS [GetRightsizingRecommendation]
(Int -> ReadS GetRightsizingRecommendation)
-> ReadS [GetRightsizingRecommendation]
-> ReadPrec GetRightsizingRecommendation
-> ReadPrec [GetRightsizingRecommendation]
-> Read GetRightsizingRecommendation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRightsizingRecommendation]
$creadListPrec :: ReadPrec [GetRightsizingRecommendation]
readPrec :: ReadPrec GetRightsizingRecommendation
$creadPrec :: ReadPrec GetRightsizingRecommendation
readList :: ReadS [GetRightsizingRecommendation]
$creadList :: ReadS [GetRightsizingRecommendation]
readsPrec :: Int -> ReadS GetRightsizingRecommendation
$creadsPrec :: Int -> ReadS GetRightsizingRecommendation
Prelude.Read, Int -> GetRightsizingRecommendation -> ShowS
[GetRightsizingRecommendation] -> ShowS
GetRightsizingRecommendation -> String
(Int -> GetRightsizingRecommendation -> ShowS)
-> (GetRightsizingRecommendation -> String)
-> ([GetRightsizingRecommendation] -> ShowS)
-> Show GetRightsizingRecommendation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRightsizingRecommendation] -> ShowS
$cshowList :: [GetRightsizingRecommendation] -> ShowS
show :: GetRightsizingRecommendation -> String
$cshow :: GetRightsizingRecommendation -> String
showsPrec :: Int -> GetRightsizingRecommendation -> ShowS
$cshowsPrec :: Int -> GetRightsizingRecommendation -> ShowS
Prelude.Show, (forall x.
 GetRightsizingRecommendation -> Rep GetRightsizingRecommendation x)
-> (forall x.
    Rep GetRightsizingRecommendation x -> GetRightsizingRecommendation)
-> Generic GetRightsizingRecommendation
forall x.
Rep GetRightsizingRecommendation x -> GetRightsizingRecommendation
forall x.
GetRightsizingRecommendation -> Rep GetRightsizingRecommendation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRightsizingRecommendation x -> GetRightsizingRecommendation
$cfrom :: forall x.
GetRightsizingRecommendation -> Rep GetRightsizingRecommendation x
Prelude.Generic)

-- |
-- Create a value of 'GetRightsizingRecommendation' 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', 'getRightsizingRecommendation_nextPageToken' - The pagination token that indicates the next set of results that you
-- want to retrieve.
--
-- 'configuration', 'getRightsizingRecommendation_configuration' - Enables you to customize recommendations across two attributes. You can
-- choose to view recommendations for instances within the same instance
-- families or across different instance families. You can also choose to
-- view your estimated savings associated with recommendations with
-- consideration of existing Savings Plans or RI benefits, or neither.
--
-- 'filter'', 'getRightsizingRecommendation_filter' - Undocumented member.
--
-- 'pageSize', 'getRightsizingRecommendation_pageSize' - The number of recommendations that you want returned in a single
-- response object.
--
-- 'service', 'getRightsizingRecommendation_service' - The specific service that you want recommendations for. The only valid
-- value for @GetRightsizingRecommendation@ is \"@AmazonEC2@\".
newGetRightsizingRecommendation ::
  -- | 'service'
  Prelude.Text ->
  GetRightsizingRecommendation
newGetRightsizingRecommendation :: Text -> GetRightsizingRecommendation
newGetRightsizingRecommendation Text
pService_ =
  GetRightsizingRecommendation' :: Maybe Text
-> Maybe RightsizingRecommendationConfiguration
-> Maybe Expression
-> Maybe Natural
-> Text
-> GetRightsizingRecommendation
GetRightsizingRecommendation'
    { $sel:nextPageToken:GetRightsizingRecommendation' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configuration:GetRightsizingRecommendation' :: Maybe RightsizingRecommendationConfiguration
configuration = Maybe RightsizingRecommendationConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':GetRightsizingRecommendation' :: Maybe Expression
filter' = Maybe Expression
forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:GetRightsizingRecommendation' :: Maybe Natural
pageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:service:GetRightsizingRecommendation' :: Text
service = Text
pService_
    }

-- | The pagination token that indicates the next set of results that you
-- want to retrieve.
getRightsizingRecommendation_nextPageToken :: Lens.Lens' GetRightsizingRecommendation (Prelude.Maybe Prelude.Text)
getRightsizingRecommendation_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetRightsizingRecommendation -> f GetRightsizingRecommendation
getRightsizingRecommendation_nextPageToken = (GetRightsizingRecommendation -> Maybe Text)
-> (GetRightsizingRecommendation
    -> Maybe Text -> GetRightsizingRecommendation)
-> Lens
     GetRightsizingRecommendation
     GetRightsizingRecommendation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendation' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetRightsizingRecommendation' :: GetRightsizingRecommendation -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetRightsizingRecommendation
s@GetRightsizingRecommendation' {} Maybe Text
a -> GetRightsizingRecommendation
s {$sel:nextPageToken:GetRightsizingRecommendation' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetRightsizingRecommendation)

-- | Enables you to customize recommendations across two attributes. You can
-- choose to view recommendations for instances within the same instance
-- families or across different instance families. You can also choose to
-- view your estimated savings associated with recommendations with
-- consideration of existing Savings Plans or RI benefits, or neither.
getRightsizingRecommendation_configuration :: Lens.Lens' GetRightsizingRecommendation (Prelude.Maybe RightsizingRecommendationConfiguration)
getRightsizingRecommendation_configuration :: (Maybe RightsizingRecommendationConfiguration
 -> f (Maybe RightsizingRecommendationConfiguration))
-> GetRightsizingRecommendation -> f GetRightsizingRecommendation
getRightsizingRecommendation_configuration = (GetRightsizingRecommendation
 -> Maybe RightsizingRecommendationConfiguration)
-> (GetRightsizingRecommendation
    -> Maybe RightsizingRecommendationConfiguration
    -> GetRightsizingRecommendation)
-> Lens
     GetRightsizingRecommendation
     GetRightsizingRecommendation
     (Maybe RightsizingRecommendationConfiguration)
     (Maybe RightsizingRecommendationConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendation' {Maybe RightsizingRecommendationConfiguration
configuration :: Maybe RightsizingRecommendationConfiguration
$sel:configuration:GetRightsizingRecommendation' :: GetRightsizingRecommendation
-> Maybe RightsizingRecommendationConfiguration
configuration} -> Maybe RightsizingRecommendationConfiguration
configuration) (\s :: GetRightsizingRecommendation
s@GetRightsizingRecommendation' {} Maybe RightsizingRecommendationConfiguration
a -> GetRightsizingRecommendation
s {$sel:configuration:GetRightsizingRecommendation' :: Maybe RightsizingRecommendationConfiguration
configuration = Maybe RightsizingRecommendationConfiguration
a} :: GetRightsizingRecommendation)

-- | Undocumented member.
getRightsizingRecommendation_filter :: Lens.Lens' GetRightsizingRecommendation (Prelude.Maybe Expression)
getRightsizingRecommendation_filter :: (Maybe Expression -> f (Maybe Expression))
-> GetRightsizingRecommendation -> f GetRightsizingRecommendation
getRightsizingRecommendation_filter = (GetRightsizingRecommendation -> Maybe Expression)
-> (GetRightsizingRecommendation
    -> Maybe Expression -> GetRightsizingRecommendation)
-> Lens
     GetRightsizingRecommendation
     GetRightsizingRecommendation
     (Maybe Expression)
     (Maybe Expression)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendation' {Maybe Expression
filter' :: Maybe Expression
$sel:filter':GetRightsizingRecommendation' :: GetRightsizingRecommendation -> Maybe Expression
filter'} -> Maybe Expression
filter') (\s :: GetRightsizingRecommendation
s@GetRightsizingRecommendation' {} Maybe Expression
a -> GetRightsizingRecommendation
s {$sel:filter':GetRightsizingRecommendation' :: Maybe Expression
filter' = Maybe Expression
a} :: GetRightsizingRecommendation)

-- | The number of recommendations that you want returned in a single
-- response object.
getRightsizingRecommendation_pageSize :: Lens.Lens' GetRightsizingRecommendation (Prelude.Maybe Prelude.Natural)
getRightsizingRecommendation_pageSize :: (Maybe Natural -> f (Maybe Natural))
-> GetRightsizingRecommendation -> f GetRightsizingRecommendation
getRightsizingRecommendation_pageSize = (GetRightsizingRecommendation -> Maybe Natural)
-> (GetRightsizingRecommendation
    -> Maybe Natural -> GetRightsizingRecommendation)
-> Lens
     GetRightsizingRecommendation
     GetRightsizingRecommendation
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendation' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:GetRightsizingRecommendation' :: GetRightsizingRecommendation -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: GetRightsizingRecommendation
s@GetRightsizingRecommendation' {} Maybe Natural
a -> GetRightsizingRecommendation
s {$sel:pageSize:GetRightsizingRecommendation' :: Maybe Natural
pageSize = Maybe Natural
a} :: GetRightsizingRecommendation)

-- | The specific service that you want recommendations for. The only valid
-- value for @GetRightsizingRecommendation@ is \"@AmazonEC2@\".
getRightsizingRecommendation_service :: Lens.Lens' GetRightsizingRecommendation Prelude.Text
getRightsizingRecommendation_service :: (Text -> f Text)
-> GetRightsizingRecommendation -> f GetRightsizingRecommendation
getRightsizingRecommendation_service = (GetRightsizingRecommendation -> Text)
-> (GetRightsizingRecommendation
    -> Text -> GetRightsizingRecommendation)
-> Lens
     GetRightsizingRecommendation GetRightsizingRecommendation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendation' {Text
service :: Text
$sel:service:GetRightsizingRecommendation' :: GetRightsizingRecommendation -> Text
service} -> Text
service) (\s :: GetRightsizingRecommendation
s@GetRightsizingRecommendation' {} Text
a -> GetRightsizingRecommendation
s {$sel:service:GetRightsizingRecommendation' :: Text
service = Text
a} :: GetRightsizingRecommendation)

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

instance Prelude.NFData GetRightsizingRecommendation

instance Core.ToHeaders GetRightsizingRecommendation where
  toHeaders :: GetRightsizingRecommendation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetRightsizingRecommendation -> 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.GetRightsizingRecommendation" ::
                          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 GetRightsizingRecommendation where
  toJSON :: GetRightsizingRecommendation -> Value
toJSON GetRightsizingRecommendation' {Maybe Natural
Maybe Text
Maybe RightsizingRecommendationConfiguration
Maybe Expression
Text
service :: Text
pageSize :: Maybe Natural
filter' :: Maybe Expression
configuration :: Maybe RightsizingRecommendationConfiguration
nextPageToken :: Maybe Text
$sel:service:GetRightsizingRecommendation' :: GetRightsizingRecommendation -> Text
$sel:pageSize:GetRightsizingRecommendation' :: GetRightsizingRecommendation -> Maybe Natural
$sel:filter':GetRightsizingRecommendation' :: GetRightsizingRecommendation -> Maybe Expression
$sel:configuration:GetRightsizingRecommendation' :: GetRightsizingRecommendation
-> Maybe RightsizingRecommendationConfiguration
$sel:nextPageToken:GetRightsizingRecommendation' :: GetRightsizingRecommendation -> 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
"Configuration" Text -> RightsizingRecommendationConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RightsizingRecommendationConfiguration -> Pair)
-> Maybe RightsizingRecommendationConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RightsizingRecommendationConfiguration
configuration,
            (Text
"Filter" Text -> Expression -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Expression -> Pair) -> Maybe Expression -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Expression
filter',
            (Text
"PageSize" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
pageSize,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Service" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
service)
          ]
      )

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

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

-- | /See:/ 'newGetRightsizingRecommendationResponse' smart constructor.
data GetRightsizingRecommendationResponse = GetRightsizingRecommendationResponse'
  { -- | Summary of this recommendation set.
    GetRightsizingRecommendationResponse
-> Maybe RightsizingRecommendationSummary
summary :: Prelude.Maybe RightsizingRecommendationSummary,
    -- | The token to retrieve the next set of results.
    GetRightsizingRecommendationResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | Recommendations to rightsize resources.
    GetRightsizingRecommendationResponse
-> Maybe [RightsizingRecommendation]
rightsizingRecommendations :: Prelude.Maybe [RightsizingRecommendation],
    -- | Information regarding this specific recommendation set.
    GetRightsizingRecommendationResponse
-> Maybe RightsizingRecommendationMetadata
metadata :: Prelude.Maybe RightsizingRecommendationMetadata,
    -- | Enables you to customize recommendations across two attributes. You can
    -- choose to view recommendations for instances within the same instance
    -- families or across different instance families. You can also choose to
    -- view your estimated savings associated with recommendations with
    -- consideration of existing Savings Plans or RI benefits, or neither.
    GetRightsizingRecommendationResponse
-> Maybe RightsizingRecommendationConfiguration
configuration :: Prelude.Maybe RightsizingRecommendationConfiguration,
    -- | The response's http status code.
    GetRightsizingRecommendationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetRightsizingRecommendationResponse
-> GetRightsizingRecommendationResponse -> Bool
(GetRightsizingRecommendationResponse
 -> GetRightsizingRecommendationResponse -> Bool)
-> (GetRightsizingRecommendationResponse
    -> GetRightsizingRecommendationResponse -> Bool)
-> Eq GetRightsizingRecommendationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRightsizingRecommendationResponse
-> GetRightsizingRecommendationResponse -> Bool
$c/= :: GetRightsizingRecommendationResponse
-> GetRightsizingRecommendationResponse -> Bool
== :: GetRightsizingRecommendationResponse
-> GetRightsizingRecommendationResponse -> Bool
$c== :: GetRightsizingRecommendationResponse
-> GetRightsizingRecommendationResponse -> Bool
Prelude.Eq, ReadPrec [GetRightsizingRecommendationResponse]
ReadPrec GetRightsizingRecommendationResponse
Int -> ReadS GetRightsizingRecommendationResponse
ReadS [GetRightsizingRecommendationResponse]
(Int -> ReadS GetRightsizingRecommendationResponse)
-> ReadS [GetRightsizingRecommendationResponse]
-> ReadPrec GetRightsizingRecommendationResponse
-> ReadPrec [GetRightsizingRecommendationResponse]
-> Read GetRightsizingRecommendationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRightsizingRecommendationResponse]
$creadListPrec :: ReadPrec [GetRightsizingRecommendationResponse]
readPrec :: ReadPrec GetRightsizingRecommendationResponse
$creadPrec :: ReadPrec GetRightsizingRecommendationResponse
readList :: ReadS [GetRightsizingRecommendationResponse]
$creadList :: ReadS [GetRightsizingRecommendationResponse]
readsPrec :: Int -> ReadS GetRightsizingRecommendationResponse
$creadsPrec :: Int -> ReadS GetRightsizingRecommendationResponse
Prelude.Read, Int -> GetRightsizingRecommendationResponse -> ShowS
[GetRightsizingRecommendationResponse] -> ShowS
GetRightsizingRecommendationResponse -> String
(Int -> GetRightsizingRecommendationResponse -> ShowS)
-> (GetRightsizingRecommendationResponse -> String)
-> ([GetRightsizingRecommendationResponse] -> ShowS)
-> Show GetRightsizingRecommendationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRightsizingRecommendationResponse] -> ShowS
$cshowList :: [GetRightsizingRecommendationResponse] -> ShowS
show :: GetRightsizingRecommendationResponse -> String
$cshow :: GetRightsizingRecommendationResponse -> String
showsPrec :: Int -> GetRightsizingRecommendationResponse -> ShowS
$cshowsPrec :: Int -> GetRightsizingRecommendationResponse -> ShowS
Prelude.Show, (forall x.
 GetRightsizingRecommendationResponse
 -> Rep GetRightsizingRecommendationResponse x)
-> (forall x.
    Rep GetRightsizingRecommendationResponse x
    -> GetRightsizingRecommendationResponse)
-> Generic GetRightsizingRecommendationResponse
forall x.
Rep GetRightsizingRecommendationResponse x
-> GetRightsizingRecommendationResponse
forall x.
GetRightsizingRecommendationResponse
-> Rep GetRightsizingRecommendationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRightsizingRecommendationResponse x
-> GetRightsizingRecommendationResponse
$cfrom :: forall x.
GetRightsizingRecommendationResponse
-> Rep GetRightsizingRecommendationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetRightsizingRecommendationResponse' 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:
--
-- 'summary', 'getRightsizingRecommendationResponse_summary' - Summary of this recommendation set.
--
-- 'nextPageToken', 'getRightsizingRecommendationResponse_nextPageToken' - The token to retrieve the next set of results.
--
-- 'rightsizingRecommendations', 'getRightsizingRecommendationResponse_rightsizingRecommendations' - Recommendations to rightsize resources.
--
-- 'metadata', 'getRightsizingRecommendationResponse_metadata' - Information regarding this specific recommendation set.
--
-- 'configuration', 'getRightsizingRecommendationResponse_configuration' - Enables you to customize recommendations across two attributes. You can
-- choose to view recommendations for instances within the same instance
-- families or across different instance families. You can also choose to
-- view your estimated savings associated with recommendations with
-- consideration of existing Savings Plans or RI benefits, or neither.
--
-- 'httpStatus', 'getRightsizingRecommendationResponse_httpStatus' - The response's http status code.
newGetRightsizingRecommendationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetRightsizingRecommendationResponse
newGetRightsizingRecommendationResponse :: Int -> GetRightsizingRecommendationResponse
newGetRightsizingRecommendationResponse Int
pHttpStatus_ =
  GetRightsizingRecommendationResponse' :: Maybe RightsizingRecommendationSummary
-> Maybe Text
-> Maybe [RightsizingRecommendation]
-> Maybe RightsizingRecommendationMetadata
-> Maybe RightsizingRecommendationConfiguration
-> Int
-> GetRightsizingRecommendationResponse
GetRightsizingRecommendationResponse'
    { $sel:summary:GetRightsizingRecommendationResponse' :: Maybe RightsizingRecommendationSummary
summary =
        Maybe RightsizingRecommendationSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:nextPageToken:GetRightsizingRecommendationResponse' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:rightsizingRecommendations:GetRightsizingRecommendationResponse' :: Maybe [RightsizingRecommendation]
rightsizingRecommendations =
        Maybe [RightsizingRecommendation]
forall a. Maybe a
Prelude.Nothing,
      $sel:metadata:GetRightsizingRecommendationResponse' :: Maybe RightsizingRecommendationMetadata
metadata = Maybe RightsizingRecommendationMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:configuration:GetRightsizingRecommendationResponse' :: Maybe RightsizingRecommendationConfiguration
configuration = Maybe RightsizingRecommendationConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetRightsizingRecommendationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Summary of this recommendation set.
getRightsizingRecommendationResponse_summary :: Lens.Lens' GetRightsizingRecommendationResponse (Prelude.Maybe RightsizingRecommendationSummary)
getRightsizingRecommendationResponse_summary :: (Maybe RightsizingRecommendationSummary
 -> f (Maybe RightsizingRecommendationSummary))
-> GetRightsizingRecommendationResponse
-> f GetRightsizingRecommendationResponse
getRightsizingRecommendationResponse_summary = (GetRightsizingRecommendationResponse
 -> Maybe RightsizingRecommendationSummary)
-> (GetRightsizingRecommendationResponse
    -> Maybe RightsizingRecommendationSummary
    -> GetRightsizingRecommendationResponse)
-> Lens
     GetRightsizingRecommendationResponse
     GetRightsizingRecommendationResponse
     (Maybe RightsizingRecommendationSummary)
     (Maybe RightsizingRecommendationSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendationResponse' {Maybe RightsizingRecommendationSummary
summary :: Maybe RightsizingRecommendationSummary
$sel:summary:GetRightsizingRecommendationResponse' :: GetRightsizingRecommendationResponse
-> Maybe RightsizingRecommendationSummary
summary} -> Maybe RightsizingRecommendationSummary
summary) (\s :: GetRightsizingRecommendationResponse
s@GetRightsizingRecommendationResponse' {} Maybe RightsizingRecommendationSummary
a -> GetRightsizingRecommendationResponse
s {$sel:summary:GetRightsizingRecommendationResponse' :: Maybe RightsizingRecommendationSummary
summary = Maybe RightsizingRecommendationSummary
a} :: GetRightsizingRecommendationResponse)

-- | The token to retrieve the next set of results.
getRightsizingRecommendationResponse_nextPageToken :: Lens.Lens' GetRightsizingRecommendationResponse (Prelude.Maybe Prelude.Text)
getRightsizingRecommendationResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetRightsizingRecommendationResponse
-> f GetRightsizingRecommendationResponse
getRightsizingRecommendationResponse_nextPageToken = (GetRightsizingRecommendationResponse -> Maybe Text)
-> (GetRightsizingRecommendationResponse
    -> Maybe Text -> GetRightsizingRecommendationResponse)
-> Lens
     GetRightsizingRecommendationResponse
     GetRightsizingRecommendationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendationResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetRightsizingRecommendationResponse' :: GetRightsizingRecommendationResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetRightsizingRecommendationResponse
s@GetRightsizingRecommendationResponse' {} Maybe Text
a -> GetRightsizingRecommendationResponse
s {$sel:nextPageToken:GetRightsizingRecommendationResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetRightsizingRecommendationResponse)

-- | Recommendations to rightsize resources.
getRightsizingRecommendationResponse_rightsizingRecommendations :: Lens.Lens' GetRightsizingRecommendationResponse (Prelude.Maybe [RightsizingRecommendation])
getRightsizingRecommendationResponse_rightsizingRecommendations :: (Maybe [RightsizingRecommendation]
 -> f (Maybe [RightsizingRecommendation]))
-> GetRightsizingRecommendationResponse
-> f GetRightsizingRecommendationResponse
getRightsizingRecommendationResponse_rightsizingRecommendations = (GetRightsizingRecommendationResponse
 -> Maybe [RightsizingRecommendation])
-> (GetRightsizingRecommendationResponse
    -> Maybe [RightsizingRecommendation]
    -> GetRightsizingRecommendationResponse)
-> Lens
     GetRightsizingRecommendationResponse
     GetRightsizingRecommendationResponse
     (Maybe [RightsizingRecommendation])
     (Maybe [RightsizingRecommendation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendationResponse' {Maybe [RightsizingRecommendation]
rightsizingRecommendations :: Maybe [RightsizingRecommendation]
$sel:rightsizingRecommendations:GetRightsizingRecommendationResponse' :: GetRightsizingRecommendationResponse
-> Maybe [RightsizingRecommendation]
rightsizingRecommendations} -> Maybe [RightsizingRecommendation]
rightsizingRecommendations) (\s :: GetRightsizingRecommendationResponse
s@GetRightsizingRecommendationResponse' {} Maybe [RightsizingRecommendation]
a -> GetRightsizingRecommendationResponse
s {$sel:rightsizingRecommendations:GetRightsizingRecommendationResponse' :: Maybe [RightsizingRecommendation]
rightsizingRecommendations = Maybe [RightsizingRecommendation]
a} :: GetRightsizingRecommendationResponse) ((Maybe [RightsizingRecommendation]
  -> f (Maybe [RightsizingRecommendation]))
 -> GetRightsizingRecommendationResponse
 -> f GetRightsizingRecommendationResponse)
-> ((Maybe [RightsizingRecommendation]
     -> f (Maybe [RightsizingRecommendation]))
    -> Maybe [RightsizingRecommendation]
    -> f (Maybe [RightsizingRecommendation]))
-> (Maybe [RightsizingRecommendation]
    -> f (Maybe [RightsizingRecommendation]))
-> GetRightsizingRecommendationResponse
-> f GetRightsizingRecommendationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RightsizingRecommendation]
  [RightsizingRecommendation]
  [RightsizingRecommendation]
  [RightsizingRecommendation]
-> Iso
     (Maybe [RightsizingRecommendation])
     (Maybe [RightsizingRecommendation])
     (Maybe [RightsizingRecommendation])
     (Maybe [RightsizingRecommendation])
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
  [RightsizingRecommendation]
  [RightsizingRecommendation]
  [RightsizingRecommendation]
  [RightsizingRecommendation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Information regarding this specific recommendation set.
getRightsizingRecommendationResponse_metadata :: Lens.Lens' GetRightsizingRecommendationResponse (Prelude.Maybe RightsizingRecommendationMetadata)
getRightsizingRecommendationResponse_metadata :: (Maybe RightsizingRecommendationMetadata
 -> f (Maybe RightsizingRecommendationMetadata))
-> GetRightsizingRecommendationResponse
-> f GetRightsizingRecommendationResponse
getRightsizingRecommendationResponse_metadata = (GetRightsizingRecommendationResponse
 -> Maybe RightsizingRecommendationMetadata)
-> (GetRightsizingRecommendationResponse
    -> Maybe RightsizingRecommendationMetadata
    -> GetRightsizingRecommendationResponse)
-> Lens
     GetRightsizingRecommendationResponse
     GetRightsizingRecommendationResponse
     (Maybe RightsizingRecommendationMetadata)
     (Maybe RightsizingRecommendationMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendationResponse' {Maybe RightsizingRecommendationMetadata
metadata :: Maybe RightsizingRecommendationMetadata
$sel:metadata:GetRightsizingRecommendationResponse' :: GetRightsizingRecommendationResponse
-> Maybe RightsizingRecommendationMetadata
metadata} -> Maybe RightsizingRecommendationMetadata
metadata) (\s :: GetRightsizingRecommendationResponse
s@GetRightsizingRecommendationResponse' {} Maybe RightsizingRecommendationMetadata
a -> GetRightsizingRecommendationResponse
s {$sel:metadata:GetRightsizingRecommendationResponse' :: Maybe RightsizingRecommendationMetadata
metadata = Maybe RightsizingRecommendationMetadata
a} :: GetRightsizingRecommendationResponse)

-- | Enables you to customize recommendations across two attributes. You can
-- choose to view recommendations for instances within the same instance
-- families or across different instance families. You can also choose to
-- view your estimated savings associated with recommendations with
-- consideration of existing Savings Plans or RI benefits, or neither.
getRightsizingRecommendationResponse_configuration :: Lens.Lens' GetRightsizingRecommendationResponse (Prelude.Maybe RightsizingRecommendationConfiguration)
getRightsizingRecommendationResponse_configuration :: (Maybe RightsizingRecommendationConfiguration
 -> f (Maybe RightsizingRecommendationConfiguration))
-> GetRightsizingRecommendationResponse
-> f GetRightsizingRecommendationResponse
getRightsizingRecommendationResponse_configuration = (GetRightsizingRecommendationResponse
 -> Maybe RightsizingRecommendationConfiguration)
-> (GetRightsizingRecommendationResponse
    -> Maybe RightsizingRecommendationConfiguration
    -> GetRightsizingRecommendationResponse)
-> Lens
     GetRightsizingRecommendationResponse
     GetRightsizingRecommendationResponse
     (Maybe RightsizingRecommendationConfiguration)
     (Maybe RightsizingRecommendationConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRightsizingRecommendationResponse' {Maybe RightsizingRecommendationConfiguration
configuration :: Maybe RightsizingRecommendationConfiguration
$sel:configuration:GetRightsizingRecommendationResponse' :: GetRightsizingRecommendationResponse
-> Maybe RightsizingRecommendationConfiguration
configuration} -> Maybe RightsizingRecommendationConfiguration
configuration) (\s :: GetRightsizingRecommendationResponse
s@GetRightsizingRecommendationResponse' {} Maybe RightsizingRecommendationConfiguration
a -> GetRightsizingRecommendationResponse
s {$sel:configuration:GetRightsizingRecommendationResponse' :: Maybe RightsizingRecommendationConfiguration
configuration = Maybe RightsizingRecommendationConfiguration
a} :: GetRightsizingRecommendationResponse)

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

instance
  Prelude.NFData
    GetRightsizingRecommendationResponse