{-# 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.DescribeEffectiveInstanceAssociations
-- 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)
--
-- All associations for the instance(s).
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeEffectiveInstanceAssociations
  ( -- * Creating a Request
    DescribeEffectiveInstanceAssociations (..),
    newDescribeEffectiveInstanceAssociations,

    -- * Request Lenses
    describeEffectiveInstanceAssociations_nextToken,
    describeEffectiveInstanceAssociations_maxResults,
    describeEffectiveInstanceAssociations_instanceId,

    -- * Destructuring the Response
    DescribeEffectiveInstanceAssociationsResponse (..),
    newDescribeEffectiveInstanceAssociationsResponse,

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

-- |
-- Create a value of 'DescribeEffectiveInstanceAssociations' 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', 'describeEffectiveInstanceAssociations_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeEffectiveInstanceAssociations_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', 'describeEffectiveInstanceAssociations_instanceId' - The instance ID for which you want to view all associations.
newDescribeEffectiveInstanceAssociations ::
  -- | 'instanceId'
  Prelude.Text ->
  DescribeEffectiveInstanceAssociations
newDescribeEffectiveInstanceAssociations :: Text -> DescribeEffectiveInstanceAssociations
newDescribeEffectiveInstanceAssociations Text
pInstanceId_ =
  DescribeEffectiveInstanceAssociations' :: Maybe Text
-> Maybe Natural -> Text -> DescribeEffectiveInstanceAssociations
DescribeEffectiveInstanceAssociations'
    { $sel:nextToken:DescribeEffectiveInstanceAssociations' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeEffectiveInstanceAssociations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceId:DescribeEffectiveInstanceAssociations' :: Text
instanceId = Text
pInstanceId_
    }

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

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

-- | The instance ID for which you want to view all associations.
describeEffectiveInstanceAssociations_instanceId :: Lens.Lens' DescribeEffectiveInstanceAssociations Prelude.Text
describeEffectiveInstanceAssociations_instanceId :: (Text -> f Text)
-> DescribeEffectiveInstanceAssociations
-> f DescribeEffectiveInstanceAssociations
describeEffectiveInstanceAssociations_instanceId = (DescribeEffectiveInstanceAssociations -> Text)
-> (DescribeEffectiveInstanceAssociations
    -> Text -> DescribeEffectiveInstanceAssociations)
-> Lens
     DescribeEffectiveInstanceAssociations
     DescribeEffectiveInstanceAssociations
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEffectiveInstanceAssociations' {Text
instanceId :: Text
$sel:instanceId:DescribeEffectiveInstanceAssociations' :: DescribeEffectiveInstanceAssociations -> Text
instanceId} -> Text
instanceId) (\s :: DescribeEffectiveInstanceAssociations
s@DescribeEffectiveInstanceAssociations' {} Text
a -> DescribeEffectiveInstanceAssociations
s {$sel:instanceId:DescribeEffectiveInstanceAssociations' :: Text
instanceId = Text
a} :: DescribeEffectiveInstanceAssociations)

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

instance
  Prelude.NFData
    DescribeEffectiveInstanceAssociations

instance
  Core.ToHeaders
    DescribeEffectiveInstanceAssociations
  where
  toHeaders :: DescribeEffectiveInstanceAssociations -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeEffectiveInstanceAssociations -> 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.DescribeEffectiveInstanceAssociations" ::
                          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
    DescribeEffectiveInstanceAssociations
  where
  toJSON :: DescribeEffectiveInstanceAssociations -> Value
toJSON DescribeEffectiveInstanceAssociations' {Maybe Natural
Maybe Text
Text
instanceId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:instanceId:DescribeEffectiveInstanceAssociations' :: DescribeEffectiveInstanceAssociations -> Text
$sel:maxResults:DescribeEffectiveInstanceAssociations' :: DescribeEffectiveInstanceAssociations -> Maybe Natural
$sel:nextToken:DescribeEffectiveInstanceAssociations' :: DescribeEffectiveInstanceAssociations -> 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
    DescribeEffectiveInstanceAssociations
  where
  toPath :: DescribeEffectiveInstanceAssociations -> ByteString
toPath = ByteString -> DescribeEffectiveInstanceAssociations -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'DescribeEffectiveInstanceAssociationsResponse' 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', 'describeEffectiveInstanceAssociationsResponse_nextToken' - The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
--
-- 'associations', 'describeEffectiveInstanceAssociationsResponse_associations' - The associations for the requested instance.
--
-- 'httpStatus', 'describeEffectiveInstanceAssociationsResponse_httpStatus' - The response's http status code.
newDescribeEffectiveInstanceAssociationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEffectiveInstanceAssociationsResponse
newDescribeEffectiveInstanceAssociationsResponse :: Int -> DescribeEffectiveInstanceAssociationsResponse
newDescribeEffectiveInstanceAssociationsResponse
  Int
pHttpStatus_ =
    DescribeEffectiveInstanceAssociationsResponse' :: Maybe Text
-> Maybe [InstanceAssociation]
-> Int
-> DescribeEffectiveInstanceAssociationsResponse
DescribeEffectiveInstanceAssociationsResponse'
      { $sel:nextToken:DescribeEffectiveInstanceAssociationsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:associations:DescribeEffectiveInstanceAssociationsResponse' :: Maybe [InstanceAssociation]
associations =
          Maybe [InstanceAssociation]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeEffectiveInstanceAssociationsResponse' :: 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.
describeEffectiveInstanceAssociationsResponse_nextToken :: Lens.Lens' DescribeEffectiveInstanceAssociationsResponse (Prelude.Maybe Prelude.Text)
describeEffectiveInstanceAssociationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEffectiveInstanceAssociationsResponse
-> f DescribeEffectiveInstanceAssociationsResponse
describeEffectiveInstanceAssociationsResponse_nextToken = (DescribeEffectiveInstanceAssociationsResponse -> Maybe Text)
-> (DescribeEffectiveInstanceAssociationsResponse
    -> Maybe Text -> DescribeEffectiveInstanceAssociationsResponse)
-> Lens' DescribeEffectiveInstanceAssociationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEffectiveInstanceAssociationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEffectiveInstanceAssociationsResponse' :: DescribeEffectiveInstanceAssociationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEffectiveInstanceAssociationsResponse
s@DescribeEffectiveInstanceAssociationsResponse' {} Maybe Text
a -> DescribeEffectiveInstanceAssociationsResponse
s {$sel:nextToken:DescribeEffectiveInstanceAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEffectiveInstanceAssociationsResponse)

-- | The associations for the requested instance.
describeEffectiveInstanceAssociationsResponse_associations :: Lens.Lens' DescribeEffectiveInstanceAssociationsResponse (Prelude.Maybe [InstanceAssociation])
describeEffectiveInstanceAssociationsResponse_associations :: (Maybe [InstanceAssociation] -> f (Maybe [InstanceAssociation]))
-> DescribeEffectiveInstanceAssociationsResponse
-> f DescribeEffectiveInstanceAssociationsResponse
describeEffectiveInstanceAssociationsResponse_associations = (DescribeEffectiveInstanceAssociationsResponse
 -> Maybe [InstanceAssociation])
-> (DescribeEffectiveInstanceAssociationsResponse
    -> Maybe [InstanceAssociation]
    -> DescribeEffectiveInstanceAssociationsResponse)
-> Lens'
     DescribeEffectiveInstanceAssociationsResponse
     (Maybe [InstanceAssociation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEffectiveInstanceAssociationsResponse' {Maybe [InstanceAssociation]
associations :: Maybe [InstanceAssociation]
$sel:associations:DescribeEffectiveInstanceAssociationsResponse' :: DescribeEffectiveInstanceAssociationsResponse
-> Maybe [InstanceAssociation]
associations} -> Maybe [InstanceAssociation]
associations) (\s :: DescribeEffectiveInstanceAssociationsResponse
s@DescribeEffectiveInstanceAssociationsResponse' {} Maybe [InstanceAssociation]
a -> DescribeEffectiveInstanceAssociationsResponse
s {$sel:associations:DescribeEffectiveInstanceAssociationsResponse' :: Maybe [InstanceAssociation]
associations = Maybe [InstanceAssociation]
a} :: DescribeEffectiveInstanceAssociationsResponse) ((Maybe [InstanceAssociation] -> f (Maybe [InstanceAssociation]))
 -> DescribeEffectiveInstanceAssociationsResponse
 -> f DescribeEffectiveInstanceAssociationsResponse)
-> ((Maybe [InstanceAssociation]
     -> f (Maybe [InstanceAssociation]))
    -> Maybe [InstanceAssociation] -> f (Maybe [InstanceAssociation]))
-> (Maybe [InstanceAssociation] -> f (Maybe [InstanceAssociation]))
-> DescribeEffectiveInstanceAssociationsResponse
-> f DescribeEffectiveInstanceAssociationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InstanceAssociation]
  [InstanceAssociation]
  [InstanceAssociation]
  [InstanceAssociation]
-> Iso
     (Maybe [InstanceAssociation])
     (Maybe [InstanceAssociation])
     (Maybe [InstanceAssociation])
     (Maybe [InstanceAssociation])
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
  [InstanceAssociation]
  [InstanceAssociation]
  [InstanceAssociation]
  [InstanceAssociation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeEffectiveInstanceAssociationsResponse