{-# 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.DescribeMaintenanceWindowSchedule
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves information about upcoming executions of a maintenance window.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeMaintenanceWindowSchedule
  ( -- * Creating a Request
    DescribeMaintenanceWindowSchedule (..),
    newDescribeMaintenanceWindowSchedule,

    -- * Request Lenses
    describeMaintenanceWindowSchedule_filters,
    describeMaintenanceWindowSchedule_maxResults,
    describeMaintenanceWindowSchedule_nextToken,
    describeMaintenanceWindowSchedule_resourceType,
    describeMaintenanceWindowSchedule_targets,
    describeMaintenanceWindowSchedule_windowId,

    -- * Destructuring the Response
    DescribeMaintenanceWindowScheduleResponse (..),
    newDescribeMaintenanceWindowScheduleResponse,

    -- * Response Lenses
    describeMaintenanceWindowScheduleResponse_nextToken,
    describeMaintenanceWindowScheduleResponse_scheduledWindowExecutions,
    describeMaintenanceWindowScheduleResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSM.Types

-- | /See:/ 'newDescribeMaintenanceWindowSchedule' smart constructor.
data DescribeMaintenanceWindowSchedule = DescribeMaintenanceWindowSchedule'
  { -- | Filters used to limit the range of results. For example, you can limit
    -- maintenance window executions to only those scheduled before or after a
    -- certain date and time.
    DescribeMaintenanceWindowSchedule
-> Maybe [PatchOrchestratorFilter]
filters :: Prelude.Maybe [PatchOrchestratorFilter],
    -- | 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.
    DescribeMaintenanceWindowSchedule -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeMaintenanceWindowSchedule -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The type of resource you want to retrieve information about. For
    -- example, @INSTANCE@.
    DescribeMaintenanceWindowSchedule
-> Maybe MaintenanceWindowResourceType
resourceType :: Prelude.Maybe MaintenanceWindowResourceType,
    -- | The managed node ID or key-value pair to retrieve information about.
    DescribeMaintenanceWindowSchedule -> Maybe [Target]
targets :: Prelude.Maybe [Target],
    -- | The ID of the maintenance window to retrieve information about.
    DescribeMaintenanceWindowSchedule -> Maybe Text
windowId :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeMaintenanceWindowSchedule
-> DescribeMaintenanceWindowSchedule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMaintenanceWindowSchedule
-> DescribeMaintenanceWindowSchedule -> Bool
$c/= :: DescribeMaintenanceWindowSchedule
-> DescribeMaintenanceWindowSchedule -> Bool
== :: DescribeMaintenanceWindowSchedule
-> DescribeMaintenanceWindowSchedule -> Bool
$c== :: DescribeMaintenanceWindowSchedule
-> DescribeMaintenanceWindowSchedule -> Bool
Prelude.Eq, ReadPrec [DescribeMaintenanceWindowSchedule]
ReadPrec DescribeMaintenanceWindowSchedule
Int -> ReadS DescribeMaintenanceWindowSchedule
ReadS [DescribeMaintenanceWindowSchedule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMaintenanceWindowSchedule]
$creadListPrec :: ReadPrec [DescribeMaintenanceWindowSchedule]
readPrec :: ReadPrec DescribeMaintenanceWindowSchedule
$creadPrec :: ReadPrec DescribeMaintenanceWindowSchedule
readList :: ReadS [DescribeMaintenanceWindowSchedule]
$creadList :: ReadS [DescribeMaintenanceWindowSchedule]
readsPrec :: Int -> ReadS DescribeMaintenanceWindowSchedule
$creadsPrec :: Int -> ReadS DescribeMaintenanceWindowSchedule
Prelude.Read, Int -> DescribeMaintenanceWindowSchedule -> ShowS
[DescribeMaintenanceWindowSchedule] -> ShowS
DescribeMaintenanceWindowSchedule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMaintenanceWindowSchedule] -> ShowS
$cshowList :: [DescribeMaintenanceWindowSchedule] -> ShowS
show :: DescribeMaintenanceWindowSchedule -> String
$cshow :: DescribeMaintenanceWindowSchedule -> String
showsPrec :: Int -> DescribeMaintenanceWindowSchedule -> ShowS
$cshowsPrec :: Int -> DescribeMaintenanceWindowSchedule -> ShowS
Prelude.Show, forall x.
Rep DescribeMaintenanceWindowSchedule x
-> DescribeMaintenanceWindowSchedule
forall x.
DescribeMaintenanceWindowSchedule
-> Rep DescribeMaintenanceWindowSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMaintenanceWindowSchedule x
-> DescribeMaintenanceWindowSchedule
$cfrom :: forall x.
DescribeMaintenanceWindowSchedule
-> Rep DescribeMaintenanceWindowSchedule x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMaintenanceWindowSchedule' 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', 'describeMaintenanceWindowSchedule_filters' - Filters used to limit the range of results. For example, you can limit
-- maintenance window executions to only those scheduled before or after a
-- certain date and time.
--
-- 'maxResults', 'describeMaintenanceWindowSchedule_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.
--
-- 'nextToken', 'describeMaintenanceWindowSchedule_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'resourceType', 'describeMaintenanceWindowSchedule_resourceType' - The type of resource you want to retrieve information about. For
-- example, @INSTANCE@.
--
-- 'targets', 'describeMaintenanceWindowSchedule_targets' - The managed node ID or key-value pair to retrieve information about.
--
-- 'windowId', 'describeMaintenanceWindowSchedule_windowId' - The ID of the maintenance window to retrieve information about.
newDescribeMaintenanceWindowSchedule ::
  DescribeMaintenanceWindowSchedule
newDescribeMaintenanceWindowSchedule :: DescribeMaintenanceWindowSchedule
newDescribeMaintenanceWindowSchedule =
  DescribeMaintenanceWindowSchedule'
    { $sel:filters:DescribeMaintenanceWindowSchedule' :: Maybe [PatchOrchestratorFilter]
filters =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeMaintenanceWindowSchedule' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeMaintenanceWindowSchedule' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:DescribeMaintenanceWindowSchedule' :: Maybe MaintenanceWindowResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:targets:DescribeMaintenanceWindowSchedule' :: Maybe [Target]
targets = forall a. Maybe a
Prelude.Nothing,
      $sel:windowId:DescribeMaintenanceWindowSchedule' :: Maybe Text
windowId = forall a. Maybe a
Prelude.Nothing
    }

-- | Filters used to limit the range of results. For example, you can limit
-- maintenance window executions to only those scheduled before or after a
-- certain date and time.
describeMaintenanceWindowSchedule_filters :: Lens.Lens' DescribeMaintenanceWindowSchedule (Prelude.Maybe [PatchOrchestratorFilter])
describeMaintenanceWindowSchedule_filters :: Lens'
  DescribeMaintenanceWindowSchedule (Maybe [PatchOrchestratorFilter])
describeMaintenanceWindowSchedule_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowSchedule' {Maybe [PatchOrchestratorFilter]
filters :: Maybe [PatchOrchestratorFilter]
$sel:filters:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule
-> Maybe [PatchOrchestratorFilter]
filters} -> Maybe [PatchOrchestratorFilter]
filters) (\s :: DescribeMaintenanceWindowSchedule
s@DescribeMaintenanceWindowSchedule' {} Maybe [PatchOrchestratorFilter]
a -> DescribeMaintenanceWindowSchedule
s {$sel:filters:DescribeMaintenanceWindowSchedule' :: Maybe [PatchOrchestratorFilter]
filters = Maybe [PatchOrchestratorFilter]
a} :: DescribeMaintenanceWindowSchedule) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

-- | The type of resource you want to retrieve information about. For
-- example, @INSTANCE@.
describeMaintenanceWindowSchedule_resourceType :: Lens.Lens' DescribeMaintenanceWindowSchedule (Prelude.Maybe MaintenanceWindowResourceType)
describeMaintenanceWindowSchedule_resourceType :: Lens'
  DescribeMaintenanceWindowSchedule
  (Maybe MaintenanceWindowResourceType)
describeMaintenanceWindowSchedule_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowSchedule' {Maybe MaintenanceWindowResourceType
resourceType :: Maybe MaintenanceWindowResourceType
$sel:resourceType:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule
-> Maybe MaintenanceWindowResourceType
resourceType} -> Maybe MaintenanceWindowResourceType
resourceType) (\s :: DescribeMaintenanceWindowSchedule
s@DescribeMaintenanceWindowSchedule' {} Maybe MaintenanceWindowResourceType
a -> DescribeMaintenanceWindowSchedule
s {$sel:resourceType:DescribeMaintenanceWindowSchedule' :: Maybe MaintenanceWindowResourceType
resourceType = Maybe MaintenanceWindowResourceType
a} :: DescribeMaintenanceWindowSchedule)

-- | The managed node ID or key-value pair to retrieve information about.
describeMaintenanceWindowSchedule_targets :: Lens.Lens' DescribeMaintenanceWindowSchedule (Prelude.Maybe [Target])
describeMaintenanceWindowSchedule_targets :: Lens' DescribeMaintenanceWindowSchedule (Maybe [Target])
describeMaintenanceWindowSchedule_targets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowSchedule' {Maybe [Target]
targets :: Maybe [Target]
$sel:targets:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe [Target]
targets} -> Maybe [Target]
targets) (\s :: DescribeMaintenanceWindowSchedule
s@DescribeMaintenanceWindowSchedule' {} Maybe [Target]
a -> DescribeMaintenanceWindowSchedule
s {$sel:targets:DescribeMaintenanceWindowSchedule' :: Maybe [Target]
targets = Maybe [Target]
a} :: DescribeMaintenanceWindowSchedule) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the maintenance window to retrieve information about.
describeMaintenanceWindowSchedule_windowId :: Lens.Lens' DescribeMaintenanceWindowSchedule (Prelude.Maybe Prelude.Text)
describeMaintenanceWindowSchedule_windowId :: Lens' DescribeMaintenanceWindowSchedule (Maybe Text)
describeMaintenanceWindowSchedule_windowId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowSchedule' {Maybe Text
windowId :: Maybe Text
$sel:windowId:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Text
windowId} -> Maybe Text
windowId) (\s :: DescribeMaintenanceWindowSchedule
s@DescribeMaintenanceWindowSchedule' {} Maybe Text
a -> DescribeMaintenanceWindowSchedule
s {$sel:windowId:DescribeMaintenanceWindowSchedule' :: Maybe Text
windowId = Maybe Text
a} :: DescribeMaintenanceWindowSchedule)

instance
  Core.AWSPager
    DescribeMaintenanceWindowSchedule
  where
  page :: DescribeMaintenanceWindowSchedule
-> AWSResponse DescribeMaintenanceWindowSchedule
-> Maybe DescribeMaintenanceWindowSchedule
page DescribeMaintenanceWindowSchedule
rq AWSResponse DescribeMaintenanceWindowSchedule
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeMaintenanceWindowSchedule
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeMaintenanceWindowScheduleResponse (Maybe Text)
describeMaintenanceWindowScheduleResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeMaintenanceWindowSchedule
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  DescribeMaintenanceWindowScheduleResponse
  (Maybe [ScheduledWindowExecution])
describeMaintenanceWindowScheduleResponse_scheduledWindowExecutions
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ DescribeMaintenanceWindowSchedule
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeMaintenanceWindowSchedule (Maybe Text)
describeMaintenanceWindowSchedule_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeMaintenanceWindowSchedule
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeMaintenanceWindowScheduleResponse (Maybe Text)
describeMaintenanceWindowScheduleResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

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

instance
  Prelude.Hashable
    DescribeMaintenanceWindowSchedule
  where
  hashWithSalt :: Int -> DescribeMaintenanceWindowSchedule -> Int
hashWithSalt
    Int
_salt
    DescribeMaintenanceWindowSchedule' {Maybe Natural
Maybe [PatchOrchestratorFilter]
Maybe [Target]
Maybe Text
Maybe MaintenanceWindowResourceType
windowId :: Maybe Text
targets :: Maybe [Target]
resourceType :: Maybe MaintenanceWindowResourceType
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [PatchOrchestratorFilter]
$sel:windowId:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Text
$sel:targets:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe [Target]
$sel:resourceType:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule
-> Maybe MaintenanceWindowResourceType
$sel:nextToken:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Text
$sel:maxResults:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Natural
$sel:filters:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule
-> Maybe [PatchOrchestratorFilter]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PatchOrchestratorFilter]
filters
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MaintenanceWindowResourceType
resourceType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Target]
targets
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
windowId

instance
  Prelude.NFData
    DescribeMaintenanceWindowSchedule
  where
  rnf :: DescribeMaintenanceWindowSchedule -> ()
rnf DescribeMaintenanceWindowSchedule' {Maybe Natural
Maybe [PatchOrchestratorFilter]
Maybe [Target]
Maybe Text
Maybe MaintenanceWindowResourceType
windowId :: Maybe Text
targets :: Maybe [Target]
resourceType :: Maybe MaintenanceWindowResourceType
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [PatchOrchestratorFilter]
$sel:windowId:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Text
$sel:targets:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe [Target]
$sel:resourceType:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule
-> Maybe MaintenanceWindowResourceType
$sel:nextToken:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Text
$sel:maxResults:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Natural
$sel:filters:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule
-> Maybe [PatchOrchestratorFilter]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [PatchOrchestratorFilter]
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MaintenanceWindowResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Target]
targets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
windowId

instance
  Data.ToHeaders
    DescribeMaintenanceWindowSchedule
  where
  toHeaders :: DescribeMaintenanceWindowSchedule -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonSSM.DescribeMaintenanceWindowSchedule" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Data.ToJSON
    DescribeMaintenanceWindowSchedule
  where
  toJSON :: DescribeMaintenanceWindowSchedule -> Value
toJSON DescribeMaintenanceWindowSchedule' {Maybe Natural
Maybe [PatchOrchestratorFilter]
Maybe [Target]
Maybe Text
Maybe MaintenanceWindowResourceType
windowId :: Maybe Text
targets :: Maybe [Target]
resourceType :: Maybe MaintenanceWindowResourceType
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [PatchOrchestratorFilter]
$sel:windowId:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Text
$sel:targets:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe [Target]
$sel:resourceType:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule
-> Maybe MaintenanceWindowResourceType
$sel:nextToken:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Text
$sel:maxResults:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule -> Maybe Natural
$sel:filters:DescribeMaintenanceWindowSchedule' :: DescribeMaintenanceWindowSchedule
-> Maybe [PatchOrchestratorFilter]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Filters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PatchOrchestratorFilter]
filters,
            (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"ResourceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MaintenanceWindowResourceType
resourceType,
            (Key
"Targets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Target]
targets,
            (Key
"WindowId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
windowId
          ]
      )

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

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

-- | /See:/ 'newDescribeMaintenanceWindowScheduleResponse' smart constructor.
data DescribeMaintenanceWindowScheduleResponse = DescribeMaintenanceWindowScheduleResponse'
  { -- | The token for the next set of items to return. (You use this token in
    -- the next call.)
    DescribeMaintenanceWindowScheduleResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information about maintenance window executions scheduled for the
    -- specified time range.
    DescribeMaintenanceWindowScheduleResponse
-> Maybe [ScheduledWindowExecution]
scheduledWindowExecutions :: Prelude.Maybe [ScheduledWindowExecution],
    -- | The response's http status code.
    DescribeMaintenanceWindowScheduleResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeMaintenanceWindowScheduleResponse
-> DescribeMaintenanceWindowScheduleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMaintenanceWindowScheduleResponse
-> DescribeMaintenanceWindowScheduleResponse -> Bool
$c/= :: DescribeMaintenanceWindowScheduleResponse
-> DescribeMaintenanceWindowScheduleResponse -> Bool
== :: DescribeMaintenanceWindowScheduleResponse
-> DescribeMaintenanceWindowScheduleResponse -> Bool
$c== :: DescribeMaintenanceWindowScheduleResponse
-> DescribeMaintenanceWindowScheduleResponse -> Bool
Prelude.Eq, ReadPrec [DescribeMaintenanceWindowScheduleResponse]
ReadPrec DescribeMaintenanceWindowScheduleResponse
Int -> ReadS DescribeMaintenanceWindowScheduleResponse
ReadS [DescribeMaintenanceWindowScheduleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMaintenanceWindowScheduleResponse]
$creadListPrec :: ReadPrec [DescribeMaintenanceWindowScheduleResponse]
readPrec :: ReadPrec DescribeMaintenanceWindowScheduleResponse
$creadPrec :: ReadPrec DescribeMaintenanceWindowScheduleResponse
readList :: ReadS [DescribeMaintenanceWindowScheduleResponse]
$creadList :: ReadS [DescribeMaintenanceWindowScheduleResponse]
readsPrec :: Int -> ReadS DescribeMaintenanceWindowScheduleResponse
$creadsPrec :: Int -> ReadS DescribeMaintenanceWindowScheduleResponse
Prelude.Read, Int -> DescribeMaintenanceWindowScheduleResponse -> ShowS
[DescribeMaintenanceWindowScheduleResponse] -> ShowS
DescribeMaintenanceWindowScheduleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMaintenanceWindowScheduleResponse] -> ShowS
$cshowList :: [DescribeMaintenanceWindowScheduleResponse] -> ShowS
show :: DescribeMaintenanceWindowScheduleResponse -> String
$cshow :: DescribeMaintenanceWindowScheduleResponse -> String
showsPrec :: Int -> DescribeMaintenanceWindowScheduleResponse -> ShowS
$cshowsPrec :: Int -> DescribeMaintenanceWindowScheduleResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeMaintenanceWindowScheduleResponse x
-> DescribeMaintenanceWindowScheduleResponse
forall x.
DescribeMaintenanceWindowScheduleResponse
-> Rep DescribeMaintenanceWindowScheduleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMaintenanceWindowScheduleResponse x
-> DescribeMaintenanceWindowScheduleResponse
$cfrom :: forall x.
DescribeMaintenanceWindowScheduleResponse
-> Rep DescribeMaintenanceWindowScheduleResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMaintenanceWindowScheduleResponse' 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:
--
-- 'nextToken', 'describeMaintenanceWindowScheduleResponse_nextToken' - The token for the next set of items to return. (You use this token in
-- the next call.)
--
-- 'scheduledWindowExecutions', 'describeMaintenanceWindowScheduleResponse_scheduledWindowExecutions' - Information about maintenance window executions scheduled for the
-- specified time range.
--
-- 'httpStatus', 'describeMaintenanceWindowScheduleResponse_httpStatus' - The response's http status code.
newDescribeMaintenanceWindowScheduleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeMaintenanceWindowScheduleResponse
newDescribeMaintenanceWindowScheduleResponse :: Int -> DescribeMaintenanceWindowScheduleResponse
newDescribeMaintenanceWindowScheduleResponse
  Int
pHttpStatus_ =
    DescribeMaintenanceWindowScheduleResponse'
      { $sel:nextToken:DescribeMaintenanceWindowScheduleResponse' :: Maybe Text
nextToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledWindowExecutions:DescribeMaintenanceWindowScheduleResponse' :: Maybe [ScheduledWindowExecution]
scheduledWindowExecutions =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeMaintenanceWindowScheduleResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The token for the next set of items to return. (You use this token in
-- the next call.)
describeMaintenanceWindowScheduleResponse_nextToken :: Lens.Lens' DescribeMaintenanceWindowScheduleResponse (Prelude.Maybe Prelude.Text)
describeMaintenanceWindowScheduleResponse_nextToken :: Lens' DescribeMaintenanceWindowScheduleResponse (Maybe Text)
describeMaintenanceWindowScheduleResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowScheduleResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeMaintenanceWindowScheduleResponse' :: DescribeMaintenanceWindowScheduleResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeMaintenanceWindowScheduleResponse
s@DescribeMaintenanceWindowScheduleResponse' {} Maybe Text
a -> DescribeMaintenanceWindowScheduleResponse
s {$sel:nextToken:DescribeMaintenanceWindowScheduleResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeMaintenanceWindowScheduleResponse)

-- | Information about maintenance window executions scheduled for the
-- specified time range.
describeMaintenanceWindowScheduleResponse_scheduledWindowExecutions :: Lens.Lens' DescribeMaintenanceWindowScheduleResponse (Prelude.Maybe [ScheduledWindowExecution])
describeMaintenanceWindowScheduleResponse_scheduledWindowExecutions :: Lens'
  DescribeMaintenanceWindowScheduleResponse
  (Maybe [ScheduledWindowExecution])
describeMaintenanceWindowScheduleResponse_scheduledWindowExecutions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowScheduleResponse' {Maybe [ScheduledWindowExecution]
scheduledWindowExecutions :: Maybe [ScheduledWindowExecution]
$sel:scheduledWindowExecutions:DescribeMaintenanceWindowScheduleResponse' :: DescribeMaintenanceWindowScheduleResponse
-> Maybe [ScheduledWindowExecution]
scheduledWindowExecutions} -> Maybe [ScheduledWindowExecution]
scheduledWindowExecutions) (\s :: DescribeMaintenanceWindowScheduleResponse
s@DescribeMaintenanceWindowScheduleResponse' {} Maybe [ScheduledWindowExecution]
a -> DescribeMaintenanceWindowScheduleResponse
s {$sel:scheduledWindowExecutions:DescribeMaintenanceWindowScheduleResponse' :: Maybe [ScheduledWindowExecution]
scheduledWindowExecutions = Maybe [ScheduledWindowExecution]
a} :: DescribeMaintenanceWindowScheduleResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeMaintenanceWindowScheduleResponse
  where
  rnf :: DescribeMaintenanceWindowScheduleResponse -> ()
rnf DescribeMaintenanceWindowScheduleResponse' {Int
Maybe [ScheduledWindowExecution]
Maybe Text
httpStatus :: Int
scheduledWindowExecutions :: Maybe [ScheduledWindowExecution]
nextToken :: Maybe Text
$sel:httpStatus:DescribeMaintenanceWindowScheduleResponse' :: DescribeMaintenanceWindowScheduleResponse -> Int
$sel:scheduledWindowExecutions:DescribeMaintenanceWindowScheduleResponse' :: DescribeMaintenanceWindowScheduleResponse
-> Maybe [ScheduledWindowExecution]
$sel:nextToken:DescribeMaintenanceWindowScheduleResponse' :: DescribeMaintenanceWindowScheduleResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ScheduledWindowExecution]
scheduledWindowExecutions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus