{-# 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.LicenseManagerLinuxSubscriptions.Types.Instance
-- 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.LicenseManagerLinuxSubscriptions.Types.Instance where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Details discovered information about a running instance using Linux
-- subscriptions.
--
-- /See:/ 'newInstance' smart constructor.
data Instance = Instance'
  { -- | The account ID which owns the instance.
    Instance -> Maybe Text
accountID :: Prelude.Maybe Prelude.Text,
    -- | The AMI ID used to launch the instance.
    Instance -> Maybe Text
amiId :: Prelude.Maybe Prelude.Text,
    -- | The instance ID of the resource.
    Instance -> Maybe Text
instanceID :: Prelude.Maybe Prelude.Text,
    -- | The instance type of the resource.
    Instance -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
    -- | The time in which the last discovery updated the instance details.
    Instance -> Maybe Text
lastUpdatedTime :: Prelude.Maybe Prelude.Text,
    -- | The product code for the instance. For more information, see
    -- <https://docs.aws.amazon.com/license-manager/latest/userguide/linux-subscriptions-usage-operation.html Usage operation values>
    -- in the /License Manager User Guide/ .
    Instance -> Maybe [Text]
productCode :: Prelude.Maybe [Prelude.Text],
    -- | The Region the instance is running in.
    Instance -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The status of the instance.
    Instance -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The name of the subscription being used by the instance.
    Instance -> Maybe Text
subscriptionName :: Prelude.Maybe Prelude.Text,
    -- | The usage operation of the instance. For more information, see For more
    -- information, see
    -- <https://docs.aws.amazon.com/license-manager/latest/userguide/linux-subscriptions-usage-operation.html Usage operation values>
    -- in the /License Manager User Guide/.
    Instance -> Maybe Text
usageOperation :: Prelude.Maybe Prelude.Text
  }
  deriving (Instance -> Instance -> Bool
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]
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
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. 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:
--
-- 'accountID', 'instance_accountID' - The account ID which owns the instance.
--
-- 'amiId', 'instance_amiId' - The AMI ID used to launch the instance.
--
-- 'instanceID', 'instance_instanceID' - The instance ID of the resource.
--
-- 'instanceType', 'instance_instanceType' - The instance type of the resource.
--
-- 'lastUpdatedTime', 'instance_lastUpdatedTime' - The time in which the last discovery updated the instance details.
--
-- 'productCode', 'instance_productCode' - The product code for the instance. For more information, see
-- <https://docs.aws.amazon.com/license-manager/latest/userguide/linux-subscriptions-usage-operation.html Usage operation values>
-- in the /License Manager User Guide/ .
--
-- 'region', 'instance_region' - The Region the instance is running in.
--
-- 'status', 'instance_status' - The status of the instance.
--
-- 'subscriptionName', 'instance_subscriptionName' - The name of the subscription being used by the instance.
--
-- 'usageOperation', 'instance_usageOperation' - The usage operation of the instance. For more information, see For more
-- information, see
-- <https://docs.aws.amazon.com/license-manager/latest/userguide/linux-subscriptions-usage-operation.html Usage operation values>
-- in the /License Manager User Guide/.
newInstance ::
  Instance
newInstance :: Instance
newInstance =
  Instance'
    { $sel:accountID:Instance' :: Maybe Text
accountID = forall a. Maybe a
Prelude.Nothing,
      $sel:amiId:Instance' :: Maybe Text
amiId = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceID:Instance' :: Maybe Text
instanceID = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:Instance' :: Maybe Text
instanceType = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:Instance' :: Maybe Text
lastUpdatedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:productCode:Instance' :: Maybe [Text]
productCode = forall a. Maybe a
Prelude.Nothing,
      $sel:region:Instance' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing,
      $sel:status:Instance' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:subscriptionName:Instance' :: Maybe Text
subscriptionName = forall a. Maybe a
Prelude.Nothing,
      $sel:usageOperation:Instance' :: Maybe Text
usageOperation = forall a. Maybe a
Prelude.Nothing
    }

-- | The account ID which owns the instance.
instance_accountID :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_accountID :: Lens' Instance (Maybe Text)
instance_accountID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
accountID :: Maybe Text
$sel:accountID:Instance' :: Instance -> Maybe Text
accountID} -> Maybe Text
accountID) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:accountID:Instance' :: Maybe Text
accountID = Maybe Text
a} :: Instance)

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

-- | The instance ID of the resource.
instance_instanceID :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_instanceID :: Lens' Instance (Maybe Text)
instance_instanceID = 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)

-- | The instance type of the resource.
instance_instanceType :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_instanceType :: Lens' Instance (Maybe Text)
instance_instanceType = 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 time in which the last discovery updated the instance details.
instance_lastUpdatedTime :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_lastUpdatedTime :: Lens' Instance (Maybe Text)
instance_lastUpdatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
lastUpdatedTime :: Maybe Text
$sel:lastUpdatedTime:Instance' :: Instance -> Maybe Text
lastUpdatedTime} -> Maybe Text
lastUpdatedTime) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:lastUpdatedTime:Instance' :: Maybe Text
lastUpdatedTime = Maybe Text
a} :: Instance)

-- | The product code for the instance. For more information, see
-- <https://docs.aws.amazon.com/license-manager/latest/userguide/linux-subscriptions-usage-operation.html Usage operation values>
-- in the /License Manager User Guide/ .
instance_productCode :: Lens.Lens' Instance (Prelude.Maybe [Prelude.Text])
instance_productCode :: Lens' Instance (Maybe [Text])
instance_productCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe [Text]
productCode :: Maybe [Text]
$sel:productCode:Instance' :: Instance -> Maybe [Text]
productCode} -> Maybe [Text]
productCode) (\s :: Instance
s@Instance' {} Maybe [Text]
a -> Instance
s {$sel:productCode:Instance' :: Maybe [Text]
productCode = Maybe [Text]
a} :: Instance) 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 Region the instance is running in.
instance_region :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_region :: Lens' Instance (Maybe Text)
instance_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
region :: Maybe Text
$sel:region:Instance' :: Instance -> Maybe Text
region} -> Maybe Text
region) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:region:Instance' :: Maybe Text
region = Maybe Text
a} :: Instance)

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

-- | The name of the subscription being used by the instance.
instance_subscriptionName :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_subscriptionName :: Lens' Instance (Maybe Text)
instance_subscriptionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
subscriptionName :: Maybe Text
$sel:subscriptionName:Instance' :: Instance -> Maybe Text
subscriptionName} -> Maybe Text
subscriptionName) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:subscriptionName:Instance' :: Maybe Text
subscriptionName = Maybe Text
a} :: Instance)

-- | The usage operation of the instance. For more information, see For more
-- information, see
-- <https://docs.aws.amazon.com/license-manager/latest/userguide/linux-subscriptions-usage-operation.html Usage operation values>
-- in the /License Manager User Guide/.
instance_usageOperation :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_usageOperation :: Lens' Instance (Maybe Text)
instance_usageOperation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
usageOperation :: Maybe Text
$sel:usageOperation:Instance' :: Instance -> Maybe Text
usageOperation} -> Maybe Text
usageOperation) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:usageOperation:Instance' :: Maybe Text
usageOperation = Maybe Text
a} :: Instance)

instance Data.FromJSON Instance where
  parseJSON :: Value -> Parser Instance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Instance"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Instance
Instance'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AccountID")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AmiId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InstanceID")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InstanceType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastUpdatedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ProductCode" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Region")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SubscriptionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"UsageOperation")
      )

instance Prelude.Hashable Instance where
  hashWithSalt :: Int -> Instance -> Int
hashWithSalt Int
_salt Instance' {Maybe [Text]
Maybe Text
usageOperation :: Maybe Text
subscriptionName :: Maybe Text
status :: Maybe Text
region :: Maybe Text
productCode :: Maybe [Text]
lastUpdatedTime :: Maybe Text
instanceType :: Maybe Text
instanceID :: Maybe Text
amiId :: Maybe Text
accountID :: Maybe Text
$sel:usageOperation:Instance' :: Instance -> Maybe Text
$sel:subscriptionName:Instance' :: Instance -> Maybe Text
$sel:status:Instance' :: Instance -> Maybe Text
$sel:region:Instance' :: Instance -> Maybe Text
$sel:productCode:Instance' :: Instance -> Maybe [Text]
$sel:lastUpdatedTime:Instance' :: Instance -> Maybe Text
$sel:instanceType:Instance' :: Instance -> Maybe Text
$sel:instanceID:Instance' :: Instance -> Maybe Text
$sel:amiId:Instance' :: Instance -> Maybe Text
$sel:accountID:Instance' :: Instance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
amiId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastUpdatedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
productCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subscriptionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
usageOperation

instance Prelude.NFData Instance where
  rnf :: Instance -> ()
rnf Instance' {Maybe [Text]
Maybe Text
usageOperation :: Maybe Text
subscriptionName :: Maybe Text
status :: Maybe Text
region :: Maybe Text
productCode :: Maybe [Text]
lastUpdatedTime :: Maybe Text
instanceType :: Maybe Text
instanceID :: Maybe Text
amiId :: Maybe Text
accountID :: Maybe Text
$sel:usageOperation:Instance' :: Instance -> Maybe Text
$sel:subscriptionName:Instance' :: Instance -> Maybe Text
$sel:status:Instance' :: Instance -> Maybe Text
$sel:region:Instance' :: Instance -> Maybe Text
$sel:productCode:Instance' :: Instance -> Maybe [Text]
$sel:lastUpdatedTime:Instance' :: Instance -> Maybe Text
$sel:instanceType:Instance' :: Instance -> Maybe Text
$sel:instanceID:Instance' :: Instance -> Maybe Text
$sel:amiId:Instance' :: Instance -> Maybe Text
$sel:accountID:Instance' :: Instance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
amiId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastUpdatedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
productCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subscriptionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
usageOperation