{-# 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.InstanceProfile
-- 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.InstanceProfile 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

-- | Represents the instance profile.
--
-- /See:/ 'newInstanceProfile' smart constructor.
data InstanceProfile = InstanceProfile'
  { -- | The Amazon Resource Name (ARN) of the instance profile.
    InstanceProfile -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The description of the instance profile.
    InstanceProfile -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | An array of strings containing the list of app packages that should not
    -- be cleaned up from the device after a test run completes.
    --
    -- The list of packages is considered only if you set @packageCleanup@ to
    -- @true@.
    InstanceProfile -> Maybe [Text]
excludeAppPackagesFromCleanup :: Prelude.Maybe [Prelude.Text],
    -- | The name of the instance profile.
    InstanceProfile -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | When set to @true@, Device Farm removes app packages after a test run.
    -- The default value is @false@ for private devices.
    InstanceProfile -> Maybe Bool
packageCleanup :: Prelude.Maybe Prelude.Bool,
    -- | When set to @true@, Device Farm reboots the instance after a test run.
    -- The default value is @true@.
    InstanceProfile -> Maybe Bool
rebootAfterUse :: Prelude.Maybe Prelude.Bool
  }
  deriving (InstanceProfile -> InstanceProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceProfile -> InstanceProfile -> Bool
$c/= :: InstanceProfile -> InstanceProfile -> Bool
== :: InstanceProfile -> InstanceProfile -> Bool
$c== :: InstanceProfile -> InstanceProfile -> Bool
Prelude.Eq, ReadPrec [InstanceProfile]
ReadPrec InstanceProfile
Int -> ReadS InstanceProfile
ReadS [InstanceProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceProfile]
$creadListPrec :: ReadPrec [InstanceProfile]
readPrec :: ReadPrec InstanceProfile
$creadPrec :: ReadPrec InstanceProfile
readList :: ReadS [InstanceProfile]
$creadList :: ReadS [InstanceProfile]
readsPrec :: Int -> ReadS InstanceProfile
$creadsPrec :: Int -> ReadS InstanceProfile
Prelude.Read, Int -> InstanceProfile -> ShowS
[InstanceProfile] -> ShowS
InstanceProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceProfile] -> ShowS
$cshowList :: [InstanceProfile] -> ShowS
show :: InstanceProfile -> String
$cshow :: InstanceProfile -> String
showsPrec :: Int -> InstanceProfile -> ShowS
$cshowsPrec :: Int -> InstanceProfile -> ShowS
Prelude.Show, forall x. Rep InstanceProfile x -> InstanceProfile
forall x. InstanceProfile -> Rep InstanceProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceProfile x -> InstanceProfile
$cfrom :: forall x. InstanceProfile -> Rep InstanceProfile x
Prelude.Generic)

-- |
-- Create a value of 'InstanceProfile' 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', 'instanceProfile_arn' - The Amazon Resource Name (ARN) of the instance profile.
--
-- 'description', 'instanceProfile_description' - The description of the instance profile.
--
-- 'excludeAppPackagesFromCleanup', 'instanceProfile_excludeAppPackagesFromCleanup' - An array of strings containing the list of app packages that should not
-- be cleaned up from the device after a test run completes.
--
-- The list of packages is considered only if you set @packageCleanup@ to
-- @true@.
--
-- 'name', 'instanceProfile_name' - The name of the instance profile.
--
-- 'packageCleanup', 'instanceProfile_packageCleanup' - When set to @true@, Device Farm removes app packages after a test run.
-- The default value is @false@ for private devices.
--
-- 'rebootAfterUse', 'instanceProfile_rebootAfterUse' - When set to @true@, Device Farm reboots the instance after a test run.
-- The default value is @true@.
newInstanceProfile ::
  InstanceProfile
newInstanceProfile :: InstanceProfile
newInstanceProfile =
  InstanceProfile'
    { $sel:arn:InstanceProfile' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:description:InstanceProfile' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:excludeAppPackagesFromCleanup:InstanceProfile' :: Maybe [Text]
excludeAppPackagesFromCleanup = forall a. Maybe a
Prelude.Nothing,
      $sel:name:InstanceProfile' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:packageCleanup:InstanceProfile' :: Maybe Bool
packageCleanup = forall a. Maybe a
Prelude.Nothing,
      $sel:rebootAfterUse:InstanceProfile' :: Maybe Bool
rebootAfterUse = forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | An array of strings containing the list of app packages that should not
-- be cleaned up from the device after a test run completes.
--
-- The list of packages is considered only if you set @packageCleanup@ to
-- @true@.
instanceProfile_excludeAppPackagesFromCleanup :: Lens.Lens' InstanceProfile (Prelude.Maybe [Prelude.Text])
instanceProfile_excludeAppPackagesFromCleanup :: Lens' InstanceProfile (Maybe [Text])
instanceProfile_excludeAppPackagesFromCleanup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceProfile' {Maybe [Text]
excludeAppPackagesFromCleanup :: Maybe [Text]
$sel:excludeAppPackagesFromCleanup:InstanceProfile' :: InstanceProfile -> Maybe [Text]
excludeAppPackagesFromCleanup} -> Maybe [Text]
excludeAppPackagesFromCleanup) (\s :: InstanceProfile
s@InstanceProfile' {} Maybe [Text]
a -> InstanceProfile
s {$sel:excludeAppPackagesFromCleanup:InstanceProfile' :: Maybe [Text]
excludeAppPackagesFromCleanup = Maybe [Text]
a} :: InstanceProfile) 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 name of the instance profile.
instanceProfile_name :: Lens.Lens' InstanceProfile (Prelude.Maybe Prelude.Text)
instanceProfile_name :: Lens' InstanceProfile (Maybe Text)
instanceProfile_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceProfile' {Maybe Text
name :: Maybe Text
$sel:name:InstanceProfile' :: InstanceProfile -> Maybe Text
name} -> Maybe Text
name) (\s :: InstanceProfile
s@InstanceProfile' {} Maybe Text
a -> InstanceProfile
s {$sel:name:InstanceProfile' :: Maybe Text
name = Maybe Text
a} :: InstanceProfile)

-- | When set to @true@, Device Farm removes app packages after a test run.
-- The default value is @false@ for private devices.
instanceProfile_packageCleanup :: Lens.Lens' InstanceProfile (Prelude.Maybe Prelude.Bool)
instanceProfile_packageCleanup :: Lens' InstanceProfile (Maybe Bool)
instanceProfile_packageCleanup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceProfile' {Maybe Bool
packageCleanup :: Maybe Bool
$sel:packageCleanup:InstanceProfile' :: InstanceProfile -> Maybe Bool
packageCleanup} -> Maybe Bool
packageCleanup) (\s :: InstanceProfile
s@InstanceProfile' {} Maybe Bool
a -> InstanceProfile
s {$sel:packageCleanup:InstanceProfile' :: Maybe Bool
packageCleanup = Maybe Bool
a} :: InstanceProfile)

-- | When set to @true@, Device Farm reboots the instance after a test run.
-- The default value is @true@.
instanceProfile_rebootAfterUse :: Lens.Lens' InstanceProfile (Prelude.Maybe Prelude.Bool)
instanceProfile_rebootAfterUse :: Lens' InstanceProfile (Maybe Bool)
instanceProfile_rebootAfterUse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceProfile' {Maybe Bool
rebootAfterUse :: Maybe Bool
$sel:rebootAfterUse:InstanceProfile' :: InstanceProfile -> Maybe Bool
rebootAfterUse} -> Maybe Bool
rebootAfterUse) (\s :: InstanceProfile
s@InstanceProfile' {} Maybe Bool
a -> InstanceProfile
s {$sel:rebootAfterUse:InstanceProfile' :: Maybe Bool
rebootAfterUse = Maybe Bool
a} :: InstanceProfile)

instance Data.FromJSON InstanceProfile where
  parseJSON :: Value -> Parser InstanceProfile
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InstanceProfile"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> InstanceProfile
InstanceProfile'
            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
"description")
            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
"excludeAppPackagesFromCleanup"
                            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
"name")
            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
"packageCleanup")
            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
"rebootAfterUse")
      )

instance Prelude.Hashable InstanceProfile where
  hashWithSalt :: Int -> InstanceProfile -> Int
hashWithSalt Int
_salt InstanceProfile' {Maybe Bool
Maybe [Text]
Maybe Text
rebootAfterUse :: Maybe Bool
packageCleanup :: Maybe Bool
name :: Maybe Text
excludeAppPackagesFromCleanup :: Maybe [Text]
description :: Maybe Text
arn :: Maybe Text
$sel:rebootAfterUse:InstanceProfile' :: InstanceProfile -> Maybe Bool
$sel:packageCleanup:InstanceProfile' :: InstanceProfile -> Maybe Bool
$sel:name:InstanceProfile' :: InstanceProfile -> Maybe Text
$sel:excludeAppPackagesFromCleanup:InstanceProfile' :: InstanceProfile -> Maybe [Text]
$sel:description:InstanceProfile' :: InstanceProfile -> Maybe Text
$sel:arn:InstanceProfile' :: InstanceProfile -> 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
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
excludeAppPackagesFromCleanup
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
packageCleanup
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
rebootAfterUse

instance Prelude.NFData InstanceProfile where
  rnf :: InstanceProfile -> ()
rnf InstanceProfile' {Maybe Bool
Maybe [Text]
Maybe Text
rebootAfterUse :: Maybe Bool
packageCleanup :: Maybe Bool
name :: Maybe Text
excludeAppPackagesFromCleanup :: Maybe [Text]
description :: Maybe Text
arn :: Maybe Text
$sel:rebootAfterUse:InstanceProfile' :: InstanceProfile -> Maybe Bool
$sel:packageCleanup:InstanceProfile' :: InstanceProfile -> Maybe Bool
$sel:name:InstanceProfile' :: InstanceProfile -> Maybe Text
$sel:excludeAppPackagesFromCleanup:InstanceProfile' :: InstanceProfile -> Maybe [Text]
$sel:description:InstanceProfile' :: InstanceProfile -> Maybe Text
$sel:arn:InstanceProfile' :: InstanceProfile -> 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
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
excludeAppPackagesFromCleanup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
packageCleanup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
rebootAfterUse