{-# 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.SSM.DescribeMaintenanceWindowTasks
-- 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)
--
-- Lists the tasks in a maintenance window.
--
-- For maintenance window tasks without a specified target, you can\'t
-- supply values for @--max-errors@ and @--max-concurrency@. Instead, the
-- system inserts a placeholder value of @1@, which may be reported in the
-- response to this command. These values don\'t affect the running of your
-- task and can be ignored.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeMaintenanceWindowTasks
  ( -- * Creating a Request
    DescribeMaintenanceWindowTasks (..),
    newDescribeMaintenanceWindowTasks,

    -- * Request Lenses
    describeMaintenanceWindowTasks_filters,
    describeMaintenanceWindowTasks_nextToken,
    describeMaintenanceWindowTasks_maxResults,
    describeMaintenanceWindowTasks_windowId,

    -- * Destructuring the Response
    DescribeMaintenanceWindowTasksResponse (..),
    newDescribeMaintenanceWindowTasksResponse,

    -- * Response Lenses
    describeMaintenanceWindowTasksResponse_tasks,
    describeMaintenanceWindowTasksResponse_nextToken,
    describeMaintenanceWindowTasksResponse_httpStatus,
  )
where

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
import Amazonka.SSM.Types

-- | /See:/ 'newDescribeMaintenanceWindowTasks' smart constructor.
data DescribeMaintenanceWindowTasks = DescribeMaintenanceWindowTasks'
  { -- | Optional filters used to narrow down the scope of the returned tasks.
    -- The supported filter keys are @WindowTaskId@, @TaskArn@, @Priority@, and
    -- @TaskType@.
    DescribeMaintenanceWindowTasks -> Maybe [MaintenanceWindowFilter]
filters :: Prelude.Maybe [MaintenanceWindowFilter],
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeMaintenanceWindowTasks -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    DescribeMaintenanceWindowTasks -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the maintenance window whose tasks should be retrieved.
    DescribeMaintenanceWindowTasks -> Text
windowId :: Prelude.Text
  }
  deriving (DescribeMaintenanceWindowTasks
-> DescribeMaintenanceWindowTasks -> Bool
(DescribeMaintenanceWindowTasks
 -> DescribeMaintenanceWindowTasks -> Bool)
-> (DescribeMaintenanceWindowTasks
    -> DescribeMaintenanceWindowTasks -> Bool)
-> Eq DescribeMaintenanceWindowTasks
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMaintenanceWindowTasks
-> DescribeMaintenanceWindowTasks -> Bool
$c/= :: DescribeMaintenanceWindowTasks
-> DescribeMaintenanceWindowTasks -> Bool
== :: DescribeMaintenanceWindowTasks
-> DescribeMaintenanceWindowTasks -> Bool
$c== :: DescribeMaintenanceWindowTasks
-> DescribeMaintenanceWindowTasks -> Bool
Prelude.Eq, ReadPrec [DescribeMaintenanceWindowTasks]
ReadPrec DescribeMaintenanceWindowTasks
Int -> ReadS DescribeMaintenanceWindowTasks
ReadS [DescribeMaintenanceWindowTasks]
(Int -> ReadS DescribeMaintenanceWindowTasks)
-> ReadS [DescribeMaintenanceWindowTasks]
-> ReadPrec DescribeMaintenanceWindowTasks
-> ReadPrec [DescribeMaintenanceWindowTasks]
-> Read DescribeMaintenanceWindowTasks
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMaintenanceWindowTasks]
$creadListPrec :: ReadPrec [DescribeMaintenanceWindowTasks]
readPrec :: ReadPrec DescribeMaintenanceWindowTasks
$creadPrec :: ReadPrec DescribeMaintenanceWindowTasks
readList :: ReadS [DescribeMaintenanceWindowTasks]
$creadList :: ReadS [DescribeMaintenanceWindowTasks]
readsPrec :: Int -> ReadS DescribeMaintenanceWindowTasks
$creadsPrec :: Int -> ReadS DescribeMaintenanceWindowTasks
Prelude.Read, Int -> DescribeMaintenanceWindowTasks -> ShowS
[DescribeMaintenanceWindowTasks] -> ShowS
DescribeMaintenanceWindowTasks -> String
(Int -> DescribeMaintenanceWindowTasks -> ShowS)
-> (DescribeMaintenanceWindowTasks -> String)
-> ([DescribeMaintenanceWindowTasks] -> ShowS)
-> Show DescribeMaintenanceWindowTasks
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMaintenanceWindowTasks] -> ShowS
$cshowList :: [DescribeMaintenanceWindowTasks] -> ShowS
show :: DescribeMaintenanceWindowTasks -> String
$cshow :: DescribeMaintenanceWindowTasks -> String
showsPrec :: Int -> DescribeMaintenanceWindowTasks -> ShowS
$cshowsPrec :: Int -> DescribeMaintenanceWindowTasks -> ShowS
Prelude.Show, (forall x.
 DescribeMaintenanceWindowTasks
 -> Rep DescribeMaintenanceWindowTasks x)
-> (forall x.
    Rep DescribeMaintenanceWindowTasks x
    -> DescribeMaintenanceWindowTasks)
-> Generic DescribeMaintenanceWindowTasks
forall x.
Rep DescribeMaintenanceWindowTasks x
-> DescribeMaintenanceWindowTasks
forall x.
DescribeMaintenanceWindowTasks
-> Rep DescribeMaintenanceWindowTasks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMaintenanceWindowTasks x
-> DescribeMaintenanceWindowTasks
$cfrom :: forall x.
DescribeMaintenanceWindowTasks
-> Rep DescribeMaintenanceWindowTasks x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMaintenanceWindowTasks' 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:
--
-- 'filters', 'describeMaintenanceWindowTasks_filters' - Optional filters used to narrow down the scope of the returned tasks.
-- The supported filter keys are @WindowTaskId@, @TaskArn@, @Priority@, and
-- @TaskType@.
--
-- 'nextToken', 'describeMaintenanceWindowTasks_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeMaintenanceWindowTasks_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
--
-- 'windowId', 'describeMaintenanceWindowTasks_windowId' - The ID of the maintenance window whose tasks should be retrieved.
newDescribeMaintenanceWindowTasks ::
  -- | 'windowId'
  Prelude.Text ->
  DescribeMaintenanceWindowTasks
newDescribeMaintenanceWindowTasks :: Text -> DescribeMaintenanceWindowTasks
newDescribeMaintenanceWindowTasks Text
pWindowId_ =
  DescribeMaintenanceWindowTasks' :: Maybe [MaintenanceWindowFilter]
-> Maybe Text
-> Maybe Natural
-> Text
-> DescribeMaintenanceWindowTasks
DescribeMaintenanceWindowTasks'
    { $sel:filters:DescribeMaintenanceWindowTasks' :: Maybe [MaintenanceWindowFilter]
filters =
        Maybe [MaintenanceWindowFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeMaintenanceWindowTasks' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeMaintenanceWindowTasks' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:windowId:DescribeMaintenanceWindowTasks' :: Text
windowId = Text
pWindowId_
    }

-- | Optional filters used to narrow down the scope of the returned tasks.
-- The supported filter keys are @WindowTaskId@, @TaskArn@, @Priority@, and
-- @TaskType@.
describeMaintenanceWindowTasks_filters :: Lens.Lens' DescribeMaintenanceWindowTasks (Prelude.Maybe [MaintenanceWindowFilter])
describeMaintenanceWindowTasks_filters :: (Maybe [MaintenanceWindowFilter]
 -> f (Maybe [MaintenanceWindowFilter]))
-> DescribeMaintenanceWindowTasks
-> f DescribeMaintenanceWindowTasks
describeMaintenanceWindowTasks_filters = (DescribeMaintenanceWindowTasks -> Maybe [MaintenanceWindowFilter])
-> (DescribeMaintenanceWindowTasks
    -> Maybe [MaintenanceWindowFilter]
    -> DescribeMaintenanceWindowTasks)
-> Lens
     DescribeMaintenanceWindowTasks
     DescribeMaintenanceWindowTasks
     (Maybe [MaintenanceWindowFilter])
     (Maybe [MaintenanceWindowFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowTasks' {Maybe [MaintenanceWindowFilter]
filters :: Maybe [MaintenanceWindowFilter]
$sel:filters:DescribeMaintenanceWindowTasks' :: DescribeMaintenanceWindowTasks -> Maybe [MaintenanceWindowFilter]
filters} -> Maybe [MaintenanceWindowFilter]
filters) (\s :: DescribeMaintenanceWindowTasks
s@DescribeMaintenanceWindowTasks' {} Maybe [MaintenanceWindowFilter]
a -> DescribeMaintenanceWindowTasks
s {$sel:filters:DescribeMaintenanceWindowTasks' :: Maybe [MaintenanceWindowFilter]
filters = Maybe [MaintenanceWindowFilter]
a} :: DescribeMaintenanceWindowTasks) ((Maybe [MaintenanceWindowFilter]
  -> f (Maybe [MaintenanceWindowFilter]))
 -> DescribeMaintenanceWindowTasks
 -> f DescribeMaintenanceWindowTasks)
-> ((Maybe [MaintenanceWindowFilter]
     -> f (Maybe [MaintenanceWindowFilter]))
    -> Maybe [MaintenanceWindowFilter]
    -> f (Maybe [MaintenanceWindowFilter]))
-> (Maybe [MaintenanceWindowFilter]
    -> f (Maybe [MaintenanceWindowFilter]))
-> DescribeMaintenanceWindowTasks
-> f DescribeMaintenanceWindowTasks
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MaintenanceWindowFilter]
  [MaintenanceWindowFilter]
  [MaintenanceWindowFilter]
  [MaintenanceWindowFilter]
-> Iso
     (Maybe [MaintenanceWindowFilter])
     (Maybe [MaintenanceWindowFilter])
     (Maybe [MaintenanceWindowFilter])
     (Maybe [MaintenanceWindowFilter])
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
  [MaintenanceWindowFilter]
  [MaintenanceWindowFilter]
  [MaintenanceWindowFilter]
  [MaintenanceWindowFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
describeMaintenanceWindowTasks_maxResults :: Lens.Lens' DescribeMaintenanceWindowTasks (Prelude.Maybe Prelude.Natural)
describeMaintenanceWindowTasks_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeMaintenanceWindowTasks
-> f DescribeMaintenanceWindowTasks
describeMaintenanceWindowTasks_maxResults = (DescribeMaintenanceWindowTasks -> Maybe Natural)
-> (DescribeMaintenanceWindowTasks
    -> Maybe Natural -> DescribeMaintenanceWindowTasks)
-> Lens
     DescribeMaintenanceWindowTasks
     DescribeMaintenanceWindowTasks
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowTasks' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeMaintenanceWindowTasks' :: DescribeMaintenanceWindowTasks -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeMaintenanceWindowTasks
s@DescribeMaintenanceWindowTasks' {} Maybe Natural
a -> DescribeMaintenanceWindowTasks
s {$sel:maxResults:DescribeMaintenanceWindowTasks' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeMaintenanceWindowTasks)

-- | The ID of the maintenance window whose tasks should be retrieved.
describeMaintenanceWindowTasks_windowId :: Lens.Lens' DescribeMaintenanceWindowTasks Prelude.Text
describeMaintenanceWindowTasks_windowId :: (Text -> f Text)
-> DescribeMaintenanceWindowTasks
-> f DescribeMaintenanceWindowTasks
describeMaintenanceWindowTasks_windowId = (DescribeMaintenanceWindowTasks -> Text)
-> (DescribeMaintenanceWindowTasks
    -> Text -> DescribeMaintenanceWindowTasks)
-> Lens
     DescribeMaintenanceWindowTasks
     DescribeMaintenanceWindowTasks
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowTasks' {Text
windowId :: Text
$sel:windowId:DescribeMaintenanceWindowTasks' :: DescribeMaintenanceWindowTasks -> Text
windowId} -> Text
windowId) (\s :: DescribeMaintenanceWindowTasks
s@DescribeMaintenanceWindowTasks' {} Text
a -> DescribeMaintenanceWindowTasks
s {$sel:windowId:DescribeMaintenanceWindowTasks' :: Text
windowId = Text
a} :: DescribeMaintenanceWindowTasks)

instance Core.AWSPager DescribeMaintenanceWindowTasks where
  page :: DescribeMaintenanceWindowTasks
-> AWSResponse DescribeMaintenanceWindowTasks
-> Maybe DescribeMaintenanceWindowTasks
page DescribeMaintenanceWindowTasks
rq AWSResponse DescribeMaintenanceWindowTasks
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeMaintenanceWindowTasks
DescribeMaintenanceWindowTasksResponse
rs
            DescribeMaintenanceWindowTasksResponse
-> Getting (First Text) DescribeMaintenanceWindowTasksResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeMaintenanceWindowTasksResponse
-> Const (First Text) DescribeMaintenanceWindowTasksResponse
Lens' DescribeMaintenanceWindowTasksResponse (Maybe Text)
describeMaintenanceWindowTasksResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeMaintenanceWindowTasksResponse
 -> Const (First Text) DescribeMaintenanceWindowTasksResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeMaintenanceWindowTasksResponse 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 DescribeMaintenanceWindowTasks
forall a. Maybe a
Prelude.Nothing
    | Maybe [MaintenanceWindowTask] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeMaintenanceWindowTasks
DescribeMaintenanceWindowTasksResponse
rs
            DescribeMaintenanceWindowTasksResponse
-> Getting
     (First [MaintenanceWindowTask])
     DescribeMaintenanceWindowTasksResponse
     [MaintenanceWindowTask]
-> Maybe [MaintenanceWindowTask]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [MaintenanceWindowTask]
 -> Const
      (First [MaintenanceWindowTask]) (Maybe [MaintenanceWindowTask]))
-> DescribeMaintenanceWindowTasksResponse
-> Const
     (First [MaintenanceWindowTask])
     DescribeMaintenanceWindowTasksResponse
Lens'
  DescribeMaintenanceWindowTasksResponse
  (Maybe [MaintenanceWindowTask])
describeMaintenanceWindowTasksResponse_tasks
              ((Maybe [MaintenanceWindowTask]
  -> Const
       (First [MaintenanceWindowTask]) (Maybe [MaintenanceWindowTask]))
 -> DescribeMaintenanceWindowTasksResponse
 -> Const
      (First [MaintenanceWindowTask])
      DescribeMaintenanceWindowTasksResponse)
-> (([MaintenanceWindowTask]
     -> Const (First [MaintenanceWindowTask]) [MaintenanceWindowTask])
    -> Maybe [MaintenanceWindowTask]
    -> Const
         (First [MaintenanceWindowTask]) (Maybe [MaintenanceWindowTask]))
-> Getting
     (First [MaintenanceWindowTask])
     DescribeMaintenanceWindowTasksResponse
     [MaintenanceWindowTask]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MaintenanceWindowTask]
 -> Const (First [MaintenanceWindowTask]) [MaintenanceWindowTask])
-> Maybe [MaintenanceWindowTask]
-> Const
     (First [MaintenanceWindowTask]) (Maybe [MaintenanceWindowTask])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeMaintenanceWindowTasks
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeMaintenanceWindowTasks
-> Maybe DescribeMaintenanceWindowTasks
forall a. a -> Maybe a
Prelude.Just (DescribeMaintenanceWindowTasks
 -> Maybe DescribeMaintenanceWindowTasks)
-> DescribeMaintenanceWindowTasks
-> Maybe DescribeMaintenanceWindowTasks
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeMaintenanceWindowTasks
rq
          DescribeMaintenanceWindowTasks
-> (DescribeMaintenanceWindowTasks
    -> DescribeMaintenanceWindowTasks)
-> DescribeMaintenanceWindowTasks
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeMaintenanceWindowTasks
-> Identity DescribeMaintenanceWindowTasks
Lens
  DescribeMaintenanceWindowTasks
  DescribeMaintenanceWindowTasks
  (Maybe Text)
  (Maybe Text)
describeMaintenanceWindowTasks_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeMaintenanceWindowTasks
 -> Identity DescribeMaintenanceWindowTasks)
-> Maybe Text
-> DescribeMaintenanceWindowTasks
-> DescribeMaintenanceWindowTasks
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeMaintenanceWindowTasks
DescribeMaintenanceWindowTasksResponse
rs
          DescribeMaintenanceWindowTasksResponse
-> Getting (First Text) DescribeMaintenanceWindowTasksResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeMaintenanceWindowTasksResponse
-> Const (First Text) DescribeMaintenanceWindowTasksResponse
Lens' DescribeMaintenanceWindowTasksResponse (Maybe Text)
describeMaintenanceWindowTasksResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeMaintenanceWindowTasksResponse
 -> Const (First Text) DescribeMaintenanceWindowTasksResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeMaintenanceWindowTasksResponse 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
    DescribeMaintenanceWindowTasks
  where
  type
    AWSResponse DescribeMaintenanceWindowTasks =
      DescribeMaintenanceWindowTasksResponse
  request :: DescribeMaintenanceWindowTasks
-> Request DescribeMaintenanceWindowTasks
request = Service
-> DescribeMaintenanceWindowTasks
-> Request DescribeMaintenanceWindowTasks
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeMaintenanceWindowTasks
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeMaintenanceWindowTasks)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeMaintenanceWindowTasks))
-> Logger
-> Service
-> Proxy DescribeMaintenanceWindowTasks
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeMaintenanceWindowTasks)))
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 [MaintenanceWindowTask]
-> Maybe Text -> Int -> DescribeMaintenanceWindowTasksResponse
DescribeMaintenanceWindowTasksResponse'
            (Maybe [MaintenanceWindowTask]
 -> Maybe Text -> Int -> DescribeMaintenanceWindowTasksResponse)
-> Either String (Maybe [MaintenanceWindowTask])
-> Either
     String
     (Maybe Text -> Int -> DescribeMaintenanceWindowTasksResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (Maybe [MaintenanceWindowTask]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Tasks" Either String (Maybe (Maybe [MaintenanceWindowTask]))
-> Maybe [MaintenanceWindowTask]
-> Either String (Maybe [MaintenanceWindowTask])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [MaintenanceWindowTask]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text -> Int -> DescribeMaintenanceWindowTasksResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeMaintenanceWindowTasksResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> DescribeMaintenanceWindowTasksResponse)
-> Either String Int
-> Either String DescribeMaintenanceWindowTasksResponse
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
    DescribeMaintenanceWindowTasks

instance
  Prelude.NFData
    DescribeMaintenanceWindowTasks

instance
  Core.ToHeaders
    DescribeMaintenanceWindowTasks
  where
  toHeaders :: DescribeMaintenanceWindowTasks -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeMaintenanceWindowTasks -> 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
"AmazonSSM.DescribeMaintenanceWindowTasks" ::
                          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 DescribeMaintenanceWindowTasks where
  toJSON :: DescribeMaintenanceWindowTasks -> Value
toJSON DescribeMaintenanceWindowTasks' {Maybe Natural
Maybe [MaintenanceWindowFilter]
Maybe Text
Text
windowId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [MaintenanceWindowFilter]
$sel:windowId:DescribeMaintenanceWindowTasks' :: DescribeMaintenanceWindowTasks -> Text
$sel:maxResults:DescribeMaintenanceWindowTasks' :: DescribeMaintenanceWindowTasks -> Maybe Natural
$sel:nextToken:DescribeMaintenanceWindowTasks' :: DescribeMaintenanceWindowTasks -> Maybe Text
$sel:filters:DescribeMaintenanceWindowTasks' :: DescribeMaintenanceWindowTasks -> Maybe [MaintenanceWindowFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [MaintenanceWindowFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([MaintenanceWindowFilter] -> Pair)
-> Maybe [MaintenanceWindowFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MaintenanceWindowFilter]
filters,
            (Text
"NextToken" 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
nextToken,
            (Text
"MaxResults" 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
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WindowId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
windowId)
          ]
      )

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

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

-- | /See:/ 'newDescribeMaintenanceWindowTasksResponse' smart constructor.
data DescribeMaintenanceWindowTasksResponse = DescribeMaintenanceWindowTasksResponse'
  { -- | Information about the tasks in the maintenance window.
    DescribeMaintenanceWindowTasksResponse
-> Maybe [MaintenanceWindowTask]
tasks :: Prelude.Maybe [MaintenanceWindowTask],
    -- | The token to use when requesting the next set of items. If there are no
    -- additional items to return, the string is empty.
    DescribeMaintenanceWindowTasksResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeMaintenanceWindowTasksResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeMaintenanceWindowTasksResponse
-> DescribeMaintenanceWindowTasksResponse -> Bool
(DescribeMaintenanceWindowTasksResponse
 -> DescribeMaintenanceWindowTasksResponse -> Bool)
-> (DescribeMaintenanceWindowTasksResponse
    -> DescribeMaintenanceWindowTasksResponse -> Bool)
-> Eq DescribeMaintenanceWindowTasksResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMaintenanceWindowTasksResponse
-> DescribeMaintenanceWindowTasksResponse -> Bool
$c/= :: DescribeMaintenanceWindowTasksResponse
-> DescribeMaintenanceWindowTasksResponse -> Bool
== :: DescribeMaintenanceWindowTasksResponse
-> DescribeMaintenanceWindowTasksResponse -> Bool
$c== :: DescribeMaintenanceWindowTasksResponse
-> DescribeMaintenanceWindowTasksResponse -> Bool
Prelude.Eq, Int -> DescribeMaintenanceWindowTasksResponse -> ShowS
[DescribeMaintenanceWindowTasksResponse] -> ShowS
DescribeMaintenanceWindowTasksResponse -> String
(Int -> DescribeMaintenanceWindowTasksResponse -> ShowS)
-> (DescribeMaintenanceWindowTasksResponse -> String)
-> ([DescribeMaintenanceWindowTasksResponse] -> ShowS)
-> Show DescribeMaintenanceWindowTasksResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMaintenanceWindowTasksResponse] -> ShowS
$cshowList :: [DescribeMaintenanceWindowTasksResponse] -> ShowS
show :: DescribeMaintenanceWindowTasksResponse -> String
$cshow :: DescribeMaintenanceWindowTasksResponse -> String
showsPrec :: Int -> DescribeMaintenanceWindowTasksResponse -> ShowS
$cshowsPrec :: Int -> DescribeMaintenanceWindowTasksResponse -> ShowS
Prelude.Show, (forall x.
 DescribeMaintenanceWindowTasksResponse
 -> Rep DescribeMaintenanceWindowTasksResponse x)
-> (forall x.
    Rep DescribeMaintenanceWindowTasksResponse x
    -> DescribeMaintenanceWindowTasksResponse)
-> Generic DescribeMaintenanceWindowTasksResponse
forall x.
Rep DescribeMaintenanceWindowTasksResponse x
-> DescribeMaintenanceWindowTasksResponse
forall x.
DescribeMaintenanceWindowTasksResponse
-> Rep DescribeMaintenanceWindowTasksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMaintenanceWindowTasksResponse x
-> DescribeMaintenanceWindowTasksResponse
$cfrom :: forall x.
DescribeMaintenanceWindowTasksResponse
-> Rep DescribeMaintenanceWindowTasksResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMaintenanceWindowTasksResponse' 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:
--
-- 'tasks', 'describeMaintenanceWindowTasksResponse_tasks' - Information about the tasks in the maintenance window.
--
-- 'nextToken', 'describeMaintenanceWindowTasksResponse_nextToken' - The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
--
-- 'httpStatus', 'describeMaintenanceWindowTasksResponse_httpStatus' - The response's http status code.
newDescribeMaintenanceWindowTasksResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeMaintenanceWindowTasksResponse
newDescribeMaintenanceWindowTasksResponse :: Int -> DescribeMaintenanceWindowTasksResponse
newDescribeMaintenanceWindowTasksResponse
  Int
pHttpStatus_ =
    DescribeMaintenanceWindowTasksResponse' :: Maybe [MaintenanceWindowTask]
-> Maybe Text -> Int -> DescribeMaintenanceWindowTasksResponse
DescribeMaintenanceWindowTasksResponse'
      { $sel:tasks:DescribeMaintenanceWindowTasksResponse' :: Maybe [MaintenanceWindowTask]
tasks =
          Maybe [MaintenanceWindowTask]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeMaintenanceWindowTasksResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeMaintenanceWindowTasksResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Information about the tasks in the maintenance window.
describeMaintenanceWindowTasksResponse_tasks :: Lens.Lens' DescribeMaintenanceWindowTasksResponse (Prelude.Maybe [MaintenanceWindowTask])
describeMaintenanceWindowTasksResponse_tasks :: (Maybe [MaintenanceWindowTask]
 -> f (Maybe [MaintenanceWindowTask]))
-> DescribeMaintenanceWindowTasksResponse
-> f DescribeMaintenanceWindowTasksResponse
describeMaintenanceWindowTasksResponse_tasks = (DescribeMaintenanceWindowTasksResponse
 -> Maybe [MaintenanceWindowTask])
-> (DescribeMaintenanceWindowTasksResponse
    -> Maybe [MaintenanceWindowTask]
    -> DescribeMaintenanceWindowTasksResponse)
-> Lens'
     DescribeMaintenanceWindowTasksResponse
     (Maybe [MaintenanceWindowTask])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowTasksResponse' {Maybe [MaintenanceWindowTask]
tasks :: Maybe [MaintenanceWindowTask]
$sel:tasks:DescribeMaintenanceWindowTasksResponse' :: DescribeMaintenanceWindowTasksResponse
-> Maybe [MaintenanceWindowTask]
tasks} -> Maybe [MaintenanceWindowTask]
tasks) (\s :: DescribeMaintenanceWindowTasksResponse
s@DescribeMaintenanceWindowTasksResponse' {} Maybe [MaintenanceWindowTask]
a -> DescribeMaintenanceWindowTasksResponse
s {$sel:tasks:DescribeMaintenanceWindowTasksResponse' :: Maybe [MaintenanceWindowTask]
tasks = Maybe [MaintenanceWindowTask]
a} :: DescribeMaintenanceWindowTasksResponse) ((Maybe [MaintenanceWindowTask]
  -> f (Maybe [MaintenanceWindowTask]))
 -> DescribeMaintenanceWindowTasksResponse
 -> f DescribeMaintenanceWindowTasksResponse)
-> ((Maybe [MaintenanceWindowTask]
     -> f (Maybe [MaintenanceWindowTask]))
    -> Maybe [MaintenanceWindowTask]
    -> f (Maybe [MaintenanceWindowTask]))
-> (Maybe [MaintenanceWindowTask]
    -> f (Maybe [MaintenanceWindowTask]))
-> DescribeMaintenanceWindowTasksResponse
-> f DescribeMaintenanceWindowTasksResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MaintenanceWindowTask]
  [MaintenanceWindowTask]
  [MaintenanceWindowTask]
  [MaintenanceWindowTask]
-> Iso
     (Maybe [MaintenanceWindowTask])
     (Maybe [MaintenanceWindowTask])
     (Maybe [MaintenanceWindowTask])
     (Maybe [MaintenanceWindowTask])
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
  [MaintenanceWindowTask]
  [MaintenanceWindowTask]
  [MaintenanceWindowTask]
  [MaintenanceWindowTask]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
describeMaintenanceWindowTasksResponse_nextToken :: Lens.Lens' DescribeMaintenanceWindowTasksResponse (Prelude.Maybe Prelude.Text)
describeMaintenanceWindowTasksResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeMaintenanceWindowTasksResponse
-> f DescribeMaintenanceWindowTasksResponse
describeMaintenanceWindowTasksResponse_nextToken = (DescribeMaintenanceWindowTasksResponse -> Maybe Text)
-> (DescribeMaintenanceWindowTasksResponse
    -> Maybe Text -> DescribeMaintenanceWindowTasksResponse)
-> Lens' DescribeMaintenanceWindowTasksResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowTasksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeMaintenanceWindowTasksResponse' :: DescribeMaintenanceWindowTasksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeMaintenanceWindowTasksResponse
s@DescribeMaintenanceWindowTasksResponse' {} Maybe Text
a -> DescribeMaintenanceWindowTasksResponse
s {$sel:nextToken:DescribeMaintenanceWindowTasksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeMaintenanceWindowTasksResponse)

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

instance
  Prelude.NFData
    DescribeMaintenanceWindowTasksResponse