{-# 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.DescribeAssociationExecutions
-- 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)
--
-- Views all executions for a specific association ID.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeAssociationExecutions
  ( -- * Creating a Request
    DescribeAssociationExecutions (..),
    newDescribeAssociationExecutions,

    -- * Request Lenses
    describeAssociationExecutions_filters,
    describeAssociationExecutions_nextToken,
    describeAssociationExecutions_maxResults,
    describeAssociationExecutions_associationId,

    -- * Destructuring the Response
    DescribeAssociationExecutionsResponse (..),
    newDescribeAssociationExecutionsResponse,

    -- * Response Lenses
    describeAssociationExecutionsResponse_nextToken,
    describeAssociationExecutionsResponse_associationExecutions,
    describeAssociationExecutionsResponse_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:/ 'newDescribeAssociationExecutions' smart constructor.
data DescribeAssociationExecutions = DescribeAssociationExecutions'
  { -- | Filters for the request. You can specify the following filters and
    -- values.
    --
    -- ExecutionId (EQUAL)
    --
    -- Status (EQUAL)
    --
    -- CreatedTime (EQUAL, GREATER_THAN, LESS_THAN)
    DescribeAssociationExecutions
-> Maybe (NonEmpty AssociationExecutionFilter)
filters :: Prelude.Maybe (Prelude.NonEmpty AssociationExecutionFilter),
    -- | A token to start the list. Use this token to get the next set of
    -- results.
    DescribeAssociationExecutions -> 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.
    DescribeAssociationExecutions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The association ID for which you want to view execution history details.
    DescribeAssociationExecutions -> Text
associationId :: Prelude.Text
  }
  deriving (DescribeAssociationExecutions
-> DescribeAssociationExecutions -> Bool
(DescribeAssociationExecutions
 -> DescribeAssociationExecutions -> Bool)
-> (DescribeAssociationExecutions
    -> DescribeAssociationExecutions -> Bool)
-> Eq DescribeAssociationExecutions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAssociationExecutions
-> DescribeAssociationExecutions -> Bool
$c/= :: DescribeAssociationExecutions
-> DescribeAssociationExecutions -> Bool
== :: DescribeAssociationExecutions
-> DescribeAssociationExecutions -> Bool
$c== :: DescribeAssociationExecutions
-> DescribeAssociationExecutions -> Bool
Prelude.Eq, ReadPrec [DescribeAssociationExecutions]
ReadPrec DescribeAssociationExecutions
Int -> ReadS DescribeAssociationExecutions
ReadS [DescribeAssociationExecutions]
(Int -> ReadS DescribeAssociationExecutions)
-> ReadS [DescribeAssociationExecutions]
-> ReadPrec DescribeAssociationExecutions
-> ReadPrec [DescribeAssociationExecutions]
-> Read DescribeAssociationExecutions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAssociationExecutions]
$creadListPrec :: ReadPrec [DescribeAssociationExecutions]
readPrec :: ReadPrec DescribeAssociationExecutions
$creadPrec :: ReadPrec DescribeAssociationExecutions
readList :: ReadS [DescribeAssociationExecutions]
$creadList :: ReadS [DescribeAssociationExecutions]
readsPrec :: Int -> ReadS DescribeAssociationExecutions
$creadsPrec :: Int -> ReadS DescribeAssociationExecutions
Prelude.Read, Int -> DescribeAssociationExecutions -> ShowS
[DescribeAssociationExecutions] -> ShowS
DescribeAssociationExecutions -> String
(Int -> DescribeAssociationExecutions -> ShowS)
-> (DescribeAssociationExecutions -> String)
-> ([DescribeAssociationExecutions] -> ShowS)
-> Show DescribeAssociationExecutions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAssociationExecutions] -> ShowS
$cshowList :: [DescribeAssociationExecutions] -> ShowS
show :: DescribeAssociationExecutions -> String
$cshow :: DescribeAssociationExecutions -> String
showsPrec :: Int -> DescribeAssociationExecutions -> ShowS
$cshowsPrec :: Int -> DescribeAssociationExecutions -> ShowS
Prelude.Show, (forall x.
 DescribeAssociationExecutions
 -> Rep DescribeAssociationExecutions x)
-> (forall x.
    Rep DescribeAssociationExecutions x
    -> DescribeAssociationExecutions)
-> Generic DescribeAssociationExecutions
forall x.
Rep DescribeAssociationExecutions x
-> DescribeAssociationExecutions
forall x.
DescribeAssociationExecutions
-> Rep DescribeAssociationExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAssociationExecutions x
-> DescribeAssociationExecutions
$cfrom :: forall x.
DescribeAssociationExecutions
-> Rep DescribeAssociationExecutions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAssociationExecutions' 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', 'describeAssociationExecutions_filters' - Filters for the request. You can specify the following filters and
-- values.
--
-- ExecutionId (EQUAL)
--
-- Status (EQUAL)
--
-- CreatedTime (EQUAL, GREATER_THAN, LESS_THAN)
--
-- 'nextToken', 'describeAssociationExecutions_nextToken' - A token to start the list. Use this token to get the next set of
-- results.
--
-- 'maxResults', 'describeAssociationExecutions_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.
--
-- 'associationId', 'describeAssociationExecutions_associationId' - The association ID for which you want to view execution history details.
newDescribeAssociationExecutions ::
  -- | 'associationId'
  Prelude.Text ->
  DescribeAssociationExecutions
newDescribeAssociationExecutions :: Text -> DescribeAssociationExecutions
newDescribeAssociationExecutions Text
pAssociationId_ =
  DescribeAssociationExecutions' :: Maybe (NonEmpty AssociationExecutionFilter)
-> Maybe Text
-> Maybe Natural
-> Text
-> DescribeAssociationExecutions
DescribeAssociationExecutions'
    { $sel:filters:DescribeAssociationExecutions' :: Maybe (NonEmpty AssociationExecutionFilter)
filters =
        Maybe (NonEmpty AssociationExecutionFilter)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAssociationExecutions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeAssociationExecutions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:associationId:DescribeAssociationExecutions' :: Text
associationId = Text
pAssociationId_
    }

-- | Filters for the request. You can specify the following filters and
-- values.
--
-- ExecutionId (EQUAL)
--
-- Status (EQUAL)
--
-- CreatedTime (EQUAL, GREATER_THAN, LESS_THAN)
describeAssociationExecutions_filters :: Lens.Lens' DescribeAssociationExecutions (Prelude.Maybe (Prelude.NonEmpty AssociationExecutionFilter))
describeAssociationExecutions_filters :: (Maybe (NonEmpty AssociationExecutionFilter)
 -> f (Maybe (NonEmpty AssociationExecutionFilter)))
-> DescribeAssociationExecutions -> f DescribeAssociationExecutions
describeAssociationExecutions_filters = (DescribeAssociationExecutions
 -> Maybe (NonEmpty AssociationExecutionFilter))
-> (DescribeAssociationExecutions
    -> Maybe (NonEmpty AssociationExecutionFilter)
    -> DescribeAssociationExecutions)
-> Lens
     DescribeAssociationExecutions
     DescribeAssociationExecutions
     (Maybe (NonEmpty AssociationExecutionFilter))
     (Maybe (NonEmpty AssociationExecutionFilter))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociationExecutions' {Maybe (NonEmpty AssociationExecutionFilter)
filters :: Maybe (NonEmpty AssociationExecutionFilter)
$sel:filters:DescribeAssociationExecutions' :: DescribeAssociationExecutions
-> Maybe (NonEmpty AssociationExecutionFilter)
filters} -> Maybe (NonEmpty AssociationExecutionFilter)
filters) (\s :: DescribeAssociationExecutions
s@DescribeAssociationExecutions' {} Maybe (NonEmpty AssociationExecutionFilter)
a -> DescribeAssociationExecutions
s {$sel:filters:DescribeAssociationExecutions' :: Maybe (NonEmpty AssociationExecutionFilter)
filters = Maybe (NonEmpty AssociationExecutionFilter)
a} :: DescribeAssociationExecutions) ((Maybe (NonEmpty AssociationExecutionFilter)
  -> f (Maybe (NonEmpty AssociationExecutionFilter)))
 -> DescribeAssociationExecutions
 -> f DescribeAssociationExecutions)
-> ((Maybe (NonEmpty AssociationExecutionFilter)
     -> f (Maybe (NonEmpty AssociationExecutionFilter)))
    -> Maybe (NonEmpty AssociationExecutionFilter)
    -> f (Maybe (NonEmpty AssociationExecutionFilter)))
-> (Maybe (NonEmpty AssociationExecutionFilter)
    -> f (Maybe (NonEmpty AssociationExecutionFilter)))
-> DescribeAssociationExecutions
-> f DescribeAssociationExecutions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty AssociationExecutionFilter)
  (NonEmpty AssociationExecutionFilter)
  (NonEmpty AssociationExecutionFilter)
  (NonEmpty AssociationExecutionFilter)
-> Iso
     (Maybe (NonEmpty AssociationExecutionFilter))
     (Maybe (NonEmpty AssociationExecutionFilter))
     (Maybe (NonEmpty AssociationExecutionFilter))
     (Maybe (NonEmpty AssociationExecutionFilter))
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 AssociationExecutionFilter)
  (NonEmpty AssociationExecutionFilter)
  (NonEmpty AssociationExecutionFilter)
  (NonEmpty AssociationExecutionFilter)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token to start the list. Use this token to get the next set of
-- results.
describeAssociationExecutions_nextToken :: Lens.Lens' DescribeAssociationExecutions (Prelude.Maybe Prelude.Text)
describeAssociationExecutions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAssociationExecutions -> f DescribeAssociationExecutions
describeAssociationExecutions_nextToken = (DescribeAssociationExecutions -> Maybe Text)
-> (DescribeAssociationExecutions
    -> Maybe Text -> DescribeAssociationExecutions)
-> Lens
     DescribeAssociationExecutions
     DescribeAssociationExecutions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociationExecutions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAssociationExecutions' :: DescribeAssociationExecutions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAssociationExecutions
s@DescribeAssociationExecutions' {} Maybe Text
a -> DescribeAssociationExecutions
s {$sel:nextToken:DescribeAssociationExecutions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAssociationExecutions)

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

-- | The association ID for which you want to view execution history details.
describeAssociationExecutions_associationId :: Lens.Lens' DescribeAssociationExecutions Prelude.Text
describeAssociationExecutions_associationId :: (Text -> f Text)
-> DescribeAssociationExecutions -> f DescribeAssociationExecutions
describeAssociationExecutions_associationId = (DescribeAssociationExecutions -> Text)
-> (DescribeAssociationExecutions
    -> Text -> DescribeAssociationExecutions)
-> Lens
     DescribeAssociationExecutions
     DescribeAssociationExecutions
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociationExecutions' {Text
associationId :: Text
$sel:associationId:DescribeAssociationExecutions' :: DescribeAssociationExecutions -> Text
associationId} -> Text
associationId) (\s :: DescribeAssociationExecutions
s@DescribeAssociationExecutions' {} Text
a -> DescribeAssociationExecutions
s {$sel:associationId:DescribeAssociationExecutions' :: Text
associationId = Text
a} :: DescribeAssociationExecutions)

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

instance Prelude.NFData DescribeAssociationExecutions

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

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

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

-- | /See:/ 'newDescribeAssociationExecutionsResponse' smart constructor.
data DescribeAssociationExecutionsResponse = DescribeAssociationExecutionsResponse'
  { -- | The token for the next set of items to return. Use this token to get the
    -- next set of results.
    DescribeAssociationExecutionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of the executions for the specified association ID.
    DescribeAssociationExecutionsResponse
-> Maybe [AssociationExecution]
associationExecutions :: Prelude.Maybe [AssociationExecution],
    -- | The response's http status code.
    DescribeAssociationExecutionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAssociationExecutionsResponse
-> DescribeAssociationExecutionsResponse -> Bool
(DescribeAssociationExecutionsResponse
 -> DescribeAssociationExecutionsResponse -> Bool)
-> (DescribeAssociationExecutionsResponse
    -> DescribeAssociationExecutionsResponse -> Bool)
-> Eq DescribeAssociationExecutionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAssociationExecutionsResponse
-> DescribeAssociationExecutionsResponse -> Bool
$c/= :: DescribeAssociationExecutionsResponse
-> DescribeAssociationExecutionsResponse -> Bool
== :: DescribeAssociationExecutionsResponse
-> DescribeAssociationExecutionsResponse -> Bool
$c== :: DescribeAssociationExecutionsResponse
-> DescribeAssociationExecutionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAssociationExecutionsResponse]
ReadPrec DescribeAssociationExecutionsResponse
Int -> ReadS DescribeAssociationExecutionsResponse
ReadS [DescribeAssociationExecutionsResponse]
(Int -> ReadS DescribeAssociationExecutionsResponse)
-> ReadS [DescribeAssociationExecutionsResponse]
-> ReadPrec DescribeAssociationExecutionsResponse
-> ReadPrec [DescribeAssociationExecutionsResponse]
-> Read DescribeAssociationExecutionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAssociationExecutionsResponse]
$creadListPrec :: ReadPrec [DescribeAssociationExecutionsResponse]
readPrec :: ReadPrec DescribeAssociationExecutionsResponse
$creadPrec :: ReadPrec DescribeAssociationExecutionsResponse
readList :: ReadS [DescribeAssociationExecutionsResponse]
$creadList :: ReadS [DescribeAssociationExecutionsResponse]
readsPrec :: Int -> ReadS DescribeAssociationExecutionsResponse
$creadsPrec :: Int -> ReadS DescribeAssociationExecutionsResponse
Prelude.Read, Int -> DescribeAssociationExecutionsResponse -> ShowS
[DescribeAssociationExecutionsResponse] -> ShowS
DescribeAssociationExecutionsResponse -> String
(Int -> DescribeAssociationExecutionsResponse -> ShowS)
-> (DescribeAssociationExecutionsResponse -> String)
-> ([DescribeAssociationExecutionsResponse] -> ShowS)
-> Show DescribeAssociationExecutionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAssociationExecutionsResponse] -> ShowS
$cshowList :: [DescribeAssociationExecutionsResponse] -> ShowS
show :: DescribeAssociationExecutionsResponse -> String
$cshow :: DescribeAssociationExecutionsResponse -> String
showsPrec :: Int -> DescribeAssociationExecutionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeAssociationExecutionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAssociationExecutionsResponse
 -> Rep DescribeAssociationExecutionsResponse x)
-> (forall x.
    Rep DescribeAssociationExecutionsResponse x
    -> DescribeAssociationExecutionsResponse)
-> Generic DescribeAssociationExecutionsResponse
forall x.
Rep DescribeAssociationExecutionsResponse x
-> DescribeAssociationExecutionsResponse
forall x.
DescribeAssociationExecutionsResponse
-> Rep DescribeAssociationExecutionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAssociationExecutionsResponse x
-> DescribeAssociationExecutionsResponse
$cfrom :: forall x.
DescribeAssociationExecutionsResponse
-> Rep DescribeAssociationExecutionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAssociationExecutionsResponse' 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', 'describeAssociationExecutionsResponse_nextToken' - The token for the next set of items to return. Use this token to get the
-- next set of results.
--
-- 'associationExecutions', 'describeAssociationExecutionsResponse_associationExecutions' - A list of the executions for the specified association ID.
--
-- 'httpStatus', 'describeAssociationExecutionsResponse_httpStatus' - The response's http status code.
newDescribeAssociationExecutionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAssociationExecutionsResponse
newDescribeAssociationExecutionsResponse :: Int -> DescribeAssociationExecutionsResponse
newDescribeAssociationExecutionsResponse Int
pHttpStatus_ =
  DescribeAssociationExecutionsResponse' :: Maybe Text
-> Maybe [AssociationExecution]
-> Int
-> DescribeAssociationExecutionsResponse
DescribeAssociationExecutionsResponse'
    { $sel:nextToken:DescribeAssociationExecutionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:associationExecutions:DescribeAssociationExecutionsResponse' :: Maybe [AssociationExecution]
associationExecutions =
        Maybe [AssociationExecution]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAssociationExecutionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token for the next set of items to return. Use this token to get the
-- next set of results.
describeAssociationExecutionsResponse_nextToken :: Lens.Lens' DescribeAssociationExecutionsResponse (Prelude.Maybe Prelude.Text)
describeAssociationExecutionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAssociationExecutionsResponse
-> f DescribeAssociationExecutionsResponse
describeAssociationExecutionsResponse_nextToken = (DescribeAssociationExecutionsResponse -> Maybe Text)
-> (DescribeAssociationExecutionsResponse
    -> Maybe Text -> DescribeAssociationExecutionsResponse)
-> Lens' DescribeAssociationExecutionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociationExecutionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAssociationExecutionsResponse' :: DescribeAssociationExecutionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAssociationExecutionsResponse
s@DescribeAssociationExecutionsResponse' {} Maybe Text
a -> DescribeAssociationExecutionsResponse
s {$sel:nextToken:DescribeAssociationExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAssociationExecutionsResponse)

-- | A list of the executions for the specified association ID.
describeAssociationExecutionsResponse_associationExecutions :: Lens.Lens' DescribeAssociationExecutionsResponse (Prelude.Maybe [AssociationExecution])
describeAssociationExecutionsResponse_associationExecutions :: (Maybe [AssociationExecution] -> f (Maybe [AssociationExecution]))
-> DescribeAssociationExecutionsResponse
-> f DescribeAssociationExecutionsResponse
describeAssociationExecutionsResponse_associationExecutions = (DescribeAssociationExecutionsResponse
 -> Maybe [AssociationExecution])
-> (DescribeAssociationExecutionsResponse
    -> Maybe [AssociationExecution]
    -> DescribeAssociationExecutionsResponse)
-> Lens'
     DescribeAssociationExecutionsResponse
     (Maybe [AssociationExecution])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAssociationExecutionsResponse' {Maybe [AssociationExecution]
associationExecutions :: Maybe [AssociationExecution]
$sel:associationExecutions:DescribeAssociationExecutionsResponse' :: DescribeAssociationExecutionsResponse
-> Maybe [AssociationExecution]
associationExecutions} -> Maybe [AssociationExecution]
associationExecutions) (\s :: DescribeAssociationExecutionsResponse
s@DescribeAssociationExecutionsResponse' {} Maybe [AssociationExecution]
a -> DescribeAssociationExecutionsResponse
s {$sel:associationExecutions:DescribeAssociationExecutionsResponse' :: Maybe [AssociationExecution]
associationExecutions = Maybe [AssociationExecution]
a} :: DescribeAssociationExecutionsResponse) ((Maybe [AssociationExecution] -> f (Maybe [AssociationExecution]))
 -> DescribeAssociationExecutionsResponse
 -> f DescribeAssociationExecutionsResponse)
-> ((Maybe [AssociationExecution]
     -> f (Maybe [AssociationExecution]))
    -> Maybe [AssociationExecution]
    -> f (Maybe [AssociationExecution]))
-> (Maybe [AssociationExecution]
    -> f (Maybe [AssociationExecution]))
-> DescribeAssociationExecutionsResponse
-> f DescribeAssociationExecutionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AssociationExecution]
  [AssociationExecution]
  [AssociationExecution]
  [AssociationExecution]
-> Iso
     (Maybe [AssociationExecution])
     (Maybe [AssociationExecution])
     (Maybe [AssociationExecution])
     (Maybe [AssociationExecution])
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
  [AssociationExecution]
  [AssociationExecution]
  [AssociationExecution]
  [AssociationExecution]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeAssociationExecutionsResponse