{-# 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.Inspector.Types.TelemetryMetadata
-- 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.Inspector.Types.TelemetryMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The metadata about the Amazon Inspector application data metrics
-- collected by the agent. This data type is used as the response element
-- in the GetTelemetryMetadata action.
--
-- /See:/ 'newTelemetryMetadata' smart constructor.
data TelemetryMetadata = TelemetryMetadata'
  { -- | The data size of messages that the agent sends to the Amazon Inspector
    -- service.
    TelemetryMetadata -> Maybe Integer
dataSize :: Prelude.Maybe Prelude.Integer,
    -- | A specific type of behavioral data that is collected by the agent.
    TelemetryMetadata -> Text
messageType :: Prelude.Text,
    -- | The count of messages that the agent sends to the Amazon Inspector
    -- service.
    TelemetryMetadata -> Integer
count :: Prelude.Integer
  }
  deriving (TelemetryMetadata -> TelemetryMetadata -> Bool
(TelemetryMetadata -> TelemetryMetadata -> Bool)
-> (TelemetryMetadata -> TelemetryMetadata -> Bool)
-> Eq TelemetryMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TelemetryMetadata -> TelemetryMetadata -> Bool
$c/= :: TelemetryMetadata -> TelemetryMetadata -> Bool
== :: TelemetryMetadata -> TelemetryMetadata -> Bool
$c== :: TelemetryMetadata -> TelemetryMetadata -> Bool
Prelude.Eq, ReadPrec [TelemetryMetadata]
ReadPrec TelemetryMetadata
Int -> ReadS TelemetryMetadata
ReadS [TelemetryMetadata]
(Int -> ReadS TelemetryMetadata)
-> ReadS [TelemetryMetadata]
-> ReadPrec TelemetryMetadata
-> ReadPrec [TelemetryMetadata]
-> Read TelemetryMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TelemetryMetadata]
$creadListPrec :: ReadPrec [TelemetryMetadata]
readPrec :: ReadPrec TelemetryMetadata
$creadPrec :: ReadPrec TelemetryMetadata
readList :: ReadS [TelemetryMetadata]
$creadList :: ReadS [TelemetryMetadata]
readsPrec :: Int -> ReadS TelemetryMetadata
$creadsPrec :: Int -> ReadS TelemetryMetadata
Prelude.Read, Int -> TelemetryMetadata -> ShowS
[TelemetryMetadata] -> ShowS
TelemetryMetadata -> String
(Int -> TelemetryMetadata -> ShowS)
-> (TelemetryMetadata -> String)
-> ([TelemetryMetadata] -> ShowS)
-> Show TelemetryMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TelemetryMetadata] -> ShowS
$cshowList :: [TelemetryMetadata] -> ShowS
show :: TelemetryMetadata -> String
$cshow :: TelemetryMetadata -> String
showsPrec :: Int -> TelemetryMetadata -> ShowS
$cshowsPrec :: Int -> TelemetryMetadata -> ShowS
Prelude.Show, (forall x. TelemetryMetadata -> Rep TelemetryMetadata x)
-> (forall x. Rep TelemetryMetadata x -> TelemetryMetadata)
-> Generic TelemetryMetadata
forall x. Rep TelemetryMetadata x -> TelemetryMetadata
forall x. TelemetryMetadata -> Rep TelemetryMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TelemetryMetadata x -> TelemetryMetadata
$cfrom :: forall x. TelemetryMetadata -> Rep TelemetryMetadata x
Prelude.Generic)

-- |
-- Create a value of 'TelemetryMetadata' 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:
--
-- 'dataSize', 'telemetryMetadata_dataSize' - The data size of messages that the agent sends to the Amazon Inspector
-- service.
--
-- 'messageType', 'telemetryMetadata_messageType' - A specific type of behavioral data that is collected by the agent.
--
-- 'count', 'telemetryMetadata_count' - The count of messages that the agent sends to the Amazon Inspector
-- service.
newTelemetryMetadata ::
  -- | 'messageType'
  Prelude.Text ->
  -- | 'count'
  Prelude.Integer ->
  TelemetryMetadata
newTelemetryMetadata :: Text -> Integer -> TelemetryMetadata
newTelemetryMetadata Text
pMessageType_ Integer
pCount_ =
  TelemetryMetadata' :: Maybe Integer -> Text -> Integer -> TelemetryMetadata
