{-# 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.GameLift.Types.InstanceAccess
-- 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.GameLift.Types.InstanceAccess where

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types.InstanceCredentials
import Amazonka.GameLift.Types.OperatingSystem
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information required to remotely connect to a fleet instance. Access is
-- requested by calling GetInstanceAccess.
--
-- /See:/ 'newInstanceAccess' smart constructor.
data InstanceAccess = InstanceAccess'
  { -- | A unique identifier for the instance being accessed.
    InstanceAccess -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
    -- | IP address that is assigned to the instance.
    InstanceAccess -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | Operating system that is running on the instance.
    InstanceAccess -> Maybe OperatingSystem
operatingSystem :: Prelude.Maybe OperatingSystem,
    -- | Credentials required to access the instance.
    InstanceAccess -> Maybe (Sensitive InstanceCredentials)
credentials :: Prelude.Maybe (Core.Sensitive InstanceCredentials),
    -- | A unique identifier for the fleet containing the instance being
    -- accessed.
    InstanceAccess -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text
  }
  deriving (InstanceAccess -> InstanceAccess -> Bool
(InstanceAccess -> InstanceAccess -> Bool)
-> (InstanceAccess -> InstanceAccess -> Bool) -> Eq InstanceAccess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceAccess -> InstanceAccess -> Bool
$c/= :: InstanceAccess -> InstanceAccess -> Bool
== :: InstanceAccess -> InstanceAccess -> Bool
$c== :: InstanceAccess -> InstanceAccess -> Bool
Prelude.Eq, Int -> InstanceAccess -> ShowS
[InstanceAccess] -> ShowS
InstanceAccess -> String
(Int -> InstanceAccess -> ShowS)
-> (InstanceAccess -> String)
-> ([InstanceAccess] -> ShowS)
-> Show InstanceAccess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceAccess] -> ShowS
$cshowList :: [InstanceAccess] -> ShowS
show :: InstanceAccess -> String
$cshow :: InstanceAccess -> String
showsPrec :: Int -> InstanceAccess -> ShowS
$cshowsPrec :: Int -> InstanceAccess -> ShowS
Prelude.Show, (forall x. InstanceAccess -> Rep InstanceAccess x)
-> (forall x. Rep InstanceAccess x -> InstanceAccess)
-> Generic InstanceAccess
forall x. Rep InstanceAccess x -> InstanceAccess
forall x. InstanceAccess -> Rep InstanceAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceAccess x -> InstanceAccess
$cfrom :: forall x. InstanceAccess -> Rep InstanceAccess x
Prelude.Generic)

-- |
-- Create a value of 'InstanceAccess' 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', 'instanceAccess_instanceId' - A unique identifier for the instance being accessed.
--
-- 'ipAddress', 'instanceAccess_ipAddress' - IP address that is assigned to the instance.
--
-- 'operatingSystem', 'instanceAccess_operatingSystem' - Operating system that is running on the instance.
--
-- 'credentials', 'instanceAccess_credentials' - Credentials required to access the instance.
--
-- 'fleetId', 'instanceAccess_fleetId' - A unique identifier for the fleet containing the instance being
-- accessed.
newInstanceAccess ::
  InstanceAccess
newInstanceAccess :: InstanceAccess
newInstanceAccess =
  InstanceAccess' :: Maybe Text
