{-# 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.DescribeMaintenanceWindowExecutions
-- 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 executions of a maintenance window. This includes information
-- about when the maintenance window was scheduled to be active, and
-- information about tasks registered and run with the maintenance window.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeMaintenanceWindowExecutions
  ( -- * Creating a Request
    DescribeMaintenanceWindowExecutions (..),
    newDescribeMaintenanceWindowExecutions,

    -- * Request Lenses
    describeMaintenanceWindowExecutions_filters,
    describeMaintenanceWindowExecutions_nextToken,
    describeMaintenanceWindowExecutions_maxResults,
    describeMaintenanceWindowExecutions_windowId,

    -- * Destructuring the Response
    DescribeMaintenanceWindowExecutionsResponse (..),
    newDescribeMaintenanceWindowExecutionsResponse,

    -- * Response Lenses
    describeMaintenanceWindowExecutionsResponse_windowExecutions,
    describeMaintenanceWindowExecutionsResponse_nextToken,
    describeMaintenanceWindowExecutionsResponse_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:/ 'newDescribeMaintenanceWindowExecutions' smart constructor.
data DescribeMaintenanceWindowExecutions = DescribeMaintenanceWindowExecutions'
  { -- | Each entry in the array is a structure containing:
    --
    -- -   Key. A string between 1 and 128 characters. Supported keys include
    --     @ExecutedBefore@ and @ExecutedAfter@.
    --
    -- -   Values. An array of strings, each between 1 and 256 characters.
    --     Supported values are date\/time strings in a valid ISO 8601
    --     date\/time format, such as @2021-11-04T05:00:00Z@.
    DescribeMaintenanceWindowExecutions
-> Maybe [MaintenanceWindowFilter]
filters :: Prelude.Maybe [MaintenanceWindowFilter],
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeMaintenanceWindowExecutions -> 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.
    DescribeMaintenanceWindowExecutions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the maintenance window whose executions should be retrieved.
    DescribeMaintenanceWindowExecutions -> Text
windowId :: Prelude.Text
  }
  deriving (DescribeMaintenanceWindowExecutions
-> DescribeMaintenanceWindowExecutions -> Bool
(DescribeMaintenanceWindowExecutions
 -> DescribeMaintenanceWindowExecutions -> Bool)
-> (DescribeMaintenanceWindowExecutions
    -> DescribeMaintenanceWindowExecutions -> Bool)
-> Eq DescribeMaintenanceWindowExecutions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMaintenanceWindowExecutions
-> DescribeMaintenanceWindowExecutions -> Bool
$c/= :: DescribeMaintenanceWindowExecutions
-> DescribeMaintenanceWindowExecutions -> Bool
== :: DescribeMaintenanceWindowExecutions
-> DescribeMaintenanceWindowExecutions -> Bool
$c== :: DescribeMaintenanceWindowExecutions
-> DescribeMaintenanceWindowExecutions -> Bool
Prelude.Eq, ReadPrec [DescribeMaintenanceWindowExecutions]
ReadPrec DescribeMaintenanceWindowExecutions
Int -> ReadS DescribeMaintenanceWindowExecutions
ReadS [DescribeMaintenanceWindowExecutions]
(Int -> ReadS DescribeMaintenanceWindowExecutions)
-> ReadS [DescribeMaintenanceWindowExecutions]
-> ReadPrec DescribeMaintenanceWindowExecutions
-> ReadPrec [DescribeMaintenanceWindowExecutions]
-> Read DescribeMaintenanceWindowExecutions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMaintenanceWindowExecutions]
$creadListPrec :: ReadPrec [DescribeMaintenanceWindowExecutions]
readPrec :: ReadPrec DescribeMaintenanceWindowExecutions
$creadPrec :: ReadPrec DescribeMaintenanceWindowExecutions
readList :: ReadS [DescribeMaintenanceWindowExecutions]
$creadList :: ReadS [DescribeMaintenanceWindowExecutions]
readsPrec :: Int -> ReadS DescribeMaintenanceWindowExecutions
$creadsPrec :: Int -> ReadS DescribeMaintenanceWindowExecutions
Prelude.Read, Int -> DescribeMaintenanceWindowExecutions -> ShowS
[DescribeMaintenanceWindowExecutions] -> ShowS
DescribeMaintenanceWindowExecutions -> String
(Int -> DescribeMaintenanceWindowExecutions -> ShowS)
-> (DescribeMaintenanceWindowExecutions -> String)
-> ([DescribeMaintenanceWindowExecutions] -> ShowS)
-> Show DescribeMaintenanceWindowExecutions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMaintenanceWindowExecutions] -> ShowS
$cshowList :: [DescribeMaintenanceWindowExecutions] -> ShowS
show :: DescribeMaintenanceWindowExecutions -> String
$cshow :: DescribeMaintenanceWindowExecutions -> String
showsPrec :: Int -> DescribeMaintenanceWindowExecutions -> ShowS
$cshowsPrec :: Int -> DescribeMaintenanceWindowExecutions -> ShowS
Prelude.Show, (forall x.
 DescribeMaintenanceWindowExecutions
 -> Rep DescribeMaintenanceWindowExecutions x)
-> (forall x.
    Rep DescribeMaintenanceWindowExecutions x
    -> DescribeMaintenanceWindowExecutions)
-> Generic DescribeMaintenanceWindowExecutions
forall x.
Rep DescribeMaintenanceWindowExecutions x
-> DescribeMaintenanceWindowExecutions
forall x.
DescribeMaintenanceWindowExecutions
-> Rep DescribeMaintenanceWindowExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMaintenanceWindowExecutions x
-> DescribeMaintenanceWindowExecutions
$cfrom :: forall x.
DescribeMaintenanceWindowExecutions
-> Rep DescribeMaintenanceWindowExecutions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMaintenanceWindowExecutions' 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', 'describeMaintenanceWindowExecutions_filters' - Each entry in the array is a structure containing:
--
-- -   Key. A string between 1 and 128 characters. Supported keys include
--     @ExecutedBefore@ and @ExecutedAfter@.
--
-- -   Values. An array of strings, each between 1 and 256 characters.
--     Supported values are date\/time strings in a valid ISO 8601
--     date\/time format, such as @2021-11-04T05:00:00Z@.
--
-- 'nextToken', 'describeMaintenanceWindowExecutions_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeMaintenanceWindowExecutions_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', 'describeMaintenanceWindowExecutions_windowId' - The ID of the maintenance window whose executions should be retrieved.
newDescribeMaintenanceWindowExecutions ::
  -- | 'windowId'
  Prelude.Text ->
  DescribeMaintenanceWindowExecutions
newDescribeMaintenanceWindowExecutions :: Text -> DescribeMaintenanceWindowExecutions
newDescribeMaintenanceWindowExecutions Text
pWindowId_ =
  DescribeMaintenanceWindowExecutions' :: Maybe [MaintenanceWindowFilter]
-> Maybe Text
-> Maybe Natural
-> Text
-> DescribeMaintenanceWindowExecutions
DescribeMaintenanceWindowExecutions'
    { $sel:filters:DescribeMaintenanceWindowExecutions' :: Maybe [MaintenanceWindowFilter]
filters =
        Maybe [MaintenanceWindowFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeMaintenanceWindowExecutions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeMaintenanceWindowExecutions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:windowId:DescribeMaintenanceWindowExecutions' :: Text
windowId = Text
pWindowId_
    }

-- | Each entry in the array is a structure containing:
--
-- -   Key. A string between 1 and 128 characters. Supported keys include
--     @ExecutedBefore@ and @ExecutedAfter@.
--
-- -   Values. An array of strings, each between 1 and 256 characters.
--     Supported values are date\/time strings in a valid ISO 8601
--     date\/time format, such as @2021-11-04T05:00:00Z@.
describeMaintenanceWindowExecutions_filters :: Lens.Lens' DescribeMaintenanceWindowExecutions (Prelude.Maybe [MaintenanceWindowFilter])
describeMaintenanceWindowExecutions_filters :: (Maybe [MaintenanceWindowFilter]
 -> f (Maybe [MaintenanceWindowFilter]))
-> DescribeMaintenanceWindowExecutions
-> f DescribeMaintenanceWindowExecutions
describeMaintenanceWindowExecutions_filters = (DescribeMaintenanceWindowExecutions
 -> Maybe [MaintenanceWindowFilter])
-> (DescribeMaintenanceWindowExecutions
    -> Maybe [MaintenanceWindowFilter]
    -> DescribeMaintenanceWindowExecutions)
-> Lens
     DescribeMaintenanceWindowExecutions
     DescribeMaintenanceWindowExecutions
     (Maybe [MaintenanceWindowFilter])
     (Maybe [MaintenanceWindowFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowExecutions' {Maybe [MaintenanceWindowFilter]
filters :: Maybe [MaintenanceWindowFilter]
$sel:filters:DescribeMaintenanceWindowExecutions' :: DescribeMaintenanceWindowExecutions
-> Maybe [MaintenanceWindowFilter]
filters} -> Maybe [MaintenanceWindowFilter]
filters) (\s :: DescribeMaintenanceWindowExecutions
s@DescribeMaintenanceWindowExecutions' {} Maybe [MaintenanceWindowFilter]
a -> DescribeMaintenanceWindowExecutions
s {$sel:filters:DescribeMaintenanceWindowExecutions' :: Maybe [MaintenanceWindowFilter]
filters = Maybe [MaintenanceWindowFilter]
a} :: DescribeMaintenanceWindowExecutions) ((Maybe [MaintenanceWindowFilter]
  -> f (Maybe [MaintenanceWindowFilter]))
 -> DescribeMaintenanceWindowExecutions
 -> f DescribeMaintenanceWindowExecutions)
-> ((Maybe [MaintenanceWindowFilter]
     -> f (Maybe [MaintenanceWindowFilter]))
    -> Maybe [MaintenanceWindowFilter]
    -> f (Maybe [MaintenanceWindowFilter]))
-> (Maybe [MaintenanceWindowFilter]
    -> f (Maybe [MaintenanceWindowFilter]))
-> DescribeMaintenanceWindowExecutions
-> f DescribeMaintenanceWindowExecutions
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.)
describeMaintenanceWindowExecutions_nextToken :: Lens.Lens' DescribeMaintenanceWindowExecutions (Prelude.Maybe Prelude.Text)
describeMaintenanceWindowExecutions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeMaintenanceWindowExecutions
-> f DescribeMaintenanceWindowExecutions
describeMaintenanceWindowExecutions_nextToken = (DescribeMaintenanceWindowExecutions -> Maybe Text)
-> (DescribeMaintenanceWindowExecutions
    -> Maybe Text -> DescribeMaintenanceWindowExecutions)
-> Lens
     DescribeMaintenanceWindowExecutions
     DescribeMaintenanceWindowExecutions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowExecutions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeMaintenanceWindowExecutions' :: DescribeMaintenanceWindowExecutions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeMaintenanceWindowExecutions
s@DescribeMaintenanceWindowExecutions' {} Maybe Text
a -> DescribeMaintenanceWindowExecutions
s {$sel:nextToken:DescribeMaintenanceWindowExecutions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeMaintenanceWindowExecutions)

-- | 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.
describeMaintenanceWindowExecutions_maxResults :: Lens.Lens' DescribeMaintenanceWindowExecutions (Prelude.Maybe Prelude.Natural)
describeMaintenanceWindowExecutions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeMaintenanceWindowExecutions
-> f DescribeMaintenanceWindowExecutions
describeMaintenanceWindowExecutions_maxResults = (DescribeMaintenanceWindowExecutions -> Maybe Natural)
-> (DescribeMaintenanceWindowExecutions
    -> Maybe Natural -> DescribeMaintenanceWindowExecutions)
-> Lens
     DescribeMaintenanceWindowExecutions
     DescribeMaintenanceWindowExecutions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowExecutions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeMaintenanceWindowExecutions' :: DescribeMaintenanceWindowExecutions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeMaintenanceWindowExecutions
s@DescribeMaintenanceWindowExecutions' {} Maybe Natural
a -> DescribeMaintenanceWindowExecutions
s {$sel:maxResults:DescribeMaintenanceWindowExecutions' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeMaintenanceWindowExecutions)

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

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

instance
  Prelude.NFData
    DescribeMaintenanceWindowExecutions

instance
  Core.ToHeaders
    DescribeMaintenanceWindowExecutions
  where
  toHeaders :: DescribeMaintenanceWindowExecutions -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeMaintenanceWindowExecutions -> 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.DescribeMaintenanceWindowExecutions" ::
                          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
    DescribeMaintenanceWindowExecutions
  where
  toJSON :: DescribeMaintenanceWindowExecutions -> Value
toJSON DescribeMaintenanceWindowExecutions' {Maybe Natural
Maybe [MaintenanceWindowFilter]
Maybe Text
Text
windowId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [MaintenanceWindowFilter]
$sel:windowId:DescribeMaintenanceWindowExecutions' :: DescribeMaintenanceWindowExecutions -> Text
$sel:maxResults:DescribeMaintenanceWindowExecutions' :: DescribeMaintenanceWindowExecutions -> Maybe Natural
$sel:nextToken:DescribeMaintenanceWindowExecutions' :: DescribeMaintenanceWindowExecutions -> Maybe Text
$sel:filters:DescribeMaintenanceWindowExecutions' :: DescribeMaintenanceWindowExecutions
-> 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
    DescribeMaintenanceWindowExecutions
  where
  toPath :: DescribeMaintenanceWindowExecutions -> ByteString
toPath = ByteString -> DescribeMaintenanceWindowExecutions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDescribeMaintenanceWindowExecutionsResponse' smart constructor.
data DescribeMaintenanceWindowExecutionsResponse = DescribeMaintenanceWindowExecutionsResponse'
  { -- | Information about the maintenance window executions.
    DescribeMaintenanceWindowExecutionsResponse
-> Maybe [MaintenanceWindowExecution]
windowExecutions :: Prelude.Maybe [MaintenanceWindowExecution],
    -- | The token to use when requesting the next set of items. If there are no
    -- additional items to return, the string is empty.
    DescribeMaintenanceWindowExecutionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeMaintenanceWindowExecutionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeMaintenanceWindowExecutionsResponse
-> DescribeMaintenanceWindowExecutionsResponse -> Bool
(DescribeMaintenanceWindowExecutionsResponse
 -> DescribeMaintenanceWindowExecutionsResponse -> Bool)
-> (DescribeMaintenanceWindowExecutionsResponse
    -> DescribeMaintenanceWindowExecutionsResponse -> Bool)
-> Eq DescribeMaintenanceWindowExecutionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMaintenanceWindowExecutionsResponse
-> DescribeMaintenanceWindowExecutionsResponse -> Bool
$c/= :: DescribeMaintenanceWindowExecutionsResponse
-> DescribeMaintenanceWindowExecutionsResponse -> Bool
== :: DescribeMaintenanceWindowExecutionsResponse
-> DescribeMaintenanceWindowExecutionsResponse -> Bool
$c== :: DescribeMaintenanceWindowExecutionsResponse
-> DescribeMaintenanceWindowExecutionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeMaintenanceWindowExecutionsResponse]
ReadPrec DescribeMaintenanceWindowExecutionsResponse
Int -> ReadS DescribeMaintenanceWindowExecutionsResponse
ReadS [DescribeMaintenanceWindowExecutionsResponse]
(Int -> ReadS DescribeMaintenanceWindowExecutionsResponse)
-> ReadS [DescribeMaintenanceWindowExecutionsResponse]
-> ReadPrec DescribeMaintenanceWindowExecutionsResponse
-> ReadPrec [DescribeMaintenanceWindowExecutionsResponse]
-> Read DescribeMaintenanceWindowExecutionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMaintenanceWindowExecutionsResponse]
$creadListPrec :: ReadPrec [DescribeMaintenanceWindowExecutionsResponse]
readPrec :: ReadPrec DescribeMaintenanceWindowExecutionsResponse
$creadPrec :: ReadPrec DescribeMaintenanceWindowExecutionsResponse
readList :: ReadS [DescribeMaintenanceWindowExecutionsResponse]
$creadList :: ReadS [DescribeMaintenanceWindowExecutionsResponse]
readsPrec :: Int -> ReadS DescribeMaintenanceWindowExecutionsResponse
$creadsPrec :: Int -> ReadS DescribeMaintenanceWindowExecutionsResponse
Prelude.Read, Int -> DescribeMaintenanceWindowExecutionsResponse -> ShowS
[DescribeMaintenanceWindowExecutionsResponse] -> ShowS
DescribeMaintenanceWindowExecutionsResponse -> String
(Int -> DescribeMaintenanceWindowExecutionsResponse -> ShowS)
-> (DescribeMaintenanceWindowExecutionsResponse -> String)
-> ([DescribeMaintenanceWindowExecutionsResponse] -> ShowS)
-> Show DescribeMaintenanceWindowExecutionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMaintenanceWindowExecutionsResponse] -> ShowS
$cshowList :: [DescribeMaintenanceWindowExecutionsResponse] -> ShowS
show :: DescribeMaintenanceWindowExecutionsResponse -> String
$cshow :: DescribeMaintenanceWindowExecutionsResponse -> String
showsPrec :: Int -> DescribeMaintenanceWindowExecutionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeMaintenanceWindowExecutionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeMaintenanceWindowExecutionsResponse
 -> Rep DescribeMaintenanceWindowExecutionsResponse x)
-> (forall x.
    Rep DescribeMaintenanceWindowExecutionsResponse x
    -> DescribeMaintenanceWindowExecutionsResponse)
-> Generic DescribeMaintenanceWindowExecutionsResponse
forall x.
Rep DescribeMaintenanceWindowExecutionsResponse x
-> DescribeMaintenanceWindowExecutionsResponse
forall x.
DescribeMaintenanceWindowExecutionsResponse
-> Rep DescribeMaintenanceWindowExecutionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMaintenanceWindowExecutionsResponse x
-> DescribeMaintenanceWindowExecutionsResponse
$cfrom :: forall x.
DescribeMaintenanceWindowExecutionsResponse
-> Rep DescribeMaintenanceWindowExecutionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMaintenanceWindowExecutionsResponse' 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:
--
-- 'windowExecutions', 'describeMaintenanceWindowExecutionsResponse_windowExecutions' - Information about the maintenance window executions.
--
-- 'nextToken', 'describeMaintenanceWindowExecutionsResponse_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', 'describeMaintenanceWindowExecutionsResponse_httpStatus' - The response's http status code.
newDescribeMaintenanceWindowExecutionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeMaintenanceWindowExecutionsResponse
newDescribeMaintenanceWindowExecutionsResponse :: Int -> DescribeMaintenanceWindowExecutionsResponse
newDescribeMaintenanceWindowExecutionsResponse
  Int
pHttpStatus_ =
    DescribeMaintenanceWindowExecutionsResponse' :: Maybe [MaintenanceWindowExecution]
-> Maybe Text -> Int -> DescribeMaintenanceWindowExecutionsResponse
DescribeMaintenanceWindowExecutionsResponse'
      { $sel:windowExecutions:DescribeMaintenanceWindowExecutionsResponse' :: Maybe [MaintenanceWindowExecution]
windowExecutions =
          Maybe [MaintenanceWindowExecution]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeMaintenanceWindowExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeMaintenanceWindowExecutionsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Information about the maintenance window executions.
describeMaintenanceWindowExecutionsResponse_windowExecutions :: Lens.Lens' DescribeMaintenanceWindowExecutionsResponse (Prelude.Maybe [MaintenanceWindowExecution])
describeMaintenanceWindowExecutionsResponse_windowExecutions :: (Maybe [MaintenanceWindowExecution]
 -> f (Maybe [MaintenanceWindowExecution]))
-> DescribeMaintenanceWindowExecutionsResponse
-> f DescribeMaintenanceWindowExecutionsResponse
describeMaintenanceWindowExecutionsResponse_windowExecutions = (DescribeMaintenanceWindowExecutionsResponse
 -> Maybe [MaintenanceWindowExecution])
-> (DescribeMaintenanceWindowExecutionsResponse
    -> Maybe [MaintenanceWindowExecution]
    -> DescribeMaintenanceWindowExecutionsResponse)
-> Lens'
     DescribeMaintenanceWindowExecutionsResponse
     (Maybe [MaintenanceWindowExecution])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowExecutionsResponse' {Maybe [MaintenanceWindowExecution]
windowExecutions :: Maybe [MaintenanceWindowExecution]
$sel:windowExecutions:DescribeMaintenanceWindowExecutionsResponse' :: DescribeMaintenanceWindowExecutionsResponse
-> Maybe [MaintenanceWindowExecution]
windowExecutions} -> Maybe [MaintenanceWindowExecution]
windowExecutions) (\s :: DescribeMaintenanceWindowExecutionsResponse
s@DescribeMaintenanceWindowExecutionsResponse' {} Maybe [MaintenanceWindowExecution]
a -> DescribeMaintenanceWindowExecutionsResponse
s {$sel:windowExecutions:DescribeMaintenanceWindowExecutionsResponse' :: Maybe [MaintenanceWindowExecution]
windowExecutions = Maybe [MaintenanceWindowExecution]
a} :: DescribeMaintenanceWindowExecutionsResponse) ((Maybe [MaintenanceWindowExecution]
  -> f (Maybe [MaintenanceWindowExecution]))
 -> DescribeMaintenanceWindowExecutionsResponse
 -> f DescribeMaintenanceWindowExecutionsResponse)
-> ((Maybe [MaintenanceWindowExecution]
     -> f (Maybe [MaintenanceWindowExecution]))
    -> Maybe [MaintenanceWindowExecution]
    -> f (Maybe [MaintenanceWindowExecution]))
-> (Maybe [MaintenanceWindowExecution]
    -> f (Maybe [MaintenanceWindowExecution]))
-> DescribeMaintenanceWindowExecutionsResponse
-> f DescribeMaintenanceWindowExecutionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MaintenanceWindowExecution]
  [MaintenanceWindowExecution]
  [MaintenanceWindowExecution]
  [MaintenanceWindowExecution]
-> Iso
     (Maybe [MaintenanceWindowExecution])
     (Maybe [MaintenanceWindowExecution])
     (Maybe [MaintenanceWindowExecution])
     (Maybe [MaintenanceWindowExecution])
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
  [MaintenanceWindowExecution]
  [MaintenanceWindowExecution]
  [MaintenanceWindowExecution]
  [MaintenanceWindowExecution]
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.
describeMaintenanceWindowExecutionsResponse_nextToken :: Lens.Lens' DescribeMaintenanceWindowExecutionsResponse (Prelude.Maybe Prelude.Text)
describeMaintenanceWindowExecutionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeMaintenanceWindowExecutionsResponse
-> f DescribeMaintenanceWindowExecutionsResponse
describeMaintenanceWindowExecutionsResponse_nextToken = (DescribeMaintenanceWindowExecutionsResponse -> Maybe Text)
-> (DescribeMaintenanceWindowExecutionsResponse
    -> Maybe Text -> DescribeMaintenanceWindowExecutionsResponse)
-> Lens' DescribeMaintenanceWindowExecutionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowExecutionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeMaintenanceWindowExecutionsResponse' :: DescribeMaintenanceWindowExecutionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeMaintenanceWindowExecutionsResponse
s@DescribeMaintenanceWindowExecutionsResponse' {} Maybe Text
a -> DescribeMaintenanceWindowExecutionsResponse
s {$sel:nextToken:DescribeMaintenanceWindowExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeMaintenanceWindowExecutionsResponse)

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

instance
  Prelude.NFData
    DescribeMaintenanceWindowExecutionsResponse