{-# 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.AutoScalingPlans.GetScalingPlanResourceForecastData
-- 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 the forecast data for a scalable resource.
--
-- Capacity forecasts are represented as predicted values, or data points,
-- that are calculated using historical data points from a specified
-- CloudWatch load metric. Data points are available for up to 56 days.
module Amazonka.AutoScalingPlans.GetScalingPlanResourceForecastData
  ( -- * Creating a Request
    GetScalingPlanResourceForecastData (..),
    newGetScalingPlanResourceForecastData,

    -- * Request Lenses
    getScalingPlanResourceForecastData_scalingPlanName,
    getScalingPlanResourceForecastData_scalingPlanVersion,
    getScalingPlanResourceForecastData_serviceNamespace,
    getScalingPlanResourceForecastData_resourceId,
    getScalingPlanResourceForecastData_scalableDimension,
    getScalingPlanResourceForecastData_forecastDataType,
    getScalingPlanResourceForecastData_startTime,
    getScalingPlanResourceForecastData_endTime,

    -- * Destructuring the Response
    GetScalingPlanResourceForecastDataResponse (..),
    newGetScalingPlanResourceForecastDataResponse,

    -- * Response Lenses
    getScalingPlanResourceForecastDataResponse_httpStatus,
    getScalingPlanResourceForecastDataResponse_datapoints,
  )
where

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

-- | /See:/ 'newGetScalingPlanResourceForecastData' smart constructor.
data GetScalingPlanResourceForecastData = GetScalingPlanResourceForecastData'
  { -- | The name of the scaling plan.
    GetScalingPlanResourceForecastData -> Text
scalingPlanName :: Prelude.Text,
    -- | The version number of the scaling plan. Currently, the only valid value
    -- is @1@.
    GetScalingPlanResourceForecastData -> Integer
scalingPlanVersion :: Prelude.Integer,
    -- | The namespace of the AWS service. The only valid value is @autoscaling@.
    GetScalingPlanResourceForecastData -> ServiceNamespace
serviceNamespace :: ServiceNamespace,
    -- | The ID of the resource. This string consists of a prefix
    -- (@autoScalingGroup@) followed by the name of a specified Auto Scaling
    -- group (@my-asg@). Example: @autoScalingGroup\/my-asg@.
    GetScalingPlanResourceForecastData -> Text
resourceId :: Prelude.Text,
    -- | The scalable dimension for the resource. The only valid value is
    -- @autoscaling:autoScalingGroup:DesiredCapacity@.
    GetScalingPlanResourceForecastData -> ScalableDimension
scalableDimension :: ScalableDimension,
    -- | The type of forecast data to get.
    --
    -- -   @LoadForecast@: The load metric forecast.
    --
    -- -   @CapacityForecast@: The capacity forecast.
    --
    -- -   @ScheduledActionMinCapacity@: The minimum capacity for each
    --     scheduled scaling action. This data is calculated as the larger of
    --     two values: the capacity forecast or the minimum capacity in the
    --     scaling instruction.
    --
    -- -   @ScheduledActionMaxCapacity@: The maximum capacity for each
    --     scheduled scaling action. The calculation used is determined by the
    --     predictive scaling maximum capacity behavior setting in the scaling
    --     instruction.
    GetScalingPlanResourceForecastData -> ForecastDataType
forecastDataType :: ForecastDataType,
    -- | The inclusive start time of the time range for the forecast data to get.
    -- The date and time can be at most 56 days before the current date and
    -- time.
    GetScalingPlanResourceForecastData -> POSIX
startTime :: Core.POSIX,
    -- | The exclusive end time of the time range for the forecast data to get.
    -- The maximum time duration between the start and end time is seven days.
    --
    -- Although this parameter can accept a date and time that is more than two
    -- days in the future, the availability of forecast data has limits. AWS
    -- Auto Scaling only issues forecasts for periods of two days in advance.
    GetScalingPlanResourceForecastData -> POSIX
endTime :: Core.POSIX
  }
  deriving (GetScalingPlanResourceForecastData
-> GetScalingPlanResourceForecastData -> Bool
(GetScalingPlanResourceForecastData
 -> GetScalingPlanResourceForecastData -> Bool)
-> (GetScalingPlanResourceForecastData
    -> GetScalingPlanResourceForecastData -> Bool)
-> Eq GetScalingPlanResourceForecastData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetScalingPlanResourceForecastData
-> GetScalingPlanResourceForecastData -> Bool
$c/= :: GetScalingPlanResourceForecastData
-> GetScalingPlanResourceForecastData -> Bool
== :: GetScalingPlanResourceForecastData
-> GetScalingPlanResourceForecastData -> Bool
$c== :: GetScalingPlanResourceForecastData
-> GetScalingPlanResourceForecastData -> Bool
Prelude.Eq, ReadPrec [GetScalingPlanResourceForecastData]
ReadPrec GetScalingPlanResourceForecastData
Int -> ReadS GetScalingPlanResourceForecastData
ReadS [GetScalingPlanResourceForecastData]
(Int -> ReadS GetScalingPlanResourceForecastData)
-> ReadS [GetScalingPlanResourceForecastData]
-> ReadPrec GetScalingPlanResourceForecastData
-> ReadPrec [GetScalingPlanResourceForecastData]
-> Read GetScalingPlanResourceForecastData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetScalingPlanResourceForecastData]
$creadListPrec :: ReadPrec [GetScalingPlanResourceForecastData]
readPrec :: ReadPrec GetScalingPlanResourceForecastData
$creadPrec :: ReadPrec GetScalingPlanResourceForecastData
readList :: ReadS [GetScalingPlanResourceForecastData]
$creadList :: ReadS [GetScalingPlanResourceForecastData]
readsPrec :: Int -> ReadS GetScalingPlanResourceForecastData
$creadsPrec :: Int -> ReadS GetScalingPlanResourceForecastData
Prelude.Read, Int -> GetScalingPlanResourceForecastData -> ShowS
[GetScalingPlanResourceForecastData] -> ShowS
GetScalingPlanResourceForecastData -> String
(Int -> GetScalingPlanResourceForecastData -> ShowS)
-> (GetScalingPlanResourceForecastData -> String)
-> ([GetScalingPlanResourceForecastData] -> ShowS)
-> Show GetScalingPlanResourceForecastData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetScalingPlanResourceForecastData] -> ShowS
$cshowList :: [GetScalingPlanResourceForecastData] -> ShowS
show :: GetScalingPlanResourceForecastData -> String
$cshow :: GetScalingPlanResourceForecastData -> String
showsPrec :: Int -> GetScalingPlanResourceForecastData -> ShowS
$cshowsPrec :: Int -> GetScalingPlanResourceForecastData -> ShowS
Prelude.Show, (forall x.
 GetScalingPlanResourceForecastData
 -> Rep GetScalingPlanResourceForecastData x)
-> (forall x.
    Rep GetScalingPlanResourceForecastData x
    -> GetScalingPlanResourceForecastData)
-> Generic GetScalingPlanResourceForecastData
forall x.
Rep GetScalingPlanResourceForecastData x
-> GetScalingPlanResourceForecastData
forall x.
GetScalingPlanResourceForecastData
-> Rep GetScalingPlanResourceForecastData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetScalingPlanResourceForecastData x
-> GetScalingPlanResourceForecastData
$cfrom :: forall x.
GetScalingPlanResourceForecastData
-> Rep GetScalingPlanResourceForecastData x
Prelude.Generic)

-- |
-- Create a value of 'GetScalingPlanResourceForecastData' 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:
--
-- 'scalingPlanName', 'getScalingPlanResourceForecastData_scalingPlanName' - The name of the scaling plan.
--
-- 'scalingPlanVersion', 'getScalingPlanResourceForecastData_scalingPlanVersion' - The version number of the scaling plan. Currently, the only valid value
-- is @1@.
--
-- 'serviceNamespace', 'getScalingPlanResourceForecastData_serviceNamespace' - The namespace of the AWS service. The only valid value is @autoscaling@.
--
-- 'resourceId', 'getScalingPlanResourceForecastData_resourceId' - The ID of the resource. This string consists of a prefix
-- (@autoScalingGroup@) followed by the name of a specified Auto Scaling
-- group (@my-asg@). Example: @autoScalingGroup\/my-asg@.
--
-- 'scalableDimension', 'getScalingPlanResourceForecastData_scalableDimension' - The scalable dimension for the resource. The only valid value is
-- @autoscaling:autoScalingGroup:DesiredCapacity@.
--
-- 'forecastDataType', 'getScalingPlanResourceForecastData_forecastDataType' - The type of forecast data to get.
--
-- -   @LoadForecast@: The load metric forecast.
--
-- -   @CapacityForecast@: The capacity forecast.
--
-- -   @ScheduledActionMinCapacity@: The minimum capacity for each
--     scheduled scaling action. This data is calculated as the larger of
--     two values: the capacity forecast or the minimum capacity in the
--     scaling instruction.
--
-- -   @ScheduledActionMaxCapacity@: The maximum capacity for each
--     scheduled scaling action. The calculation used is determined by the
--     predictive scaling maximum capacity behavior setting in the scaling
--     instruction.
--
-- 'startTime', 'getScalingPlanResourceForecastData_startTime' - The inclusive start time of the time range for the forecast data to get.
-- The date and time can be at most 56 days before the current date and
-- time.
--
-- 'endTime', 'getScalingPlanResourceForecastData_endTime' - The exclusive end time of the time range for the forecast data to get.
-- The maximum time duration between the start and end time is seven days.
--
-- Although this parameter can accept a date and time that is more than two
-- days in the future, the availability of forecast data has limits. AWS
-- Auto Scaling only issues forecasts for periods of two days in advance.
newGetScalingPlanResourceForecastData ::
  -- | 'scalingPlanName'
  Prelude.Text ->
  -- | 'scalingPlanVersion'
  Prelude.Integer ->
  -- | 'serviceNamespace'
  ServiceNamespace ->
  -- | 'resourceId'
  Prelude.Text ->
  -- | 'scalableDimension'
  ScalableDimension ->
  -- | 'forecastDataType'
  ForecastDataType ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  Prelude.UTCTime ->
  GetScalingPlanResourceForecastData
newGetScalingPlanResourceForecastData :: Text
-> Integer
-> ServiceNamespace
-> Text
-> ScalableDimension
-> ForecastDataType
-> UTCTime
-> UTCTime
-> GetScalingPlanResourceForecastData
newGetScalingPlanResourceForecastData
  Text
pScalingPlanName_
  Integer
pScalingPlanVersion_
  ServiceNamespace
pServiceNamespace_
  Text
pResourceId_
  ScalableDimension
pScalableDimension_
  ForecastDataType
pForecastDataType_
  UTCTime
pStartTime_
  UTCTime
pEndTime_ =
    GetScalingPlanResourceForecastData' :: Text
-> Integer
-> ServiceNamespace
-> Text
-> ScalableDimension
-> ForecastDataType
-> POSIX
-> POSIX
-> GetScalingPlanResourceForecastData
GetScalingPlanResourceForecastData'
      { $sel:scalingPlanName:GetScalingPlanResourceForecastData' :: Text
scalingPlanName =
          Text
pScalingPlanName_,
        $sel:scalingPlanVersion:GetScalingPlanResourceForecastData' :: Integer
scalingPlanVersion =
          Integer
pScalingPlanVersion_,
        $sel:serviceNamespace:GetScalingPlanResourceForecastData' :: ServiceNamespace
serviceNamespace = ServiceNamespace
pServiceNamespace_,
        $sel:resourceId:GetScalingPlanResourceForecastData' :: Text
resourceId = Text
pResourceId_,
        $sel:scalableDimension:GetScalingPlanResourceForecastData' :: ScalableDimension
scalableDimension = ScalableDimension
pScalableDimension_,
        $sel:forecastDataType:GetScalingPlanResourceForecastData' :: ForecastDataType
forecastDataType = ForecastDataType
pForecastDataType_,
        $sel:startTime:GetScalingPlanResourceForecastData' :: POSIX
startTime =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:endTime:GetScalingPlanResourceForecastData' :: POSIX
endTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_
      }

-- | The name of the scaling plan.
getScalingPlanResourceForecastData_scalingPlanName :: Lens.Lens' GetScalingPlanResourceForecastData Prelude.Text
getScalingPlanResourceForecastData_scalingPlanName :: (Text -> f Text)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
getScalingPlanResourceForecastData_scalingPlanName = (GetScalingPlanResourceForecastData -> Text)
-> (GetScalingPlanResourceForecastData
    -> Text -> GetScalingPlanResourceForecastData)
-> Lens
     GetScalingPlanResourceForecastData
     GetScalingPlanResourceForecastData
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScalingPlanResourceForecastData' {Text
scalingPlanName :: Text
$sel:scalingPlanName:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> Text
scalingPlanName} -> Text
scalingPlanName) (\s :: GetScalingPlanResourceForecastData
s@GetScalingPlanResourceForecastData' {} Text
a -> GetScalingPlanResourceForecastData
s {$sel:scalingPlanName:GetScalingPlanResourceForecastData' :: Text
scalingPlanName = Text
a} :: GetScalingPlanResourceForecastData)

-- | The version number of the scaling plan. Currently, the only valid value
-- is @1@.
getScalingPlanResourceForecastData_scalingPlanVersion :: Lens.Lens' GetScalingPlanResourceForecastData Prelude.Integer
getScalingPlanResourceForecastData_scalingPlanVersion :: (Integer -> f Integer)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
getScalingPlanResourceForecastData_scalingPlanVersion = (GetScalingPlanResourceForecastData -> Integer)
-> (GetScalingPlanResourceForecastData
    -> Integer -> GetScalingPlanResourceForecastData)
-> Lens
     GetScalingPlanResourceForecastData
     GetScalingPlanResourceForecastData
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScalingPlanResourceForecastData' {Integer
scalingPlanVersion :: Integer
$sel:scalingPlanVersion:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> Integer
scalingPlanVersion} -> Integer
scalingPlanVersion) (\s :: GetScalingPlanResourceForecastData
s@GetScalingPlanResourceForecastData' {} Integer
a -> GetScalingPlanResourceForecastData
s {$sel:scalingPlanVersion:GetScalingPlanResourceForecastData' :: Integer
scalingPlanVersion = Integer
a} :: GetScalingPlanResourceForecastData)

-- | The namespace of the AWS service. The only valid value is @autoscaling@.
getScalingPlanResourceForecastData_serviceNamespace :: Lens.Lens' GetScalingPlanResourceForecastData ServiceNamespace
getScalingPlanResourceForecastData_serviceNamespace :: (ServiceNamespace -> f ServiceNamespace)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
getScalingPlanResourceForecastData_serviceNamespace = (GetScalingPlanResourceForecastData -> ServiceNamespace)
-> (GetScalingPlanResourceForecastData
    -> ServiceNamespace -> GetScalingPlanResourceForecastData)
-> Lens
     GetScalingPlanResourceForecastData
     GetScalingPlanResourceForecastData
     ServiceNamespace
     ServiceNamespace
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScalingPlanResourceForecastData' {ServiceNamespace
serviceNamespace :: ServiceNamespace
$sel:serviceNamespace:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> ServiceNamespace
serviceNamespace} -> ServiceNamespace
serviceNamespace) (\s :: GetScalingPlanResourceForecastData
s@GetScalingPlanResourceForecastData' {} ServiceNamespace
a -> GetScalingPlanResourceForecastData
s {$sel:serviceNamespace:GetScalingPlanResourceForecastData' :: ServiceNamespace
serviceNamespace = ServiceNamespace
a} :: GetScalingPlanResourceForecastData)

-- | The ID of the resource. This string consists of a prefix
-- (@autoScalingGroup@) followed by the name of a specified Auto Scaling
-- group (@my-asg@). Example: @autoScalingGroup\/my-asg@.
getScalingPlanResourceForecastData_resourceId :: Lens.Lens' GetScalingPlanResourceForecastData Prelude.Text
getScalingPlanResourceForecastData_resourceId :: (Text -> f Text)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
getScalingPlanResourceForecastData_resourceId = (GetScalingPlanResourceForecastData -> Text)
-> (GetScalingPlanResourceForecastData
    -> Text -> GetScalingPlanResourceForecastData)
-> Lens
     GetScalingPlanResourceForecastData
     GetScalingPlanResourceForecastData
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScalingPlanResourceForecastData' {Text
resourceId :: Text
$sel:resourceId:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> Text
resourceId} -> Text
resourceId) (\s :: GetScalingPlanResourceForecastData
s@GetScalingPlanResourceForecastData' {} Text
a -> GetScalingPlanResourceForecastData
s {$sel:resourceId:GetScalingPlanResourceForecastData' :: Text
resourceId = Text
a} :: GetScalingPlanResourceForecastData)

-- | The scalable dimension for the resource. The only valid value is
-- @autoscaling:autoScalingGroup:DesiredCapacity@.
getScalingPlanResourceForecastData_scalableDimension :: Lens.Lens' GetScalingPlanResourceForecastData ScalableDimension
getScalingPlanResourceForecastData_scalableDimension :: (ScalableDimension -> f ScalableDimension)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
getScalingPlanResourceForecastData_scalableDimension = (GetScalingPlanResourceForecastData -> ScalableDimension)
-> (GetScalingPlanResourceForecastData
    -> ScalableDimension -> GetScalingPlanResourceForecastData)
-> Lens
     GetScalingPlanResourceForecastData
     GetScalingPlanResourceForecastData
     ScalableDimension
     ScalableDimension
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScalingPlanResourceForecastData' {ScalableDimension
scalableDimension :: ScalableDimension
$sel:scalableDimension:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> ScalableDimension
scalableDimension} -> ScalableDimension
scalableDimension) (\s :: GetScalingPlanResourceForecastData
s@GetScalingPlanResourceForecastData' {} ScalableDimension
a -> GetScalingPlanResourceForecastData
s {$sel:scalableDimension:GetScalingPlanResourceForecastData' :: ScalableDimension
scalableDimension = ScalableDimension
a} :: GetScalingPlanResourceForecastData)

-- | The type of forecast data to get.
--
-- -   @LoadForecast@: The load metric forecast.
--
-- -   @CapacityForecast@: The capacity forecast.
--
-- -   @ScheduledActionMinCapacity@: The minimum capacity for each
--     scheduled scaling action. This data is calculated as the larger of
--     two values: the capacity forecast or the minimum capacity in the
--     scaling instruction.
--
-- -   @ScheduledActionMaxCapacity@: The maximum capacity for each
--     scheduled scaling action. The calculation used is determined by the
--     predictive scaling maximum capacity behavior setting in the scaling
--     instruction.
getScalingPlanResourceForecastData_forecastDataType :: Lens.Lens' GetScalingPlanResourceForecastData ForecastDataType
getScalingPlanResourceForecastData_forecastDataType :: (ForecastDataType -> f ForecastDataType)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
getScalingPlanResourceForecastData_forecastDataType = (GetScalingPlanResourceForecastData -> ForecastDataType)
-> (GetScalingPlanResourceForecastData
    -> ForecastDataType -> GetScalingPlanResourceForecastData)
-> Lens
     GetScalingPlanResourceForecastData
     GetScalingPlanResourceForecastData
     ForecastDataType
     ForecastDataType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScalingPlanResourceForecastData' {ForecastDataType
forecastDataType :: ForecastDataType
$sel:forecastDataType:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> ForecastDataType
forecastDataType} -> ForecastDataType
forecastDataType) (\s :: GetScalingPlanResourceForecastData
s@GetScalingPlanResourceForecastData' {} ForecastDataType
a -> GetScalingPlanResourceForecastData
s {$sel:forecastDataType:GetScalingPlanResourceForecastData' :: ForecastDataType
forecastDataType = ForecastDataType
a} :: GetScalingPlanResourceForecastData)

-- | The inclusive start time of the time range for the forecast data to get.
-- The date and time can be at most 56 days before the current date and
-- time.
getScalingPlanResourceForecastData_startTime :: Lens.Lens' GetScalingPlanResourceForecastData Prelude.UTCTime
getScalingPlanResourceForecastData_startTime :: (UTCTime -> f UTCTime)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
getScalingPlanResourceForecastData_startTime = (GetScalingPlanResourceForecastData -> POSIX)
-> (GetScalingPlanResourceForecastData
    -> POSIX -> GetScalingPlanResourceForecastData)
-> Lens
     GetScalingPlanResourceForecastData
     GetScalingPlanResourceForecastData
     POSIX
     POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScalingPlanResourceForecastData' {POSIX
startTime :: POSIX
$sel:startTime:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> POSIX
startTime} -> POSIX
startTime) (\s :: GetScalingPlanResourceForecastData
s@GetScalingPlanResourceForecastData' {} POSIX
a -> GetScalingPlanResourceForecastData
s {$sel:startTime:GetScalingPlanResourceForecastData' :: POSIX
startTime = POSIX
a} :: GetScalingPlanResourceForecastData) ((POSIX -> f POSIX)
 -> GetScalingPlanResourceForecastData
 -> f GetScalingPlanResourceForecastData)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The exclusive end time of the time range for the forecast data to get.
-- The maximum time duration between the start and end time is seven days.
--
-- Although this parameter can accept a date and time that is more than two
-- days in the future, the availability of forecast data has limits. AWS
-- Auto Scaling only issues forecasts for periods of two days in advance.
getScalingPlanResourceForecastData_endTime :: Lens.Lens' GetScalingPlanResourceForecastData Prelude.UTCTime
getScalingPlanResourceForecastData_endTime :: (UTCTime -> f UTCTime)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
getScalingPlanResourceForecastData_endTime = (GetScalingPlanResourceForecastData -> POSIX)
-> (GetScalingPlanResourceForecastData
    -> POSIX -> GetScalingPlanResourceForecastData)
-> Lens
     GetScalingPlanResourceForecastData
     GetScalingPlanResourceForecastData
     POSIX
     POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScalingPlanResourceForecastData' {POSIX
endTime :: POSIX
$sel:endTime:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> POSIX
endTime} -> POSIX
endTime) (\s :: GetScalingPlanResourceForecastData
s@GetScalingPlanResourceForecastData' {} POSIX
a -> GetScalingPlanResourceForecastData
s {$sel:endTime:GetScalingPlanResourceForecastData' :: POSIX
endTime = POSIX
a} :: GetScalingPlanResourceForecastData) ((POSIX -> f POSIX)
 -> GetScalingPlanResourceForecastData
 -> f GetScalingPlanResourceForecastData)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetScalingPlanResourceForecastData
-> f GetScalingPlanResourceForecastData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance
  Core.AWSRequest
    GetScalingPlanResourceForecastData
  where
  type
    AWSResponse GetScalingPlanResourceForecastData =
      GetScalingPlanResourceForecastDataResponse
  request :: GetScalingPlanResourceForecastData
-> Request GetScalingPlanResourceForecastData
request = Service
-> GetScalingPlanResourceForecastData
-> Request GetScalingPlanResourceForecastData
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetScalingPlanResourceForecastData
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetScalingPlanResourceForecastData)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetScalingPlanResourceForecastData))
-> Logger
-> Service
-> Proxy GetScalingPlanResourceForecastData
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetScalingPlanResourceForecastData)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> [Datapoint] -> GetScalingPlanResourceForecastDataResponse
GetScalingPlanResourceForecastDataResponse'
            (Int -> [Datapoint] -> GetScalingPlanResourceForecastDataResponse)
-> Either String Int
-> Either
     String ([Datapoint] -> GetScalingPlanResourceForecastDataResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
              Either
  String ([Datapoint] -> GetScalingPlanResourceForecastDataResponse)
-> Either String [Datapoint]
-> Either String GetScalingPlanResourceForecastDataResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Datapoint])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Datapoints" Either String (Maybe [Datapoint])
-> [Datapoint] -> Either String [Datapoint]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Datapoint]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    GetScalingPlanResourceForecastData

instance
  Prelude.NFData
    GetScalingPlanResourceForecastData

instance
  Core.ToHeaders
    GetScalingPlanResourceForecastData
  where
  toHeaders :: GetScalingPlanResourceForecastData -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetScalingPlanResourceForecastData -> 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
"AnyScaleScalingPlannerFrontendService.GetScalingPlanResourceForecastData" ::
                          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
    GetScalingPlanResourceForecastData
  where
  toJSON :: GetScalingPlanResourceForecastData -> Value
toJSON GetScalingPlanResourceForecastData' {Integer
Text
POSIX
ForecastDataType
ScalableDimension
ServiceNamespace
endTime :: POSIX
startTime :: POSIX
forecastDataType :: ForecastDataType
scalableDimension :: ScalableDimension
resourceId :: Text
serviceNamespace :: ServiceNamespace
scalingPlanVersion :: Integer
scalingPlanName :: Text
$sel:endTime:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> POSIX
$sel:startTime:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> POSIX
$sel:forecastDataType:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> ForecastDataType
$sel:scalableDimension:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> ScalableDimension
$sel:resourceId:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> Text
$sel:serviceNamespace:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> ServiceNamespace
$sel:scalingPlanVersion:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> Integer
$sel:scalingPlanName:GetScalingPlanResourceForecastData' :: GetScalingPlanResourceForecastData -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ScalingPlanName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
scalingPlanName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ScalingPlanVersion" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Integer
scalingPlanVersion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ServiceNamespace" Text -> ServiceNamespace -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ServiceNamespace
serviceNamespace),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ScalableDimension" Text -> ScalableDimension -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ScalableDimension
scalableDimension),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ForecastDataType" Text -> ForecastDataType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ForecastDataType
forecastDataType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
startTime),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
endTime)
          ]
      )

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

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

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

-- |
-- Create a value of 'GetScalingPlanResourceForecastDataResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'getScalingPlanResourceForecastDataResponse_httpStatus' - The response's http status code.
--
-- 'datapoints', 'getScalingPlanResourceForecastDataResponse_datapoints' - The data points to return.
newGetScalingPlanResourceForecastDataResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetScalingPlanResourceForecastDataResponse
newGetScalingPlanResourceForecastDataResponse :: Int -> GetScalingPlanResourceForecastDataResponse
newGetScalingPlanResourceForecastDataResponse
  Int
pHttpStatus_ =
    GetScalingPlanResourceForecastDataResponse' :: Int -> [Datapoint] -> GetScalingPlanResourceForecastDataResponse
GetScalingPlanResourceForecastDataResponse'
      { $sel:httpStatus:GetScalingPlanResourceForecastDataResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:datapoints:GetScalingPlanResourceForecastDataResponse' :: [Datapoint]
datapoints = [Datapoint]
forall a. Monoid a => a
Prelude.mempty
      }

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

-- | The data points to return.
getScalingPlanResourceForecastDataResponse_datapoints :: Lens.Lens' GetScalingPlanResourceForecastDataResponse [Datapoint]
getScalingPlanResourceForecastDataResponse_datapoints :: ([Datapoint] -> f [Datapoint])
-> GetScalingPlanResourceForecastDataResponse
-> f GetScalingPlanResourceForecastDataResponse
getScalingPlanResourceForecastDataResponse_datapoints = (GetScalingPlanResourceForecastDataResponse -> [Datapoint])
-> (GetScalingPlanResourceForecastDataResponse
    -> [Datapoint] -> GetScalingPlanResourceForecastDataResponse)
-> Lens
     GetScalingPlanResourceForecastDataResponse
     GetScalingPlanResourceForecastDataResponse
     [Datapoint]
     [Datapoint]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetScalingPlanResourceForecastDataResponse' {[Datapoint]
datapoints :: [Datapoint]
$sel:datapoints:GetScalingPlanResourceForecastDataResponse' :: GetScalingPlanResourceForecastDataResponse -> [Datapoint]
datapoints} -> [Datapoint]
datapoints) (\s :: GetScalingPlanResourceForecastDataResponse
s@GetScalingPlanResourceForecastDataResponse' {} [Datapoint]
a -> GetScalingPlanResourceForecastDataResponse
s {$sel:datapoints:GetScalingPlanResourceForecastDataResponse' :: [Datapoint]
datapoints = [Datapoint]
a} :: GetScalingPlanResourceForecastDataResponse) (([Datapoint] -> f [Datapoint])
 -> GetScalingPlanResourceForecastDataResponse
 -> f GetScalingPlanResourceForecastDataResponse)
-> (([Datapoint] -> f [Datapoint]) -> [Datapoint] -> f [Datapoint])
-> ([Datapoint] -> f [Datapoint])
-> GetScalingPlanResourceForecastDataResponse
-> f GetScalingPlanResourceForecastDataResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Datapoint] -> f [Datapoint]) -> [Datapoint] -> f [Datapoint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    GetScalingPlanResourceForecastDataResponse