{-# 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.DescribeMaintenanceWindowTargets
-- 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 targets registered with the maintenance window.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeMaintenanceWindowTargets
  ( -- * Creating a Request
    DescribeMaintenanceWindowTargets (..),
    newDescribeMaintenanceWindowTargets,

    -- * Request Lenses
    describeMaintenanceWindowTargets_filters,
    describeMaintenanceWindowTargets_nextToken,
    describeMaintenanceWindowTargets_maxResults,
    describeMaintenanceWindowTargets_windowId,

    -- * Destructuring the Response
    DescribeMaintenanceWindowTargetsResponse (..),
    newDescribeMaintenanceWindowTargetsResponse,

    -- * Response Lenses
    describeMaintenanceWindowTargetsResponse_nextToken,
    describeMaintenanceWindowTargetsResponse_targets,
    describeMaintenanceWindowTargetsResponse_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:/ 'newDescribeMaintenanceWindowTargets' smart constructor.
data DescribeMaintenanceWindowTargets = DescribeMaintenanceWindowTargets'
  { -- | Optional filters that can be used to narrow down the scope of the
    -- returned window targets. The supported filter keys are @Type@,
    -- @WindowTargetId@, and @OwnerInformation@.
    DescribeMaintenanceWindowTargets -> Maybe [MaintenanceWindowFilter]
filters :: Prelude.Maybe [MaintenanceWindowFilter],
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeMaintenanceWindowTargets -> 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.
    DescribeMaintenanceWindowTargets -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the maintenance window whose targets should be retrieved.
    DescribeMaintenanceWindowTargets -> Text
windowId :: Prelude.Text
  }
  deriving (DescribeMaintenanceWindowTargets
-> DescribeMaintenanceWindowTargets -> Bool
(DescribeMaintenanceWindowTargets
 -> DescribeMaintenanceWindowTargets -> Bool)
-> (DescribeMaintenanceWindowTargets
    -> DescribeMaintenanceWindowTargets -> Bool)
-> Eq DescribeMaintenanceWindowTargets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMaintenanceWindowTargets
-> DescribeMaintenanceWindowTargets -> Bool
$c/= :: DescribeMaintenanceWindowTargets
-> DescribeMaintenanceWindowTargets -> Bool
== :: DescribeMaintenanceWindowTargets
-> DescribeMaintenanceWindowTargets -> Bool
$c== :: DescribeMaintenanceWindowTargets
-> DescribeMaintenanceWindowTargets -> Bool
Prelude.Eq, ReadPrec [DescribeMaintenanceWindowTargets]
ReadPrec DescribeMaintenanceWindowTargets
Int -> ReadS DescribeMaintenanceWindowTargets
ReadS [DescribeMaintenanceWindowTargets]
(Int -> ReadS DescribeMaintenanceWindowTargets)
-> ReadS [DescribeMaintenanceWindowTargets]
-> ReadPrec DescribeMaintenanceWindowTargets
-> ReadPrec [DescribeMaintenanceWindowTargets]
-> Read DescribeMaintenanceWindowTargets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMaintenanceWindowTargets]
$creadListPrec :: ReadPrec [DescribeMaintenanceWindowTargets]
readPrec :: ReadPrec DescribeMaintenanceWindowTargets
$creadPrec :: ReadPrec DescribeMaintenanceWindowTargets
readList :: ReadS [DescribeMaintenanceWindowTargets]
$creadList :: ReadS [DescribeMaintenanceWindowTargets]
readsPrec :: Int -> ReadS DescribeMaintenanceWindowTargets
$creadsPrec :: Int -> ReadS DescribeMaintenanceWindowTargets
Prelude.Read, Int -> DescribeMaintenanceWindowTargets -> ShowS
[DescribeMaintenanceWindowTargets] -> ShowS
DescribeMaintenanceWindowTargets -> String
(Int -> DescribeMaintenanceWindowTargets -> ShowS)
-> (DescribeMaintenanceWindowTargets -> String)
-> ([DescribeMaintenanceWindowTargets] -> ShowS)
-> Show DescribeMaintenanceWindowTargets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMaintenanceWindowTargets] -> ShowS
$cshowList :: [DescribeMaintenanceWindowTargets] -> ShowS
show :: DescribeMaintenanceWindowTargets -> String
$cshow :: DescribeMaintenanceWindowTargets -> String
showsPrec :: Int -> DescribeMaintenanceWindowTargets -> ShowS
$cshowsPrec :: Int -> DescribeMaintenanceWindowTargets -> ShowS
Prelude.Show, (forall x.
 DescribeMaintenanceWindowTargets
 -> Rep DescribeMaintenanceWindowTargets x)
-> (forall x.
    Rep DescribeMaintenanceWindowTargets x
    -> DescribeMaintenanceWindowTargets)
-> Generic DescribeMaintenanceWindowTargets
forall x.
Rep DescribeMaintenanceWindowTargets x
-> DescribeMaintenanceWindowTargets
forall x.
DescribeMaintenanceWindowTargets
-> Rep DescribeMaintenanceWindowTargets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMaintenanceWindowTargets x
-> DescribeMaintenanceWindowTargets
$cfrom :: forall x.
DescribeMaintenanceWindowTargets
-> Rep DescribeMaintenanceWindowTargets x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMaintenanceWindowTargets' 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', 'describeMaintenanceWindowTargets_filters' - Optional filters that can be used to narrow down the scope of the
-- returned window targets. The supported filter keys are @Type@,
-- @WindowTargetId@, and @OwnerInformation@.
--
-- 'nextToken', 'describeMaintenanceWindowTargets_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeMaintenanceWindowTargets_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', 'describeMaintenanceWindowTargets_windowId' - The ID of the maintenance window whose targets should be retrieved.
newDescribeMaintenanceWindowTargets ::
  -- | 'windowId'
  Prelude.Text ->
  DescribeMaintenanceWindowTargets
newDescribeMaintenanceWindowTargets :: Text -> DescribeMaintenanceWindowTargets
newDescribeMaintenanceWindowTargets Text
pWindowId_ =
  DescribeMaintenanceWindowTargets' :: Maybe [MaintenanceWindowFilter]
-> Maybe Text
-> Maybe Natural
-> Text
-> DescribeMaintenanceWindowTargets
DescribeMaintenanceWindowTargets'
    { $sel:filters:DescribeMaintenanceWindowTargets' :: Maybe [MaintenanceWindowFilter]
filters =
        Maybe [MaintenanceWindowFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeMaintenanceWindowTargets' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeMaintenanceWindowTargets' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:windowId:DescribeMaintenanceWindowTargets' :: Text
windowId = Text
pWindowId_
    }

-- | Optional filters that can be used to narrow down the scope of the
-- returned window targets. The supported filter keys are @Type@,
-- @WindowTargetId@, and @OwnerInformation@.
describeMaintenanceWindowTargets_filters :: Lens.Lens' DescribeMaintenanceWindowTargets (Prelude.Maybe [MaintenanceWindowFilter])
describeMaintenanceWindowTargets_filters :: (Maybe [MaintenanceWindowFilter]
 -> f (Maybe [MaintenanceWindowFilter]))
-> DescribeMaintenanceWindowTargets
-> f DescribeMaintenanceWindowTargets
describeMaintenanceWindowTargets_filters = (DescribeMaintenanceWindowTargets
 -> Maybe [MaintenanceWindowFilter])
-> (DescribeMaintenanceWindowTargets
    -> Maybe [MaintenanceWindowFilter]
    -> DescribeMaintenanceWindowTargets)
-> Lens
     DescribeMaintenanceWindowTargets
     DescribeMaintenanceWindowTargets
     (Maybe [MaintenanceWindowFilter])
     (Maybe [MaintenanceWindowFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowTargets' {Maybe [MaintenanceWindowFilter]
filters :: Maybe [MaintenanceWindowFilter]
$sel:filters:DescribeMaintenanceWindowTargets' :: DescribeMaintenanceWindowTargets -> Maybe [MaintenanceWindowFilter]
filters} -> Maybe [MaintenanceWindowFilter]
filters) (\s :: DescribeMaintenanceWindowTargets
s@DescribeMaintenanceWindowTargets' {} Maybe [MaintenanceWindowFilter]
a -> DescribeMaintenanceWindowTargets
s {$sel:filters:DescribeMaintenanceWindowTargets' :: Maybe [MaintenanceWindowFilter]
filters = Maybe [MaintenanceWindowFilter]
a} :: DescribeMaintenanceWindowTargets) ((Maybe [MaintenanceWindowFilter]
  -> f (Maybe [MaintenanceWindowFilter]))
 -> DescribeMaintenanceWindowTargets
 -> f DescribeMaintenanceWindowTargets)
-> ((Maybe [MaintenanceWindowFilter]
     -> f (Maybe [MaintenanceWindowFilter]))
    -> Maybe [MaintenanceWindowFilter]
    -> f (Maybe [MaintenanceWindowFilter]))
-> (Maybe [MaintenanceWindowFilter]
    -> f (Maybe [MaintenanceWindowFilter]))
-> DescribeMaintenanceWindowTargets
-> f DescribeMaintenanceWindowTargets
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.)
describeMaintenanceWindowTargets_nextToken :: Lens.Lens' DescribeMaintenanceWindowTargets (Prelude.Maybe Prelude.Text)
describeMaintenanceWindowTargets_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeMaintenanceWindowTargets
-> f DescribeMaintenanceWindowTargets
describeMaintenanceWindowTargets_nextToken = (DescribeMaintenanceWindowTargets -> Maybe Text)
-> (DescribeMaintenanceWindowTargets
    -> Maybe Text -> DescribeMaintenanceWindowTargets)
-> Lens
     DescribeMaintenanceWindowTargets
     DescribeMaintenanceWindowTargets
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMaintenanceWindowTargets' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeMaintenanceWindowTargets' :: DescribeMaintenanceWindowTargets -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeMaintenanceWindowTargets
s@DescribeMaintenanceWindowTargets' {} Maybe Text
a -> DescribeMaintenanceWindowTargets
s {$sel:nextToken:DescribeMaintenanceWindowTargets' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeMaintenanceWindowTargets)

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

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

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

instance
  Prelude.NFData
    DescribeMaintenanceWindowTargets

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

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

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

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

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

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

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

instance
  Prelude.NFData
    DescribeMaintenanceWindowTargetsResponse