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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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,
    -- | 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,
    -- | 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,
    -- | 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 description of the instance profile.
    InstanceProfile -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (InstanceProfile -> InstanceProfile -> Bool
(InstanceProfile -> InstanceProfile -> Bool)
-> (InstanceProfile -> InstanceProfile -> Bool)
-> Eq InstanceProfile
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]
(Int -> ReadS InstanceProfile)
-> ReadS [InstanceProfile]
-> ReadPrec InstanceProfile
-> ReadPrec [InstanceProfile]
-> Read 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
(Int -> InstanceProfile -> ShowS)
-> (InstanceProfile -> String)
-> ([InstanceProfile] -> ShowS)
-> Show InstanceProfile
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. InstanceProfile -> Rep InstanceProfile x)
-> (forall x. Rep InstanceProfile x -> InstanceProfile)
-> Generic InstanceProfile
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.
--
-- 'rebootAfterUse', 'instanceProfile_rebootAfterUse' - When set to @true@, Device Farm reboots the instance after a test run.
-- The default value is @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.
--
-- '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@.
--
-- 'description', 'instanceProfile_description' - The description of the instance profile.
newInstanceProfile ::
  InstanceProfile
newInstanceProfile :: InstanceProfile
newInstanceProfile =
  InstanceProfile' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe [Text]
-> Maybe Text
-> InstanceProfile
InstanceProfile'
    { $sel:arn:InstanceProfile' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:rebootAfterUse:InstanceProfile' :: Maybe Bool
rebootAfterUse = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:InstanceProfile' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:packageCleanup:InstanceProfile' :: Maybe Bool
packageCleanup = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:excludeAppPackagesFromCleanup:InstanceProfile' :: Maybe [Text]
excludeAppPackagesFromCleanup = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:description:InstanceProfile' :: Maybe Text
description = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> InstanceProfile -> f InstanceProfile
instanceProfile_arn = (InstanceProfile -> Maybe Text)
-> (InstanceProfile -> Maybe Text -> InstanceProfile)
-> Lens InstanceProfile InstanceProfile (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> InstanceProfile -> f InstanceProfile
instanceProfile_rebootAfterUse = (InstanceProfile -> Maybe Bool)
-> (InstanceProfile -> Maybe Bool -> InstanceProfile)
-> Lens InstanceProfile InstanceProfile (Maybe Bool) (Maybe Bool)
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)

-- | The name of the instance profile.
instanceProfile_name :: Lens.Lens' InstanceProfile (Prelude.Maybe Prelude.Text)
instanceProfile_name :: (Maybe Text -> f (Maybe Text))
-> InstanceProfile -> f InstanceProfile
instanceProfile_name = (InstanceProfile -> Maybe Text)
-> (InstanceProfile -> Maybe Text -> InstanceProfile)
-> Lens InstanceProfile InstanceProfile (Maybe Text) (Maybe Text)
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 :: (Maybe Bool -> f (Maybe Bool))
-> InstanceProfile -> f InstanceProfile
instanceProfile_packageCleanup = (InstanceProfile -> Maybe Bool)
-> (InstanceProfile -> Maybe Bool -> InstanceProfile)
-> Lens InstanceProfile InstanceProfile (Maybe Bool) (Maybe Bool)
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)

-- | 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 :: (Maybe [Text] -> f (Maybe [Text]))
-> InstanceProfile -> f InstanceProfile
instanceProfile_excludeAppPackagesFromCleanup = (InstanceProfile -> Maybe [Text])
-> (InstanceProfile -> Maybe [Text] -> InstanceProfile)
-> Lens
     InstanceProfile InstanceProfile (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> InstanceProfile -> f InstanceProfile)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> InstanceProfile
-> f InstanceProfile
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

-- | The description of the instance profile.
instanceProfile_description :: Lens.Lens' InstanceProfile (Prelude.Maybe Prelude.Text)
instanceProfile_description :: (Maybe Text -> f (Maybe Text))
-> InstanceProfile -> f InstanceProfile
instanceProfile_description = (InstanceProfile -> Maybe Text)
-> (InstanceProfile -> Maybe Text -> InstanceProfile)
-> Lens InstanceProfile InstanceProfile (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable InstanceProfile

instance Prelude.NFData InstanceProfile