{-# 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.DescribePatchGroups
-- 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 all patch groups that have been registered with patch baselines.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribePatchGroups
  ( -- * Creating a Request
    DescribePatchGroups (..),
    newDescribePatchGroups,

    -- * Request Lenses
    describePatchGroups_filters,
    describePatchGroups_nextToken,
    describePatchGroups_maxResults,

    -- * Destructuring the Response
    DescribePatchGroupsResponse (..),
    newDescribePatchGroupsResponse,

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

-- |
-- Create a value of 'DescribePatchGroups' 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', 'describePatchGroups_filters' - Each element in the array is a structure containing a key-value pair.
--
-- Supported keys for @DescribePatchGroups@ include the following:
--
-- -   __@NAME_PREFIX@__
--
--     Sample values: @AWS-@ | @My-@.
--
-- -   __@OPERATING_SYSTEM@__
--
--     Sample values: @AMAZON_LINUX@ | @SUSE@ | @WINDOWS@
--
-- 'nextToken', 'describePatchGroups_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describePatchGroups_maxResults' - The maximum number of patch groups to return (per page).
newDescribePatchGroups ::
  DescribePatchGroups
newDescribePatchGroups :: DescribePatchGroups
newDescribePatchGroups =
  DescribePatchGroups' :: Maybe [PatchOrchestratorFilter]
-> Maybe Text -> Maybe Natural -> DescribePatchGroups
DescribePatchGroups'
    { $sel:filters:DescribePatchGroups' :: Maybe [PatchOrchestratorFilter]
filters = Maybe [PatchOrchestratorFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribePatchGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribePatchGroups' :: 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 @DescribePatchGroups@ include the following:
--
-- -   __@NAME_PREFIX@__
--
--     Sample values: @AWS-@ | @My-@.
--
-- -   __@OPERATING_SYSTEM@__
--
--     Sample values: @AMAZON_LINUX@ | @SUSE@ | @WINDOWS@
describePatchGroups_filters :: Lens.Lens' DescribePatchGroups (Prelude.Maybe [PatchOrchestratorFilter])
describePatchGroups_filters :: (Maybe [PatchOrchestratorFilter]
 -> f (Maybe [PatchOrchestratorFilter]))
-> DescribePatchGroups -> f DescribePatchGroups
describePatchGroups_filters = (DescribePatchGroups -> Maybe [PatchOrchestratorFilter])
-> (DescribePatchGroups
    -> Maybe [PatchOrchestratorFilter] -> DescribePatchGroups)
-> Lens
     DescribePatchGroups
     DescribePatchGroups
     (Maybe [PatchOrchestratorFilter])
     (Maybe [PatchOrchestratorFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchGroups' {Maybe [PatchOrchestratorFilter]
filters :: Maybe [PatchOrchestratorFilter]
$sel:filters:DescribePatchGroups' :: DescribePatchGroups -> Maybe [PatchOrchestratorFilter]
filters} -> Maybe [PatchOrchestratorFilter]
filters) (\s :: DescribePatchGroups
s@DescribePatchGroups' {} Maybe [PatchOrchestratorFilter]
a -> DescribePatchGroups
s {$sel:filters:DescribePatchGroups' :: Maybe [PatchOrchestratorFilter]
filters = Maybe [PatchOrchestratorFilter]
a} :: DescribePatchGroups) ((Maybe [PatchOrchestratorFilter]
  -> f (Maybe [PatchOrchestratorFilter]))
 -> DescribePatchGroups -> f DescribePatchGroups)
-> ((Maybe [PatchOrchestratorFilter]
     -> f (Maybe [PatchOrchestratorFilter]))
    -> Maybe [PatchOrchestratorFilter]
    -> f (Maybe [PatchOrchestratorFilter]))
-> (Maybe [PatchOrchestratorFilter]
    -> f (Maybe [PatchOrchestratorFilter]))
-> DescribePatchGroups
-> f DescribePatchGroups
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.)
describePatchGroups_nextToken :: Lens.Lens' DescribePatchGroups (Prelude.Maybe Prelude.Text)
describePatchGroups_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribePatchGroups -> f DescribePatchGroups
describePatchGroups_nextToken = (DescribePatchGroups -> Maybe Text)
-> (DescribePatchGroups -> Maybe Text -> DescribePatchGroups)
-> Lens
     DescribePatchGroups DescribePatchGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribePatchGroups' :: DescribePatchGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribePatchGroups
s@DescribePatchGroups' {} Maybe Text
a -> DescribePatchGroups
s {$sel:nextToken:DescribePatchGroups' :: Maybe Text
nextToken = Maybe Text
a} :: DescribePatchGroups)

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

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

instance Prelude.NFData DescribePatchGroups

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

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

-- | /See:/ 'newDescribePatchGroupsResponse' smart constructor.
data DescribePatchGroupsResponse = DescribePatchGroupsResponse'
  { -- | Each entry in the array contains:
    --
    -- -   @PatchGroup@: string (between 1 and 256 characters. Regex:
    --     @^([\\p{L}\\p{Z}\\p{N}_.:\/=+\\-\@]*)$)@
    --
    -- -   @PatchBaselineIdentity@: A @PatchBaselineIdentity@ element.
    DescribePatchGroupsResponse
-> Maybe [PatchGroupPatchBaselineMapping]
mappings :: Prelude.Maybe [PatchGroupPatchBaselineMapping],
    -- | The token to use when requesting the next set of items. If there are no
    -- additional items to return, the string is empty.
    DescribePatchGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribePatchGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribePatchGroupsResponse -> DescribePatchGroupsResponse -> Bool
(DescribePatchGroupsResponse
 -> DescribePatchGroupsResponse -> Bool)
-> (DescribePatchGroupsResponse
    -> DescribePatchGroupsResponse -> Bool)
-> Eq DescribePatchGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePatchGroupsResponse -> DescribePatchGroupsResponse -> Bool
$c/= :: DescribePatchGroupsResponse -> DescribePatchGroupsResponse -> Bool
== :: DescribePatchGroupsResponse -> DescribePatchGroupsResponse -> Bool
$c== :: DescribePatchGroupsResponse -> DescribePatchGroupsResponse -> Bool
Prelude.Eq, ReadPrec [DescribePatchGroupsResponse]
ReadPrec DescribePatchGroupsResponse
Int -> ReadS DescribePatchGroupsResponse
ReadS [DescribePatchGroupsResponse]
(Int -> ReadS DescribePatchGroupsResponse)
-> ReadS [DescribePatchGroupsResponse]
-> ReadPrec DescribePatchGroupsResponse
-> ReadPrec [DescribePatchGroupsResponse]
-> Read DescribePatchGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePatchGroupsResponse]
$creadListPrec :: ReadPrec [DescribePatchGroupsResponse]
readPrec :: ReadPrec DescribePatchGroupsResponse
$creadPrec :: ReadPrec DescribePatchGroupsResponse
readList :: ReadS [DescribePatchGroupsResponse]
$creadList :: ReadS [DescribePatchGroupsResponse]
readsPrec :: Int -> ReadS DescribePatchGroupsResponse
$creadsPrec :: Int -> ReadS DescribePatchGroupsResponse
Prelude.Read, Int -> DescribePatchGroupsResponse -> ShowS
[DescribePatchGroupsResponse] -> ShowS
DescribePatchGroupsResponse -> String
(Int -> DescribePatchGroupsResponse -> ShowS)
-> (DescribePatchGroupsResponse -> String)
-> ([DescribePatchGroupsResponse] -> ShowS)
-> Show DescribePatchGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePatchGroupsResponse] -> ShowS
$cshowList :: [DescribePatchGroupsResponse] -> ShowS
show :: DescribePatchGroupsResponse -> String
$cshow :: DescribePatchGroupsResponse -> String
showsPrec :: Int -> DescribePatchGroupsResponse -> ShowS
$cshowsPrec :: Int -> DescribePatchGroupsResponse -> ShowS
Prelude.Show, (forall x.
 DescribePatchGroupsResponse -> Rep DescribePatchGroupsResponse x)
-> (forall x.
    Rep DescribePatchGroupsResponse x -> DescribePatchGroupsResponse)
-> Generic DescribePatchGroupsResponse
forall x.
Rep DescribePatchGroupsResponse x -> DescribePatchGroupsResponse
forall x.
DescribePatchGroupsResponse -> Rep DescribePatchGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribePatchGroupsResponse x -> DescribePatchGroupsResponse
$cfrom :: forall x.
DescribePatchGroupsResponse -> Rep DescribePatchGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribePatchGroupsResponse' 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:
--
-- 'mappings', 'describePatchGroupsResponse_mappings' - Each entry in the array contains:
--
-- -   @PatchGroup@: string (between 1 and 256 characters. Regex:
--     @^([\\p{L}\\p{Z}\\p{N}_.:\/=+\\-\@]*)$)@
--
-- -   @PatchBaselineIdentity@: A @PatchBaselineIdentity@ element.
--
-- 'nextToken', 'describePatchGroupsResponse_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', 'describePatchGroupsResponse_httpStatus' - The response's http status code.
newDescribePatchGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribePatchGroupsResponse
newDescribePatchGroupsResponse :: Int -> DescribePatchGroupsResponse
newDescribePatchGroupsResponse Int
pHttpStatus_ =
  DescribePatchGroupsResponse' :: Maybe [PatchGroupPatchBaselineMapping]
-> Maybe Text -> Int -> DescribePatchGroupsResponse
DescribePatchGroupsResponse'
    { $sel:mappings:DescribePatchGroupsResponse' :: Maybe [PatchGroupPatchBaselineMapping]
mappings =
        Maybe [PatchGroupPatchBaselineMapping]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribePatchGroupsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribePatchGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Each entry in the array contains:
--
-- -   @PatchGroup@: string (between 1 and 256 characters. Regex:
--     @^([\\p{L}\\p{Z}\\p{N}_.:\/=+\\-\@]*)$)@
--
-- -   @PatchBaselineIdentity@: A @PatchBaselineIdentity@ element.
describePatchGroupsResponse_mappings :: Lens.Lens' DescribePatchGroupsResponse (Prelude.Maybe [PatchGroupPatchBaselineMapping])
describePatchGroupsResponse_mappings :: (Maybe [PatchGroupPatchBaselineMapping]
 -> f (Maybe [PatchGroupPatchBaselineMapping]))
-> DescribePatchGroupsResponse -> f DescribePatchGroupsResponse
describePatchGroupsResponse_mappings = (DescribePatchGroupsResponse
 -> Maybe [PatchGroupPatchBaselineMapping])
-> (DescribePatchGroupsResponse
    -> Maybe [PatchGroupPatchBaselineMapping]
    -> DescribePatchGroupsResponse)
-> Lens'
     DescribePatchGroupsResponse
     (Maybe [PatchGroupPatchBaselineMapping])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchGroupsResponse' {Maybe [PatchGroupPatchBaselineMapping]
mappings :: Maybe [PatchGroupPatchBaselineMapping]
$sel:mappings:DescribePatchGroupsResponse' :: DescribePatchGroupsResponse
-> Maybe [PatchGroupPatchBaselineMapping]
mappings} -> Maybe [PatchGroupPatchBaselineMapping]
mappings) (\s :: DescribePatchGroupsResponse
s@DescribePatchGroupsResponse' {} Maybe [PatchGroupPatchBaselineMapping]
a -> DescribePatchGroupsResponse
s {$sel:mappings:DescribePatchGroupsResponse' :: Maybe [PatchGroupPatchBaselineMapping]
mappings = Maybe [PatchGroupPatchBaselineMapping]
a} :: DescribePatchGroupsResponse) ((Maybe [PatchGroupPatchBaselineMapping]
  -> f (Maybe [PatchGroupPatchBaselineMapping]))
 -> DescribePatchGroupsResponse -> f DescribePatchGroupsResponse)
-> ((Maybe [PatchGroupPatchBaselineMapping]
     -> f (Maybe [PatchGroupPatchBaselineMapping]))
    -> Maybe [PatchGroupPatchBaselineMapping]
    -> f (Maybe [PatchGroupPatchBaselineMapping]))
-> (Maybe [PatchGroupPatchBaselineMapping]
    -> f (Maybe [PatchGroupPatchBaselineMapping]))
-> DescribePatchGroupsResponse
-> f DescribePatchGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PatchGroupPatchBaselineMapping]
  [PatchGroupPatchBaselineMapping]
  [PatchGroupPatchBaselineMapping]
  [PatchGroupPatchBaselineMapping]
-> Iso
     (Maybe [PatchGroupPatchBaselineMapping])
     (Maybe [PatchGroupPatchBaselineMapping])
     (Maybe [PatchGroupPatchBaselineMapping])
     (Maybe [PatchGroupPatchBaselineMapping])
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
  [PatchGroupPatchBaselineMapping]
  [PatchGroupPatchBaselineMapping]
  [PatchGroupPatchBaselineMapping]
  [PatchGroupPatchBaselineMapping]
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.
describePatchGroupsResponse_nextToken :: Lens.Lens' DescribePatchGroupsResponse (Prelude.Maybe Prelude.Text)
describePatchGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribePatchGroupsResponse -> f DescribePatchGroupsResponse
describePatchGroupsResponse_nextToken = (DescribePatchGroupsResponse -> Maybe Text)
-> (DescribePatchGroupsResponse
    -> Maybe Text -> DescribePatchGroupsResponse)
-> Lens' DescribePatchGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribePatchGroupsResponse' :: DescribePatchGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribePatchGroupsResponse
s@DescribePatchGroupsResponse' {} Maybe Text
a -> DescribePatchGroupsResponse
s {$sel:nextToken:DescribePatchGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribePatchGroupsResponse)

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

instance Prelude.NFData DescribePatchGroupsResponse