{-# 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.DescribeAutomationExecutions
-- 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)
--
-- Provides details about all active and terminated Automation executions.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeAutomationExecutions
  ( -- * Creating a Request
    DescribeAutomationExecutions (..),
    newDescribeAutomationExecutions,

    -- * Request Lenses
    describeAutomationExecutions_filters,
    describeAutomationExecutions_nextToken,
    describeAutomationExecutions_maxResults,

    -- * Destructuring the Response
    DescribeAutomationExecutionsResponse (..),
    newDescribeAutomationExecutionsResponse,

    -- * Response Lenses
    describeAutomationExecutionsResponse_nextToken,
    describeAutomationExecutionsResponse_automationExecutionMetadataList,
    describeAutomationExecutionsResponse_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:/ 'newDescribeAutomationExecutions' smart constructor.
data DescribeAutomationExecutions = DescribeAutomationExecutions'
  { -- | Filters used to limit the scope of executions that are requested.
    DescribeAutomationExecutions
-> Maybe (NonEmpty AutomationExecutionFilter)
filters :: Prelude.Maybe (Prelude.NonEmpty AutomationExecutionFilter),
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeAutomationExecutions -> 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.
    DescribeAutomationExecutions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeAutomationExecutions
-> DescribeAutomationExecutions -> Bool
(DescribeAutomationExecutions
 -> DescribeAutomationExecutions -> Bool)
-> (DescribeAutomationExecutions
    -> DescribeAutomationExecutions -> Bool)
-> Eq DescribeAutomationExecutions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAutomationExecutions
-> DescribeAutomationExecutions -> Bool
$c/= :: DescribeAutomationExecutions
-> DescribeAutomationExecutions -> Bool
== :: DescribeAutomationExecutions
-> DescribeAutomationExecutions -> Bool
$c== :: DescribeAutomationExecutions
-> DescribeAutomationExecutions -> Bool
Prelude.Eq, ReadPrec [DescribeAutomationExecutions]
ReadPrec DescribeAutomationExecutions
Int -> ReadS DescribeAutomationExecutions
ReadS [DescribeAutomationExecutions]
(Int -> ReadS DescribeAutomationExecutions)
-> ReadS [DescribeAutomationExecutions]
-> ReadPrec DescribeAutomationExecutions
-> ReadPrec [DescribeAutomationExecutions]
-> Read DescribeAutomationExecutions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAutomationExecutions]
$creadListPrec :: ReadPrec [DescribeAutomationExecutions]
readPrec :: ReadPrec DescribeAutomationExecutions
$creadPrec :: ReadPrec DescribeAutomationExecutions
readList :: ReadS [DescribeAutomationExecutions]
$creadList :: ReadS [DescribeAutomationExecutions]
readsPrec :: Int -> ReadS DescribeAutomationExecutions
$creadsPrec :: Int -> ReadS DescribeAutomationExecutions
Prelude.Read, Int -> DescribeAutomationExecutions -> ShowS
[DescribeAutomationExecutions] -> ShowS
DescribeAutomationExecutions -> String
(Int -> DescribeAutomationExecutions -> ShowS)
-> (DescribeAutomationExecutions -> String)
-> ([DescribeAutomationExecutions] -> ShowS)
-> Show DescribeAutomationExecutions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAutomationExecutions] -> ShowS
$cshowList :: [DescribeAutomationExecutions] -> ShowS
show :: DescribeAutomationExecutions -> String
$cshow :: DescribeAutomationExecutions -> String
showsPrec :: Int -> DescribeAutomationExecutions -> ShowS
$cshowsPrec :: Int -> DescribeAutomationExecutions -> ShowS
Prelude.Show, (forall x.
 DescribeAutomationExecutions -> Rep DescribeAutomationExecutions x)
-> (forall x.
    Rep DescribeAutomationExecutions x -> DescribeAutomationExecutions)
-> Generic DescribeAutomationExecutions
forall x.
Rep DescribeAutomationExecutions x -> DescribeAutomationExecutions
forall x.
DescribeAutomationExecutions -> Rep DescribeAutomationExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAutomationExecutions x -> DescribeAutomationExecutions
$cfrom :: forall x.
DescribeAutomationExecutions -> Rep DescribeAutomationExecutions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAutomationExecutions' 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', 'describeAutomationExecutions_filters' - Filters used to limit the scope of executions that are requested.
--
-- 'nextToken', 'describeAutomationExecutions_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeAutomationExecutions_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.
newDescribeAutomationExecutions ::
  DescribeAutomationExecutions
newDescribeAutomationExecutions :: DescribeAutomationExecutions
newDescribeAutomationExecutions =
  DescribeAutomationExecutions' :: Maybe (NonEmpty AutomationExecutionFilter)
-> Maybe Text -> Maybe Natural -> DescribeAutomationExecutions
DescribeAutomationExecutions'
    { $sel:filters:DescribeAutomationExecutions' :: Maybe (NonEmpty AutomationExecutionFilter)
filters =
        Maybe (NonEmpty AutomationExecutionFilter)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAutomationExecutions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeAutomationExecutions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Filters used to limit the scope of executions that are requested.
describeAutomationExecutions_filters :: Lens.Lens' DescribeAutomationExecutions (Prelude.Maybe (Prelude.NonEmpty AutomationExecutionFilter))
describeAutomationExecutions_filters :: (Maybe (NonEmpty AutomationExecutionFilter)
 -> f (Maybe (NonEmpty AutomationExecutionFilter)))
-> DescribeAutomationExecutions -> f DescribeAutomationExecutions
describeAutomationExecutions_filters = (DescribeAutomationExecutions
 -> Maybe (NonEmpty AutomationExecutionFilter))
-> (DescribeAutomationExecutions
    -> Maybe (NonEmpty AutomationExecutionFilter)
    -> DescribeAutomationExecutions)
-> Lens
     DescribeAutomationExecutions
     DescribeAutomationExecutions
     (Maybe (NonEmpty AutomationExecutionFilter))
     (Maybe (NonEmpty AutomationExecutionFilter))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationExecutions' {Maybe (NonEmpty AutomationExecutionFilter)
filters :: Maybe (NonEmpty AutomationExecutionFilter)
$sel:filters:DescribeAutomationExecutions' :: DescribeAutomationExecutions
-> Maybe (NonEmpty AutomationExecutionFilter)
filters} -> Maybe (NonEmpty AutomationExecutionFilter)
filters) (\s :: DescribeAutomationExecutions
s@DescribeAutomationExecutions' {} Maybe (NonEmpty AutomationExecutionFilter)
a -> DescribeAutomationExecutions
s {$sel:filters:DescribeAutomationExecutions' :: Maybe (NonEmpty AutomationExecutionFilter)
filters = Maybe (NonEmpty AutomationExecutionFilter)
a} :: DescribeAutomationExecutions) ((Maybe (NonEmpty AutomationExecutionFilter)
  -> f (Maybe (NonEmpty AutomationExecutionFilter)))
 -> DescribeAutomationExecutions -> f DescribeAutomationExecutions)
-> ((Maybe (NonEmpty AutomationExecutionFilter)
     -> f (Maybe (NonEmpty AutomationExecutionFilter)))
    -> Maybe (NonEmpty AutomationExecutionFilter)
    -> f (Maybe (NonEmpty AutomationExecutionFilter)))
-> (Maybe (NonEmpty AutomationExecutionFilter)
    -> f (Maybe (NonEmpty AutomationExecutionFilter)))
-> DescribeAutomationExecutions
-> f DescribeAutomationExecutions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty AutomationExecutionFilter)
  (NonEmpty AutomationExecutionFilter)
  (NonEmpty AutomationExecutionFilter)
  (NonEmpty AutomationExecutionFilter)
-> Iso
     (Maybe (NonEmpty AutomationExecutionFilter))
     (Maybe (NonEmpty AutomationExecutionFilter))
     (Maybe (NonEmpty AutomationExecutionFilter))
     (Maybe (NonEmpty AutomationExecutionFilter))
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
  (NonEmpty AutomationExecutionFilter)
  (NonEmpty AutomationExecutionFilter)
  (NonEmpty AutomationExecutionFilter)
  (NonEmpty AutomationExecutionFilter)
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.)
describeAutomationExecutions_nextToken :: Lens.Lens' DescribeAutomationExecutions (Prelude.Maybe Prelude.Text)
describeAutomationExecutions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAutomationExecutions -> f DescribeAutomationExecutions
describeAutomationExecutions_nextToken = (DescribeAutomationExecutions -> Maybe Text)
-> (DescribeAutomationExecutions
    -> Maybe Text -> DescribeAutomationExecutions)
-> Lens
     DescribeAutomationExecutions
     DescribeAutomationExecutions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationExecutions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAutomationExecutions' :: DescribeAutomationExecutions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAutomationExecutions
s@DescribeAutomationExecutions' {} Maybe Text
a -> DescribeAutomationExecutions
s {$sel:nextToken:DescribeAutomationExecutions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAutomationExecutions)

-- | 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.
describeAutomationExecutions_maxResults :: Lens.Lens' DescribeAutomationExecutions (Prelude.Maybe Prelude.Natural)
describeAutomationExecutions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeAutomationExecutions -> f DescribeAutomationExecutions
describeAutomationExecutions_maxResults = (DescribeAutomationExecutions -> Maybe Natural)
-> (DescribeAutomationExecutions
    -> Maybe Natural -> DescribeAutomationExecutions)
