{-# 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.DeviceFarm.Types.DeviceInstance
-- 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.DeviceFarm.Types.DeviceInstance where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DeviceFarm.Types.InstanceProfile
import Amazonka.DeviceFarm.Types.InstanceStatus
import qualified Amazonka.Prelude as Prelude

-- | Represents the device instance.
--
-- /See:/ 'newDeviceInstance' smart constructor.
data DeviceInstance = DeviceInstance'
  { -- | The Amazon Resource Name (ARN) of the device instance.
    DeviceInstance -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the device.
    DeviceInstance -> Maybe Text
deviceArn :: Prelude.Maybe Prelude.Text,
    -- | A object that contains information about the instance profile.
    DeviceInstance -> Maybe InstanceProfile
instanceProfile :: Prelude.Maybe InstanceProfile,
    -- | An array of strings that describe the device instance.
    DeviceInstance -> Maybe [Text]
labels :: Prelude.Maybe [Prelude.Text],
    -- | The status of the device instance. Valid values are listed here.
    DeviceInstance -> Maybe InstanceStatus
status :: Prelude.Maybe InstanceStatus,
    -- | Unique device identifier for the device instance.
    DeviceInstance -> Maybe Text
udid :: Prelude.Maybe Prelude.Text
  }
  deriving (DeviceInstance -> DeviceInstance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceInstance -> DeviceInstance -> Bool
$c/= :: DeviceInstance -> DeviceInstance -> Bool
== :: DeviceInstance -> DeviceInstance -> Bool
$c== :: DeviceInstance -> DeviceInstance -> Bool
Prelude.Eq, ReadPrec [DeviceInstance]
ReadPrec DeviceInstance
Int -> ReadS DeviceInstance
ReadS [DeviceInstance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceInstance]
$creadListPrec :: ReadPrec [DeviceInstance]
readPrec :: ReadPrec DeviceInstance
$creadPrec :: ReadPrec DeviceInstance
readList :: ReadS [DeviceInstance]
$creadList :: ReadS [DeviceInstance]
readsPrec :: Int -> ReadS DeviceInstance
$creadsPrec :: Int -> ReadS DeviceInstance
Prelude.Read, Int -> DeviceInstance -> ShowS
[DeviceInstance] -> ShowS
DeviceInstance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceInstance] -> ShowS
$cshowList :: [DeviceInstance] -> ShowS
show :: DeviceInstance -> String
$cshow :: DeviceInstance -> String
showsPrec :: Int -> DeviceInstance -> ShowS
$cshowsPrec :: Int -> DeviceInstance -> ShowS
Prelude.Show, forall x. Rep DeviceInstance x -> DeviceInstance
forall x. DeviceInstance -> Rep DeviceInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceInstance x -> DeviceInstance
$cfrom :: forall x. DeviceInstance -> Rep DeviceInstance x
Prelude.Generic)

-- |
-- Create a value of 'DeviceInstance' 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:
--
-- 'arn', 'deviceInstance_arn' - The Amazon Resource Name (ARN) of the device instance.
--
-- 'deviceArn', 'deviceInstance_deviceArn' - The ARN of the device.
--
-- 'instanceProfile', 'deviceInstance_instanceProfile' - A object that contains information about the instance profile.
--
-- 'labels', 'deviceInstance_labels' - An array of strings that describe the device instance.
--
-- 'status', 'deviceInstance_status' - The status of the device instance. Valid values are listed here.
--
-- 'udid', 'deviceInstance_udid' - Unique device identifier for the device instance.
newDeviceInstance ::
  DeviceInstance
newDeviceInstance :: DeviceInstance
newDeviceInstance =
  DeviceInstance'
    { $sel:arn:DeviceInstance' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:deviceArn:DeviceInstance' :: Maybe Text
deviceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceProfile:DeviceInstance' :: Maybe InstanceProfile
instanceProfile = forall a. Maybe a
Prelude.Nothing,
      $sel:labels:DeviceInstance' :: Maybe [Text]
labels = forall a. Maybe a
Prelude.Nothing,
      $sel:status:DeviceInstance' :: Maybe InstanceStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:udid:DeviceInstance' :: Maybe Text
udid = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the device instance.
deviceInstance_arn :: Lens.Lens' DeviceInstance (Prelude.Maybe Prelude.Text)
deviceInstance_arn :: Lens' DeviceInstance (Maybe Text)
deviceInstance_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceInstance' {Maybe Text
arn :: Maybe Text
$sel:arn:DeviceInstance' :: DeviceInstance -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeviceInstance
s@DeviceInstance' {} Maybe Text
a -> DeviceInstance
s {$sel:arn:DeviceInstance' :: Maybe Text
arn = Maybe Text
a} :: DeviceInstance)

-- | The ARN of the device.
deviceInstance_deviceArn :: Lens.Lens' DeviceInstance (Prelude.Maybe Prelude.Text)
deviceInstance_deviceArn :: Lens' DeviceInstance (Maybe Text)
deviceInstance_deviceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceInstance' {Maybe Text
deviceArn :: Maybe Text
$sel:deviceArn:DeviceInstance' :: DeviceInstance -> Maybe Text
deviceArn} -> Maybe Text
deviceArn) (\s :: DeviceInstance
s@DeviceInstance' {} Maybe Text
a -> DeviceInstance
s {$sel:deviceArn:DeviceInstance' :: Maybe Text
deviceArn = Maybe Text
a} :: DeviceInstance)

-- | A object that contains information about the instance profile.
deviceInstance_instanceProfile :: Lens.Lens' DeviceInstance (Prelude.Maybe InstanceProfile)
deviceInstance_instanceProfile :: Lens' DeviceInstance (Maybe InstanceProfile)
deviceInstance_instanceProfile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceInstance' {Maybe InstanceProfile
instanceProfile :: Maybe InstanceProfile
$sel:instanceProfile:DeviceInstance' :: DeviceInstance -> Maybe InstanceProfile
instanceProfile} -> Maybe InstanceProfile
instanceProfile) (\s :: DeviceInstance
s@DeviceInstance' {} Maybe InstanceProfile
a -> DeviceInstance
s {$sel:instanceProfile:DeviceInstance' :: Maybe InstanceProfile
instanceProfile = Maybe InstanceProfile
a} :: DeviceInstance)

-- | An array of strings that describe the device instance.
deviceInstance_labels :: Lens.Lens' DeviceInstance (Prelude.Maybe [Prelude.Text])
deviceInstance_labels :: Lens' DeviceInstance (Maybe [Text])
deviceInstance_labels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceInstance' {Maybe [Text]
labels :: Maybe [Text]
$sel:labels:DeviceInstance' :: DeviceInstance -> Maybe [Text]
labels} -> Maybe [Text]
labels) (\s :: DeviceInstance
s@DeviceInstance' {} Maybe [Text]
a -> DeviceInstance
s {$sel:labels:DeviceInstance' :: Maybe [Text]
labels = Maybe [Text]
a} :: DeviceInstance) 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 status of the device instance. Valid values are listed here.
deviceInstance_status :: Lens.Lens' DeviceInstance (Prelude.Maybe InstanceStatus)
deviceInstance_status :: Lens' DeviceInstance (Maybe InstanceStatus)
deviceInstance_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceInstance' {Maybe InstanceStatus
status :: Maybe InstanceStatus
$sel:status:DeviceInstance' :: DeviceInstance -> Maybe InstanceStatus
status} -> Maybe InstanceStatus
status) (\s :: DeviceInstance
s@DeviceInstance' {} Maybe InstanceStatus
a -> DeviceInstance
s {$sel:status:DeviceInstance' :: Maybe InstanceStatus
status = Maybe InstanceStatus
a} :: DeviceInstance)

-- | Unique device identifier for the device instance.
deviceInstance_udid :: Lens.Lens' DeviceInstance (Prelude.Maybe Prelude.Text)
deviceInstance_udid :: Lens' DeviceInstance (Maybe Text)
deviceInstance_udid = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceInstance' {Maybe Text
udid :: Maybe Text
$sel:udid:DeviceInstance' :: DeviceInstance -> Maybe Text
udid} -> Maybe Text
udid) (\s :: DeviceInstance
s@DeviceInstance' {} Maybe Text
a -> DeviceInstance
s {$sel:udid:DeviceInstance' :: Maybe Text
udid = Maybe Text
a} :: DeviceInstance)

instance Data.FromJSON DeviceInstance where
  parseJSON :: Value -> Parser DeviceInstance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeviceInstance"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe InstanceProfile
-> Maybe [Text]
-> Maybe InstanceStatus
-> Maybe Text
-> DeviceInstance
DeviceInstance'
            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
"arn")
            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
"deviceArn")
            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
"instanceProfile")
            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
"labels" 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
"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
"udid")
      )

instance Prelude.Hashable DeviceInstance where
  hashWithSalt :: Int -> DeviceInstance -> Int
hashWithSalt Int
_salt DeviceInstance' {Maybe [Text]
Maybe Text
Maybe InstanceProfile
Maybe InstanceStatus
udid :: Maybe Text
status :: Maybe InstanceStatus
labels :: Maybe [Text]
instanceProfile :: Maybe InstanceProfile
deviceArn :: Maybe Text
arn :: Maybe Text
$sel:udid:DeviceInstance' :: DeviceInstance -> Maybe Text
$sel:status:DeviceInstance' :: DeviceInstance -> Maybe InstanceStatus
$sel:labels:DeviceInstance' :: DeviceInstance -> Maybe [Text]
$sel:instanceProfile:DeviceInstance' :: DeviceInstance -> Maybe InstanceProfile
$sel:deviceArn:DeviceInstance' :: DeviceInstance -> Maybe Text
$sel:arn:DeviceInstance' :: DeviceInstance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceProfile
instanceProfile
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
labels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
udid

instance Prelude.NFData DeviceInstance where
  rnf :: DeviceInstance -> ()
rnf DeviceInstance' {Maybe [Text]
Maybe Text
Maybe InstanceProfile
Maybe InstanceStatus
udid :: Maybe Text
status :: Maybe InstanceStatus
labels :: Maybe [Text]
instanceProfile :: Maybe InstanceProfile
deviceArn :: Maybe Text
arn :: Maybe Text
$sel:udid:DeviceInstance' :: DeviceInstance -> Maybe Text
$sel:status:DeviceInstance' :: DeviceInstance -> Maybe InstanceStatus
$sel:labels:DeviceInstance' :: DeviceInstance -> Maybe [Text]
$sel:instanceProfile:DeviceInstance' :: DeviceInstance -> Maybe InstanceProfile
$sel:deviceArn:DeviceInstance' :: DeviceInstance -> Maybe Text
$sel:arn:DeviceInstance' :: DeviceInstance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceProfile
instanceProfile
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
labels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
udid