{-# 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.SnowDeviceManagement.Types.Instance
-- 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)
module Amazonka.SnowDeviceManagement.Types.Instance where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SnowDeviceManagement.Types.CpuOptions
import Amazonka.SnowDeviceManagement.Types.InstanceBlockDeviceMapping
import Amazonka.SnowDeviceManagement.Types.InstanceState
import Amazonka.SnowDeviceManagement.Types.SecurityGroupIdentifier

-- | The description of an instance. Currently, Amazon EC2 instances are the
-- only supported instance type.
--
-- /See:/ 'newInstance' smart constructor.
data Instance = Instance'
  { -- | The ID of the instance.
    Instance -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
    Instance -> Maybe InstanceState
state :: Prelude.Maybe InstanceState,
    -- | The security groups for the instance.
    Instance -> Maybe [SecurityGroupIdentifier]
securityGroups :: Prelude.Maybe [SecurityGroupIdentifier],
    -- | When the instance was created.
    Instance -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The CPU options for the instance.
    Instance -> Maybe CpuOptions
cpuOptions :: Prelude.Maybe CpuOptions,
    -- | The device name of the root device volume (for example, @\/dev\/sda1@).
    Instance -> Maybe Text
rootDeviceName :: Prelude.Maybe Prelude.Text,
    -- | The instance type.
    Instance -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
    -- | The ID of the AMI used to launch the instance.
    Instance -> Maybe Text
imageId :: Prelude.Maybe Prelude.Text,
    -- | The private IPv4 address assigned to the instance.
    Instance -> Maybe Text
privateIpAddress :: Prelude.Maybe Prelude.Text,
    -- | When the instance was last updated.
    Instance -> Maybe POSIX
updatedAt :: Prelude.Maybe Core.POSIX,
    -- | Any block device mapping entries for the instance.
    Instance -> Maybe [InstanceBlockDeviceMapping]
blockDeviceMappings :: Prelude.Maybe [InstanceBlockDeviceMapping],
    -- | The public IPv4 address assigned to the instance.
    Instance -> Maybe Text
publicIpAddress :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Machine Image (AMI) launch index, which you can use to find
    -- this instance in the launch group.
    Instance -> Maybe Int
amiLaunchIndex :: Prelude.Maybe Prelude.Int
  }
  deriving (Instance -> Instance -> Bool
(Instance -> Instance -> Bool)
-> (Instance -> Instance -> Bool) -> Eq Instance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Instance -> Instance -> Bool
$c/= :: Instance -> Instance -> Bool
== :: Instance -> Instance -> Bool
$c== :: Instance -> Instance -> Bool
Prelude.Eq, ReadPrec [Instance]
ReadPrec Instance
Int -> ReadS Instance
ReadS [Instance]
(Int -> ReadS Instance)
-> ReadS [Instance]
-> ReadPrec Instance
-> ReadPrec [Instance]
-> Read Instance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Instance]
$creadListPrec :: ReadPrec [Instance]
readPrec :: ReadPrec Instance
$creadPrec :: ReadPrec Instance
readList :: ReadS [Instance]
$creadList :: ReadS [Instance]
readsPrec :: Int -> ReadS Instance
$creadsPrec :: Int -> ReadS Instance
Prelude.Read, Int -> Instance -> ShowS
[Instance] -> ShowS
Instance -> String
(Int -> Instance -> ShowS)
-> (Instance -> String) -> ([Instance] -> ShowS) -> Show Instance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Instance] -> ShowS
$cshowList :: [Instance] -> ShowS
show :: Instance -> String
$cshow :: Instance -> String
showsPrec :: Int -> Instance -> ShowS
$cshowsPrec :: Int -> Instance -> ShowS
Prelude.Show, (forall x. Instance -> Rep Instance x)
-> (forall x. Rep Instance x -> Instance) -> Generic Instance
forall x. Rep Instance x -> Instance
forall x. Instance -> Rep Instance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Instance x -> Instance
$cfrom :: forall x. Instance -> Rep Instance x
Prelude.Generic)

-- |
-- Create a value of 'Instance' 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:
--
-- 'instanceId', 'instance_instanceId' - The ID of the instance.
--
-- 'state', 'instance_state' - Undocumented member.
--
-- 'securityGroups', 'instance_securityGroups' - The security groups for the instance.
--
-- 'createdAt', 'instance_createdAt' - When the instance was created.
--
-- 'cpuOptions', 'instance_cpuOptions' - The CPU options for the instance.
--
-- 'rootDeviceName', 'instance_rootDeviceName' - The device name of the root device volume (for example, @\/dev\/sda1@).
--
-- 'instanceType', 'instance_instanceType' - The instance type.
--
-- 'imageId', 'instance_imageId' - The ID of the AMI used to launch the instance.
--
-- 'privateIpAddress', 'instance_privateIpAddress' - The private IPv4 address assigned to the instance.
--
-- 'updatedAt', 'instance_updatedAt' - When the instance was last updated.
--
-- 'blockDeviceMappings', 'instance_blockDeviceMappings' - Any block device mapping entries for the instance.
--
-- 'publicIpAddress', 'instance_publicIpAddress' - The public IPv4 address assigned to the instance.
--
-- 'amiLaunchIndex', 'instance_amiLaunchIndex' - The Amazon Machine Image (AMI) launch index, which you can use to find
-- this instance in the launch group.
newInstance ::
  Instance
newInstance :: Instance
newInstance =
  Instance' :: Maybe Text
-> Maybe InstanceState
-> Maybe [SecurityGroupIdentifier]
-> Maybe POSIX
-> Maybe CpuOptions
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe [InstanceBlockDeviceMapping]
-> Maybe Text
-> Maybe Int
-> Instance
Instance'
    { $sel:instanceId:Instance' :: Maybe Text
instanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:state:Instance' :: Maybe InstanceState
state = Maybe InstanceState
forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroups:Instance' :: Maybe [SecurityGroupIdentifier]
securityGroups = Maybe [SecurityGroupIdentifier]
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Instance' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:cpuOptions:Instance' :: Maybe CpuOptions
cpuOptions = Maybe CpuOptions
forall a. Maybe a
Prelude.Nothing,
      $sel:rootDeviceName:Instance' :: Maybe Text
rootDeviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:Instance' :: Maybe Text
instanceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageId:Instance' :: Maybe Text
imageId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:privateIpAddress:Instance' :: Maybe Text
privateIpAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:Instance' :: Maybe POSIX
updatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:blockDeviceMappings:Instance' :: Maybe [InstanceBlockDeviceMapping]
blockDeviceMappings = Maybe [InstanceBlockDeviceMapping]
forall a. Maybe a
Prelude.Nothing,
      $sel:publicIpAddress:Instance' :: Maybe Text
publicIpAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:amiLaunchIndex:Instance' :: Maybe Int
amiLaunchIndex = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the instance.
instance_instanceId :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_instanceId :: (Maybe Text -> f (Maybe Text)) -> Instance -> f Instance
instance_instanceId = (Instance -> Maybe Text)
-> (Instance -> Maybe Text -> Instance)
-> Lens Instance Instance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:Instance' :: Instance -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:instanceId:Instance' :: Maybe Text
instanceId = Maybe Text
a} :: Instance)

-- | Undocumented member.
instance_state :: Lens.Lens' Instance (Prelude.Maybe InstanceState)
instance_state :: (Maybe InstanceState -> f (Maybe InstanceState))
-> Instance -> f Instance
instance_state = (Instance -> Maybe InstanceState)
-> (Instance -> Maybe InstanceState -> Instance)
-> Lens
     Instance Instance (Maybe InstanceState) (Maybe InstanceState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe InstanceState
state :: Maybe InstanceState
$sel:state:Instance' :: Instance -> Maybe InstanceState
state} -> Maybe InstanceState
state) (\s :: Instance
s@Instance' {} Maybe InstanceState
a -> Instance
s {$sel:state:Instance' :: Maybe InstanceState
state = Maybe InstanceState
a} :: Instance)

-- | The security groups for the instance.
instance_securityGroups :: Lens.Lens' Instance (Prelude.Maybe [SecurityGroupIdentifier])
instance_securityGroups :: (Maybe [SecurityGroupIdentifier]
 -> f (Maybe [SecurityGroupIdentifier]))
-> Instance -> f Instance
instance_securityGroups = (Instance -> Maybe [SecurityGroupIdentifier])
-> (Instance -> Maybe [SecurityGroupIdentifier] -> Instance)
-> Lens
     Instance
     Instance
     (Maybe [SecurityGroupIdentifier])
     (Maybe [SecurityGroupIdentifier])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe [SecurityGroupIdentifier]
securityGroups :: Maybe [SecurityGroupIdentifier]
$sel:securityGroups:Instance' :: Instance -> Maybe [SecurityGroupIdentifier]
securityGroups} -> Maybe [SecurityGroupIdentifier]
securityGroups) (\s :: Instance
s@Instance' {} Maybe [SecurityGroupIdentifier]
a -> Instance
s {$sel:securityGroups:Instance' :: Maybe [SecurityGroupIdentifier]
securityGroups = Maybe [SecurityGroupIdentifier]
a} :: Instance) ((Maybe [SecurityGroupIdentifier]
  -> f (Maybe [SecurityGroupIdentifier]))
 -> Instance -> f Instance)
-> ((Maybe [SecurityGroupIdentifier]
     -> f (Maybe [SecurityGroupIdentifier]))
    -> Maybe [SecurityGroupIdentifier]
    -> f (Maybe [SecurityGroupIdentifier]))
-> (Maybe [SecurityGroupIdentifier]
    -> f (Maybe [SecurityGroupIdentifier]))
-> Instance
-> f Instance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SecurityGroupIdentifier]
  [SecurityGroupIdentifier]
  [SecurityGroupIdentifier]
  [SecurityGroupIdentifier]
-> Iso
     (Maybe [SecurityGroupIdentifier])
     (Maybe [SecurityGroupIdentifier])
     (Maybe [SecurityGroupIdentifier])
     (Maybe [SecurityGroupIdentifier])
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
  [SecurityGroupIdentifier]
  [SecurityGroupIdentifier]
  [SecurityGroupIdentifier]
  [SecurityGroupIdentifier]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | When the instance was created.
instance_createdAt :: Lens.Lens' Instance (Prelude.Maybe Prelude.UTCTime)
instance_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Instance -> f Instance
instance_createdAt = (Instance -> Maybe POSIX)
-> (Instance -> Maybe POSIX -> Instance)
-> Lens Instance Instance (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Instance' :: Instance -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Instance
s@Instance' {} Maybe POSIX
a -> Instance
s {$sel:createdAt:Instance' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Instance) ((Maybe POSIX -> f (Maybe POSIX)) -> Instance -> f Instance)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Instance
-> f Instance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The CPU options for the instance.
instance_cpuOptions :: Lens.Lens' Instance (Prelude.Maybe CpuOptions)
instance_cpuOptions :: (Maybe CpuOptions -> f (Maybe CpuOptions))
-> Instance -> f Instance
instance_cpuOptions = (Instance -> Maybe CpuOptions)
-> (Instance -> Maybe CpuOptions -> Instance)
-> Lens Instance Instance (Maybe CpuOptions) (Maybe CpuOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe CpuOptions
cpuOptions :: Maybe CpuOptions
$sel:cpuOptions:Instance' :: Instance -> Maybe CpuOptions
cpuOptions} -> Maybe CpuOptions
cpuOptions) (\s :: Instance
s@Instance' {} Maybe CpuOptions
a -> Instance
s {$sel:cpuOptions:Instance' :: Maybe CpuOptions
cpuOptions = Maybe CpuOptions
a} :: Instance)

-- | The device name of the root device volume (for example, @\/dev\/sda1@).
instance_rootDeviceName :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_rootDeviceName :: (Maybe Text -> f (Maybe Text)) -> Instance -> f Instance
instance_rootDeviceName = (Instance -> Maybe Text)
-> (Instance -> Maybe Text -> Instance)
-> Lens Instance Instance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
rootDeviceName :: Maybe Text
$sel:rootDeviceName:Instance' :: Instance -> Maybe Text
rootDeviceName} -> Maybe Text
rootDeviceName) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:rootDeviceName:Instance' :: Maybe Text
rootDeviceName = Maybe Text
a} :: Instance)

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

-- | The ID of the AMI used to launch the instance.
instance_imageId :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_imageId :: (Maybe Text -> f (Maybe Text)) -> Instance -> f Instance
instance_imageId = (Instance -> Maybe Text)
-> (Instance -> Maybe Text -> Instance)
-> Lens Instance Instance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
imageId :: Maybe Text
$sel:imageId:Instance' :: Instance -> Maybe Text
imageId} -> Maybe Text
imageId) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:imageId:Instance' :: Maybe Text
imageId = Maybe Text
a} :: Instance)

-- | The private IPv4 address assigned to the instance.
instance_privateIpAddress :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_privateIpAddress :: (Maybe Text -> f (Maybe Text)) -> Instance -> f Instance
instance_privateIpAddress = (Instance -> Maybe Text)
-> (Instance -> Maybe Text -> Instance)
-> Lens Instance Instance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
privateIpAddress :: Maybe Text
$sel:privateIpAddress:Instance' :: Instance -> Maybe Text
privateIpAddress} -> Maybe Text
privateIpAddress) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:privateIpAddress:Instance' :: Maybe Text
privateIpAddress = Maybe Text
a} :: Instance)

-- | When the instance was last updated.
instance_updatedAt :: Lens.Lens' Instance (Prelude.Maybe Prelude.UTCTime)
instance_updatedAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Instance -> f Instance
instance_updatedAt = (Instance -> Maybe POSIX)
-> (Instance -> Maybe POSIX -> Instance)
-> Lens Instance Instance (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:Instance' :: Instance -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: Instance
s@Instance' {} Maybe POSIX
a -> Instance
s {$sel:updatedAt:Instance' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: Instance) ((Maybe POSIX -> f (Maybe POSIX)) -> Instance -> f Instance)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Instance
-> f Instance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Any block device mapping entries for the instance.
instance_blockDeviceMappings :: Lens.Lens' Instance (Prelude.Maybe [InstanceBlockDeviceMapping])
instance_blockDeviceMappings :: (Maybe [InstanceBlockDeviceMapping]
 -> f (Maybe [InstanceBlockDeviceMapping]))
-> Instance -> f Instance
instance_blockDeviceMappings = (Instance -> Maybe [InstanceBlockDeviceMapping])
-> (Instance -> Maybe [InstanceBlockDeviceMapping] -> Instance)
-> Lens
     Instance
     Instance
     (Maybe [InstanceBlockDeviceMapping])
     (Maybe [InstanceBlockDeviceMapping])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe [InstanceBlockDeviceMapping]
blockDeviceMappings :: Maybe [InstanceBlockDeviceMapping]
$sel:blockDeviceMappings:Instance' :: Instance -> Maybe [InstanceBlockDeviceMapping]
blockDeviceMappings} -> Maybe [InstanceBlockDeviceMapping]
blockDeviceMappings) (\s :: Instance
s@Instance' {} Maybe [InstanceBlockDeviceMapping]
a -> Instance
s {$sel:blockDeviceMappings:Instance' :: Maybe [InstanceBlockDeviceMapping]
blockDeviceMappings = Maybe [InstanceBlockDeviceMapping]
a} :: Instance) ((Maybe [InstanceBlockDeviceMapping]
  -> f (Maybe [InstanceBlockDeviceMapping]))
 -> Instance -> f Instance)
-> ((Maybe [InstanceBlockDeviceMapping]
     -> f (Maybe [InstanceBlockDeviceMapping]))
    -> Maybe [InstanceBlockDeviceMapping]
    -> f (Maybe [InstanceBlockDeviceMapping]))
-> (Maybe [InstanceBlockDeviceMapping]
    -> f (Maybe [InstanceBlockDeviceMapping]))
-> Instance
-> f Instance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InstanceBlockDeviceMapping]
  [InstanceBlockDeviceMapping]
  [InstanceBlockDeviceMapping]
  [InstanceBlockDeviceMapping]
-> Iso
     (Maybe [InstanceBlockDeviceMapping])
     (Maybe [InstanceBlockDeviceMapping])
     (Maybe [InstanceBlockDeviceMapping])
     (Maybe [InstanceBlockDeviceMapping])
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
  [InstanceBlockDeviceMapping]
  [InstanceBlockDeviceMapping]
  [InstanceBlockDeviceMapping]
  [InstanceBlockDeviceMapping]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The public IPv4 address assigned to the instance.
instance_publicIpAddress :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_publicIpAddress :: (Maybe Text -> f (Maybe Text)) -> Instance -> f Instance
instance_publicIpAddress = (Instance -> Maybe Text)
-> (Instance -> Maybe Text -> Instance)
-> Lens Instance Instance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
publicIpAddress :: Maybe Text
$sel:publicIpAddress:Instance' :: Instance -> Maybe Text
publicIpAddress} -> Maybe Text
publicIpAddress) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:publicIpAddress:Instance' :: Maybe Text
publicIpAddress = Maybe Text
a} :: Instance)

-- | The Amazon Machine Image (AMI) launch index, which you can use to find
-- this instance in the launch group.
instance_amiLaunchIndex :: Lens.Lens' Instance (Prelude.Maybe Prelude.Int)
instance_amiLaunchIndex :: (Maybe Int -> f (Maybe Int)) -> Instance -> f Instance
instance_amiLaunchIndex = (Instance -> Maybe Int)
-> (Instance -> Maybe Int -> Instance)
-> Lens Instance Instance (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Int
amiLaunchIndex :: Maybe Int
$sel:amiLaunchIndex:Instance' :: Instance -> Maybe Int
amiLaunchIndex} -> Maybe Int
amiLaunchIndex) (\s :: Instance
s@Instance' {} Maybe Int
a -> Instance
s {$sel:amiLaunchIndex:Instance' :: Maybe Int
amiLaunchIndex = Maybe Int
a} :: Instance)

instance Core.FromJSON Instance where
  parseJSON :: Value -> Parser Instance
parseJSON =
    String -> (Object -> Parser Instance) -> Value -> Parser Instance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Instance"
      ( \Object
x ->
          Maybe Text
-> Maybe InstanceState
-> Maybe [SecurityGroupIdentifier]
-> Maybe POSIX
-> Maybe CpuOptions
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe [InstanceBlockDeviceMapping]
-> Maybe Text
-> Maybe Int
-> Instance
Instance'
            (Maybe Text
 -> Maybe InstanceState
 -> Maybe [SecurityGroupIdentifier]
 -> Maybe POSIX
 -> Maybe CpuOptions
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe [InstanceBlockDeviceMapping]
 -> Maybe Text
 -> Maybe Int
 -> Instance)
-> Parser (Maybe Text)
-> Parser
     (Maybe InstanceState
      -> Maybe [SecurityGroupIdentifier]
      -> Maybe POSIX
      -> Maybe CpuOptions
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text
      -> Maybe Int
      -> Instance)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"instanceId")
            Parser
  (Maybe InstanceState
   -> Maybe [SecurityGroupIdentifier]
   -> Maybe POSIX
   -> Maybe CpuOptions
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text
   -> Maybe Int
   -> Instance)
-> Parser (Maybe InstanceState)
-> Parser
     (Maybe [SecurityGroupIdentifier]
      -> Maybe POSIX
      -> Maybe CpuOptions
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text
      -> Maybe Int
      -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InstanceState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser
  (Maybe [SecurityGroupIdentifier]
   -> Maybe POSIX
   -> Maybe CpuOptions
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text
   -> Maybe Int
   -> Instance)
-> Parser (Maybe [SecurityGroupIdentifier])
-> Parser
     (Maybe POSIX
      -> Maybe CpuOptions
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text
      -> Maybe Int
      -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [SecurityGroupIdentifier]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"securityGroups" Parser (Maybe (Maybe [SecurityGroupIdentifier]))
-> Maybe [SecurityGroupIdentifier]
-> Parser (Maybe [SecurityGroupIdentifier])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [SecurityGroupIdentifier]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe POSIX
   -> Maybe CpuOptions
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text
   -> Maybe Int
   -> Instance)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe CpuOptions
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text
      -> Maybe Int
      -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
            Parser
  (Maybe CpuOptions
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text
   -> Maybe Int
   -> Instance)
-> Parser (Maybe CpuOptions)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text
      -> Maybe Int
      -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CpuOptions)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cpuOptions")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text
   -> Maybe Int
   -> Instance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text
      -> Maybe Int
      -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"rootDeviceName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text
   -> Maybe Int
   -> Instance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text
      -> Maybe Int
      -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"instanceType")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text
   -> Maybe Int
   -> Instance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text
      -> Maybe Int
      -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"imageId")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text
   -> Maybe Int
   -> Instance)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text
      -> Maybe Int
      -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"privateIpAddress")
            Parser
  (Maybe POSIX
   -> Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text
   -> Maybe Int
   -> Instance)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe [InstanceBlockDeviceMapping]
      -> Maybe Text -> Maybe Int -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"updatedAt")
            Parser
  (Maybe [InstanceBlockDeviceMapping]
   -> Maybe Text -> Maybe Int -> Instance)
-> Parser (Maybe [InstanceBlockDeviceMapping])
-> Parser (Maybe Text -> Maybe Int -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [InstanceBlockDeviceMapping]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"blockDeviceMappings"
                            Parser (Maybe (Maybe [InstanceBlockDeviceMapping]))
-> Maybe [InstanceBlockDeviceMapping]
-> Parser (Maybe [InstanceBlockDeviceMapping])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [InstanceBlockDeviceMapping]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> Maybe Int -> Instance)
-> Parser (Maybe Text) -> Parser (Maybe Int -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"publicIpAddress")
            Parser (Maybe Int -> Instance)
-> Parser (Maybe Int) -> Parser Instance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"amiLaunchIndex")
      )

instance Prelude.Hashable Instance

instance Prelude.NFData Instance