{-# 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.DescribePatchBaselines
-- 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 patch baselines in your Amazon Web Services account.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribePatchBaselines
  ( -- * Creating a Request
    DescribePatchBaselines (..),
    newDescribePatchBaselines,

    -- * Request Lenses
    describePatchBaselines_filters,
    describePatchBaselines_nextToken,
    describePatchBaselines_maxResults,

    -- * Destructuring the Response
    DescribePatchBaselinesResponse (..),
    newDescribePatchBaselinesResponse,

    -- * Response Lenses
    describePatchBaselinesResponse_baselineIdentities,
    describePatchBaselinesResponse_nextToken,
    describePatchBaselinesResponse_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:/ 'newDescribePatchBaselines' smart constructor.
data DescribePatchBaselines = DescribePatchBaselines'
  { -- | Each element in the array is a structure containing a key-value pair.
    --
    -- Supported keys for @DescribePatchBaselines@ include the following:
    --
    -- -   __@NAME_PREFIX@__
    --
    --     Sample values: @AWS-@ | @My-@
    --
    -- -   __@OWNER@__
    --
    --     Sample values: @AWS@ | @Self@
    --
    -- -   __@OPERATING_SYSTEM@__
    --
    --     Sample values: @AMAZON_LINUX@ | @SUSE@ | @WINDOWS@
    DescribePatchBaselines -> Maybe [PatchOrchestratorFilter]
filters :: Prelude.Maybe [PatchOrchestratorFilter],
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribePatchBaselines -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of patch baselines to return (per page).
    DescribePatchBaselines -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribePatchBaselines -> DescribePatchBaselines -> Bool
(DescribePatchBaselines -> DescribePatchBaselines -> Bool)
-> (DescribePatchBaselines -> DescribePatchBaselines -> Bool)
-> Eq DescribePatchBaselines
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePatchBaselines -> DescribePatchBaselines -> Bool
$c/= :: DescribePatchBaselines -> DescribePatchBaselines -> Bool
== :: DescribePatchBaselines -> DescribePatchBaselines -> Bool
$c== :: DescribePatchBaselines -> DescribePatchBaselines -> Bool
Prelude.Eq, ReadPrec [DescribePatchBaselines]
ReadPrec DescribePatchBaselines
Int -> ReadS DescribePatchBaselines
ReadS [DescribePatchBaselines]
(Int -> ReadS DescribePatchBaselines)
-> ReadS [DescribePatchBaselines]
-> ReadPrec DescribePatchBaselines
-> ReadPrec [DescribePatchBaselines]
-> Read DescribePatchBaselines
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePatchBaselines]
$creadListPrec :: ReadPrec [DescribePatchBaselines]
readPrec :: ReadPrec DescribePatchBaselines
$creadPrec :: ReadPrec DescribePatchBaselines
readList :: ReadS [DescribePatchBaselines]
$creadList :: ReadS [DescribePatchBaselines]
readsPrec :: Int -> ReadS DescribePatchBaselines
$creadsPrec :: Int -> ReadS DescribePatchBaselines
Prelude.Read, Int -> DescribePatchBaselines -> ShowS
[DescribePatchBaselines] -> ShowS
DescribePatchBaselines -> String
(Int -> DescribePatchBaselines -> ShowS)
-> (DescribePatchBaselines -> String)
-> ([DescribePatchBaselines] -> ShowS)
-> Show DescribePatchBaselines
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePatchBaselines] -> ShowS
$cshowList :: [DescribePatchBaselines] -> ShowS
show :: DescribePatchBaselines -> String
$cshow :: DescribePatchBaselines -> String
showsPrec :: Int -> DescribePatchBaselines -> ShowS
$cshowsPrec :: Int -> DescribePatchBaselines -> ShowS
Prelude.Show, (forall x. DescribePatchBaselines -> Rep DescribePatchBaselines x)
-> (forall x.
    Rep DescribePatchBaselines x -> DescribePatchBaselines)
-> Generic DescribePatchBaselines
forall x. Rep DescribePatchBaselines x -> DescribePatchBaselines
forall x. DescribePatchBaselines -> Rep DescribePatchBaselines x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribePatchBaselines x -> DescribePatchBaselines
$cfrom :: forall x. DescribePatchBaselines -> Rep DescribePatchBaselines x
Prelude.Generic)

-- |
-- Create a value of 'DescribePatchBaselines' 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', 'describePatchBaselines_filters' - Each element in the array is a structure containing a key-value pair.
--
-- Supported keys for @DescribePatchBaselines@ include the following:
--
-- -   __@NAME_PREFIX@__
--
--     Sample values: @AWS-@ | @My-@
--
-- -   __@OWNER@__
--
--     Sample values: @AWS@ | @Self@
--
-- -   __@OPERATING_SYSTEM@__
--
--     Sample values: @AMAZON_LINUX@ | @SUSE@ | @WINDOWS@
--
-- 'nextToken', 'describePatchBaselines_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describePatchBaselines_maxResults' - The maximum number of patch baselines to return (per page).
newDescribePatchBaselines ::
  DescribePatchBaselines
newDescribePatchBaselines :: DescribePatchBaselines
newDescribePatchBaselines =
  DescribePatchBaselines' :: Maybe [PatchOrchestratorFilter]
-> Maybe Text -> Maybe Natural -> DescribePatchBaselines
DescribePatchBaselines'
    { $sel:filters:DescribePatchBaselines' :: Maybe [PatchOrchestratorFilter]
filters = Maybe [PatchOrchestratorFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribePatchBaselines' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribePatchBaselines' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Each element in the array is a structure containing a key-value pair.
--
-- Supported keys for @DescribePatchBaselines@ include the following:
--
-- -   __@NAME_PREFIX@__
--
--     Sample values: @AWS-@ | @My-@
--
-- -   __@OWNER@__
--
--     Sample values: @AWS@ | @Self@
--
-- -   __@OPERATING_SYSTEM@__
--
--     Sample values: @AMAZON_LINUX@ | @SUSE@ | @WINDOWS@
describePatchBaselines_filters :: Lens.Lens' DescribePatchBaselines (Prelude.Maybe [PatchOrchestratorFilter])
describePatchBaselines_filters :: (Maybe [PatchOrchestratorFilter]
 -> f (Maybe [PatchOrchestratorFilter]))
-> DescribePatchBaselines -> f DescribePatchBaselines
describePatchBaselines_filters = (DescribePatchBaselines -> Maybe [PatchOrchestratorFilter])
-> (DescribePatchBaselines
    -> Maybe [PatchOrchestratorFilter] -> DescribePatchBaselines)
-> Lens
     DescribePatchBaselines
     DescribePatchBaselines
     (Maybe [PatchOrchestratorFilter])
     (Maybe [PatchOrchestratorFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchBaselines' {Maybe [PatchOrchestratorFilter]
filters :: Maybe [PatchOrchestratorFilter]
$sel:filters:DescribePatchBaselines' :: DescribePatchBaselines -> Maybe [PatchOrchestratorFilter]
filters} -> Maybe [PatchOrchestratorFilter]
filters) (\s :: DescribePatchBaselines
s@DescribePatchBaselines' {} Maybe [PatchOrchestratorFilter]
a -> DescribePatchBaselines
s {$sel:filters:DescribePatchBaselines' :: Maybe [PatchOrchestratorFilter]
filters = Maybe [PatchOrchestratorFilter]
a} :: DescribePatchBaselines) ((Maybe [PatchOrchestratorFilter]
  -> f (Maybe [PatchOrchestratorFilter]))
 -> DescribePatchBaselines -> f DescribePatchBaselines)
-> ((Maybe [PatchOrchestratorFilter]
     -> f (Maybe [PatchOrchestratorFilter]))
    -> Maybe [PatchOrchestratorFilter]
    -> f (Maybe [PatchOrchestratorFilter]))
-> (Maybe [PatchOrchestratorFilter]
    -> f (Maybe [PatchOrchestratorFilter]))
-> DescribePatchBaselines
-> f DescribePatchBaselines
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PatchOrchestratorFilter]
  [PatchOrchestratorFilter]
  [PatchOrchestratorFilter]
  [PatchOrchestratorFilter]
-> Iso
     (Maybe [PatchOrchestratorFilter])
     (Maybe [PatchOrchestratorFilter])
     (Maybe [PatchOrchestratorFilter])
     (Maybe [PatchOrchestratorFilter])
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
  [PatchOrchestratorFilter]
  [PatchOrchestratorFilter]
  [PatchOrchestratorFilter]
  [PatchOrchestratorFilter]
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.)
describePatchBaselines_nextToken :: Lens.Lens' DescribePatchBaselines (Prelude.Maybe Prelude.Text)
describePatchBaselines_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribePatchBaselines -> f DescribePatchBaselines
describePatchBaselines_nextToken = (DescribePatchBaselines -> Maybe Text)
-> (DescribePatchBaselines -> Maybe Text -> DescribePatchBaselines)
-> Lens
     DescribePatchBaselines
     DescribePatchBaselines
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchBaselines' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribePatchBaselines' :: DescribePatchBaselines -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribePatchBaselines
s@DescribePatchBaselines' {} Maybe Text
a -> DescribePatchBaselines
s {$sel:nextToken:DescribePatchBaselines' :: Maybe Text
nextToken = Maybe Text
a} :: DescribePatchBaselines)

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

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

instance Prelude.NFData DescribePatchBaselines

instance Core.ToHeaders DescribePatchBaselines where
  toHeaders :: DescribePatchBaselines -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribePatchBaselines -> 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.DescribePatchBaselines" ::
                          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 DescribePatchBaselines where
  toJSON :: DescribePatchBaselines -> Value