-> Maybe Text
-> Maybe OperatingSystem
-> Maybe (Sensitive InstanceCredentials)
-> Maybe Text
-> InstanceAccess
InstanceAccess'
    { $sel:instanceId:InstanceAccess' :: Maybe Text
instanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddress:InstanceAccess' :: Maybe Text
ipAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:operatingSystem:InstanceAccess' :: Maybe OperatingSystem
operatingSystem = Maybe OperatingSystem
forall a. Maybe a
Prelude.Nothing,
      $sel:credentials:InstanceAccess' :: Maybe (Sensitive InstanceCredentials)
credentials = Maybe (Sensitive InstanceCredentials)
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetId:InstanceAccess' :: Maybe Text
fleetId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier for the instance being accessed.
instanceAccess_instanceId :: Lens.Lens' InstanceAccess (Prelude.Maybe Prelude.Text)
instanceAccess_instanceId :: (Maybe Text -> f (Maybe Text))
-> InstanceAccess -> f InstanceAccess
instanceAccess_instanceId = (InstanceAccess -> Maybe Text)
-> (InstanceAccess -> Maybe Text -> InstanceAccess)
-> Lens InstanceAccess InstanceAccess (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceAccess' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:InstanceAccess' :: InstanceAccess -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: InstanceAccess
s@InstanceAccess' {} Maybe Text
a -> InstanceAccess
s {$sel:instanceId:InstanceAccess' :: Maybe Text
instanceId = Maybe Text
a} :: InstanceAccess)

-- | IP address that is assigned to the instance.
instanceAccess_ipAddress :: Lens.Lens' InstanceAccess (Prelude.Maybe Prelude.Text)
instanceAccess_ipAddress :: (Maybe Text -> f (Maybe Text))
-> InstanceAccess -> f InstanceAccess
instanceAccess_ipAddress = (InstanceAccess -> Maybe Text)
-> (InstanceAccess -> Maybe Text -> InstanceAccess)
-> Lens InstanceAccess InstanceAccess (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceAccess' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:InstanceAccess' :: InstanceAccess -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: InstanceAccess
s@InstanceAccess' {} Maybe Text
a -> InstanceAccess
s {$sel:ipAddress:InstanceAccess' :: Maybe Text
ipAddress = Maybe Text
a} :: InstanceAccess)

-- | Operating system that is running on the instance.
instanceAccess_operatingSystem :: Lens.Lens' InstanceAccess (Prelude.Maybe OperatingSystem)
instanceAccess_operatingSystem :: (Maybe OperatingSystem -> f (Maybe OperatingSystem))
-> InstanceAccess -> f InstanceAccess
instanceAccess_operatingSystem = (InstanceAccess -> Maybe OperatingSystem)
-> (InstanceAccess -> Maybe OperatingSystem -> InstanceAccess)
-> Lens
     InstanceAccess
     InstanceAccess
     (Maybe OperatingSystem)
     (Maybe OperatingSystem)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceAccess' {Maybe OperatingSystem
operatingSystem :: Maybe OperatingSystem
$sel:operatingSystem:InstanceAccess' :: InstanceAccess -> Maybe OperatingSystem
operatingSystem} -> Maybe OperatingSystem
operatingSystem) (\s :: InstanceAccess
s@InstanceAccess' {} Maybe OperatingSystem
a -> InstanceAccess
s {$sel:operatingSystem:InstanceAccess' :: Maybe OperatingSystem
operatingSystem = Maybe OperatingSystem
a} :: InstanceAccess)

-- | Credentials required to access the instance.
instanceAccess_credentials :: Lens.Lens' InstanceAccess (Prelude.Maybe InstanceCredentials)
instanceAccess_credentials :: (Maybe InstanceCredentials -> f (Maybe InstanceCredentials))
-> InstanceAccess -> f InstanceAccess
instanceAccess_credentials = (InstanceAccess -> Maybe (Sensitive InstanceCredentials))
-> (InstanceAccess
    -> Maybe (Sensitive InstanceCredentials) -> InstanceAccess)
-> Lens
     InstanceAccess
     InstanceAccess
     (Maybe (Sensitive InstanceCredentials))
     (Maybe (Sensitive InstanceCredentials))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceAccess' {Maybe (Sensitive InstanceCredentials)
credentials :: Maybe (Sensitive InstanceCredentials)
$sel:credentials:InstanceAccess' :: InstanceAccess -> Maybe (Sensitive InstanceCredentials)
credentials} -> Maybe (Sensitive InstanceCredentials)
credentials) (\s :: InstanceAccess
s@InstanceAccess' {} Maybe (Sensitive InstanceCredentials)
a -> InstanceAccess
s {$sel:credentials:InstanceAccess' :: Maybe (Sensitive InstanceCredentials)
credentials = Maybe (Sensitive InstanceCredentials)
a} :: InstanceAccess) ((Maybe (Sensitive InstanceCredentials)
  -> f (Maybe (Sensitive InstanceCredentials)))
 -> InstanceAccess -> f InstanceAccess)
-> ((Maybe InstanceCredentials -> f (Maybe InstanceCredentials))
    -> Maybe (Sensitive InstanceCredentials)
    -> f (Maybe (Sensitive InstanceCredentials)))
-> (Maybe InstanceCredentials -> f (Maybe InstanceCredentials))
-> InstanceAccess
-> f InstanceAccess
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (Sensitive InstanceCredentials)
  (Sensitive InstanceCredentials)
  InstanceCredentials
  InstanceCredentials
-> Iso
     (Maybe (Sensitive InstanceCredentials))
     (Maybe (Sensitive InstanceCredentials))
     (Maybe InstanceCredentials)
     (Maybe InstanceCredentials)
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
  (Sensitive InstanceCredentials)
  (Sensitive InstanceCredentials)
  InstanceCredentials
  InstanceCredentials
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | A unique identifier for the fleet containing the instance being
-- accessed.
instanceAccess_fleetId :: Lens.Lens' InstanceAccess (Prelude.Maybe Prelude.Text)
instanceAccess_fleetId :: (Maybe Text -> f (Maybe Text))
-> InstanceAccess -> f InstanceAccess
instanceAccess_fleetId = (InstanceAccess -> Maybe Text)
-> (InstanceAccess -> Maybe Text -> InstanceAccess)
-> Lens InstanceAccess InstanceAccess (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceAccess' {Maybe Text
fleetId :: Maybe Text
$sel:fleetId:InstanceAccess' :: InstanceAccess -> Maybe Text
fleetId} -> Maybe Text
fleetId) (\s :: InstanceAccess
s@InstanceAccess' {} Maybe Text
a -> InstanceAccess
s {$sel:fleetId:InstanceAccess' :: Maybe Text
fleetId = Maybe Text
a} :: InstanceAccess)

instance Core.FromJSON InstanceAccess where
  parseJSON :: Value -> Parser InstanceAccess
parseJSON =
    String
-> (Object -> Parser InstanceAccess)
-> Value
-> Parser InstanceAccess
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstanceAccess"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe OperatingSystem
-> Maybe (Sensitive InstanceCredentials)
-> Maybe Text
-> InstanceAccess
InstanceAccess'
            (Maybe Text
 -> Maybe Text
 -> Maybe OperatingSystem
 -> Maybe (Sensitive InstanceCredentials)
 -> Maybe Text
 -> InstanceAccess)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe OperatingSystem
      -> Maybe (Sensitive InstanceCredentials)
      -> Maybe Text
      -> InstanceAccess)
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 Text
   -> Maybe OperatingSystem
   -> Maybe (Sensitive InstanceCredentials)
   -> Maybe Text
   -> InstanceAccess)
-> Parser (Maybe Text)
-> Parser
     (Maybe OperatingSystem
      -> Maybe (Sensitive InstanceCredentials)
      -> Maybe Text
      -> InstanceAccess)
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
"IpAddress")
            Parser
  (Maybe OperatingSystem
   -> Maybe (Sensitive InstanceCredentials)
   -> Maybe Text
   -> InstanceAccess)
-> Parser (Maybe OperatingSystem)
-> Parser
     (Maybe (Sensitive InstanceCredentials)
      -> Maybe Text -> InstanceAccess)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OperatingSystem)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OperatingSystem")
            Parser
  (Maybe (Sensitive InstanceCredentials)
   -> Maybe Text -> InstanceAccess)
-> Parser (Maybe (Sensitive InstanceCredentials))
-> Parser (Maybe Text -> InstanceAccess)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive InstanceCredentials))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Credentials")
            Parser (Maybe Text -> InstanceAccess)
-> Parser (Maybe Text) -> Parser InstanceAccess
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
"FleetId")
      )

instance Prelude.Hashable InstanceAccess

instance Prelude.NFData InstanceAccess