{-# 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.DescribeInstanceInformation
-- 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)
--
-- Describes one or more of your instances, including information about the
-- operating system platform, the version of SSM Agent installed on the
-- instance, instance status, and so on.
--
-- If you specify one or more instance IDs, it returns information for
-- those instances. If you don\'t specify instance IDs, it returns
-- information for all your instances. If you specify an instance ID that
-- isn\'t valid or an instance that you don\'t own, you receive an error.
--
-- The @IamRole@ field for this API operation is the Identity and Access
-- Management (IAM) role assigned to on-premises instances. This call
-- doesn\'t return the IAM role for EC2 instances.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeInstanceInformation
  ( -- * Creating a Request
    DescribeInstanceInformation (..),
    newDescribeInstanceInformation,

    -- * Request Lenses
    describeInstanceInformation_instanceInformationFilterList,
    describeInstanceInformation_filters,
    describeInstanceInformation_nextToken,
    describeInstanceInformation_maxResults,

    -- * Destructuring the Response
    DescribeInstanceInformationResponse (..),
    newDescribeInstanceInformationResponse,

    -- * Response Lenses
    describeInstanceInformationResponse_nextToken,
    describeInstanceInformationResponse_instanceInformationList,
    describeInstanceInformationResponse_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:/ 'newDescribeInstanceInformation' smart constructor.
data DescribeInstanceInformation = DescribeInstanceInformation'
  { -- | This is a legacy method. We recommend that you don\'t use this method.
    -- Instead, use the @Filters@ data type. @Filters@ enables you to return
    -- instance information by filtering based on tags applied to managed
    -- instances.
    --
    -- Attempting to use @InstanceInformationFilterList@ and @Filters@ leads to
    -- an exception error.
    DescribeInstanceInformation -> Maybe [InstanceInformationFilter]
instanceInformationFilterList :: Prelude.Maybe [InstanceInformationFilter],
    -- | One or more filters. Use a filter to return a more specific list of
    -- instances. You can filter based on tags applied to EC2 instances. Use
    -- this @Filters@ data type instead of @InstanceInformationFilterList@,
    -- which is deprecated.
    DescribeInstanceInformation
-> Maybe [InstanceInformationStringFilter]
filters :: Prelude.Maybe [InstanceInformationStringFilter],
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeInstanceInformation -> 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.
    DescribeInstanceInformation -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeInstanceInformation -> DescribeInstanceInformation -> Bool
(DescribeInstanceInformation
 -> DescribeInstanceInformation -> Bool)
-> (DescribeInstanceInformation
    -> DescribeInstanceInformation -> Bool)
-> Eq DescribeInstanceInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInstanceInformation -> DescribeInstanceInformation -> Bool
$c/= :: DescribeInstanceInformation -> DescribeInstanceInformation -> Bool
== :: DescribeInstanceInformation -> DescribeInstanceInformation -> Bool
$c== :: DescribeInstanceInformation -> DescribeInstanceInformation -> Bool
Prelude.Eq, ReadPrec [DescribeInstanceInformation]
ReadPrec DescribeInstanceInformation
Int -> ReadS DescribeInstanceInformation
ReadS [DescribeInstanceInformation]
(Int -> ReadS DescribeInstanceInformation)
-> ReadS [DescribeInstanceInformation]
-> ReadPrec DescribeInstanceInformation
-> ReadPrec [DescribeInstanceInformation]
-> Read DescribeInstanceInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInstanceInformation]
$creadListPrec :: ReadPrec [DescribeInstanceInformation]
readPrec :: ReadPrec DescribeInstanceInformation
$creadPrec :: ReadPrec DescribeInstanceInformation
readList :: ReadS [DescribeInstanceInformation]
$creadList :: ReadS [DescribeInstanceInformation]
readsPrec :: Int -> ReadS DescribeInstanceInformation
$creadsPrec :: Int -> ReadS DescribeInstanceInformation
Prelude.Read, Int -> DescribeInstanceInformation -> ShowS
[DescribeInstanceInformation] -> ShowS
DescribeInstanceInformation -> String
(Int -> DescribeInstanceInformation -> ShowS)
-> (DescribeInstanceInformation -> String)
-> ([DescribeInstanceInformation] -> ShowS)
-> Show DescribeInstanceInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInstanceInformation] -> ShowS
$cshowList :: [DescribeInstanceInformation] -> ShowS
show :: DescribeInstanceInformation -> String
$cshow :: DescribeInstanceInformation -> String
showsPrec :: Int -> DescribeInstanceInformation -> ShowS
$cshowsPrec :: Int -> DescribeInstanceInformation -> ShowS
Prelude.Show, (forall x.
 DescribeInstanceInformation -> Rep DescribeInstanceInformation x)
-> (forall x.
    Rep DescribeInstanceInformation x -> DescribeInstanceInformation)
-> Generic DescribeInstanceInformation
forall x.
Rep DescribeInstanceInformation x -> DescribeInstanceInformation
forall x.
DescribeInstanceInformation -> Rep DescribeInstanceInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeInstanceInformation x -> DescribeInstanceInformation
$cfrom :: forall x.
DescribeInstanceInformation -> Rep DescribeInstanceInformation x
Prelude.Generic)

-- |
-- Create a value of 'DescribeInstanceInformation' 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:
--
-- 'instanceInformationFilterList', 'describeInstanceInformation_instanceInformationFilterList' - This is a legacy method. We recommend that you don\'t use this method.
-- Instead, use the @Filters@ data type. @Filters@ enables you to return
-- instance information by filtering based on tags applied to managed
-- instances.
--
-- Attempting to use @InstanceInformationFilterList@ and @Filters@ leads to
-- an exception error.
--
-- 'filters', 'describeInstanceInformation_filters' - One or more filters. Use a filter to return a more specific list of
-- instances. You can filter based on tags applied to EC2 instances. Use
-- this @Filters@ data type instead of @InstanceInformationFilterList@,
-- which is deprecated.
--
-- 'nextToken', 'describeInstanceInformation_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeInstanceInformation_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.
newDescribeInstanceInformation ::
  DescribeInstanceInformation
newDescribeInstanceInformation :: DescribeInstanceInformation
newDescribeInstanceInformation =
  DescribeInstanceInformation' :: Maybe [InstanceInformationFilter]
-> Maybe [InstanceInformationStringFilter]
-> Maybe Text
-> Maybe Natural
-> DescribeInstanceInformation
DescribeInstanceInformation'
    { $sel:instanceInformationFilterList:DescribeInstanceInformation' :: Maybe [InstanceInformationFilter]
instanceInformationFilterList =
        Maybe [InstanceInformationFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeInstanceInformation' :: Maybe [InstanceInformationStringFilter]
filters = Maybe [InstanceInformationStringFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeInstanceInformation' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeInstanceInformation' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | This is a legacy method. We recommend that you don\'t use this method.
-- Instead, use the @Filters@ data type. @Filters@ enables you to return
-- instance information by filtering based on tags applied to managed
-- instances.
--
-- Attempting to use @InstanceInformationFilterList@ and @Filters@ leads to
-- an exception error.
describeInstanceInformation_instanceInformationFilterList :: Lens.Lens' DescribeInstanceInformation (Prelude.Maybe [InstanceInformationFilter])
describeInstanceInformation_instanceInformationFilterList :: (Maybe [InstanceInformationFilter]
 -> f (Maybe [InstanceInformationFilter]))
-> DescribeInstanceInformation -> f DescribeInstanceInformation
describeInstanceInformation_instanceInformationFilterList = (DescribeInstanceInformation -> Maybe [InstanceInformationFilter])
-> (DescribeInstanceInformation
    -> Maybe [InstanceInformationFilter]
    -> DescribeInstanceInformation)
-> Lens
     DescribeInstanceInformation
     DescribeInstanceInformation
     (Maybe [InstanceInformationFilter])
     (Maybe [InstanceInformationFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceInformation' {Maybe [InstanceInformationFilter]
instanceInformationFilterList :: Maybe [InstanceInformationFilter]
$sel:instanceInformationFilterList:DescribeInstanceInformation' :: DescribeInstanceInformation -> Maybe [InstanceInformationFilter]
instanceInformationFilterList} -> Maybe [InstanceInformationFilter]
instanceInformationFilterList) (\s :: DescribeInstanceInformation
s@DescribeInstanceInformation' {} Maybe [InstanceInformationFilter]
a -> DescribeInstanceInformation
s {$sel:instanceInformationFilterList:DescribeInstanceInformation' :: Maybe [InstanceInformationFilter]
instanceInformationFilterList = Maybe [InstanceInformationFilter]
a} :: DescribeInstanceInformation) ((Maybe [InstanceInformationFilter]
  -> f (Maybe [InstanceInformationFilter]))
 -> DescribeInstanceInformation -> f DescribeInstanceInformation)
-> ((Maybe [InstanceInformationFilter]
     -> f (Maybe [InstanceInformationFilter]))
    -> Maybe [InstanceInformationFilter]
    -> f (Maybe [InstanceInformationFilter]))
-> (Maybe [InstanceInformationFilter]
    -> f (Maybe [InstanceInformationFilter]))
-> DescribeInstanceInformation
-> f DescribeInstanceInformation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InstanceInformationFilter]
  [InstanceInformationFilter]
  [InstanceInformationFilter]
  [InstanceInformationFilter]
-> Iso
     (Maybe [InstanceInformationFilter])
     (Maybe [InstanceInformationFilter])
     (Maybe [InstanceInformationFilter])
     (Maybe [InstanceInformationFilter])
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
  [InstanceInformationFilter]
  [InstanceInformationFilter]
  [InstanceInformationFilter]
  [InstanceInformationFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | One or more filters. Use a filter to return a more specific list of
-- instances. You can filter based on tags applied to EC2 instances. Use
-- this @Filters@ data type instead of @InstanceInformationFilterList@,
-- which is deprecated.
describeInstanceInformation_filters :: Lens.Lens' DescribeInstanceInformation (Prelude.Maybe [InstanceInformationStringFilter])
describeInstanceInformation_filters :: (Maybe [InstanceInformationStringFilter]
 -> f (Maybe [InstanceInformationStringFilter]))
-> DescribeInstanceInformation -> f DescribeInstanceInformation
describeInstanceInformation_filters = (DescribeInstanceInformation
 -> Maybe [InstanceInformationStringFilter])
-> (DescribeInstanceInformation
    -> Maybe [InstanceInformationStringFilter]
    -> DescribeInstanceInformation)
-> Lens
     DescribeInstanceInformation
     DescribeInstanceInformation
     (Maybe [InstanceInformationStringFilter])
     (Maybe [InstanceInformationStringFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceInformation' {Maybe [InstanceInformationStringFilter]
filters :: Maybe [InstanceInformationStringFilter]
$sel:filters:DescribeInstanceInformation' :: DescribeInstanceInformation
-> Maybe [InstanceInformationStringFilter]
filters} -> Maybe [InstanceInformationStringFilter]
filters) (\s :: DescribeInstanceInformation
s@DescribeInstanceInformation' {} Maybe [InstanceInformationStringFilter]
a -> DescribeInstanceInformation
s {$sel:filters:DescribeInstanceInformation' :: Maybe [InstanceInformationStringFilter]
filters = Maybe [InstanceInformationStringFilter]
a} :: DescribeInstanceInformation) ((Maybe [InstanceInformationStringFilter]
  -> f (Maybe [InstanceInformationStringFilter]))
 -> DescribeInstanceInformation -> f DescribeInstanceInformation)
-> ((Maybe [InstanceInformationStringFilter]
     -> f (Maybe [InstanceInformationStringFilter]))
    -> Maybe [InstanceInformationStringFilter]
    -> f (Maybe [InstanceInformationStringFilter]))
-> (Maybe [InstanceInformationStringFilter]
    -> f (Maybe [InstanceInformationStringFilter]))
-> DescribeInstanceInformation
-> f DescribeInstanceInformation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InstanceInformationStringFilter]
  [InstanceInformationStringFilter]
  [InstanceInformationStringFilter]
  [InstanceInformationStringFilter]
-> Iso
     (Maybe [InstanceInformationStringFilter])
     (Maybe [InstanceInformationStringFilter])
     (Maybe [InstanceInformationStringFilter])
     (Maybe [InstanceInformationStringFilter])
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
  [InstanceInformationStringFilter]
  [InstanceInformationStringFilter]
  [InstanceInformationStringFilter]
  [InstanceInformationStringFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

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

instance Prelude.NFData DescribeInstanceInformation

instance Core.ToHeaders DescribeInstanceInformation where
  toHeaders :: DescribeInstanceInformation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeInstanceInformation -> 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.DescribeInstanceInformation" ::
                          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 DescribeInstanceInformation where
  toJSON :: DescribeInstanceInformation -> Value
toJSON DescribeInstanceInformation' {Maybe Natural
Maybe [InstanceInformationFilter]
Maybe [InstanceInformationStringFilter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [InstanceInformationStringFilter]
instanceInformationFilterList :: Maybe [InstanceInformationFilter]
$sel:maxResults:DescribeInstanceInformation' :: DescribeInstanceInformation -> Maybe Natural
$sel:nextToken:DescribeInstanceInformation' :: DescribeInstanceInformation -> Maybe Text
$sel:filters:DescribeInstanceInformation' :: DescribeInstanceInformation
-> Maybe [InstanceInformationStringFilter]
$sel:instanceInformationFilterList:DescribeInstanceInformation' :: DescribeInstanceInformation -> Maybe [InstanceInformationFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InstanceInformationFilterList" Text -> [InstanceInformationFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([InstanceInformationFilter] -> Pair)
-> Maybe [InstanceInformationFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InstanceInformationFilter]
instanceInformationFilterList,
            (Text
"Filters" Text -> [InstanceInformationStringFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([InstanceInformationStringFilter] -> Pair)
-> Maybe [InstanceInformationStringFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InstanceInformationStringFilter]
filters,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeInstanceInformationResponse' 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', 'describeInstanceInformationResponse_nextToken' - The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
--
-- 'instanceInformationList', 'describeInstanceInformationResponse_instanceInformationList' - The instance information list.
--
-- 'httpStatus', 'describeInstanceInformationResponse_httpStatus' - The response's http status code.
newDescribeInstanceInformationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeInstanceInformationResponse
newDescribeInstanceInformationResponse :: Int -> DescribeInstanceInformationResponse
newDescribeInstanceInformationResponse Int
pHttpStatus_ =
  DescribeInstanceInformationResponse' :: Maybe Text
-> Maybe [InstanceInformation]
-> Int
-> DescribeInstanceInformationResponse
DescribeInstanceInformationResponse'
    { $sel:nextToken:DescribeInstanceInformationResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceInformationList:DescribeInstanceInformationResponse' :: Maybe [InstanceInformation]
instanceInformationList =
        Maybe [InstanceInformation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeInstanceInformationResponse' :: 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.
describeInstanceInformationResponse_nextToken :: Lens.Lens' DescribeInstanceInformationResponse (Prelude.Maybe Prelude.Text)
describeInstanceInformationResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeInstanceInformationResponse
-> f DescribeInstanceInformationResponse
describeInstanceInformationResponse_nextToken = (DescribeInstanceInformationResponse -> Maybe Text)
-> (DescribeInstanceInformationResponse
    -> Maybe Text -> DescribeInstanceInformationResponse)
-> Lens' DescribeInstanceInformationResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceInformationResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeInstanceInformationResponse' :: DescribeInstanceInformationResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeInstanceInformationResponse
s@DescribeInstanceInformationResponse' {} Maybe Text
a -> DescribeInstanceInformationResponse
s {$sel:nextToken:DescribeInstanceInformationResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeInstanceInformationResponse)

-- | The instance information list.
describeInstanceInformationResponse_instanceInformationList :: Lens.Lens' DescribeInstanceInformationResponse (Prelude.Maybe [InstanceInformation])
describeInstanceInformationResponse_instanceInformationList :: (Maybe [InstanceInformation] -> f (Maybe [InstanceInformation]))
-> DescribeInstanceInformationResponse
-> f DescribeInstanceInformationResponse
describeInstanceInformationResponse_instanceInformationList = (DescribeInstanceInformationResponse
 -> Maybe [InstanceInformation])
-> (DescribeInstanceInformationResponse
    -> Maybe [InstanceInformation]
    -> DescribeInstanceInformationResponse)
-> Lens'
     DescribeInstanceInformationResponse (Maybe [InstanceInformation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceInformationResponse' {Maybe [InstanceInformation]
instanceInformationList :: Maybe [InstanceInformation]
$sel:instanceInformationList:DescribeInstanceInformationResponse' :: DescribeInstanceInformationResponse -> Maybe [InstanceInformation]
instanceInformationList} -> Maybe [InstanceInformation]
instanceInformationList) (\s :: DescribeInstanceInformationResponse
s@DescribeInstanceInformationResponse' {} Maybe [InstanceInformation]
a -> DescribeInstanceInformationResponse
s {$sel:instanceInformationList:DescribeInstanceInformationResponse' :: Maybe [InstanceInformation]
instanceInformationList = Maybe [InstanceInformation]
a} :: DescribeInstanceInformationResponse) ((Maybe [InstanceInformation] -> f (Maybe [InstanceInformation]))
 -> DescribeInstanceInformationResponse
 -> f DescribeInstanceInformationResponse)
-> ((Maybe [InstanceInformation]
     -> f (Maybe [InstanceInformation]))
    -> Maybe [InstanceInformation] -> f (Maybe [InstanceInformation]))
-> (Maybe [InstanceInformation] -> f (Maybe [InstanceInformation]))
-> DescribeInstanceInformationResponse
-> f DescribeInstanceInformationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InstanceInformation]
  [InstanceInformation]
  [InstanceInformation]
  [InstanceInformation]
-> Iso
     (Maybe [InstanceInformation])
     (Maybe [InstanceInformation])
     (Maybe [InstanceInformation])
     (Maybe [InstanceInformation])
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
  [InstanceInformation]
  [InstanceInformation]
  [InstanceInformation]
  [InstanceInformation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeInstanceInformationResponse