{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.EC2.Types.DescribeFleetsInstances
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EC2.Types.DescribeFleetsInstances where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.InstanceLifecycle
import Amazonka.EC2.Types.InstanceType
import Amazonka.EC2.Types.LaunchTemplateAndOverridesResponse
import Amazonka.EC2.Types.PlatformValues
import qualified Amazonka.Prelude as Prelude

-- | Describes the instances that were launched by the fleet.
--
-- /See:/ 'newDescribeFleetsInstances' smart constructor.
data DescribeFleetsInstances = DescribeFleetsInstances'
  { -- | The IDs of the instances.
    DescribeFleetsInstances -> Maybe [Text]
instanceIds :: Prelude.Maybe [Prelude.Text],
    -- | The instance type.
    DescribeFleetsInstances -> Maybe InstanceType
instanceType :: Prelude.Maybe InstanceType,
    -- | The launch templates and overrides that were used for launching the
    -- instances. The values that you specify in the Overrides replace the
    -- values in the launch template.
    DescribeFleetsInstances -> Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides :: Prelude.Maybe LaunchTemplateAndOverridesResponse,
    -- | Indicates if the instance that was launched is a Spot Instance or
    -- On-Demand Instance.
    DescribeFleetsInstances -> Maybe InstanceLifecycle
lifecycle :: Prelude.Maybe InstanceLifecycle,
    -- | The value is @Windows@ for Windows instances. Otherwise, the value is
    -- blank.
    DescribeFleetsInstances -> Maybe PlatformValues
platform :: Prelude.Maybe PlatformValues
  }
  deriving (DescribeFleetsInstances -> DescribeFleetsInstances -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFleetsInstances -> DescribeFleetsInstances -> Bool
$c/= :: DescribeFleetsInstances -> DescribeFleetsInstances -> Bool
== :: DescribeFleetsInstances -> DescribeFleetsInstances -> Bool
$c== :: DescribeFleetsInstances -> DescribeFleetsInstances -> Bool
Prelude.Eq, ReadPrec [DescribeFleetsInstances]
ReadPrec DescribeFleetsInstances
Int -> ReadS DescribeFleetsInstances
ReadS [DescribeFleetsInstances]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFleetsInstances]
$creadListPrec :: ReadPrec [DescribeFleetsInstances]
readPrec :: ReadPrec DescribeFleetsInstances
$creadPrec :: ReadPrec DescribeFleetsInstances
readList :: ReadS [DescribeFleetsInstances]
$creadList :: ReadS [DescribeFleetsInstances]
readsPrec :: Int -> ReadS DescribeFleetsInstances
$creadsPrec :: Int -> ReadS DescribeFleetsInstances
Prelude.Read, Int -> DescribeFleetsInstances -> ShowS
[DescribeFleetsInstances] -> ShowS
DescribeFleetsInstances -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFleetsInstances] -> ShowS
$cshowList :: [DescribeFleetsInstances] -> ShowS
show :: DescribeFleetsInstances -> String
$cshow :: DescribeFleetsInstances -> String
showsPrec :: Int -> DescribeFleetsInstances -> ShowS
$cshowsPrec :: Int -> DescribeFleetsInstances -> ShowS
Prelude.Show, forall x. Rep DescribeFleetsInstances x -> DescribeFleetsInstances
forall x. DescribeFleetsInstances -> Rep DescribeFleetsInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFleetsInstances x -> DescribeFleetsInstances
$cfrom :: forall x. DescribeFleetsInstances -> Rep DescribeFleetsInstances x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFleetsInstances' 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:
--
-- 'instanceIds', 'describeFleetsInstances_instanceIds' - The IDs of the instances.
--
-- 'instanceType', 'describeFleetsInstances_instanceType' - The instance type.
--
-- 'launchTemplateAndOverrides', 'describeFleetsInstances_launchTemplateAndOverrides' - The launch templates and overrides that were used for launching the
-- instances. The values that you specify in the Overrides replace the
-- values in the launch template.
--
-- 'lifecycle', 'describeFleetsInstances_lifecycle' - Indicates if the instance that was launched is a Spot Instance or
-- On-Demand Instance.
--
-- 'platform', 'describeFleetsInstances_platform' - The value is @Windows@ for Windows instances. Otherwise, the value is
-- blank.
newDescribeFleetsInstances ::
  DescribeFleetsInstances
newDescribeFleetsInstances :: DescribeFleetsInstances
newDescribeFleetsInstances =
  DescribeFleetsInstances'
    { $sel:instanceIds:DescribeFleetsInstances' :: Maybe [Text]
instanceIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:DescribeFleetsInstances' :: Maybe InstanceType
instanceType = forall a. Maybe a
Prelude.Nothing,
      $sel:launchTemplateAndOverrides:DescribeFleetsInstances' :: Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides = forall a. Maybe a
Prelude.Nothing,
      $sel:lifecycle:DescribeFleetsInstances' :: Maybe InstanceLifecycle
lifecycle = forall a. Maybe a
Prelude.Nothing,
      $sel:platform:DescribeFleetsInstances' :: Maybe PlatformValues
platform = forall a. Maybe a
Prelude.Nothing
    }

-- | The IDs of the instances.
describeFleetsInstances_instanceIds :: Lens.Lens' DescribeFleetsInstances (Prelude.Maybe [Prelude.Text])
describeFleetsInstances_instanceIds :: Lens' DescribeFleetsInstances (Maybe [Text])
describeFleetsInstances_instanceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetsInstances' {Maybe [Text]
instanceIds :: Maybe [Text]
$sel:instanceIds:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe [Text]
instanceIds} -> Maybe [Text]
instanceIds) (\s :: DescribeFleetsInstances
s@DescribeFleetsInstances' {} Maybe [Text]
a -> DescribeFleetsInstances
s {$sel:instanceIds:DescribeFleetsInstances' :: Maybe [Text]
instanceIds = Maybe [Text]
a} :: DescribeFleetsInstances) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The instance type.
describeFleetsInstances_instanceType :: Lens.Lens' DescribeFleetsInstances (Prelude.Maybe InstanceType)
describeFleetsInstances_instanceType :: Lens' DescribeFleetsInstances (Maybe InstanceType)
describeFleetsInstances_instanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetsInstances' {Maybe InstanceType
instanceType :: Maybe InstanceType
$sel:instanceType:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe InstanceType
instanceType} -> Maybe InstanceType
instanceType) (\s :: DescribeFleetsInstances
s@DescribeFleetsInstances' {} Maybe InstanceType
a -> DescribeFleetsInstances
s {$sel:instanceType:DescribeFleetsInstances' :: Maybe InstanceType
instanceType = Maybe InstanceType
a} :: DescribeFleetsInstances)

-- | The launch templates and overrides that were used for launching the
-- instances. The values that you specify in the Overrides replace the
-- values in the launch template.
describeFleetsInstances_launchTemplateAndOverrides :: Lens.Lens' DescribeFleetsInstances (Prelude.Maybe LaunchTemplateAndOverridesResponse)
describeFleetsInstances_launchTemplateAndOverrides :: Lens'
  DescribeFleetsInstances (Maybe LaunchTemplateAndOverridesResponse)
describeFleetsInstances_launchTemplateAndOverrides = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetsInstances' {Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides :: Maybe LaunchTemplateAndOverridesResponse
$sel:launchTemplateAndOverrides:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides} -> Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides) (\s :: DescribeFleetsInstances
s@DescribeFleetsInstances' {} Maybe LaunchTemplateAndOverridesResponse
a -> DescribeFleetsInstances
s {$sel:launchTemplateAndOverrides:DescribeFleetsInstances' :: Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides = Maybe LaunchTemplateAndOverridesResponse
a} :: DescribeFleetsInstances)

-- | Indicates if the instance that was launched is a Spot Instance or
-- On-Demand Instance.
describeFleetsInstances_lifecycle :: Lens.Lens' DescribeFleetsInstances (Prelude.Maybe InstanceLifecycle)
describeFleetsInstances_lifecycle :: Lens' DescribeFleetsInstances (Maybe InstanceLifecycle)
describeFleetsInstances_lifecycle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetsInstances' {Maybe InstanceLifecycle
lifecycle :: Maybe InstanceLifecycle
$sel:lifecycle:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe InstanceLifecycle
lifecycle} -> Maybe InstanceLifecycle
lifecycle) (\s :: DescribeFleetsInstances
s@DescribeFleetsInstances' {} Maybe InstanceLifecycle
a -> DescribeFleetsInstances
s {$sel:lifecycle:DescribeFleetsInstances' :: Maybe InstanceLifecycle
lifecycle = Maybe InstanceLifecycle
a} :: DescribeFleetsInstances)

-- | The value is @Windows@ for Windows instances. Otherwise, the value is
-- blank.
describeFleetsInstances_platform :: Lens.Lens' DescribeFleetsInstances (Prelude.Maybe PlatformValues)
describeFleetsInstances_platform :: Lens' DescribeFleetsInstances (Maybe PlatformValues)
describeFleetsInstances_platform = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetsInstances' {Maybe PlatformValues
platform :: Maybe PlatformValues
$sel:platform:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe PlatformValues
platform} -> Maybe PlatformValues
platform) (\s :: DescribeFleetsInstances
s@DescribeFleetsInstances' {} Maybe PlatformValues
a -> DescribeFleetsInstances
s {$sel:platform:DescribeFleetsInstances' :: Maybe PlatformValues
platform = Maybe PlatformValues
a} :: DescribeFleetsInstances)

instance Data.FromXML DescribeFleetsInstances where
  parseXML :: [Node] -> Either String DescribeFleetsInstances
parseXML [Node]
x =
    Maybe [Text]
-> Maybe InstanceType
-> Maybe LaunchTemplateAndOverridesResponse
-> Maybe InstanceLifecycle
-> Maybe PlatformValues
-> DescribeFleetsInstances
DescribeFleetsInstances'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"instanceIds"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"instanceType")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"launchTemplateAndOverrides")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"lifecycle")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"platform")

instance Prelude.Hashable DescribeFleetsInstances where
  hashWithSalt :: Int -> DescribeFleetsInstances -> Int
hashWithSalt Int
_salt DescribeFleetsInstances' {Maybe [Text]
Maybe InstanceLifecycle
Maybe InstanceType
Maybe PlatformValues
Maybe LaunchTemplateAndOverridesResponse
platform :: Maybe PlatformValues
lifecycle :: Maybe InstanceLifecycle
launchTemplateAndOverrides :: Maybe LaunchTemplateAndOverridesResponse
instanceType :: Maybe InstanceType
instanceIds :: Maybe [Text]
$sel:platform:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe PlatformValues
$sel:lifecycle:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe InstanceLifecycle
$sel:launchTemplateAndOverrides:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe LaunchTemplateAndOverridesResponse
$sel:instanceType:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe InstanceType
$sel:instanceIds:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
instanceIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceType
instanceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceLifecycle
lifecycle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PlatformValues
platform

instance Prelude.NFData DescribeFleetsInstances where
  rnf :: DescribeFleetsInstances -> ()
rnf DescribeFleetsInstances' {Maybe [Text]
Maybe InstanceLifecycle
Maybe InstanceType
Maybe PlatformValues
Maybe LaunchTemplateAndOverridesResponse
platform :: Maybe PlatformValues
lifecycle :: Maybe InstanceLifecycle
launchTemplateAndOverrides :: Maybe LaunchTemplateAndOverridesResponse
instanceType :: Maybe InstanceType
instanceIds :: Maybe [Text]
$sel:platform:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe PlatformValues
$sel:lifecycle:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe InstanceLifecycle
$sel:launchTemplateAndOverrides:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe LaunchTemplateAndOverridesResponse
$sel:instanceType:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe InstanceType
$sel:instanceIds:DescribeFleetsInstances' :: DescribeFleetsInstances -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
instanceIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceType
instanceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceLifecycle
lifecycle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PlatformValues
platform