{-# 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.AutoScaling.DescribeScheduledActions
-- 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)
--
-- Gets information about the scheduled actions that haven\'t run or that
-- have not reached their end time.
--
-- To describe the scaling activities for scheduled actions that have
-- already run, call the DescribeScalingActivities API.
--
-- This operation returns paginated results.
module Amazonka.AutoScaling.DescribeScheduledActions
  ( -- * Creating a Request
    DescribeScheduledActions (..),
    newDescribeScheduledActions,

    -- * Request Lenses
    describeScheduledActions_startTime,
    describeScheduledActions_nextToken,
    describeScheduledActions_autoScalingGroupName,
    describeScheduledActions_maxRecords,
    describeScheduledActions_endTime,
    describeScheduledActions_scheduledActionNames,

    -- * Destructuring the Response
    DescribeScheduledActionsResponse (..),
    newDescribeScheduledActionsResponse,

    -- * Response Lenses
    describeScheduledActionsResponse_scheduledUpdateGroupActions,
    describeScheduledActionsResponse_nextToken,
    describeScheduledActionsResponse_httpStatus,
  )
where

import Amazonka.AutoScaling.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:/ 'newDescribeScheduledActions' smart constructor.
data DescribeScheduledActions = DescribeScheduledActions'
  { -- | The earliest scheduled start time to return. If scheduled action names
    -- are provided, this parameter is ignored.
    DescribeScheduledActions -> Maybe ISO8601
startTime :: Prelude.Maybe Core.ISO8601,
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeScheduledActions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the Auto Scaling group.
    DescribeScheduledActions -> Maybe Text
autoScalingGroupName :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call. The default value
    -- is @50@ and the maximum value is @100@.
    DescribeScheduledActions -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | The latest scheduled start time to return. If scheduled action names are
    -- provided, this parameter is ignored.
    DescribeScheduledActions -> Maybe ISO8601
endTime :: Prelude.Maybe Core.ISO8601,
    -- | The names of one or more scheduled actions. If you omit this parameter,
    -- all scheduled actions are described. If you specify an unknown scheduled
    -- action, it is ignored with no error.
    --
    -- Array Members: Maximum number of 50 actions.
    DescribeScheduledActions -> Maybe [Text]
scheduledActionNames :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DescribeScheduledActions -> DescribeScheduledActions -> Bool
(DescribeScheduledActions -> DescribeScheduledActions -> Bool)
-> (DescribeScheduledActions -> DescribeScheduledActions -> Bool)
-> Eq DescribeScheduledActions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeScheduledActions -> DescribeScheduledActions -> Bool
$c/= :: DescribeScheduledActions -> DescribeScheduledActions -> Bool
== :: DescribeScheduledActions -> DescribeScheduledActions -> Bool
$c== :: DescribeScheduledActions -> DescribeScheduledActions -> Bool
Prelude.Eq, ReadPrec [DescribeScheduledActions]
ReadPrec DescribeScheduledActions
Int -> ReadS DescribeScheduledActions
ReadS [DescribeScheduledActions]
(Int -> ReadS DescribeScheduledActions)
-> ReadS [DescribeScheduledActions]
-> ReadPrec DescribeScheduledActions
-> ReadPrec [DescribeScheduledActions]
-> Read DescribeScheduledActions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeScheduledActions]
$creadListPrec :: ReadPrec [DescribeScheduledActions]
readPrec :: ReadPrec DescribeScheduledActions
$creadPrec :: ReadPrec DescribeScheduledActions
readList :: ReadS [DescribeScheduledActions]
$creadList :: ReadS [DescribeScheduledActions]
readsPrec :: Int -> ReadS DescribeScheduledActions
$creadsPrec :: Int -> ReadS DescribeScheduledActions
Prelude.Read, Int -> DescribeScheduledActions -> ShowS
[DescribeScheduledActions] -> ShowS
DescribeScheduledActions -> String
(Int -> DescribeScheduledActions -> ShowS)
-> (DescribeScheduledActions -> String)
-> ([DescribeScheduledActions] -> ShowS)
-> Show DescribeScheduledActions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeScheduledActions] -> ShowS
$cshowList :: [DescribeScheduledActions] -> ShowS
show :: DescribeScheduledActions -> String
$cshow :: DescribeScheduledActions -> String
showsPrec :: Int -> DescribeScheduledActions -> ShowS
$cshowsPrec :: Int -> DescribeScheduledActions -> ShowS
Prelude.Show, (forall x.
 DescribeScheduledActions -> Rep DescribeScheduledActions x)
-> (forall x.
    Rep DescribeScheduledActions x -> DescribeScheduledActions)
-> Generic DescribeScheduledActions
forall x.
Rep DescribeScheduledActions x -> DescribeScheduledActions
forall x.
DescribeScheduledActions -> Rep DescribeScheduledActions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeScheduledActions x -> DescribeScheduledActions
$cfrom :: forall x.
DescribeScheduledActions -> Rep DescribeScheduledActions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeScheduledActions' 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:
--
-- 'startTime', 'describeScheduledActions_startTime' - The earliest scheduled start time to return. If scheduled action names
-- are provided, this parameter is ignored.
--
-- 'nextToken', 'describeScheduledActions_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'autoScalingGroupName', 'describeScheduledActions_autoScalingGroupName' - The name of the Auto Scaling group.
--
-- 'maxRecords', 'describeScheduledActions_maxRecords' - The maximum number of items to return with this call. The default value
-- is @50@ and the maximum value is @100@.
--
-- 'endTime', 'describeScheduledActions_endTime' - The latest scheduled start time to return. If scheduled action names are
-- provided, this parameter is ignored.
--
-- 'scheduledActionNames', 'describeScheduledActions_scheduledActionNames' - The names of one or more scheduled actions. If you omit this parameter,
-- all scheduled actions are described. If you specify an unknown scheduled
-- action, it is ignored with no error.
--
-- Array Members: Maximum number of 50 actions.
newDescribeScheduledActions ::
  DescribeScheduledActions
newDescribeScheduledActions :: DescribeScheduledActions
newDescribeScheduledActions =
  DescribeScheduledActions' :: Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe ISO8601
-> Maybe [Text]
-> DescribeScheduledActions
DescribeScheduledActions'
    { $sel:startTime:DescribeScheduledActions' :: Maybe ISO8601
startTime =
        Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeScheduledActions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingGroupName:DescribeScheduledActions' :: Maybe Text
autoScalingGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeScheduledActions' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:DescribeScheduledActions' :: Maybe ISO8601
endTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledActionNames:DescribeScheduledActions' :: Maybe [Text]
scheduledActionNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The earliest scheduled start time to return. If scheduled action names
-- are provided, this parameter is ignored.
describeScheduledActions_startTime :: Lens.Lens' DescribeScheduledActions (Prelude.Maybe Prelude.UTCTime)
describeScheduledActions_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeScheduledActions -> f DescribeScheduledActions
describeScheduledActions_startTime = (DescribeScheduledActions -> Maybe ISO8601)
-> (DescribeScheduledActions
    -> Maybe ISO8601 -> DescribeScheduledActions)
-> Lens
     DescribeScheduledActions
     DescribeScheduledActions
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduledActions' {Maybe ISO8601
startTime :: Maybe ISO8601
$sel:startTime:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe ISO8601
startTime} -> Maybe ISO8601
startTime) (\s :: DescribeScheduledActions
s@DescribeScheduledActions' {} Maybe ISO8601
a -> DescribeScheduledActions
s {$sel:startTime:DescribeScheduledActions' :: Maybe ISO8601
startTime = Maybe ISO8601
a} :: DescribeScheduledActions) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> DescribeScheduledActions -> f DescribeScheduledActions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeScheduledActions
-> f DescribeScheduledActions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
describeScheduledActions_nextToken :: Lens.Lens' DescribeScheduledActions (Prelude.Maybe Prelude.Text)
describeScheduledActions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeScheduledActions -> f DescribeScheduledActions
describeScheduledActions_nextToken = (DescribeScheduledActions -> Maybe Text)
-> (DescribeScheduledActions
    -> Maybe Text -> DescribeScheduledActions)
-> Lens
     DescribeScheduledActions
     DescribeScheduledActions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduledActions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeScheduledActions
s@DescribeScheduledActions' {} Maybe Text
a -> DescribeScheduledActions
s {$sel:nextToken:DescribeScheduledActions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeScheduledActions)

-- | The name of the Auto Scaling group.
describeScheduledActions_autoScalingGroupName :: Lens.Lens' DescribeScheduledActions (Prelude.Maybe Prelude.Text)
describeScheduledActions_autoScalingGroupName :: (Maybe Text -> f (Maybe Text))
-> DescribeScheduledActions -> f DescribeScheduledActions
describeScheduledActions_autoScalingGroupName = (DescribeScheduledActions -> Maybe Text)
-> (DescribeScheduledActions
    -> Maybe Text -> DescribeScheduledActions)
-> Lens
     DescribeScheduledActions
     DescribeScheduledActions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduledActions' {Maybe Text
autoScalingGroupName :: Maybe Text
$sel:autoScalingGroupName:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe Text
autoScalingGroupName} -> Maybe Text
autoScalingGroupName) (\s :: DescribeScheduledActions
s@DescribeScheduledActions' {} Maybe Text
a -> DescribeScheduledActions
s {$sel:autoScalingGroupName:DescribeScheduledActions' :: Maybe Text
autoScalingGroupName = Maybe Text
a} :: DescribeScheduledActions)

-- | The maximum number of items to return with this call. The default value
-- is @50@ and the maximum value is @100@.
describeScheduledActions_maxRecords :: Lens.Lens' DescribeScheduledActions (Prelude.Maybe Prelude.Int)
describeScheduledActions_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeScheduledActions -> f DescribeScheduledActions
describeScheduledActions_maxRecords = (DescribeScheduledActions -> Maybe Int)
-> (DescribeScheduledActions
    -> Maybe Int -> DescribeScheduledActions)
-> Lens
     DescribeScheduledActions
     DescribeScheduledActions
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduledActions' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeScheduledActions
s@DescribeScheduledActions' {} Maybe Int
a -> DescribeScheduledActions
s {$sel:maxRecords:DescribeScheduledActions' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeScheduledActions)

-- | The latest scheduled start time to return. If scheduled action names are
-- provided, this parameter is ignored.
describeScheduledActions_endTime :: Lens.Lens' DescribeScheduledActions (Prelude.Maybe Prelude.UTCTime)
describeScheduledActions_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeScheduledActions -> f DescribeScheduledActions
describeScheduledActions_endTime = (DescribeScheduledActions -> Maybe ISO8601)
-> (DescribeScheduledActions
    -> Maybe ISO8601 -> DescribeScheduledActions)
-> Lens
     DescribeScheduledActions
     DescribeScheduledActions
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduledActions' {Maybe ISO8601
endTime :: Maybe ISO8601
$sel:endTime:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe ISO8601
endTime} -> Maybe ISO8601
endTime) (\s :: DescribeScheduledActions
s@DescribeScheduledActions' {} Maybe ISO8601
a -> DescribeScheduledActions
s {$sel:endTime:DescribeScheduledActions' :: Maybe ISO8601
endTime = Maybe ISO8601
a} :: DescribeScheduledActions) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> DescribeScheduledActions -> f DescribeScheduledActions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeScheduledActions
-> f DescribeScheduledActions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The names of one or more scheduled actions. If you omit this parameter,
-- all scheduled actions are described. If you specify an unknown scheduled
-- action, it is ignored with no error.
--
-- Array Members: Maximum number of 50 actions.
describeScheduledActions_scheduledActionNames :: Lens.Lens' DescribeScheduledActions (Prelude.Maybe [Prelude.Text])
describeScheduledActions_scheduledActionNames :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeScheduledActions -> f DescribeScheduledActions
describeScheduledActions_scheduledActionNames = (DescribeScheduledActions -> Maybe [Text])
-> (DescribeScheduledActions
    -> Maybe [Text] -> DescribeScheduledActions)
-> Lens
     DescribeScheduledActions
     DescribeScheduledActions
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduledActions' {Maybe [Text]
scheduledActionNames :: Maybe [Text]
$sel:scheduledActionNames:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe [Text]
scheduledActionNames} -> Maybe [Text]
scheduledActionNames) (\s :: DescribeScheduledActions
s@DescribeScheduledActions' {} Maybe [Text]
a -> DescribeScheduledActions
s {$sel:scheduledActionNames:DescribeScheduledActions' :: Maybe [Text]
scheduledActionNames = Maybe [Text]
a} :: DescribeScheduledActions) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeScheduledActions -> f DescribeScheduledActions)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeScheduledActions
-> f DescribeScheduledActions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSPager DescribeScheduledActions where
  page :: DescribeScheduledActions
-> AWSResponse DescribeScheduledActions
-> Maybe DescribeScheduledActions
page DescribeScheduledActions
rq AWSResponse DescribeScheduledActions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeScheduledActions
DescribeScheduledActionsResponse
rs
            DescribeScheduledActionsResponse
-> Getting (First Text) DescribeScheduledActionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeScheduledActionsResponse
-> Const (First Text) DescribeScheduledActionsResponse
Lens' DescribeScheduledActionsResponse (Maybe Text)
describeScheduledActionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeScheduledActionsResponse
 -> Const (First Text) DescribeScheduledActionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeScheduledActionsResponse 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 DescribeScheduledActions
forall a. Maybe a
Prelude.Nothing
    | Maybe [ScheduledUpdateGroupAction] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeScheduledActions
DescribeScheduledActionsResponse
rs
            DescribeScheduledActionsResponse
-> Getting
     (First [ScheduledUpdateGroupAction])
     DescribeScheduledActionsResponse
     [ScheduledUpdateGroupAction]
-> Maybe [ScheduledUpdateGroupAction]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ScheduledUpdateGroupAction]
 -> Const
      (First [ScheduledUpdateGroupAction])
      (Maybe [ScheduledUpdateGroupAction]))
-> DescribeScheduledActionsResponse
-> Const
     (First [ScheduledUpdateGroupAction])
     DescribeScheduledActionsResponse
Lens'
  DescribeScheduledActionsResponse
  (Maybe [ScheduledUpdateGroupAction])
describeScheduledActionsResponse_scheduledUpdateGroupActions
              ((Maybe [ScheduledUpdateGroupAction]
  -> Const
       (First [ScheduledUpdateGroupAction])
       (Maybe [ScheduledUpdateGroupAction]))
 -> DescribeScheduledActionsResponse
 -> Const
      (First [ScheduledUpdateGroupAction])
      DescribeScheduledActionsResponse)
-> (([ScheduledUpdateGroupAction]
     -> Const
          (First [ScheduledUpdateGroupAction]) [ScheduledUpdateGroupAction])
    -> Maybe [ScheduledUpdateGroupAction]
    -> Const
         (First [ScheduledUpdateGroupAction])
         (Maybe [ScheduledUpdateGroupAction]))
-> Getting
     (First [ScheduledUpdateGroupAction])
     DescribeScheduledActionsResponse
     [ScheduledUpdateGroupAction]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ScheduledUpdateGroupAction]
 -> Const
      (First [ScheduledUpdateGroupAction]) [ScheduledUpdateGroupAction])
-> Maybe [ScheduledUpdateGroupAction]
-> Const
     (First [ScheduledUpdateGroupAction])
     (Maybe [ScheduledUpdateGroupAction])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeScheduledActions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeScheduledActions -> Maybe DescribeScheduledActions
forall a. a -> Maybe a
Prelude.Just (DescribeScheduledActions -> Maybe DescribeScheduledActions)
-> DescribeScheduledActions -> Maybe DescribeScheduledActions
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeScheduledActions
rq
          DescribeScheduledActions
-> (DescribeScheduledActions -> DescribeScheduledActions)
-> DescribeScheduledActions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeScheduledActions -> Identity DescribeScheduledActions
Lens
  DescribeScheduledActions
  DescribeScheduledActions
  (Maybe Text)
  (Maybe Text)
describeScheduledActions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeScheduledActions -> Identity DescribeScheduledActions)
-> Maybe Text
-> DescribeScheduledActions
-> DescribeScheduledActions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeScheduledActions
DescribeScheduledActionsResponse
rs
          DescribeScheduledActionsResponse
-> Getting (First Text) DescribeScheduledActionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeScheduledActionsResponse
-> Const (First Text) DescribeScheduledActionsResponse
Lens' DescribeScheduledActionsResponse (Maybe Text)
describeScheduledActionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeScheduledActionsResponse
 -> Const (First Text) DescribeScheduledActionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeScheduledActionsResponse 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 DescribeScheduledActions where
  type
    AWSResponse DescribeScheduledActions =
      DescribeScheduledActionsResponse
  request :: DescribeScheduledActions -> Request DescribeScheduledActions
request = Service
-> DescribeScheduledActions -> Request DescribeScheduledActions
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeScheduledActions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeScheduledActions)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeScheduledActions))
-> Logger
-> Service
-> Proxy DescribeScheduledActions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeScheduledActions)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeScheduledActionsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [ScheduledUpdateGroupAction]
-> Maybe Text -> Int -> DescribeScheduledActionsResponse
DescribeScheduledActionsResponse'
            (Maybe [ScheduledUpdateGroupAction]
 -> Maybe Text -> Int -> DescribeScheduledActionsResponse)
-> Either String (Maybe [ScheduledUpdateGroupAction])
-> Either
     String (Maybe Text -> Int -> DescribeScheduledActionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ScheduledUpdateGroupActions"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [ScheduledUpdateGroupAction]))
-> Either String (Maybe [ScheduledUpdateGroupAction])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [ScheduledUpdateGroupAction])
-> [Node] -> Either String (Maybe [ScheduledUpdateGroupAction])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [ScheduledUpdateGroupAction]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String (Maybe Text -> Int -> DescribeScheduledActionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeScheduledActionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextToken")
            Either String (Int -> DescribeScheduledActionsResponse)
-> Either String Int
-> Either String DescribeScheduledActionsResponse
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 DescribeScheduledActions

instance Prelude.NFData DescribeScheduledActions

instance Core.ToHeaders DescribeScheduledActions where
  toHeaders :: DescribeScheduledActions -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeScheduledActions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DescribeScheduledActions where
  toQuery :: DescribeScheduledActions -> QueryString
toQuery DescribeScheduledActions' {Maybe Int
Maybe [Text]
Maybe Text
Maybe ISO8601
scheduledActionNames :: Maybe [Text]
endTime :: Maybe ISO8601
maxRecords :: Maybe Int
autoScalingGroupName :: Maybe Text
nextToken :: Maybe Text
startTime :: Maybe ISO8601
$sel:scheduledActionNames:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe [Text]
$sel:endTime:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe ISO8601
$sel:maxRecords:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe Int
$sel:autoScalingGroupName:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe Text
$sel:nextToken:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe Text
$sel:startTime:DescribeScheduledActions' :: DescribeScheduledActions -> Maybe ISO8601
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeScheduledActions" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2011-01-01" :: Prelude.ByteString),
        ByteString
"StartTime" ByteString -> Maybe ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ISO8601
startTime,
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"AutoScalingGroupName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
autoScalingGroupName,
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords,
        ByteString
"EndTime" ByteString -> Maybe ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ISO8601
endTime,
        ByteString
"ScheduledActionNames"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
scheduledActionNames
            )
      ]

-- | /See:/ 'newDescribeScheduledActionsResponse' smart constructor.
data DescribeScheduledActionsResponse = DescribeScheduledActionsResponse'
  { -- | The scheduled actions.
    DescribeScheduledActionsResponse
-> Maybe [ScheduledUpdateGroupAction]
scheduledUpdateGroupActions :: Prelude.Maybe [ScheduledUpdateGroupAction],
    -- | A string that indicates that the response contains more items than can
    -- be returned in a single response. To receive additional items, specify
    -- this string for the @NextToken@ value when requesting the next set of
    -- items. This value is null when there are no more items to return.
    DescribeScheduledActionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeScheduledActionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeScheduledActionsResponse
-> DescribeScheduledActionsResponse -> Bool
(DescribeScheduledActionsResponse
 -> DescribeScheduledActionsResponse -> Bool)
-> (DescribeScheduledActionsResponse
    -> DescribeScheduledActionsResponse -> Bool)
-> Eq DescribeScheduledActionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeScheduledActionsResponse
-> DescribeScheduledActionsResponse -> Bool
$c/= :: DescribeScheduledActionsResponse
-> DescribeScheduledActionsResponse -> Bool
== :: DescribeScheduledActionsResponse
-> DescribeScheduledActionsResponse -> Bool
$c== :: DescribeScheduledActionsResponse
-> DescribeScheduledActionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeScheduledActionsResponse]
ReadPrec DescribeScheduledActionsResponse
Int -> ReadS DescribeScheduledActionsResponse
ReadS [DescribeScheduledActionsResponse]
(Int -> ReadS DescribeScheduledActionsResponse)
-> ReadS [DescribeScheduledActionsResponse]
-> ReadPrec DescribeScheduledActionsResponse
-> ReadPrec [DescribeScheduledActionsResponse]
-> Read DescribeScheduledActionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeScheduledActionsResponse]
$creadListPrec :: ReadPrec [DescribeScheduledActionsResponse]
readPrec :: ReadPrec DescribeScheduledActionsResponse
$creadPrec :: ReadPrec DescribeScheduledActionsResponse
readList :: ReadS [DescribeScheduledActionsResponse]
$creadList :: ReadS [DescribeScheduledActionsResponse]
readsPrec :: Int -> ReadS DescribeScheduledActionsResponse
$creadsPrec :: Int -> ReadS DescribeScheduledActionsResponse
Prelude.Read, Int -> DescribeScheduledActionsResponse -> ShowS
[DescribeScheduledActionsResponse] -> ShowS
DescribeScheduledActionsResponse -> String
(Int -> DescribeScheduledActionsResponse -> ShowS)
-> (DescribeScheduledActionsResponse -> String)
-> ([DescribeScheduledActionsResponse] -> ShowS)
-> Show DescribeScheduledActionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeScheduledActionsResponse] -> ShowS
$cshowList :: [DescribeScheduledActionsResponse] -> ShowS
show :: DescribeScheduledActionsResponse -> String
$cshow :: DescribeScheduledActionsResponse -> String
showsPrec :: Int -> DescribeScheduledActionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeScheduledActionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeScheduledActionsResponse
 -> Rep DescribeScheduledActionsResponse x)
-> (forall x.
    Rep DescribeScheduledActionsResponse x
    -> DescribeScheduledActionsResponse)
-> Generic DescribeScheduledActionsResponse
forall x.
Rep DescribeScheduledActionsResponse x
-> DescribeScheduledActionsResponse
forall x.
DescribeScheduledActionsResponse
-> Rep DescribeScheduledActionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeScheduledActionsResponse x
-> DescribeScheduledActionsResponse
$cfrom :: forall x.
DescribeScheduledActionsResponse
-> Rep DescribeScheduledActionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeScheduledActionsResponse' 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:
--
-- 'scheduledUpdateGroupActions', 'describeScheduledActionsResponse_scheduledUpdateGroupActions' - The scheduled actions.
--
-- 'nextToken', 'describeScheduledActionsResponse_nextToken' - A string that indicates that the response contains more items than can
-- be returned in a single response. To receive additional items, specify
-- this string for the @NextToken@ value when requesting the next set of
-- items. This value is null when there are no more items to return.
--
-- 'httpStatus', 'describeScheduledActionsResponse_httpStatus' - The response's http status code.
newDescribeScheduledActionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeScheduledActionsResponse
newDescribeScheduledActionsResponse :: Int -> DescribeScheduledActionsResponse
newDescribeScheduledActionsResponse Int
pHttpStatus_ =
  DescribeScheduledActionsResponse' :: Maybe [ScheduledUpdateGroupAction]
-> Maybe Text -> Int -> DescribeScheduledActionsResponse
DescribeScheduledActionsResponse'
    { $sel:scheduledUpdateGroupActions:DescribeScheduledActionsResponse' :: Maybe [ScheduledUpdateGroupAction]
scheduledUpdateGroupActions =
        Maybe [ScheduledUpdateGroupAction]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeScheduledActionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeScheduledActionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The scheduled actions.
describeScheduledActionsResponse_scheduledUpdateGroupActions :: Lens.Lens' DescribeScheduledActionsResponse (Prelude.Maybe [ScheduledUpdateGroupAction])
describeScheduledActionsResponse_scheduledUpdateGroupActions :: (Maybe [ScheduledUpdateGroupAction]
 -> f (Maybe [ScheduledUpdateGroupAction]))
-> DescribeScheduledActionsResponse
-> f DescribeScheduledActionsResponse
describeScheduledActionsResponse_scheduledUpdateGroupActions = (DescribeScheduledActionsResponse
 -> Maybe [ScheduledUpdateGroupAction])
-> (DescribeScheduledActionsResponse
    -> Maybe [ScheduledUpdateGroupAction]
    -> DescribeScheduledActionsResponse)
-> Lens'
     DescribeScheduledActionsResponse
     (Maybe [ScheduledUpdateGroupAction])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduledActionsResponse' {Maybe [ScheduledUpdateGroupAction]
scheduledUpdateGroupActions :: Maybe [ScheduledUpdateGroupAction]
$sel:scheduledUpdateGroupActions:DescribeScheduledActionsResponse' :: DescribeScheduledActionsResponse
-> Maybe [ScheduledUpdateGroupAction]
scheduledUpdateGroupActions} -> Maybe [ScheduledUpdateGroupAction]
scheduledUpdateGroupActions) (\s :: DescribeScheduledActionsResponse
s@DescribeScheduledActionsResponse' {} Maybe [ScheduledUpdateGroupAction]
a -> DescribeScheduledActionsResponse
s {$sel:scheduledUpdateGroupActions:DescribeScheduledActionsResponse' :: Maybe [ScheduledUpdateGroupAction]
scheduledUpdateGroupActions = Maybe [ScheduledUpdateGroupAction]
a} :: DescribeScheduledActionsResponse) ((Maybe [ScheduledUpdateGroupAction]
  -> f (Maybe [ScheduledUpdateGroupAction]))
 -> DescribeScheduledActionsResponse
 -> f DescribeScheduledActionsResponse)
-> ((Maybe [ScheduledUpdateGroupAction]
     -> f (Maybe [ScheduledUpdateGroupAction]))
    -> Maybe [ScheduledUpdateGroupAction]
    -> f (Maybe [ScheduledUpdateGroupAction]))
-> (Maybe [ScheduledUpdateGroupAction]
    -> f (Maybe [ScheduledUpdateGroupAction]))
-> DescribeScheduledActionsResponse
-> f DescribeScheduledActionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ScheduledUpdateGroupAction]
  [ScheduledUpdateGroupAction]
  [ScheduledUpdateGroupAction]
  [ScheduledUpdateGroupAction]
-> Iso
     (Maybe [ScheduledUpdateGroupAction])
     (Maybe [ScheduledUpdateGroupAction])
     (Maybe [ScheduledUpdateGroupAction])
     (Maybe [ScheduledUpdateGroupAction])
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
  [ScheduledUpdateGroupAction]
  [ScheduledUpdateGroupAction]
  [ScheduledUpdateGroupAction]
  [ScheduledUpdateGroupAction]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A string that indicates that the response contains more items than can
-- be returned in a single response. To receive additional items, specify
-- this string for the @NextToken@ value when requesting the next set of
-- items. This value is null when there are no more items to return.
describeScheduledActionsResponse_nextToken :: Lens.Lens' DescribeScheduledActionsResponse (Prelude.Maybe Prelude.Text)
describeScheduledActionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeScheduledActionsResponse
-> f DescribeScheduledActionsResponse
describeScheduledActionsResponse_nextToken = (DescribeScheduledActionsResponse -> Maybe Text)
-> (DescribeScheduledActionsResponse
    -> Maybe Text -> DescribeScheduledActionsResponse)
-> Lens' DescribeScheduledActionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduledActionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeScheduledActionsResponse' :: DescribeScheduledActionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeScheduledActionsResponse
s@DescribeScheduledActionsResponse' {} Maybe Text
a -> DescribeScheduledActionsResponse
s {$sel:nextToken:DescribeScheduledActionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeScheduledActionsResponse)

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

instance
  Prelude.NFData
    DescribeScheduledActionsResponse