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

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

-- | Represents the device instance.
--
-- /See:/ 'newDeviceInstance' smart constructor.
data DeviceInstance = DeviceInstance'
  { -- | 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,
    -- | A object that contains information about the instance profile.
    DeviceInstance -> Maybe InstanceProfile
instanceProfile :: Prelude.Maybe InstanceProfile,
    -- | 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,
    -- | An array of strings that describe the device instance.
    DeviceInstance -> Maybe [Text]
labels :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DeviceInstance -> DeviceInstance -> Bool
(DeviceInstance -> DeviceInstance -> Bool)
-> (DeviceInstance -> DeviceInstance -> Bool) -> Eq DeviceInstance
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]
(Int -> ReadS DeviceInstance)
-> ReadS [DeviceInstance]
-> ReadPrec DeviceInstance
-> ReadPrec [DeviceInstance]
-> Read 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
(Int -> DeviceInstance -> ShowS)
-> (DeviceInstance -> String)
-> ([DeviceInstance] -> ShowS)
-> Show DeviceInstance
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. DeviceInstance -> Rep DeviceInstance x)
-> (forall x. Rep DeviceInstance x -> DeviceInstance)
-> Generic DeviceInstance
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:
--
-- 'status', 'deviceInstance_status' - The status of the device instance. Valid values are listed here.
--
-- 'udid', 'deviceInstance_udid' - Unique device identifier for the device instance.
--
-- 'instanceProfile', 'deviceInstance_instanceProfile' - A object that contains information about the instance profile.
--
-- 'arn', 'deviceInstance_arn' - The Amazon Resource Name (ARN) of the device instance.
--
-- 'deviceArn', 'deviceInstance_deviceArn' - The ARN of the device.
--
-- 'labels', 'deviceInstance_labels' - An array of strings that describe the device instance.
newDeviceInstance ::
  DeviceInstance
newDeviceInstance :: DeviceInstance
newDeviceInstance =
  DeviceInstance' :: Maybe InstanceStatus
-> Maybe Text
-> Maybe InstanceProfile
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> DeviceInstance
DeviceInstance'
    { $sel:status:DeviceInstance' :: Maybe InstanceStatus
status = Maybe InstanceStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:udid:DeviceInstance' :: Maybe Text
udid = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceProfile:DeviceInstance' :: Maybe InstanceProfile
instanceProfile = Maybe InstanceProfile
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DeviceInstance' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceArn:DeviceInstance' :: Maybe Text
deviceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:labels:DeviceInstance' :: Maybe [Text]
labels = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the device instance. Valid values are listed here.
deviceInstance_status :: Lens.Lens' DeviceInstance (Prelude.Maybe InstanceStatus)
deviceInstance_status :: (Maybe InstanceStatus -> f (Maybe InstanceStatus))
-> DeviceInstance -> f DeviceInstance
deviceInstance_status = (DeviceInstance -> Maybe InstanceStatus)
-> (DeviceInstance -> Maybe InstanceStatus -> DeviceInstance)
-> Lens
     DeviceInstance
     DeviceInstance
     (Maybe InstanceStatus)
     (Maybe InstanceStatus)
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 :: (Maybe Text -> f (Maybe Text))
-> DeviceInstance -> f DeviceInstance
deviceInstance_udid = (DeviceInstance -> Maybe Text)
-> (DeviceInstance -> Maybe Text -> DeviceInstance)
-> Lens DeviceInstance DeviceInstance (Maybe Text) (Maybe Text)
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)

-- | A object that contains information about the instance profile.
deviceInstance_instanceProfile :: Lens.Lens' DeviceInstance (Prelude.Maybe InstanceProfile)
deviceInstance_instanceProfile :: (Maybe InstanceProfile -> f (Maybe InstanceProfile))
-> DeviceInstance -> f DeviceInstance
deviceInstance_instanceProfile = (DeviceInstance -> Maybe InstanceProfile)
-> (DeviceInstance -> Maybe InstanceProfile -> DeviceInstance)
-> Lens
     DeviceInstance
     DeviceInstance
     (Maybe InstanceProfile)
     (Maybe 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)

-- | The Amazon Resource Name (ARN) of the device instance.
deviceInstance_arn :: Lens.Lens' DeviceInstance (Prelude.Maybe Prelude.Text)
deviceInstance_arn :: (Maybe Text -> f (Maybe Text))
-> DeviceInstance -> f DeviceInstance
deviceInstance_arn = (DeviceInstance -> Maybe Text)
-> (DeviceInstance -> Maybe Text -> DeviceInstance)
-> Lens DeviceInstance DeviceInstance (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> DeviceInstance -> f DeviceInstance
deviceInstance_deviceArn = (DeviceInstance -> Maybe Text)
-> (DeviceInstance -> Maybe Text -> DeviceInstance)
-> Lens DeviceInstance DeviceInstance (Maybe Text) (Maybe Text)
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)

-- | An array of strings that describe the device instance.
deviceInstance_labels :: Lens.Lens' DeviceInstance (Prelude.Maybe [Prelude.Text])
deviceInstance_labels :: (Maybe [Text] -> f (Maybe [Text]))
-> DeviceInstance -> f DeviceInstance
deviceInstance_labels = (DeviceInstance -> Maybe [Text])
-> (DeviceInstance -> Maybe [Text] -> DeviceInstance)
-> Lens DeviceInstance DeviceInstance (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> DeviceInstance -> f DeviceInstance)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DeviceInstance
-> f DeviceInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON DeviceInstance where
  parseJSON :: Value -> Parser DeviceInstance
parseJSON =
    String
-> (Object -> Parser DeviceInstance)
-> Value
-> Parser DeviceInstance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeviceInstance"
      ( \Object
x ->
          Maybe InstanceStatus
-> Maybe Text
-> Maybe InstanceProfile
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> DeviceInstance
DeviceInstance'
            (Maybe InstanceStatus
 -> Maybe Text
 -> Maybe InstanceProfile
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> DeviceInstance)
-> Parser (Maybe InstanceStatus)
-> Parser
     (Maybe Text
      -> Maybe InstanceProfile
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> DeviceInstance)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InstanceStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe InstanceProfile
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> DeviceInstance)
-> Parser (Maybe Text)
-> Parser
     (Maybe InstanceProfile
      -> Maybe Text -> Maybe Text -> Maybe [Text] -> DeviceInstance)
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
"udid")
            Parser
  (Maybe InstanceProfile
   -> Maybe Text -> Maybe Text -> Maybe [Text] -> DeviceInstance)
-> Parser (Maybe InstanceProfile)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe [Text] -> DeviceInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InstanceProfile)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"instanceProfile")
            Parser (Maybe Text -> Maybe Text -> Maybe [Text] -> DeviceInstance)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [Text] -> DeviceInstance)
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
"arn")
            Parser (Maybe Text -> Maybe [Text] -> DeviceInstance)
-> Parser (Maybe Text) -> Parser (Maybe [Text] -> DeviceInstance)
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
"deviceArn")
            Parser (Maybe [Text] -> DeviceInstance)
-> Parser (Maybe [Text]) -> Parser DeviceInstance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"labels" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable DeviceInstance

instance Prelude.NFData DeviceInstance