toJSON DescribePatchBaselines' {Maybe Natural
Maybe [PatchOrchestratorFilter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [PatchOrchestratorFilter]
$sel:maxResults:DescribePatchBaselines' :: DescribePatchBaselines -> Maybe Natural
$sel:nextToken:DescribePatchBaselines' :: DescribePatchBaselines -> Maybe Text
$sel:filters:DescribePatchBaselines' :: DescribePatchBaselines -> Maybe [PatchOrchestratorFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [PatchOrchestratorFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([PatchOrchestratorFilter] -> Pair)
-> Maybe [PatchOrchestratorFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PatchOrchestratorFilter]
filters,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribePatchBaselinesResponse' 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:
--
-- 'baselineIdentities', 'describePatchBaselinesResponse_baselineIdentities' - An array of @PatchBaselineIdentity@ elements.
--
-- 'nextToken', 'describePatchBaselinesResponse_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', 'describePatchBaselinesResponse_httpStatus' - The response's http status code.
newDescribePatchBaselinesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribePatchBaselinesResponse
newDescribePatchBaselinesResponse :: Int -> DescribePatchBaselinesResponse
newDescribePatchBaselinesResponse Int
pHttpStatus_ =
  DescribePatchBaselinesResponse' :: Maybe [PatchBaselineIdentity]
-> Maybe Text -> Int -> DescribePatchBaselinesResponse
DescribePatchBaselinesResponse'
    { $sel:baselineIdentities:DescribePatchBaselinesResponse' :: Maybe [PatchBaselineIdentity]
baselineIdentities =
        Maybe [PatchBaselineIdentity]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribePatchBaselinesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribePatchBaselinesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of @PatchBaselineIdentity@ elements.
describePatchBaselinesResponse_baselineIdentities :: Lens.Lens' DescribePatchBaselinesResponse (Prelude.Maybe [PatchBaselineIdentity])
describePatchBaselinesResponse_baselineIdentities :: (Maybe [PatchBaselineIdentity]
 -> f (Maybe [PatchBaselineIdentity]))
-> DescribePatchBaselinesResponse
-> f DescribePatchBaselinesResponse
describePatchBaselinesResponse_baselineIdentities = (DescribePatchBaselinesResponse -> Maybe [PatchBaselineIdentity])
-> (DescribePatchBaselinesResponse
    -> Maybe [PatchBaselineIdentity] -> DescribePatchBaselinesResponse)
-> Lens'
     DescribePatchBaselinesResponse (Maybe [PatchBaselineIdentity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchBaselinesResponse' {Maybe [PatchBaselineIdentity]
baselineIdentities :: Maybe [PatchBaselineIdentity]
$sel:baselineIdentities:DescribePatchBaselinesResponse' :: DescribePatchBaselinesResponse -> Maybe [PatchBaselineIdentity]
baselineIdentities} -> Maybe [PatchBaselineIdentity]
baselineIdentities) (\s :: DescribePatchBaselinesResponse
s@DescribePatchBaselinesResponse' {} Maybe [PatchBaselineIdentity]
a -> DescribePatchBaselinesResponse
s {$sel:baselineIdentities:DescribePatchBaselinesResponse' :: Maybe [PatchBaselineIdentity]
baselineIdentities = Maybe [PatchBaselineIdentity]
a} :: DescribePatchBaselinesResponse) ((Maybe [PatchBaselineIdentity]
  -> f (Maybe [PatchBaselineIdentity]))
 -> DescribePatchBaselinesResponse
 -> f DescribePatchBaselinesResponse)
-> ((Maybe [PatchBaselineIdentity]
     -> f (Maybe [PatchBaselineIdentity]))
    -> Maybe [PatchBaselineIdentity]
    -> f (Maybe [PatchBaselineIdentity]))
-> (Maybe [PatchBaselineIdentity]
    -> f (Maybe [PatchBaselineIdentity]))
-> DescribePatchBaselinesResponse
-> f DescribePatchBaselinesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PatchBaselineIdentity]
  [PatchBaselineIdentity]
  [PatchBaselineIdentity]
  [PatchBaselineIdentity]
-> Iso
     (Maybe [PatchBaselineIdentity])
     (Maybe [PatchBaselineIdentity])
     (Maybe [PatchBaselineIdentity])
     (Maybe [PatchBaselineIdentity])
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
  [PatchBaselineIdentity]
  [PatchBaselineIdentity]
  [PatchBaselineIdentity]
  [PatchBaselineIdentity]
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.
describePatchBaselinesResponse_nextToken :: Lens.Lens' DescribePatchBaselinesResponse (Prelude.Maybe Prelude.Text)
describePatchBaselinesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribePatchBaselinesResponse
-> f DescribePatchBaselinesResponse
describePatchBaselinesResponse_nextToken = (DescribePatchBaselinesResponse -> Maybe Text)
-> (DescribePatchBaselinesResponse
    -> Maybe Text -> DescribePatchBaselinesResponse)
-> Lens' DescribePatchBaselinesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchBaselinesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribePatchBaselinesResponse' :: DescribePatchBaselinesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribePatchBaselinesResponse
s@DescribePatchBaselinesResponse' {} Maybe Text
a -> DescribePatchBaselinesResponse
s {$sel:nextToken:DescribePatchBaselinesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribePatchBaselinesResponse)

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

instance
  Prelude.NFData
    DescribePatchBaselinesResponse