TelemetryMetadata'
    { $sel:dataSize:TelemetryMetadata' :: Maybe Integer
dataSize = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:messageType:TelemetryMetadata' :: Text
messageType = Text
pMessageType_,
      $sel:count:TelemetryMetadata' :: Integer
count = Integer
pCount_
    }

-- | The data size of messages that the agent sends to the Amazon Inspector
-- service.
telemetryMetadata_dataSize :: Lens.Lens' TelemetryMetadata (Prelude.Maybe Prelude.Integer)
telemetryMetadata_dataSize :: (Maybe Integer -> f (Maybe Integer))
-> TelemetryMetadata -> f TelemetryMetadata
telemetryMetadata_dataSize = (TelemetryMetadata -> Maybe Integer)
-> (TelemetryMetadata -> Maybe Integer -> TelemetryMetadata)
-> Lens
     TelemetryMetadata TelemetryMetadata (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TelemetryMetadata' {Maybe Integer
dataSize :: Maybe Integer
$sel:dataSize:TelemetryMetadata' :: TelemetryMetadata -> Maybe Integer
dataSize} -> Maybe Integer
dataSize) (\s :: TelemetryMetadata
s@TelemetryMetadata' {} Maybe Integer
a -> TelemetryMetadata
s {$sel:dataSize:TelemetryMetadata' :: Maybe Integer
dataSize = Maybe Integer
a} :: TelemetryMetadata)

-- | A specific type of behavioral data that is collected by the agent.
telemetryMetadata_messageType :: Lens.Lens' TelemetryMetadata Prelude.Text
telemetryMetadata_messageType :: (Text -> f Text) -> TelemetryMetadata -> f TelemetryMetadata
telemetryMetadata_messageType = (TelemetryMetadata -> Text)
-> (TelemetryMetadata -> Text -> TelemetryMetadata)
-> Lens TelemetryMetadata TelemetryMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TelemetryMetadata' {Text
messageType :: Text
$sel:messageType:TelemetryMetadata' :: TelemetryMetadata -> Text
messageType} -> Text
messageType) (\s :: TelemetryMetadata
s@TelemetryMetadata' {} Text
a -> TelemetryMetadata
s {$sel:messageType:TelemetryMetadata' :: Text
messageType = Text
a} :: TelemetryMetadata)

-- | The count of messages that the agent sends to the Amazon Inspector
-- service.
telemetryMetadata_count :: Lens.Lens' TelemetryMetadata Prelude.Integer
telemetryMetadata_count :: (Integer -> f Integer) -> TelemetryMetadata -> f TelemetryMetadata
telemetryMetadata_count = (TelemetryMetadata -> Integer)
-> (TelemetryMetadata -> Integer -> TelemetryMetadata)
-> Lens TelemetryMetadata TelemetryMetadata Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TelemetryMetadata' {Integer
count :: Integer
$sel:count:TelemetryMetadata' :: TelemetryMetadata -> Integer
count} -> Integer
count) (\s :: TelemetryMetadata
s@TelemetryMetadata' {} Integer
a -> TelemetryMetadata
s {$sel:count:TelemetryMetadata' :: Integer
count = Integer
a} :: TelemetryMetadata)

instance Core.FromJSON TelemetryMetadata where
  parseJSON :: Value -> Parser TelemetryMetadata
parseJSON =
    String
-> (Object -> Parser TelemetryMetadata)
-> Value
-> Parser TelemetryMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TelemetryMetadata"
      ( \Object
x ->
          Maybe Integer -> Text -> Integer -> TelemetryMetadata
TelemetryMetadata'
            (Maybe Integer -> Text -> Integer -> TelemetryMetadata)
-> Parser (Maybe Integer)
-> Parser (Text -> Integer -> TelemetryMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dataSize")
            Parser (Text -> Integer -> TelemetryMetadata)
-> Parser Text -> Parser (Integer -> TelemetryMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"messageType")
            Parser (Integer -> TelemetryMetadata)
-> Parser Integer -> Parser TelemetryMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"count")
      )

instance Prelude.Hashable TelemetryMetadata

instance Prelude.NFData TelemetryMetadata