-> Lens
     DescribeAutomationExecutions
     DescribeAutomationExecutions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationExecutions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeAutomationExecutions' :: DescribeAutomationExecutions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeAutomationExecutions
s@DescribeAutomationExecutions' {} Maybe Natural
a -> DescribeAutomationExecutions
s {$sel:maxResults:DescribeAutomationExecutions' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeAutomationExecutions)

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

instance Prelude.NFData DescribeAutomationExecutions

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

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

-- | /See:/ 'newDescribeAutomationExecutionsResponse' smart constructor.
data DescribeAutomationExecutionsResponse = DescribeAutomationExecutionsResponse'
  { -- | The token to use when requesting the next set of items. If there are no
    -- additional items to return, the string is empty.
    DescribeAutomationExecutionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of details about each automation execution which has occurred
    -- which matches the filter specification, if any.
    DescribeAutomationExecutionsResponse
-> Maybe [AutomationExecutionMetadata]
automationExecutionMetadataList :: Prelude.Maybe [AutomationExecutionMetadata],
    -- | The response's http status code.
    DescribeAutomationExecutionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAutomationExecutionsResponse
-> DescribeAutomationExecutionsResponse -> Bool
(DescribeAutomationExecutionsResponse
 -> DescribeAutomationExecutionsResponse -> Bool)
-> (DescribeAutomationExecutionsResponse
    -> DescribeAutomationExecutionsResponse -> Bool)
-> Eq DescribeAutomationExecutionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAutomationExecutionsResponse
-> DescribeAutomationExecutionsResponse -> Bool
$c/= :: DescribeAutomationExecutionsResponse
-> DescribeAutomationExecutionsResponse -> Bool
== :: DescribeAutomationExecutionsResponse
-> DescribeAutomationExecutionsResponse -> Bool
$c== :: DescribeAutomationExecutionsResponse
-> DescribeAutomationExecutionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAutomationExecutionsResponse]
ReadPrec DescribeAutomationExecutionsResponse
Int -> ReadS DescribeAutomationExecutionsResponse
ReadS [DescribeAutomationExecutionsResponse]
(Int -> ReadS DescribeAutomationExecutionsResponse)
-> ReadS [DescribeAutomationExecutionsResponse]
-> ReadPrec DescribeAutomationExecutionsResponse
-> ReadPrec [DescribeAutomationExecutionsResponse]
-> Read DescribeAutomationExecutionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAutomationExecutionsResponse]
$creadListPrec :: ReadPrec [DescribeAutomationExecutionsResponse]
readPrec :: ReadPrec DescribeAutomationExecutionsResponse
$creadPrec :: ReadPrec DescribeAutomationExecutionsResponse
readList :: ReadS [DescribeAutomationExecutionsResponse]
$creadList :: ReadS [DescribeAutomationExecutionsResponse]
readsPrec :: Int -> ReadS DescribeAutomationExecutionsResponse
$creadsPrec :: Int -> ReadS DescribeAutomationExecutionsResponse
Prelude.Read, Int -> DescribeAutomationExecutionsResponse -> ShowS
[DescribeAutomationExecutionsResponse] -> ShowS
DescribeAutomationExecutionsResponse -> String
(Int -> DescribeAutomationExecutionsResponse -> ShowS)
-> (DescribeAutomationExecutionsResponse -> String)
-> ([DescribeAutomationExecutionsResponse] -> ShowS)
-> Show DescribeAutomationExecutionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAutomationExecutionsResponse] -> ShowS
$cshowList :: [DescribeAutomationExecutionsResponse] -> ShowS
show :: DescribeAutomationExecutionsResponse -> String
$cshow :: DescribeAutomationExecutionsResponse -> String
showsPrec :: Int -> DescribeAutomationExecutionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeAutomationExecutionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAutomationExecutionsResponse
 -> Rep DescribeAutomationExecutionsResponse x)
-> (forall x.
    Rep DescribeAutomationExecutionsResponse x
    -> DescribeAutomationExecutionsResponse)
-> Generic DescribeAutomationExecutionsResponse
forall x.
Rep DescribeAutomationExecutionsResponse x
-> DescribeAutomationExecutionsResponse
forall x.
DescribeAutomationExecutionsResponse
-> Rep DescribeAutomationExecutionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAutomationExecutionsResponse x
-> DescribeAutomationExecutionsResponse
$cfrom :: forall x.
DescribeAutomationExecutionsResponse
-> Rep DescribeAutomationExecutionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAutomationExecutionsResponse' 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', 'describeAutomationExecutionsResponse_nextToken' - The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
--
-- 'automationExecutionMetadataList', 'describeAutomationExecutionsResponse_automationExecutionMetadataList' - The list of details about each automation execution which has occurred
-- which matches the filter specification, if any.
--
-- 'httpStatus', 'describeAutomationExecutionsResponse_httpStatus' - The response's http status code.
newDescribeAutomationExecutionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAutomationExecutionsResponse
newDescribeAutomationExecutionsResponse :: Int -> DescribeAutomationExecutionsResponse
newDescribeAutomationExecutionsResponse Int
pHttpStatus_ =
  DescribeAutomationExecutionsResponse' :: Maybe Text
-> Maybe [AutomationExecutionMetadata]
-> Int
-> DescribeAutomationExecutionsResponse
DescribeAutomationExecutionsResponse'
    { $sel:nextToken:DescribeAutomationExecutionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:automationExecutionMetadataList:DescribeAutomationExecutionsResponse' :: Maybe [AutomationExecutionMetadata]
automationExecutionMetadataList =
        Maybe [AutomationExecutionMetadata]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAutomationExecutionsResponse' :: 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.
describeAutomationExecutionsResponse_nextToken :: Lens.Lens' DescribeAutomationExecutionsResponse (Prelude.Maybe Prelude.Text)
describeAutomationExecutionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAutomationExecutionsResponse
-> f DescribeAutomationExecutionsResponse
describeAutomationExecutionsResponse_nextToken = (DescribeAutomationExecutionsResponse -> Maybe Text)
-> (DescribeAutomationExecutionsResponse
    -> Maybe Text -> DescribeAutomationExecutionsResponse)
-> Lens' DescribeAutomationExecutionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationExecutionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAutomationExecutionsResponse' :: DescribeAutomationExecutionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAutomationExecutionsResponse
s@DescribeAutomationExecutionsResponse' {} Maybe Text
a -> DescribeAutomationExecutionsResponse
s {$sel:nextToken:DescribeAutomationExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAutomationExecutionsResponse)

-- | The list of details about each automation execution which has occurred
-- which matches the filter specification, if any.
describeAutomationExecutionsResponse_automationExecutionMetadataList :: Lens.Lens' DescribeAutomationExecutionsResponse (Prelude.Maybe [AutomationExecutionMetadata])
describeAutomationExecutionsResponse_automationExecutionMetadataList :: (Maybe [AutomationExecutionMetadata]
 -> f (Maybe [AutomationExecutionMetadata]))
-> DescribeAutomationExecutionsResponse
-> f DescribeAutomationExecutionsResponse
describeAutomationExecutionsResponse_automationExecutionMetadataList = (DescribeAutomationExecutionsResponse
 -> Maybe [AutomationExecutionMetadata])
-> (DescribeAutomationExecutionsResponse
    -> Maybe [AutomationExecutionMetadata]
    -> DescribeAutomationExecutionsResponse)
-> Lens'
     DescribeAutomationExecutionsResponse
     (Maybe [AutomationExecutionMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationExecutionsResponse' {Maybe [AutomationExecutionMetadata]
automationExecutionMetadataList :: Maybe [AutomationExecutionMetadata]
$sel:automationExecutionMetadataList:DescribeAutomationExecutionsResponse' :: DescribeAutomationExecutionsResponse
-> Maybe [AutomationExecutionMetadata]
automationExecutionMetadataList} -> Maybe [AutomationExecutionMetadata]
automationExecutionMetadataList) (\s :: DescribeAutomationExecutionsResponse
s@DescribeAutomationExecutionsResponse' {} Maybe [AutomationExecutionMetadata]
a -> DescribeAutomationExecutionsResponse
s {$sel:automationExecutionMetadataList:DescribeAutomationExecutionsResponse' :: Maybe [AutomationExecutionMetadata]
automationExecutionMetadataList = Maybe [AutomationExecutionMetadata]
a} :: DescribeAutomationExecutionsResponse) ((Maybe [AutomationExecutionMetadata]
  -> f (Maybe [AutomationExecutionMetadata]))
 -> DescribeAutomationExecutionsResponse
 -> f DescribeAutomationExecutionsResponse)
-> ((Maybe [AutomationExecutionMetadata]
     -> f (Maybe [AutomationExecutionMetadata]))
    -> Maybe [AutomationExecutionMetadata]
    -> f (Maybe [AutomationExecutionMetadata]))
-> (Maybe [AutomationExecutionMetadata]
    -> f (Maybe [AutomationExecutionMetadata]))
-> DescribeAutomationExecutionsResponse
-> f DescribeAutomationExecutionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AutomationExecutionMetadata]
  [AutomationExecutionMetadata]
  [AutomationExecutionMetadata]
  [AutomationExecutionMetadata]
-> Iso
     (Maybe [AutomationExecutionMetadata])
     (Maybe [AutomationExecutionMetadata])
     (Maybe [AutomationExecutionMetadata])
     (Maybe [AutomationExecutionMetadata])
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
  [AutomationExecutionMetadata]
  [AutomationExecutionMetadata]
  [AutomationExecutionMetadata]
  [AutomationExecutionMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeAutomationExecutionsResponse