{-# 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.DescribeInstanceAssociationsStatus
-- 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)
--
-- The status of the associations for the instance(s).
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeInstanceAssociationsStatus
  ( -- * Creating a Request
    DescribeInstanceAssociationsStatus (..),
    newDescribeInstanceAssociationsStatus,

    -- * Request Lenses
    describeInstanceAssociationsStatus_nextToken,
    describeInstanceAssociationsStatus_maxResults,
    describeInstanceAssociationsStatus_instanceId,

    -- * Destructuring the Response
    DescribeInstanceAssociationsStatusResponse (..),
    newDescribeInstanceAssociationsStatusResponse,

    -- * Response Lenses
    describeInstanceAssociationsStatusResponse_instanceAssociationStatusInfos,
    describeInstanceAssociationsStatusResponse_nextToken,
    describeInstanceAssociationsStatusResponse_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:/ 'newDescribeInstanceAssociationsStatus' smart constructor.
data DescribeInstanceAssociationsStatus = DescribeInstanceAssociationsStatus'
  { -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeInstanceAssociationsStatus -> 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.
    DescribeInstanceAssociationsStatus -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The instance IDs for which you want association status information.
    DescribeInstanceAssociationsStatus -> Text
instanceId :: Prelude.Text
  }
  deriving (DescribeInstanceAssociationsStatus
-> DescribeInstanceAssociationsStatus -> Bool
(DescribeInstanceAssociationsStatus
 -> DescribeInstanceAssociationsStatus -> Bool)
-> (DescribeInstanceAssociationsStatus
    -> DescribeInstanceAssociationsStatus -> Bool)
-> Eq DescribeInstanceAssociationsStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInstanceAssociationsStatus
-> DescribeInstanceAssociationsStatus -> Bool
$c/= :: DescribeInstanceAssociationsStatus
-> DescribeInstanceAssociationsStatus -> Bool
== :: DescribeInstanceAssociationsStatus
-> DescribeInstanceAssociationsStatus -> Bool
$c== :: DescribeInstanceAssociationsStatus
-> DescribeInstanceAssociationsStatus -> Bool
Prelude.Eq, ReadPrec [DescribeInstanceAssociationsStatus]
ReadPrec DescribeInstanceAssociationsStatus
Int -> ReadS DescribeInstanceAssociationsStatus
ReadS [DescribeInstanceAssociationsStatus]
(Int -> ReadS DescribeInstanceAssociationsStatus)
-> ReadS [DescribeInstanceAssociationsStatus]
-> ReadPrec DescribeInstanceAssociationsStatus
-> ReadPrec [DescribeInstanceAssociationsStatus]
-> Read DescribeInstanceAssociationsStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInstanceAssociationsStatus]
$creadListPrec :: ReadPrec [DescribeInstanceAssociationsStatus]
readPrec :: ReadPrec DescribeInstanceAssociationsStatus
$creadPrec :: ReadPrec DescribeInstanceAssociationsStatus
readList :: ReadS [DescribeInstanceAssociationsStatus]
$creadList :: ReadS [DescribeInstanceAssociationsStatus]
readsPrec :: Int -> ReadS DescribeInstanceAssociationsStatus
$creadsPrec :: Int -> ReadS DescribeInstanceAssociationsStatus
Prelude.Read, Int -> DescribeInstanceAssociationsStatus -> ShowS
[DescribeInstanceAssociationsStatus] -> ShowS
DescribeInstanceAssociationsStatus -> String
(Int -> DescribeInstanceAssociationsStatus -> ShowS)
-> (DescribeInstanceAssociationsStatus -> String)
-> ([DescribeInstanceAssociationsStatus] -> ShowS)
-> Show DescribeInstanceAssociationsStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInstanceAssociationsStatus] -> ShowS
$cshowList :: [DescribeInstanceAssociationsStatus] -> ShowS
show :: DescribeInstanceAssociationsStatus -> String
$cshow :: DescribeInstanceAssociationsStatus -> String
showsPrec :: Int -> DescribeInstanceAssociationsStatus -> ShowS
$cshowsPrec :: Int -> DescribeInstanceAssociationsStatus -> ShowS
Prelude.Show, (forall x.
 DescribeInstanceAssociationsStatus
 -> Rep DescribeInstanceAssociationsStatus x)
-> (forall x.
    Rep DescribeInstanceAssociationsStatus x
    -> DescribeInstanceAssociationsStatus)
-> Generic DescribeInstanceAssociationsStatus
forall x.
Rep DescribeInstanceAssociationsStatus x
-> DescribeInstanceAssociationsStatus
forall x.
DescribeInstanceAssociationsStatus
-> Rep DescribeInstanceAssociationsStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeInstanceAssociationsStatus x
-> DescribeInstanceAssociationsStatus
$cfrom :: forall x.
DescribeInstanceAssociationsStatus
-> Rep DescribeInstanceAssociationsStatus x
Prelude.Generic)

-- |
-- Create a value of 'DescribeInstanceAssociationsStatus' 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', 'describeInstanceAssociationsStatus_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeInstanceAssociationsStatus_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.
--
-- 'instanceId', 'describeInstanceAssociationsStatus_instanceId' - The instance IDs for which you want association status information.
newDescribeInstanceAssociationsStatus ::
  -- | 'instanceId'
  Prelude.Text ->
  DescribeInstanceAssociationsStatus
newDescribeInstanceAssociationsStatus :: Text -> DescribeInstanceAssociationsStatus
newDescribeInstanceAssociationsStatus Text
pInstanceId_ =
  DescribeInstanceAssociationsStatus' :: Maybe Text
-> Maybe Natural -> Text -> DescribeInstanceAssociationsStatus
DescribeInstanceAssociationsStatus'
    { $sel:nextToken:DescribeInstanceAssociationsStatus' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeInstanceAssociationsStatus' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceId:DescribeInstanceAssociationsStatus' :: Text
instanceId = Text
pInstanceId_
    }

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

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

-- | The instance IDs for which you want association status information.
describeInstanceAssociationsStatus_instanceId :: Lens.Lens' DescribeInstanceAssociationsStatus Prelude.Text
describeInstanceAssociationsStatus_instanceId :: (Text -> f Text)
-> DescribeInstanceAssociationsStatus
-> f DescribeInstanceAssociationsStatus
describeInstanceAssociationsStatus_instanceId = (DescribeInstanceAssociationsStatus -> Text)
-> (DescribeInstanceAssociationsStatus
    -> Text -> DescribeInstanceAssociationsStatus)
-> Lens
     DescribeInstanceAssociationsStatus
     DescribeInstanceAssociationsStatus
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceAssociationsStatus' {Text
instanceId :: Text
$sel:instanceId:DescribeInstanceAssociationsStatus' :: DescribeInstanceAssociationsStatus -> Text
instanceId} -> Text
instanceId) (\s :: DescribeInstanceAssociationsStatus
s@DescribeInstanceAssociationsStatus' {} Text
a -> DescribeInstanceAssociationsStatus
s {$sel:instanceId:DescribeInstanceAssociationsStatus' :: Text
instanceId = Text
a} :: DescribeInstanceAssociationsStatus)

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

instance
  Prelude.NFData
    DescribeInstanceAssociationsStatus

instance
  Core.ToHeaders
    DescribeInstanceAssociationsStatus
  where
  toHeaders :: DescribeInstanceAssociationsStatus -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeInstanceAssociationsStatus -> 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.DescribeInstanceAssociationsStatus" ::
                          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
    DescribeInstanceAssociationsStatus
  where
  toJSON :: DescribeInstanceAssociationsStatus -> Value
toJSON DescribeInstanceAssociationsStatus' {Maybe Natural
Maybe Text
Text
instanceId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:instanceId:DescribeInstanceAssociationsStatus' :: DescribeInstanceAssociationsStatus -> Text
$sel:maxResults:DescribeInstanceAssociationsStatus' :: DescribeInstanceAssociationsStatus -> Maybe Natural
$sel:nextToken:DescribeInstanceAssociationsStatus' :: DescribeInstanceAssociationsStatus -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId)
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeInstanceAssociationsStatusResponse' 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:
--
-- 'instanceAssociationStatusInfos', 'describeInstanceAssociationsStatusResponse_instanceAssociationStatusInfos' - Status information about the association.
--
-- 'nextToken', 'describeInstanceAssociationsStatusResponse_nextToken' - The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
--
-- 'httpStatus', 'describeInstanceAssociationsStatusResponse_httpStatus' - The response's http status code.
newDescribeInstanceAssociationsStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeInstanceAssociationsStatusResponse
newDescribeInstanceAssociationsStatusResponse :: Int -> DescribeInstanceAssociationsStatusResponse
newDescribeInstanceAssociationsStatusResponse
  Int
pHttpStatus_ =
    DescribeInstanceAssociationsStatusResponse' :: Maybe [InstanceAssociationStatusInfo]
-> Maybe Text -> Int -> DescribeInstanceAssociationsStatusResponse
DescribeInstanceAssociationsStatusResponse'
      { $sel:instanceAssociationStatusInfos:DescribeInstanceAssociationsStatusResponse' :: Maybe [InstanceAssociationStatusInfo]
instanceAssociationStatusInfos =
          Maybe [InstanceAssociationStatusInfo]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeInstanceAssociationsStatusResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeInstanceAssociationsStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Status information about the association.
describeInstanceAssociationsStatusResponse_instanceAssociationStatusInfos :: Lens.Lens' DescribeInstanceAssociationsStatusResponse (Prelude.Maybe [InstanceAssociationStatusInfo])
describeInstanceAssociationsStatusResponse_instanceAssociationStatusInfos :: (Maybe [InstanceAssociationStatusInfo]
 -> f (Maybe [InstanceAssociationStatusInfo]))
-> DescribeInstanceAssociationsStatusResponse
-> f DescribeInstanceAssociationsStatusResponse
describeInstanceAssociationsStatusResponse_instanceAssociationStatusInfos = (DescribeInstanceAssociationsStatusResponse
 -> Maybe [InstanceAssociationStatusInfo])
-> (DescribeInstanceAssociationsStatusResponse
    -> Maybe [InstanceAssociationStatusInfo]
    -> DescribeInstanceAssociationsStatusResponse)
-> Lens'
     DescribeInstanceAssociationsStatusResponse
     (Maybe [InstanceAssociationStatusInfo])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceAssociationsStatusResponse' {Maybe [InstanceAssociationStatusInfo]
instanceAssociationStatusInfos :: Maybe [InstanceAssociationStatusInfo]
$sel:instanceAssociationStatusInfos:DescribeInstanceAssociationsStatusResponse' :: DescribeInstanceAssociationsStatusResponse
-> Maybe [InstanceAssociationStatusInfo]
instanceAssociationStatusInfos} -> Maybe [InstanceAssociationStatusInfo]
instanceAssociationStatusInfos) (\s :: DescribeInstanceAssociationsStatusResponse
s@DescribeInstanceAssociationsStatusResponse' {} Maybe [InstanceAssociationStatusInfo]
a -> DescribeInstanceAssociationsStatusResponse
s {$sel:instanceAssociationStatusInfos:DescribeInstanceAssociationsStatusResponse' :: Maybe [InstanceAssociationStatusInfo]
instanceAssociationStatusInfos = Maybe [InstanceAssociationStatusInfo]
a} :: DescribeInstanceAssociationsStatusResponse) ((Maybe [InstanceAssociationStatusInfo]
  -> f (Maybe [InstanceAssociationStatusInfo]))
 -> DescribeInstanceAssociationsStatusResponse
 -> f DescribeInstanceAssociationsStatusResponse)
-> ((Maybe [InstanceAssociationStatusInfo]
     -> f (Maybe [InstanceAssociationStatusInfo]))
    -> Maybe [InstanceAssociationStatusInfo]
    -> f (Maybe [InstanceAssociationStatusInfo]))
-> (Maybe [InstanceAssociationStatusInfo]
    -> f (Maybe [InstanceAssociationStatusInfo]))
-> DescribeInstanceAssociationsStatusResponse
-> f DescribeInstanceAssociationsStatusResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InstanceAssociationStatusInfo]
  [InstanceAssociationStatusInfo]
  [InstanceAssociationStatusInfo]
  [InstanceAssociationStatusInfo]
-> Iso
     (Maybe [InstanceAssociationStatusInfo])
     (Maybe [InstanceAssociationStatusInfo])
     (Maybe [InstanceAssociationStatusInfo])
     (Maybe [InstanceAssociationStatusInfo])
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
  [InstanceAssociationStatusInfo]
  [InstanceAssociationStatusInfo]
  [InstanceAssociationStatusInfo]
  [InstanceAssociationStatusInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Prelude.NFData
    DescribeInstanceAssociationsStatusResponse