{-# 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.DescribeMaintenanceWindows
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the maintenance windows in an Amazon Web Services account.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeMaintenanceWindows
  ( -- * Creating a Request
    DescribeMaintenanceWindows (..),
    newDescribeMaintenanceWindows,

    -- * Request Lenses
    describeMaintenanceWindows_filters,
    describeMaintenanceWindows_nextToken,
    describeMaintenanceWindows_maxResults,

    -- * Destructuring the Response
    DescribeMaintenanceWindowsResponse (..),
    newDescribeMaintenanceWindowsResponse,

    -- * Response Lenses
    describeMaintenanceWindowsResponse_windowIdentities,
    describeMaintenanceWindowsResponse_nextToken,
    describeMaintenanceWindowsResponse_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:/ 'newDescribeMaintenanceWindows' smart constructor.
data DescribeMaintenanceWindows = DescribeMaintenanceWindows'
  { -- | Optional filters used to narrow down the scope of the returned
    -- maintenance windows. Supported filter keys are @Name@ and @Enabled@. For
    -- example, @Name=MyMaintenanceWindow@ and @Enabled=True@.
    DescribeMaintenanceWindows -> Maybe [MaintenanceWindowFilter]
filters :: Prelude.Maybe [MaintenanceWindowFilter],
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeMaintenanceWindows -> 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.
    DescribeMaintenanceWindows -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeMaintenanceWindows -> DescribeMaintenanceWindows -> Bool
(DescribeMaintenanceWindows -> DescribeMaintenanceWindows -> Bool)
-> (DescribeMaintenanceWindows
    -> DescribeMaintenanceWindows -> Bool)
-> Eq DescribeMaintenanceWindows
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMaintenanceWindows -> DescribeMaintenanceWindows -> Bool
$c/= :: DescribeMaintenanceWindows -> DescribeMaintenanceWindows -> Bool
== :: DescribeMaintenanceWindows -> DescribeMaintenanceWindows -> Bool
$c== :: DescribeMaintenanceWindows -> DescribeMaintenanceWindows -> Bool
Prelude.Eq, ReadPrec [DescribeMaintenanceWindows]
ReadPrec DescribeMaintenanceWindows
Int -> ReadS DescribeMaintenanceWindows
ReadS [DescribeMaintenanceWindows]
(Int -> ReadS DescribeMaintenanceWindows)
-> ReadS [DescribeMaintenanceWindows]
-> ReadPrec DescribeMaintenanceWindows
-> ReadPrec [DescribeMaintenanceWindows]
-> Read DescribeMaintenanceWindows
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMaintenanceWindows]
$creadListPrec :: ReadPrec [DescribeMaintenanceWindows]
readPrec :: ReadPrec DescribeMaintenanceWindows
$creadPrec :: ReadPrec DescribeMaintenanceWindows
readList :: ReadS [DescribeMaintenanceWindows]
$creadList :: ReadS [DescribeMaintenanceWindows]
readsPrec :: Int -> ReadS DescribeMaintenanceWindows
$creadsPrec :: Int -> ReadS DescribeMaintenanceWindows
Prelude.Read, Int -> DescribeMaintenanceWindows -> ShowS
[DescribeMaintenanceWindows] -> ShowS
DescribeMaintenanceWindows -> String
(Int -> DescribeMaintenanceWindows -> ShowS)
-> (DescribeMaintenanceWindows -> String)
-> ([DescribeMaintenanceWindows] -> ShowS)
-> Show DescribeMaintenanceWindows
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMaintenanceWindows] -> ShowS
$cshowList :: [DescribeMaintenanceWindows] -> ShowS
show :: DescribeMaintenanceWindows -> String
$cshow :: DescribeMaintenanceWindows -> String
showsPrec :: Int -> DescribeMaintenanceWindows -> ShowS
$cshowsPrec :: Int -> DescribeMaintenanceWindows -> ShowS
Prelude.Show, (forall x.
 DescribeMaintenanceWindows -> Rep DescribeMaintenanceWindows x)
-> (forall x.
    Rep DescribeMaintenanceWindows x -> DescribeMaintenanceWindows)
-> Generic DescribeMaintenanceWindows
forall x.
Rep DescribeMaintenanceWindows x -> DescribeMaintenanceWindows
forall x.
DescribeMaintenanceWindows -> Rep DescribeMaintenanceWindows x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMaintenanceWindows x -> DescribeMaintenanceWindows
$cfrom :: forall x.
DescribeMaintenanceWindows -> Rep DescribeMaintenanceWindows x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMaintenanceWindows' 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', 'describeMaintenanceWindows_filters' - Optional filters used to narrow down the scope of the returned
-- maintenance windows. Supported filter keys are @Name@ and @Enabled@. For
-- example, @Name=MyMaintenanceWindow@ and @Enabled=True@.
--
-- 'nextToken', 'describeMaintenanceWindows_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeMaintenanceWindows_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.
newDescribeMaintenanceWindows ::
  DescribeMaintenanceWindows
newDescribeMaintenanceWindows :: DescribeMaintenanceWindows
newDescribeMaintenanceWindows =
  DescribeMaintenanceWindows' :: Maybe [MaintenanceWindowFilter]
-> Maybe Text -> Maybe Natural -> DescribeMaintenanceWindows
DescribeMaintenanceWindows'
    { $sel:filters:DescribeMaintenanceWindows' :: Maybe [MaintenanceWindowFilter]
filters =
        Maybe [MaintenanceWindowFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeMaintenanceWindows' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeMaintenanceWindows' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Optional filters used to narrow down the scope of the returned
-- maintenance windows. Supported filter keys are @Name@ and @Enabled@. For
-- example, @Name=MyMaintenanceWindow@ and @Enabled=True@.
describeMaintenanceWindows_filters :: Lens.Lens' DescribeMaintenanceWindows (Prelude.Maybe [MaintenanceWindowFilter])
describeMaintenanceWindows_filters :: (Maybe [MaintenanceWindowFilter]
 -> f (Maybe [MaintenanceWindowFilter]))
-> DescribeMaintenanceWindows -> f DescribeMaintenanceWindows
describeMaintenanceWindows_filters = (DescribeMaintenanceWindows -> Maybe [MaintenanceWindowFilter])
-> (DescribeMaintenanceWindows
    -> Maybe [MaintenanceWindowFilter] -> DescribeMaintenanceWindows)
-> Lens
     DescribeMaintenanceWindows
     DescribeMaintenanceWindows
     (Maybe [MaintenanceWindowFilter])
     (Maybe [MaintenanceWindowFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindows' {Maybe [MaintenanceWindowFilter]
filters :: Maybe [MaintenanceWindowFilter]
$sel:filters:DescribeMaintenanceWindows' :: DescribeMaintenanceWindows -> Maybe [MaintenanceWindowFilter]
filters} -> Maybe [MaintenanceWindowFilter]
filters) (\s :: DescribeMaintenanceWindows
s@DescribeMaintenanceWindows' {} Maybe [MaintenanceWindowFilter]
a -> DescribeMaintenanceWindows
s {$sel:filters:DescribeMaintenanceWindows' :: Maybe [MaintenanceWindowFilter]
filters = Maybe [MaintenanceWindowFilter]
a} :: DescribeMaintenanceWindows) ((Maybe [MaintenanceWindowFilter]
  -> f (Maybe [MaintenanceWindowFilter]))
 -> DescribeMaintenanceWindows -> f DescribeMaintenanceWindows)
-> ((Maybe [MaintenanceWindowFilter]
     -> f (Maybe [MaintenanceWindowFilter]))
    -> Maybe [MaintenanceWindowFilter]
    -> f (Maybe [MaintenanceWindowFilter]))
-> (Maybe [MaintenanceWindowFilter]
    -> f (Maybe [MaintenanceWindowFilter]))
-> DescribeMaintenanceWindows
-> f DescribeMaintenanceWindows
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.)
describeMaintenanceWindows_nextToken :: Lens.Lens' DescribeMaintenanceWindows (Prelude.Maybe Prelude.Text)
describeMaintenanceWindows_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeMaintenanceWindows -> f DescribeMaintenanceWindows
describeMaintenanceWindows_nextToken = (DescribeMaintenanceWindows -> Maybe Text)
-> (DescribeMaintenanceWindows
    -> Maybe Text -> DescribeMaintenanceWindows)
-> Lens
     DescribeMaintenanceWindows
     DescribeMaintenanceWindows
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindows' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeMaintenanceWindows' :: DescribeMaintenanceWindows -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeMaintenanceWindows
s@DescribeMaintenanceWindows' {} Maybe Text
a -> DescribeMaintenanceWindows
s {$sel:nextToken:DescribeMaintenanceWindows' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeMaintenanceWindows)

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

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

instance Prelude.NFData DescribeMaintenanceWindows

instance Core.ToHeaders DescribeMaintenanceWindows where
  toHeaders :: DescribeMaintenanceWindows -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeMaintenanceWindows -> 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.DescribeMaintenanceWindows" ::
                          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 DescribeMaintenanceWindows where
  toJSON :: DescribeMaintenanceWindows -> Value
toJSON DescribeMaintenanceWindows' {Maybe Natural
Maybe [MaintenanceWindowFilter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [MaintenanceWindowFilter]
$sel:maxResults:DescribeMaintenanceWindows' :: DescribeMaintenanceWindows -> Maybe Natural
$sel:nextToken:DescribeMaintenanceWindows' :: DescribeMaintenanceWindows -> Maybe Text
$sel:filters:DescribeMaintenanceWindows' :: DescribeMaintenanceWindows -> 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
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeMaintenanceWindowsResponse' 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:
--
-- 'windowIdentities', 'describeMaintenanceWindowsResponse_windowIdentities' - Information about the maintenance windows.
--
-- 'nextToken', 'describeMaintenanceWindowsResponse_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', 'describeMaintenanceWindowsResponse_httpStatus' - The response's http status code.
newDescribeMaintenanceWindowsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeMaintenanceWindowsResponse
newDescribeMaintenanceWindowsResponse :: Int -> DescribeMaintenanceWindowsResponse
newDescribeMaintenanceWindowsResponse Int
pHttpStatus_ =
  DescribeMaintenanceWindowsResponse' :: Maybe [MaintenanceWindowIdentity]
-> Maybe Text -> Int -> DescribeMaintenanceWindowsResponse
DescribeMaintenanceWindowsResponse'
    { $sel:windowIdentities:DescribeMaintenanceWindowsResponse' :: Maybe [MaintenanceWindowIdentity]
windowIdentities =
        Maybe [MaintenanceWindowIdentity]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeMaintenanceWindowsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeMaintenanceWindowsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the maintenance windows.
describeMaintenanceWindowsResponse_windowIdentities :: Lens.Lens' DescribeMaintenanceWindowsResponse (Prelude.Maybe [MaintenanceWindowIdentity])
describeMaintenanceWindowsResponse_windowIdentities :: (Maybe [MaintenanceWindowIdentity]
 -> f (Maybe [MaintenanceWindowIdentity]))
-> DescribeMaintenanceWindowsResponse
-> f DescribeMaintenanceWindowsResponse
describeMaintenanceWindowsResponse_windowIdentities = (DescribeMaintenanceWindowsResponse
 -> Maybe [MaintenanceWindowIdentity])
-> (DescribeMaintenanceWindowsResponse
    -> Maybe [MaintenanceWindowIdentity]
    -> DescribeMaintenanceWindowsResponse)
-> Lens'
     DescribeMaintenanceWindowsResponse
     (Maybe [MaintenanceWindowIdentity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowsResponse' {Maybe [MaintenanceWindowIdentity]
windowIdentities :: Maybe [MaintenanceWindowIdentity]
$sel:windowIdentities:DescribeMaintenanceWindowsResponse' :: DescribeMaintenanceWindowsResponse
-> Maybe [MaintenanceWindowIdentity]
windowIdentities} -> Maybe [MaintenanceWindowIdentity]
windowIdentities) (\s :: DescribeMaintenanceWindowsResponse
s@DescribeMaintenanceWindowsResponse' {} Maybe [MaintenanceWindowIdentity]
a -> DescribeMaintenanceWindowsResponse
s {$sel:windowIdentities:DescribeMaintenanceWindowsResponse' :: Maybe [MaintenanceWindowIdentity]
windowIdentities = Maybe [MaintenanceWindowIdentity]
a} :: DescribeMaintenanceWindowsResponse) ((Maybe [MaintenanceWindowIdentity]
  -> f (Maybe [MaintenanceWindowIdentity]))
 -> DescribeMaintenanceWindowsResponse
 -> f DescribeMaintenanceWindowsResponse)
-> ((Maybe [MaintenanceWindowIdentity]
     -> f (Maybe [MaintenanceWindowIdentity]))
    -> Maybe [MaintenanceWindowIdentity]
    -> f (Maybe [MaintenanceWindowIdentity]))
-> (Maybe [MaintenanceWindowIdentity]
    -> f (Maybe [MaintenanceWindowIdentity]))
-> DescribeMaintenanceWindowsResponse
-> f DescribeMaintenanceWindowsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MaintenanceWindowIdentity]
  [MaintenanceWindowIdentity]
  [MaintenanceWindowIdentity]
  [MaintenanceWindowIdentity]
-> Iso
     (Maybe [MaintenanceWindowIdentity])
     (Maybe [MaintenanceWindowIdentity])
     (Maybe [MaintenanceWindowIdentity])
     (Maybe [MaintenanceWindowIdentity])
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
  [MaintenanceWindowIdentity]
  [MaintenanceWindowIdentity]
  [MaintenanceWindowIdentity]
  [MaintenanceWindowIdentity]
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.
describeMaintenanceWindowsResponse_nextToken :: Lens.Lens' DescribeMaintenanceWindowsResponse (Prelude.Maybe Prelude.Text)
describeMaintenanceWindowsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeMaintenanceWindowsResponse
-> f DescribeMaintenanceWindowsResponse
describeMaintenanceWindowsResponse_nextToken = (DescribeMaintenanceWindowsResponse -> Maybe Text)
-> (DescribeMaintenanceWindowsResponse
    -> Maybe Text -> DescribeMaintenanceWindowsResponse)
-> Lens' DescribeMaintenanceWindowsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeMaintenanceWindowsResponse' :: DescribeMaintenanceWindowsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeMaintenanceWindowsResponse
s@DescribeMaintenanceWindowsResponse' {} Maybe Text
a -> DescribeMaintenanceWindowsResponse
s {$sel:nextToken:DescribeMaintenanceWindowsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeMaintenanceWindowsResponse)

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

instance
  Prelude.NFData
    DescribeMaintenanceWindowsResponse