{-# 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.DescribePatchProperties
-- 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 properties of available patches organized by product, product
-- family, classification, severity, and other properties of available
-- patches. You can use the reported properties in the filters you specify
-- in requests for operations such as CreatePatchBaseline,
-- UpdatePatchBaseline, DescribeAvailablePatches, and
-- DescribePatchBaselines.
--
-- The following section lists the properties that can be used in filters
-- for each major operating system type:
--
-- [AMAZON_LINUX]
--     Valid properties: @PRODUCT@ | @CLASSIFICATION@ | @SEVERITY@
--
-- [AMAZON_LINUX_2]
--     Valid properties: @PRODUCT@ | @CLASSIFICATION@ | @SEVERITY@
--
-- [CENTOS]
--     Valid properties: @PRODUCT@ | @CLASSIFICATION@ | @SEVERITY@
--
-- [DEBIAN]
--     Valid properties: @PRODUCT@ | @PRIORITY@
--
-- [MACOS]
--     Valid properties: @PRODUCT@ | @CLASSIFICATION@
--
-- [ORACLE_LINUX]
--     Valid properties: @PRODUCT@ | @CLASSIFICATION@ | @SEVERITY@
--
-- [REDHAT_ENTERPRISE_LINUX]
--     Valid properties: @PRODUCT@ | @CLASSIFICATION@ | @SEVERITY@
--
-- [SUSE]
--     Valid properties: @PRODUCT@ | @CLASSIFICATION@ | @SEVERITY@
--
-- [UBUNTU]
--     Valid properties: @PRODUCT@ | @PRIORITY@
--
-- [WINDOWS]
--     Valid properties: @PRODUCT@ | @PRODUCT_FAMILY@ | @CLASSIFICATION@ |
--     @MSRC_SEVERITY@
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribePatchProperties
  ( -- * Creating a Request
    DescribePatchProperties (..),
    newDescribePatchProperties,

    -- * Request Lenses
    describePatchProperties_patchSet,
    describePatchProperties_nextToken,
    describePatchProperties_maxResults,
    describePatchProperties_operatingSystem,
    describePatchProperties_property,

    -- * Destructuring the Response
    DescribePatchPropertiesResponse (..),
    newDescribePatchPropertiesResponse,

    -- * Response Lenses
    describePatchPropertiesResponse_nextToken,
    describePatchPropertiesResponse_properties,
    describePatchPropertiesResponse_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:/ 'newDescribePatchProperties' smart constructor.
data DescribePatchProperties = DescribePatchProperties'
  { -- | Indicates whether to list patches for the Windows operating system or
    -- for applications released by Microsoft. Not applicable for the Linux or
    -- macOS operating systems.
    DescribePatchProperties -> Maybe PatchSet
patchSet :: Prelude.Maybe PatchSet,
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribePatchProperties -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    DescribePatchProperties -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The operating system type for which to list patches.
    DescribePatchProperties -> OperatingSystem
operatingSystem :: OperatingSystem,
    -- | The patch property for which you want to view patch details.
    DescribePatchProperties -> PatchProperty
property :: PatchProperty
  }
  deriving (DescribePatchProperties -> DescribePatchProperties -> Bool
(DescribePatchProperties -> DescribePatchProperties -> Bool)
-> (DescribePatchProperties -> DescribePatchProperties -> Bool)
-> Eq DescribePatchProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePatchProperties -> DescribePatchProperties -> Bool
$c/= :: DescribePatchProperties -> DescribePatchProperties -> Bool
== :: DescribePatchProperties -> DescribePatchProperties -> Bool
$c== :: DescribePatchProperties -> DescribePatchProperties -> Bool
Prelude.Eq, ReadPrec [DescribePatchProperties]
ReadPrec DescribePatchProperties
Int -> ReadS DescribePatchProperties
ReadS [DescribePatchProperties]
(Int -> ReadS DescribePatchProperties)
-> ReadS [DescribePatchProperties]
-> ReadPrec DescribePatchProperties
-> ReadPrec [DescribePatchProperties]
-> Read DescribePatchProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePatchProperties]
$creadListPrec :: ReadPrec [DescribePatchProperties]
readPrec :: ReadPrec DescribePatchProperties
$creadPrec :: ReadPrec DescribePatchProperties
readList :: ReadS [DescribePatchProperties]
$creadList :: ReadS [DescribePatchProperties]
readsPrec :: Int -> ReadS DescribePatchProperties
$creadsPrec :: Int -> ReadS DescribePatchProperties
Prelude.Read, Int -> DescribePatchProperties -> ShowS
[DescribePatchProperties] -> ShowS
DescribePatchProperties -> String
(Int -> DescribePatchProperties -> ShowS)
-> (DescribePatchProperties -> String)
-> ([DescribePatchProperties] -> ShowS)
-> Show DescribePatchProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePatchProperties] -> ShowS
$cshowList :: [DescribePatchProperties] -> ShowS
show :: DescribePatchProperties -> String
$cshow :: DescribePatchProperties -> String
showsPrec :: Int -> DescribePatchProperties -> ShowS
$cshowsPrec :: Int -> DescribePatchProperties -> ShowS
Prelude.Show, (forall x.
 DescribePatchProperties -> Rep DescribePatchProperties x)
-> (forall x.
    Rep DescribePatchProperties x -> DescribePatchProperties)
-> Generic DescribePatchProperties
forall x. Rep DescribePatchProperties x -> DescribePatchProperties
forall x. DescribePatchProperties -> Rep DescribePatchProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribePatchProperties x -> DescribePatchProperties
$cfrom :: forall x. DescribePatchProperties -> Rep DescribePatchProperties x
Prelude.Generic)

-- |
-- Create a value of 'DescribePatchProperties' 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:
--
-- 'patchSet', 'describePatchProperties_patchSet' - Indicates whether to list patches for the Windows operating system or
-- for applications released by Microsoft. Not applicable for the Linux or
-- macOS operating systems.
--
-- 'nextToken', 'describePatchProperties_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describePatchProperties_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
--
-- 'operatingSystem', 'describePatchProperties_operatingSystem' - The operating system type for which to list patches.
--
-- 'property', 'describePatchProperties_property' - The patch property for which you want to view patch details.
newDescribePatchProperties ::
  -- | 'operatingSystem'
  OperatingSystem ->
  -- | 'property'
  PatchProperty ->
  DescribePatchProperties
newDescribePatchProperties :: OperatingSystem -> PatchProperty -> DescribePatchProperties
newDescribePatchProperties
  OperatingSystem
pOperatingSystem_
  PatchProperty
pProperty_ =
    DescribePatchProperties' :: Maybe PatchSet
-> Maybe Text
-> Maybe Natural
-> OperatingSystem
-> PatchProperty
-> DescribePatchProperties
DescribePatchProperties'
      { $sel:patchSet:DescribePatchProperties' :: Maybe PatchSet
patchSet =
          Maybe PatchSet
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribePatchProperties' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:DescribePatchProperties' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:operatingSystem:DescribePatchProperties' :: OperatingSystem
operatingSystem = OperatingSystem
pOperatingSystem_,
        $sel:property:DescribePatchProperties' :: PatchProperty
property = PatchProperty
pProperty_
      }

-- | Indicates whether to list patches for the Windows operating system or
-- for applications released by Microsoft. Not applicable for the Linux or
-- macOS operating systems.
describePatchProperties_patchSet :: Lens.Lens' DescribePatchProperties (Prelude.Maybe PatchSet)
describePatchProperties_patchSet :: (Maybe PatchSet -> f (Maybe PatchSet))
-> DescribePatchProperties -> f DescribePatchProperties
describePatchProperties_patchSet = (DescribePatchProperties -> Maybe PatchSet)
-> (DescribePatchProperties
    -> Maybe PatchSet -> DescribePatchProperties)
