{-# 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.DescribeEffectivePatchesForPatchBaseline
-- 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 current effective patches (the patch and the approval
-- state) for the specified patch baseline. Applies to patch baselines for
-- Windows only.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeEffectivePatchesForPatchBaseline
  ( -- * Creating a Request
    DescribeEffectivePatchesForPatchBaseline (..),
    newDescribeEffectivePatchesForPatchBaseline,

    -- * Request Lenses
    describeEffectivePatchesForPatchBaseline_nextToken,
    describeEffectivePatchesForPatchBaseline_maxResults,
    describeEffectivePatchesForPatchBaseline_baselineId,

    -- * Destructuring the Response
    DescribeEffectivePatchesForPatchBaselineResponse (..),
    newDescribeEffectivePatchesForPatchBaselineResponse,

    -- * Response Lenses
    describeEffectivePatchesForPatchBaselineResponse_effectivePatches,
    describeEffectivePatchesForPatchBaselineResponse_nextToken,
    describeEffectivePatchesForPatchBaselineResponse_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:/ 'newDescribeEffectivePatchesForPatchBaseline' smart constructor.
data DescribeEffectivePatchesForPatchBaseline = DescribeEffectivePatchesForPatchBaseline'
  { -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeEffectivePatchesForPatchBaseline -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of patches to return (per page).
    DescribeEffectivePatchesForPatchBaseline -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the patch baseline to retrieve the effective patches for.
    DescribeEffectivePatchesForPatchBaseline -> Text
baselineId :: Prelude.Text
  }
  deriving (DescribeEffectivePatchesForPatchBaseline
-> DescribeEffectivePatchesForPatchBaseline -> Bool
(DescribeEffectivePatchesForPatchBaseline
 -> DescribeEffectivePatchesForPatchBaseline -> Bool)
-> (DescribeEffectivePatchesForPatchBaseline
    -> DescribeEffectivePatchesForPatchBaseline -> Bool)
-> Eq DescribeEffectivePatchesForPatchBaseline
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEffectivePatchesForPatchBaseline
-> DescribeEffectivePatchesForPatchBaseline -> Bool
$c/= :: DescribeEffectivePatchesForPatchBaseline
-> DescribeEffectivePatchesForPatchBaseline -> Bool
== :: DescribeEffectivePatchesForPatchBaseline
-> DescribeEffectivePatchesForPatchBaseline -> Bool
$c== :: DescribeEffectivePatchesForPatchBaseline
-> DescribeEffectivePatchesForPatchBaseline -> Bool
Prelude.Eq, ReadPrec [DescribeEffectivePatchesForPatchBaseline]
ReadPrec DescribeEffectivePatchesForPatchBaseline
Int -> ReadS DescribeEffectivePatchesForPatchBaseline
ReadS [DescribeEffectivePatchesForPatchBaseline]
(Int -> ReadS DescribeEffectivePatchesForPatchBaseline)
-> ReadS [DescribeEffectivePatchesForPatchBaseline]
-> ReadPrec DescribeEffectivePatchesForPatchBaseline
-> ReadPrec [DescribeEffectivePatchesForPatchBaseline]
-> Read DescribeEffectivePatchesForPatchBaseline
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEffectivePatchesForPatchBaseline]
$creadListPrec :: ReadPrec [DescribeEffectivePatchesForPatchBaseline]
readPrec :: ReadPrec DescribeEffectivePatchesForPatchBaseline
$creadPrec :: ReadPrec DescribeEffectivePatchesForPatchBaseline
readList :: ReadS [DescribeEffectivePatchesForPatchBaseline]
$creadList :: ReadS [DescribeEffectivePatchesForPatchBaseline]
readsPrec :: Int -> ReadS DescribeEffectivePatchesForPatchBaseline
$creadsPrec :: Int -> ReadS DescribeEffectivePatchesForPatchBaseline
Prelude.Read, Int -> DescribeEffectivePatchesForPatchBaseline -> ShowS
[DescribeEffectivePatchesForPatchBaseline] -> ShowS
DescribeEffectivePatchesForPatchBaseline -> String
(Int -> DescribeEffectivePatchesForPatchBaseline -> ShowS)
-> (DescribeEffectivePatchesForPatchBaseline -> String)
-> ([DescribeEffectivePatchesForPatchBaseline] -> ShowS)
-> Show DescribeEffectivePatchesForPatchBaseline
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEffectivePatchesForPatchBaseline] -> ShowS
$cshowList :: [DescribeEffectivePatchesForPatchBaseline] -> ShowS
show :: DescribeEffectivePatchesForPatchBaseline -> String
$cshow :: DescribeEffectivePatchesForPatchBaseline -> String
showsPrec :: Int -> DescribeEffectivePatchesForPatchBaseline -> ShowS
$cshowsPrec :: Int -> DescribeEffectivePatchesForPatchBaseline -> ShowS
Prelude.Show, (forall x.
 DescribeEffectivePatchesForPatchBaseline
 -> Rep DescribeEffectivePatchesForPatchBaseline x)
-> (forall x.
    Rep DescribeEffectivePatchesForPatchBaseline x
    -> DescribeEffectivePatchesForPatchBaseline)
-> Generic DescribeEffectivePatchesForPatchBaseline
forall x.
Rep DescribeEffectivePatchesForPatchBaseline x
-> DescribeEffectivePatchesForPatchBaseline
forall x.
DescribeEffectivePatchesForPatchBaseline
-> Rep DescribeEffectivePatchesForPatchBaseline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEffectivePatchesForPatchBaseline x
-> DescribeEffectivePatchesForPatchBaseline
$cfrom :: forall x.
DescribeEffectivePatchesForPatchBaseline
-> Rep DescribeEffectivePatchesForPatchBaseline x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEffectivePatchesForPatchBaseline' 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', 'describeEffectivePatchesForPatchBaseline_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeEffectivePatchesForPatchBaseline_maxResults' - The maximum number of patches to return (per page).
--
-- 'baselineId', 'describeEffectivePatchesForPatchBaseline_baselineId' - The ID of the patch baseline to retrieve the effective patches for.
newDescribeEffectivePatchesForPatchBaseline ::
  -- | 'baselineId'
  Prelude.Text ->
  DescribeEffectivePatchesForPatchBaseline
newDescribeEffectivePatchesForPatchBaseline :: Text -> DescribeEffectivePatchesForPatchBaseline
newDescribeEffectivePatchesForPatchBaseline
  Text
pBaselineId_ =
    DescribeEffectivePatchesForPatchBaseline' :: Maybe Text
-> Maybe Natural
-> Text
-> DescribeEffectivePatchesForPatchBaseline
DescribeEffectivePatchesForPatchBaseline'
      { $sel:nextToken:DescribeEffectivePatchesForPatchBaseline' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:DescribeEffectivePatchesForPatchBaseline' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:baselineId:DescribeEffectivePatchesForPatchBaseline' :: Text
baselineId = Text
pBaselineId_
      }

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

-- | The maximum number of patches to return (per page).
describeEffectivePatchesForPatchBaseline_maxResults :: Lens.Lens' DescribeEffectivePatchesForPatchBaseline (Prelude.Maybe Prelude.Natural)
describeEffectivePatchesForPatchBaseline_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeEffectivePatchesForPatchBaseline
-> f DescribeEffectivePatchesForPatchBaseline
describeEffectivePatchesForPatchBaseline_maxResults = (DescribeEffectivePatchesForPatchBaseline -> Maybe Natural)
-> (DescribeEffectivePatchesForPatchBaseline
    -> Maybe Natural -> DescribeEffectivePatchesForPatchBaseline)
-> Lens
     DescribeEffectivePatchesForPatchBaseline
     DescribeEffectivePatchesForPatchBaseline
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEffectivePatchesForPatchBaseline' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeEffectivePatchesForPatchBaseline' :: DescribeEffectivePatchesForPatchBaseline -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeEffectivePatchesForPatchBaseline
s@DescribeEffectivePatchesForPatchBaseline' {} Maybe Natural
a -> DescribeEffectivePatchesForPatchBaseline
s {$sel:maxResults:DescribeEffectivePatchesForPatchBaseline' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeEffectivePatchesForPatchBaseline)

-- | The ID of the patch baseline to retrieve the effective patches for.
describeEffectivePatchesForPatchBaseline_baselineId :: Lens.Lens' DescribeEffectivePatchesForPatchBaseline Prelude.Text
describeEffectivePatchesForPatchBaseline_baselineId :: (Text -> f Text)
-> DescribeEffectivePatchesForPatchBaseline
-> f DescribeEffectivePatchesForPatchBaseline
describeEffectivePatchesForPatchBaseline_baselineId = (DescribeEffectivePatchesForPatchBaseline -> Text)
-> (DescribeEffectivePatchesForPatchBaseline
    -> Text -> DescribeEffectivePatchesForPatchBaseline)
-> Lens
     DescribeEffectivePatchesForPatchBaseline
     DescribeEffectivePatchesForPatchBaseline
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEffectivePatchesForPatchBaseline' {Text
baselineId :: Text
$sel:baselineId:DescribeEffectivePatchesForPatchBaseline' :: DescribeEffectivePatchesForPatchBaseline -> Text
baselineId} -> Text
baselineId) (\s :: DescribeEffectivePatchesForPatchBaseline
s@DescribeEffectivePatchesForPatchBaseline' {} Text
a -> DescribeEffectivePatchesForPatchBaseline
s {$sel:baselineId:DescribeEffectivePatchesForPatchBaseline' :: Text
baselineId = Text
a} :: DescribeEffectivePatchesForPatchBaseline)

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

instance
  Prelude.NFData
    DescribeEffectivePatchesForPatchBaseline

instance
  Core.ToHeaders
    DescribeEffectivePatchesForPatchBaseline
  where
  toHeaders :: DescribeEffectivePatchesForPatchBaseline -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeEffectivePatchesForPatchBaseline -> 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.DescribeEffectivePatchesForPatchBaseline" ::
                          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
    DescribeEffectivePatchesForPatchBaseline
  where
  toJSON :: DescribeEffectivePatchesForPatchBaseline -> Value
toJSON DescribeEffectivePatchesForPatchBaseline' {Maybe Natural
Maybe Text
Text
baselineId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:baselineId:DescribeEffectivePatchesForPatchBaseline' :: DescribeEffectivePatchesForPatchBaseline -> Text
$sel:maxResults:DescribeEffectivePatchesForPatchBaseline' :: DescribeEffectivePatchesForPatchBaseline -> Maybe Natural
$sel:nextToken:DescribeEffectivePatchesForPatchBaseline' :: DescribeEffectivePatchesForPatchBaseline -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"BaselineId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
baselineId)
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeEffectivePatchesForPatchBaselineResponse' 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:
--
-- 'effectivePatches', 'describeEffectivePatchesForPatchBaselineResponse_effectivePatches' - An array of patches and patch status.
--
-- 'nextToken', 'describeEffectivePatchesForPatchBaselineResponse_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', 'describeEffectivePatchesForPatchBaselineResponse_httpStatus' - The response's http status code.
newDescribeEffectivePatchesForPatchBaselineResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEffectivePatchesForPatchBaselineResponse
newDescribeEffectivePatchesForPatchBaselineResponse :: Int -> DescribeEffectivePatchesForPatchBaselineResponse
newDescribeEffectivePatchesForPatchBaselineResponse
  Int
pHttpStatus_ =
    DescribeEffectivePatchesForPatchBaselineResponse' :: Maybe [EffectivePatch]
-> Maybe Text
-> Int
-> DescribeEffectivePatchesForPatchBaselineResponse
DescribeEffectivePatchesForPatchBaselineResponse'
      { $sel:effectivePatches:DescribeEffectivePatchesForPatchBaselineResponse' :: Maybe [EffectivePatch]
effectivePatches =
          Maybe [EffectivePatch]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeEffectivePatchesForPatchBaselineResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeEffectivePatchesForPatchBaselineResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | An array of patches and patch status.
describeEffectivePatchesForPatchBaselineResponse_effectivePatches :: Lens.Lens' DescribeEffectivePatchesForPatchBaselineResponse (Prelude.Maybe [EffectivePatch])
describeEffectivePatchesForPatchBaselineResponse_effectivePatches :: (Maybe [EffectivePatch] -> f (Maybe [EffectivePatch]))
-> DescribeEffectivePatchesForPatchBaselineResponse
-> f DescribeEffectivePatchesForPatchBaselineResponse
describeEffectivePatchesForPatchBaselineResponse_effectivePatches = (DescribeEffectivePatchesForPatchBaselineResponse
 -> Maybe [EffectivePatch])
-> (DescribeEffectivePatchesForPatchBaselineResponse
    -> Maybe [EffectivePatch]
    -> DescribeEffectivePatchesForPatchBaselineResponse)
-> Lens'
     DescribeEffectivePatchesForPatchBaselineResponse
     (Maybe [EffectivePatch])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEffectivePatchesForPatchBaselineResponse' {Maybe [EffectivePatch]
effectivePatches :: Maybe [EffectivePatch]
$sel:effectivePatches:DescribeEffectivePatchesForPatchBaselineResponse' :: DescribeEffectivePatchesForPatchBaselineResponse
-> Maybe [EffectivePatch]
effectivePatches} -> Maybe [EffectivePatch]
effectivePatches) (\s :: DescribeEffectivePatchesForPatchBaselineResponse
s@DescribeEffectivePatchesForPatchBaselineResponse' {} Maybe [EffectivePatch]
a -> DescribeEffectivePatchesForPatchBaselineResponse
s {$sel:effectivePatches:DescribeEffectivePatchesForPatchBaselineResponse' :: Maybe [EffectivePatch]
effectivePatches = Maybe [EffectivePatch]
a} :: DescribeEffectivePatchesForPatchBaselineResponse) ((Maybe [EffectivePatch] -> f (Maybe [EffectivePatch]))
 -> DescribeEffectivePatchesForPatchBaselineResponse
 -> f DescribeEffectivePatchesForPatchBaselineResponse)
-> ((Maybe [EffectivePatch] -> f (Maybe [EffectivePatch]))
    -> Maybe [EffectivePatch] -> f (Maybe [EffectivePatch]))
-> (Maybe [EffectivePatch] -> f (Maybe [EffectivePatch]))
-> DescribeEffectivePatchesForPatchBaselineResponse
-> f DescribeEffectivePatchesForPatchBaselineResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EffectivePatch] [EffectivePatch] [EffectivePatch] [EffectivePatch]
-> Iso
     (Maybe [EffectivePatch])
     (Maybe [EffectivePatch])
     (Maybe [EffectivePatch])
     (Maybe [EffectivePatch])
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
  [EffectivePatch] [EffectivePatch] [EffectivePatch] [EffectivePatch]
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.
describeEffectivePatchesForPatchBaselineResponse_nextToken :: Lens.Lens' DescribeEffectivePatchesForPatchBaselineResponse (Prelude.Maybe Prelude.Text)
describeEffectivePatchesForPatchBaselineResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEffectivePatchesForPatchBaselineResponse
-> f DescribeEffectivePatchesForPatchBaselineResponse
describeEffectivePatchesForPatchBaselineResponse_nextToken = (DescribeEffectivePatchesForPatchBaselineResponse -> Maybe Text)
-> (DescribeEffectivePatchesForPatchBaselineResponse
    -> Maybe Text -> DescribeEffectivePatchesForPatchBaselineResponse)
-> Lens'
     DescribeEffectivePatchesForPatchBaselineResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEffectivePatchesForPatchBaselineResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEffectivePatchesForPatchBaselineResponse' :: DescribeEffectivePatchesForPatchBaselineResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEffectivePatchesForPatchBaselineResponse
s@DescribeEffectivePatchesForPatchBaselineResponse' {} Maybe Text
a -> DescribeEffectivePatchesForPatchBaselineResponse
s {$sel:nextToken:DescribeEffectivePatchesForPatchBaselineResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEffectivePatchesForPatchBaselineResponse)

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

instance
  Prelude.NFData
    DescribeEffectivePatchesForPatchBaselineResponse