{-# 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.DescribeAvailablePatches
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all patches eligible to be included in a patch baseline.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeAvailablePatches
  ( -- * Creating a Request
    DescribeAvailablePatches (..),
    newDescribeAvailablePatches,

    -- * Request Lenses
    describeAvailablePatches_filters,
    describeAvailablePatches_maxResults,
    describeAvailablePatches_nextToken,

    -- * Destructuring the Response
    DescribeAvailablePatchesResponse (..),
    newDescribeAvailablePatchesResponse,

    -- * Response Lenses
    describeAvailablePatchesResponse_nextToken,
    describeAvailablePatchesResponse_patches,
    describeAvailablePatchesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeAvailablePatches' smart constructor.
data DescribeAvailablePatches = DescribeAvailablePatches'
  { -- | Each element in the array is a structure containing a key-value pair.
    --
    -- __Windows Server__
    --
    -- Supported keys for Windows Server managed node patches include the
    -- following:
    --
    -- -   __@PATCH_SET@__
    --
    --     Sample values: @OS@ | @APPLICATION@
    --
    -- -   __@PRODUCT@__
    --
    --     Sample values: @WindowsServer2012@ | @Office 2010@ |
    --     @MicrosoftDefenderAntivirus@
    --
    -- -   __@PRODUCT_FAMILY@__
    --
    --     Sample values: @Windows@ | @Office@
    --
    -- -   __@MSRC_SEVERITY@__
    --
    --     Sample values: @ServicePacks@ | @Important@ | @Moderate@
    --
    -- -   __@CLASSIFICATION@__
    --
    --     Sample values: @ServicePacks@ | @SecurityUpdates@ |
    --     @DefinitionUpdates@
    --
    -- -   __@PATCH_ID@__
    --
    --     Sample values: @KB123456@ | @KB4516046@
    --
    -- __Linux__
    --
    -- When specifying filters for Linux patches, you must specify a key-pair
    -- for @PRODUCT@. For example, using the Command Line Interface (CLI), the
    -- following command fails:
    --
    -- @aws ssm describe-available-patches --filters Key=CVE_ID,Values=CVE-2018-3615@
    --
    -- However, the following command succeeds:
    --
    -- @aws ssm describe-available-patches --filters Key=PRODUCT,Values=AmazonLinux2018.03 Key=CVE_ID,Values=CVE-2018-3615@
    --
    -- Supported keys for Linux managed node patches include the following:
    --
    -- -   __@PRODUCT@__
    --
    --     Sample values: @AmazonLinux2018.03@ | @AmazonLinux2.0@
    --
    -- -   __@NAME@__
    --
    --     Sample values: @kernel-headers@ | @samba-python@ | @php@
    --
    -- -   __@SEVERITY@__
    --
    --     Sample values: @Critical@ | @Important@ | @Medium@ | @Low@
    --
    -- -   __@EPOCH@__
    --
    --     Sample values: @0@ | @1@
    --
    -- -   __@VERSION@__
    --
    --     Sample values: @78.6.1@ | @4.10.16@
    --
    -- -   __@RELEASE@__
    --
    --     Sample values: @9.56.amzn1@ | @1.amzn2@
    --
    -- -   __@ARCH@__
    --
    --     Sample values: @i686@ | @x86_64@
    --
    -- -   __@REPOSITORY@__
    --
    --     Sample values: @Core@ | @Updates@
    --
    -- -   __@ADVISORY_ID@__
    --
    --     Sample values: @ALAS-2018-1058@ | @ALAS2-2021-1594@
    --
    -- -   __@CVE_ID@__
    --
    --     Sample values: @CVE-2018-3615@ | @CVE-2020-1472@
    --
    -- -   __@BUGZILLA_ID@__
    --
    --     Sample values: @1463241@
    DescribeAvailablePatches -> Maybe [PatchOrchestratorFilter]
filters :: Prelude.Maybe [PatchOrchestratorFilter],
    -- | The maximum number of patches to return (per page).
    DescribeAvailablePatches -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeAvailablePatches -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeAvailablePatches -> DescribeAvailablePatches -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAvailablePatches -> DescribeAvailablePatches -> Bool
$c/= :: DescribeAvailablePatches -> DescribeAvailablePatches -> Bool
== :: DescribeAvailablePatches -> DescribeAvailablePatches -> Bool
$c== :: DescribeAvailablePatches -> DescribeAvailablePatches -> Bool
Prelude.Eq, ReadPrec [DescribeAvailablePatches]
ReadPrec DescribeAvailablePatches
Int -> ReadS DescribeAvailablePatches
ReadS [DescribeAvailablePatches]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAvailablePatches]
$creadListPrec :: ReadPrec [DescribeAvailablePatches]
readPrec :: ReadPrec DescribeAvailablePatches
$creadPrec :: ReadPrec DescribeAvailablePatches
readList :: ReadS [DescribeAvailablePatches]
$creadList :: ReadS [DescribeAvailablePatches]
readsPrec :: Int -> ReadS DescribeAvailablePatches
$creadsPrec :: Int -> ReadS DescribeAvailablePatches
Prelude.Read, Int -> DescribeAvailablePatches -> ShowS
[DescribeAvailablePatches] -> ShowS
DescribeAvailablePatches -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAvailablePatches] -> ShowS
$cshowList :: [DescribeAvailablePatches] -> ShowS
show :: DescribeAvailablePatches -> String
$cshow :: DescribeAvailablePatches -> String
showsPrec :: Int -> DescribeAvailablePatches -> ShowS
$cshowsPrec :: Int -> DescribeAvailablePatches -> ShowS
Prelude.Show, forall x.
Rep DescribeAvailablePatches x -> DescribeAvailablePatches
forall x.
DescribeAvailablePatches -> Rep DescribeAvailablePatches x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAvailablePatches x -> DescribeAvailablePatches
$cfrom :: forall x.
DescribeAvailablePatches -> Rep DescribeAvailablePatches x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAvailablePatches' 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', 'describeAvailablePatches_filters' - Each element in the array is a structure containing a key-value pair.
--
-- __Windows Server__
--
-- Supported keys for Windows Server managed node patches include the
-- following:
--
-- -   __@PATCH_SET@__
--
--     Sample values: @OS@ | @APPLICATION@
--
-- -   __@PRODUCT@__
--
--     Sample values: @WindowsServer2012@ | @Office 2010@ |
--     @MicrosoftDefenderAntivirus@
--
-- -   __@PRODUCT_FAMILY@__
--
--     Sample values: @Windows@ | @Office@
--
-- -   __@MSRC_SEVERITY@__
--
--     Sample values: @ServicePacks@ | @Important@ | @Moderate@
--
-- -   __@CLASSIFICATION@__
--
--     Sample values: @ServicePacks@ | @SecurityUpdates@ |
--     @DefinitionUpdates@
--
-- -   __@PATCH_ID@__
--
--     Sample values: @KB123456@ | @KB4516046@
--
-- __Linux__
--
-- When specifying filters for Linux patches, you must specify a key-pair
-- for @PRODUCT@. For example, using the Command Line Interface (CLI), the
-- following command fails:
--
-- @aws ssm describe-available-patches --filters Key=CVE_ID,Values=CVE-2018-3615@
--
-- However, the following command succeeds:
--
-- @aws ssm describe-available-patches --filters Key=PRODUCT,Values=AmazonLinux2018.03 Key=CVE_ID,Values=CVE-2018-3615@
--
-- Supported keys for Linux managed node patches include the following:
--
-- -   __@PRODUCT@__
--
--     Sample values: @AmazonLinux2018.03@ | @AmazonLinux2.0@
--
-- -   __@NAME@__
--
--     Sample values: @kernel-headers@ | @samba-python@ | @php@
--
-- -   __@SEVERITY@__
--
--     Sample values: @Critical@ | @Important@ | @Medium@ | @Low@
--
-- -   __@EPOCH@__
--
--     Sample values: @0@ | @1@
--
-- -   __@VERSION@__
--
--     Sample values: @78.6.1@ | @4.10.16@
--
-- -   __@RELEASE@__
--
--     Sample values: @9.56.amzn1@ | @1.amzn2@
--
-- -   __@ARCH@__
--
--     Sample values: @i686@ | @x86_64@
--
-- -   __@REPOSITORY@__
--
--     Sample values: @Core@ | @Updates@
--
-- -   __@ADVISORY_ID@__
--
--     Sample values: @ALAS-2018-1058@ | @ALAS2-2021-1594@
--
-- -   __@CVE_ID@__
--
--     Sample values: @CVE-2018-3615@ | @CVE-2020-1472@
--
-- -   __@BUGZILLA_ID@__
--
--     Sample values: @1463241@
--
-- 'maxResults', 'describeAvailablePatches_maxResults' - The maximum number of patches to return (per page).
--
-- 'nextToken', 'describeAvailablePatches_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
newDescribeAvailablePatches ::
  DescribeAvailablePatches
newDescribeAvailablePatches :: DescribeAvailablePatches
newDescribeAvailablePatches =
  DescribeAvailablePatches'
    { $sel:filters:DescribeAvailablePatches' :: Maybe [PatchOrchestratorFilter]
filters =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeAvailablePatches' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAvailablePatches' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Each element in the array is a structure containing a key-value pair.
--
-- __Windows Server__
--
-- Supported keys for Windows Server managed node patches include the
-- following:
--
-- -   __@PATCH_SET@__
--
--     Sample values: @OS@ | @APPLICATION@
--
-- -   __@PRODUCT@__
--
--     Sample values: @WindowsServer2012@ | @Office 2010@ |
--     @MicrosoftDefenderAntivirus@
--
-- -   __@PRODUCT_FAMILY@__
--
--     Sample values: @Windows@ | @Office@
--
-- -   __@MSRC_SEVERITY@__
--
--     Sample values: @ServicePacks@ | @Important@ | @Moderate@
--
-- -   __@CLASSIFICATION@__
--
--     Sample values: @ServicePacks@ | @SecurityUpdates@ |
--     @DefinitionUpdates@
--
-- -   __@PATCH_ID@__
--
--     Sample values: @KB123456@ | @KB4516046@
--
-- __Linux__
--
-- When specifying filters for Linux patches, you must specify a key-pair
-- for @PRODUCT@. For example, using the Command Line Interface (CLI), the
-- following command fails:
--
-- @aws ssm describe-available-patches --filters Key=CVE_ID,Values=CVE-2018-3615@
--
-- However, the following command succeeds:
--
-- @aws ssm describe-available-patches --filters Key=PRODUCT,Values=AmazonLinux2018.03 Key=CVE_ID,Values=CVE-2018-3615@
--
-- Supported keys for Linux managed node patches include the following:
--
-- -   __@PRODUCT@__
--
--     Sample values: @AmazonLinux2018.03@ | @AmazonLinux2.0@
--
-- -   __@NAME@__
--
--     Sample values: @kernel-headers@ | @samba-python@ | @php@
--
-- -   __@SEVERITY@__
--
--     Sample values: @Critical@ | @Important@ | @Medium@ | @Low@
--
-- -   __@EPOCH@__
--
--     Sample values: @0@ | @1@
--
-- -   __@VERSION@__
--
--     Sample values: @78.6.1@ | @4.10.16@
--
-- -   __@RELEASE@__
--
--     Sample values: @9.56.amzn1@ | @1.amzn2@
--
-- -   __@ARCH@__
--
--     Sample values: @i686@ | @x86_64@
--
-- -   __@REPOSITORY@__
--
--     Sample values: @Core@ | @Updates@
--
-- -   __@ADVISORY_ID@__
--
--     Sample values: @ALAS-2018-1058@ | @ALAS2-2021-1594@
--
-- -   __@CVE_ID@__
--
--     Sample values: @CVE-2018-3615@ | @CVE-2020-1472@
--
-- -   __@BUGZILLA_ID@__
--
--     Sample values: @1463241@
describeAvailablePatches_filters :: Lens.Lens' DescribeAvailablePatches (Prelude.Maybe [PatchOrchestratorFilter])
describeAvailablePatches_filters :: Lens' DescribeAvailablePatches (Maybe [PatchOrchestratorFilter])
describeAvailablePatches_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAvailablePatches' {Maybe [PatchOrchestratorFilter]
filters :: Maybe [PatchOrchestratorFilter]
$sel:filters:DescribeAvailablePatches' :: DescribeAvailablePatches -> Maybe [PatchOrchestratorFilter]
filters} -> Maybe [PatchOrchestratorFilter]
filters) (\s :: DescribeAvailablePatches
s@DescribeAvailablePatches' {} Maybe [PatchOrchestratorFilter]
a -> DescribeAvailablePatches
s {$sel:filters:DescribeAvailablePatches' :: Maybe [PatchOrchestratorFilter]
filters = Maybe [PatchOrchestratorFilter]
a} :: DescribeAvailablePatches) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Core.AWSPager DescribeAvailablePatches where
  page :: DescribeAvailablePatches
-> AWSResponse DescribeAvailablePatches
-> Maybe DescribeAvailablePatches
page DescribeAvailablePatches
rq AWSResponse DescribeAvailablePatches
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAvailablePatches
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeAvailablePatchesResponse (Maybe Text)
describeAvailablePatchesResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAvailablePatches
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeAvailablePatchesResponse (Maybe [Patch])
describeAvailablePatchesResponse_patches
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ DescribeAvailablePatches
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeAvailablePatches (Maybe Text)
describeAvailablePatches_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeAvailablePatches
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeAvailablePatchesResponse (Maybe Text)
describeAvailablePatchesResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

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

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

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

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

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

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

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

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

-- |
-- Create a value of 'DescribeAvailablePatchesResponse' 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', 'describeAvailablePatchesResponse_nextToken' - The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
--
-- 'patches', 'describeAvailablePatchesResponse_patches' - An array of patches. Each entry in the array is a patch structure.
--
-- 'httpStatus', 'describeAvailablePatchesResponse_httpStatus' - The response's http status code.
newDescribeAvailablePatchesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAvailablePatchesResponse
newDescribeAvailablePatchesResponse :: Int -> DescribeAvailablePatchesResponse
newDescribeAvailablePatchesResponse Int
pHttpStatus_ =
  DescribeAvailablePatchesResponse'
    { $sel:nextToken:DescribeAvailablePatchesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:patches:DescribeAvailablePatchesResponse' :: Maybe [Patch]
patches = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAvailablePatchesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | An array of patches. Each entry in the array is a patch structure.
describeAvailablePatchesResponse_patches :: Lens.Lens' DescribeAvailablePatchesResponse (Prelude.Maybe [Patch])
describeAvailablePatchesResponse_patches :: Lens' DescribeAvailablePatchesResponse (Maybe [Patch])
describeAvailablePatchesResponse_patches = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAvailablePatchesResponse' {Maybe [Patch]
patches :: Maybe [Patch]
$sel:patches:DescribeAvailablePatchesResponse' :: DescribeAvailablePatchesResponse -> Maybe [Patch]
patches} -> Maybe [Patch]
patches) (\s :: DescribeAvailablePatchesResponse
s@DescribeAvailablePatchesResponse' {} Maybe [Patch]
a -> DescribeAvailablePatchesResponse
s {$sel:patches:DescribeAvailablePatchesResponse' :: Maybe [Patch]
patches = Maybe [Patch]
a} :: DescribeAvailablePatchesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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