-> Lens
     DescribePatchProperties
     DescribePatchProperties
     (Maybe PatchSet)
     (Maybe PatchSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchProperties' {Maybe PatchSet
patchSet :: Maybe PatchSet
$sel:patchSet:DescribePatchProperties' :: DescribePatchProperties -> Maybe PatchSet
patchSet} -> Maybe PatchSet
patchSet) (\s :: DescribePatchProperties
s@DescribePatchProperties' {} Maybe PatchSet
a -> DescribePatchProperties
s {$sel:patchSet:DescribePatchProperties' :: Maybe PatchSet
patchSet = Maybe PatchSet
a} :: DescribePatchProperties)

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

-- | The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
describePatchProperties_maxResults :: Lens.Lens' DescribePatchProperties (Prelude.Maybe Prelude.Natural)
describePatchProperties_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribePatchProperties -> f DescribePatchProperties
describePatchProperties_maxResults = (DescribePatchProperties -> Maybe Natural)
-> (DescribePatchProperties
    -> Maybe Natural -> DescribePatchProperties)
-> Lens
     DescribePatchProperties
     DescribePatchProperties
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchProperties' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribePatchProperties' :: DescribePatchProperties -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribePatchProperties
s@DescribePatchProperties' {} Maybe Natural
a -> DescribePatchProperties
s {$sel:maxResults:DescribePatchProperties' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribePatchProperties)

-- | The operating system type for which to list patches.
describePatchProperties_operatingSystem :: Lens.Lens' DescribePatchProperties OperatingSystem
describePatchProperties_operatingSystem :: (OperatingSystem -> f OperatingSystem)
-> DescribePatchProperties -> f DescribePatchProperties
describePatchProperties_operatingSystem = (DescribePatchProperties -> OperatingSystem)
-> (DescribePatchProperties
    -> OperatingSystem -> DescribePatchProperties)
-> Lens
     DescribePatchProperties
     DescribePatchProperties
     OperatingSystem
     OperatingSystem
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchProperties' {OperatingSystem
operatingSystem :: OperatingSystem
$sel:operatingSystem:DescribePatchProperties' :: DescribePatchProperties -> OperatingSystem
operatingSystem} -> OperatingSystem
operatingSystem) (\s :: DescribePatchProperties
s@DescribePatchProperties' {} OperatingSystem
a -> DescribePatchProperties
s {$sel:operatingSystem:DescribePatchProperties' :: OperatingSystem
operatingSystem = OperatingSystem
a} :: DescribePatchProperties)

-- | The patch property for which you want to view patch details.
describePatchProperties_property :: Lens.Lens' DescribePatchProperties PatchProperty
describePatchProperties_property :: (PatchProperty -> f PatchProperty)
-> DescribePatchProperties -> f DescribePatchProperties
describePatchProperties_property = (DescribePatchProperties -> PatchProperty)
-> (DescribePatchProperties
    -> PatchProperty -> DescribePatchProperties)
-> Lens
     DescribePatchProperties
     DescribePatchProperties
     PatchProperty
     PatchProperty
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchProperties' {PatchProperty
property :: PatchProperty
$sel:property:DescribePatchProperties' :: DescribePatchProperties -> PatchProperty
property} -> PatchProperty
property) (\s :: DescribePatchProperties
s@DescribePatchProperties' {} PatchProperty
a -> DescribePatchProperties
s {$sel:property:DescribePatchProperties' :: PatchProperty
property = PatchProperty
a} :: DescribePatchProperties)

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

instance Prelude.NFData DescribePatchProperties

instance Core.ToHeaders DescribePatchProperties where
  toHeaders :: DescribePatchProperties -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribePatchProperties -> 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.DescribePatchProperties" ::
                          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 DescribePatchProperties where
  toJSON :: DescribePatchProperties -> Value
toJSON DescribePatchProperties' {Maybe Natural
Maybe Text
Maybe PatchSet
OperatingSystem
PatchProperty
property :: PatchProperty
operatingSystem :: OperatingSystem
maxResults :: Maybe Natural
nextToken :: Maybe Text
patchSet :: Maybe PatchSet
$sel:property:DescribePatchProperties' :: DescribePatchProperties -> PatchProperty
$sel:operatingSystem:DescribePatchProperties' :: DescribePatchProperties -> OperatingSystem
$sel:maxResults:DescribePatchProperties' :: DescribePatchProperties -> Maybe Natural
$sel:nextToken:DescribePatchProperties' :: DescribePatchProperties -> Maybe Text
$sel:patchSet:DescribePatchProperties' :: DescribePatchProperties -> Maybe PatchSet
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PatchSet" Text -> PatchSet -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PatchSet -> Pair) -> Maybe PatchSet -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PatchSet
patchSet,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"OperatingSystem" Text -> OperatingSystem -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= OperatingSystem
operatingSystem),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Property" Text -> PatchProperty -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PatchProperty
property)
          ]
      )

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

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

-- | /See:/ 'newDescribePatchPropertiesResponse' smart constructor.
data DescribePatchPropertiesResponse = DescribePatchPropertiesResponse'
  { -- | The token for the next set of items to return. (You use this token in
    -- the next call.)
    DescribePatchPropertiesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of the properties for patches matching the filter request
    -- parameters.
    DescribePatchPropertiesResponse -> Maybe [HashMap Text Text]
properties :: Prelude.Maybe [Prelude.HashMap Prelude.Text Prelude.Text],
    -- | The response's http status code.
    DescribePatchPropertiesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribePatchPropertiesResponse
-> DescribePatchPropertiesResponse -> Bool
(DescribePatchPropertiesResponse
 -> DescribePatchPropertiesResponse -> Bool)
-> (DescribePatchPropertiesResponse
    -> DescribePatchPropertiesResponse -> Bool)
-> Eq DescribePatchPropertiesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePatchPropertiesResponse
-> DescribePatchPropertiesResponse -> Bool
$c/= :: DescribePatchPropertiesResponse
-> DescribePatchPropertiesResponse -> Bool
== :: DescribePatchPropertiesResponse
-> DescribePatchPropertiesResponse -> Bool
$c== :: DescribePatchPropertiesResponse
-> DescribePatchPropertiesResponse -> Bool
Prelude.Eq, ReadPrec [DescribePatchPropertiesResponse]
ReadPrec DescribePatchPropertiesResponse
Int -> ReadS DescribePatchPropertiesResponse
ReadS [DescribePatchPropertiesResponse]
(Int -> ReadS DescribePatchPropertiesResponse)
-> ReadS [DescribePatchPropertiesResponse]
-> ReadPrec DescribePatchPropertiesResponse
-> ReadPrec [DescribePatchPropertiesResponse]
-> Read DescribePatchPropertiesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePatchPropertiesResponse]
$creadListPrec :: ReadPrec [DescribePatchPropertiesResponse]
readPrec :: ReadPrec DescribePatchPropertiesResponse
$creadPrec :: ReadPrec DescribePatchPropertiesResponse
readList :: ReadS [DescribePatchPropertiesResponse]
$creadList :: ReadS [DescribePatchPropertiesResponse]
readsPrec :: Int -> ReadS DescribePatchPropertiesResponse
$creadsPrec :: Int -> ReadS DescribePatchPropertiesResponse
Prelude.Read, Int -> DescribePatchPropertiesResponse -> ShowS
[DescribePatchPropertiesResponse] -> ShowS
DescribePatchPropertiesResponse -> String
(Int -> DescribePatchPropertiesResponse -> ShowS)
-> (DescribePatchPropertiesResponse -> String)
-> ([DescribePatchPropertiesResponse] -> ShowS)
-> Show DescribePatchPropertiesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePatchPropertiesResponse] -> ShowS
$cshowList :: [DescribePatchPropertiesResponse] -> ShowS
show :: DescribePatchPropertiesResponse -> String
$cshow :: DescribePatchPropertiesResponse -> String
showsPrec :: Int -> DescribePatchPropertiesResponse -> ShowS
$cshowsPrec :: Int -> DescribePatchPropertiesResponse -> ShowS
Prelude.Show, (forall x.
 DescribePatchPropertiesResponse
 -> Rep DescribePatchPropertiesResponse x)
-> (forall x.
    Rep DescribePatchPropertiesResponse x
    -> DescribePatchPropertiesResponse)
-> Generic DescribePatchPropertiesResponse
forall x.
Rep DescribePatchPropertiesResponse x
-> DescribePatchPropertiesResponse
forall x.
DescribePatchPropertiesResponse
-> Rep DescribePatchPropertiesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribePatchPropertiesResponse x
-> DescribePatchPropertiesResponse
$cfrom :: forall x.
DescribePatchPropertiesResponse
-> Rep DescribePatchPropertiesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribePatchPropertiesResponse' 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', 'describePatchPropertiesResponse_nextToken' - The token for the next set of items to return. (You use this token in
-- the next call.)
--
-- 'properties', 'describePatchPropertiesResponse_properties' - A list of the properties for patches matching the filter request
-- parameters.
--
-- 'httpStatus', 'describePatchPropertiesResponse_httpStatus' - The response's http status code.
newDescribePatchPropertiesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribePatchPropertiesResponse
newDescribePatchPropertiesResponse :: Int -> DescribePatchPropertiesResponse
newDescribePatchPropertiesResponse Int
pHttpStatus_ =
  DescribePatchPropertiesResponse' :: Maybe Text
-> Maybe [HashMap Text Text]
-> Int
-> DescribePatchPropertiesResponse
DescribePatchPropertiesResponse'
    { $sel:nextToken:DescribePatchPropertiesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:properties:DescribePatchPropertiesResponse' :: Maybe [HashMap Text Text]
properties = Maybe [HashMap Text Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribePatchPropertiesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | A list of the properties for patches matching the filter request
-- parameters.
describePatchPropertiesResponse_properties :: Lens.Lens' DescribePatchPropertiesResponse (Prelude.Maybe [Prelude.HashMap Prelude.Text Prelude.Text])
describePatchPropertiesResponse_properties :: (Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
-> DescribePatchPropertiesResponse
-> f DescribePatchPropertiesResponse
describePatchPropertiesResponse_properties = (DescribePatchPropertiesResponse -> Maybe [HashMap Text Text])
-> (DescribePatchPropertiesResponse
    -> Maybe [HashMap Text Text] -> DescribePatchPropertiesResponse)
-> Lens'
     DescribePatchPropertiesResponse (Maybe [HashMap Text Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePatchPropertiesResponse' {Maybe [HashMap Text Text]
properties :: Maybe [HashMap Text Text]
$sel:properties:DescribePatchPropertiesResponse' :: DescribePatchPropertiesResponse -> Maybe [HashMap Text Text]
properties} -> Maybe [HashMap Text Text]
properties) (\s :: DescribePatchPropertiesResponse
s@DescribePatchPropertiesResponse' {} Maybe [HashMap Text Text]
a -> DescribePatchPropertiesResponse
s {$sel:properties:DescribePatchPropertiesResponse' :: Maybe [HashMap Text Text]
properties = Maybe [HashMap Text Text]
a} :: DescribePatchPropertiesResponse) ((Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
 -> DescribePatchPropertiesResponse
 -> f DescribePatchPropertiesResponse)
-> ((Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
    -> Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
-> (Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
-> DescribePatchPropertiesResponse
-> f DescribePatchPropertiesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
-> Iso
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
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
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribePatchPropertiesResponse