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

import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types.SampleType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a sample of performance data.
--
-- /See:/ 'newSample' smart constructor.
data Sample = Sample'
  { -- | The sample\'s ARN.
    Sample -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The presigned Amazon S3 URL that can be used with a GET request to
    -- download the sample\'s file.
    Sample -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The sample\'s type.
    --
    -- Must be one of the following values:
    --
    -- -   CPU: A CPU sample type. This is expressed as the app processing CPU
    --     time (including child processes) as reported by process, as a
    --     percentage.
    --
    -- -   MEMORY: A memory usage sample type. This is expressed as the total
    --     proportional set size of an app process, in kilobytes.
    --
    -- -   NATIVE_AVG_DRAWTIME
    --
    -- -   NATIVE_FPS
    --
    -- -   NATIVE_FRAMES
    --
    -- -   NATIVE_MAX_DRAWTIME
    --
    -- -   NATIVE_MIN_DRAWTIME
    --
    -- -   OPENGL_AVG_DRAWTIME
    --
    -- -   OPENGL_FPS
    --
    -- -   OPENGL_FRAMES
    --
    -- -   OPENGL_MAX_DRAWTIME
    --
    -- -   OPENGL_MIN_DRAWTIME
    --
    -- -   RX
    --
    -- -   RX_RATE: The total number of bytes per second (TCP and UDP) that are
    --     sent, by app process.
    --
    -- -   THREADS: A threads sample type. This is expressed as the total
    --     number of threads per app process.
    --
    -- -   TX
    --
    -- -   TX_RATE: The total number of bytes per second (TCP and UDP) that are
    --     received, by app process.
    Sample -> Maybe SampleType
type' :: Prelude.Maybe SampleType
  }
  deriving (Sample -> Sample -> Bool
(Sample -> Sample -> Bool)
-> (Sample -> Sample -> Bool) -> Eq Sample
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Sample -> Sample -> Bool
$c/= :: Sample -> Sample -> Bool
== :: Sample -> Sample -> Bool
$c== :: Sample -> Sample -> Bool
Prelude.Eq, ReadPrec [Sample]
ReadPrec Sample
Int -> ReadS Sample
ReadS [Sample]
(Int -> ReadS Sample)
-> ReadS [Sample]
-> ReadPrec Sample
-> ReadPrec [Sample]
-> Read Sample
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Sample]
$creadListPrec :: ReadPrec [Sample]
readPrec :: ReadPrec Sample
$creadPrec :: ReadPrec Sample
readList :: ReadS [Sample]
$creadList :: ReadS [Sample]
readsPrec :: Int -> ReadS Sample
$creadsPrec :: Int -> ReadS Sample
Prelude.Read, Int -> Sample -> ShowS
[Sample] -> ShowS
Sample -> String
(Int -> Sample -> ShowS)
-> (Sample -> String) -> ([Sample] -> ShowS) -> Show Sample
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Sample] -> ShowS
$cshowList :: [Sample] -> ShowS
show :: Sample -> String
$cshow :: Sample -> String
showsPrec :: Int -> Sample -> ShowS
$cshowsPrec :: Int -> Sample -> ShowS
Prelude.Show, (forall x. Sample -> Rep Sample x)
-> (forall x. Rep Sample x -> Sample) -> Generic Sample
forall x. Rep Sample x -> Sample
forall x. Sample -> Rep Sample x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Sample x -> Sample
$cfrom :: forall x. Sample -> Rep Sample x
Prelude.Generic)

-- |
-- Create a value of 'Sample' 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', 'sample_arn' - The sample\'s ARN.
--
-- 'url', 'sample_url' - The presigned Amazon S3 URL that can be used with a GET request to
-- download the sample\'s file.
--
-- 'type'', 'sample_type' - The sample\'s type.
--
-- Must be one of the following values:
--
-- -   CPU: A CPU sample type. This is expressed as the app processing CPU
--     time (including child processes) as reported by process, as a
--     percentage.
--
-- -   MEMORY: A memory usage sample type. This is expressed as the total
--     proportional set size of an app process, in kilobytes.
--
-- -   NATIVE_AVG_DRAWTIME
--
-- -   NATIVE_FPS
--
-- -   NATIVE_FRAMES
--
-- -   NATIVE_MAX_DRAWTIME
--
-- -   NATIVE_MIN_DRAWTIME
--
-- -   OPENGL_AVG_DRAWTIME
--
-- -   OPENGL_FPS
--
-- -   OPENGL_FRAMES
--
-- -   OPENGL_MAX_DRAWTIME
--
-- -   OPENGL_MIN_DRAWTIME
--
-- -   RX
--
-- -   RX_RATE: The total number of bytes per second (TCP and UDP) that are
--     sent, by app process.
--
-- -   THREADS: A threads sample type. This is expressed as the total
--     number of threads per app process.
--
-- -   TX
--
-- -   TX_RATE: The total number of bytes per second (TCP and UDP) that are
--     received, by app process.
newSample ::
  Sample
newSample :: Sample
newSample =
  Sample' :: Maybe Text -> Maybe Text -> Maybe SampleType -> Sample
Sample'
    { $sel:arn:Sample' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:url:Sample' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':Sample' :: Maybe SampleType
type' = Maybe SampleType
forall a. Maybe a
Prelude.Nothing
    }

-- | The sample\'s ARN.
sample_arn :: Lens.Lens' Sample (Prelude.Maybe Prelude.Text)
sample_arn :: (Maybe Text -> f (Maybe Text)) -> Sample -> f Sample
sample_arn = (Sample -> Maybe Text)
-> (Sample -> Maybe Text -> Sample)
-> Lens Sample Sample (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Sample' {Maybe Text
arn :: Maybe Text
$sel:arn:Sample' :: Sample -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Sample
s@Sample' {} Maybe Text
a -> Sample
s {$sel:arn:Sample' :: Maybe Text
arn = Maybe Text
a} :: Sample)

-- | The presigned Amazon S3 URL that can be used with a GET request to
-- download the sample\'s file.
sample_url :: Lens.Lens' Sample (Prelude.Maybe Prelude.Text)
sample_url :: (Maybe Text -> f (Maybe Text)) -> Sample -> f Sample
sample_url = (Sample -> Maybe Text)
-> (Sample -> Maybe Text -> Sample)
-> Lens Sample Sample (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Sample' {Maybe Text
url :: Maybe Text
$sel:url:Sample' :: Sample -> Maybe Text
url} -> Maybe Text
url) (\s :: Sample
s@Sample' {} Maybe Text
a -> Sample
s {$sel:url:Sample' :: Maybe Text
url = Maybe Text
a} :: Sample)

-- | The sample\'s type.
--
-- Must be one of the following values:
--
-- -   CPU: A CPU sample type. This is expressed as the app processing CPU
--     time (including child processes) as reported by process, as a
--     percentage.
--
-- -   MEMORY: A memory usage sample type. This is expressed as the total
--     proportional set size of an app process, in kilobytes.
--
-- -   NATIVE_AVG_DRAWTIME
--
-- -   NATIVE_FPS
--
-- -   NATIVE_FRAMES
--
-- -   NATIVE_MAX_DRAWTIME
--
-- -   NATIVE_MIN_DRAWTIME
--
-- -   OPENGL_AVG_DRAWTIME
--
-- -   OPENGL_FPS
--
-- -   OPENGL_FRAMES
--
-- -   OPENGL_MAX_DRAWTIME
--
-- -   OPENGL_MIN_DRAWTIME
--
-- -   RX
--
-- -   RX_RATE: The total number of bytes per second (TCP and UDP) that are
--     sent, by app process.
--
-- -   THREADS: A threads sample type. This is expressed as the total
--     number of threads per app process.
--
-- -   TX
--
-- -   TX_RATE: The total number of bytes per second (TCP and UDP) that are
--     received, by app process.
sample_type :: Lens.Lens' Sample (Prelude.Maybe SampleType)
sample_type :: (Maybe SampleType -> f (Maybe SampleType)) -> Sample -> f Sample
sample_type = (Sample -> Maybe SampleType)
-> (Sample -> Maybe SampleType -> Sample)
-> Lens Sample Sample (Maybe SampleType) (Maybe SampleType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Sample' {Maybe SampleType
type' :: Maybe SampleType
$sel:type':Sample' :: Sample -> Maybe SampleType
type'} -> Maybe SampleType
type') (\s :: Sample
s@Sample' {} Maybe SampleType
a -> Sample
s {$sel:type':Sample' :: Maybe SampleType
type' = Maybe SampleType
a} :: Sample)

instance Core.FromJSON Sample where
  parseJSON :: Value -> Parser Sample
parseJSON =
    String -> (Object -> Parser Sample) -> Value -> Parser Sample
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Sample"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe SampleType -> Sample
Sample'
            (Maybe Text -> Maybe Text -> Maybe SampleType -> Sample)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe SampleType -> Sample)
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 Text -> Maybe SampleType -> Sample)
-> Parser (Maybe Text) -> Parser (Maybe SampleType -> Sample)
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
"url")
            Parser (Maybe SampleType -> Sample)
-> Parser (Maybe SampleType) -> Parser Sample
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SampleType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
      )

instance Prelude.Hashable Sample

instance Prelude.NFData Sample