{-# 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.Pipes.Types.PipeTargetCloudWatchLogsParameters
-- 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.Pipes.Types.PipeTargetCloudWatchLogsParameters 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

-- | The parameters for using an CloudWatch Logs log stream as a target.
--
-- /See:/ 'newPipeTargetCloudWatchLogsParameters' smart constructor.
data PipeTargetCloudWatchLogsParameters = PipeTargetCloudWatchLogsParameters'
  { -- | The name of the log stream.
    PipeTargetCloudWatchLogsParameters -> Maybe Text
logStreamName :: Prelude.Maybe Prelude.Text,
    -- | The time the event occurred, expressed as the number of milliseconds
    -- after Jan 1, 1970 00:00:00 UTC.
    PipeTargetCloudWatchLogsParameters -> Maybe Text
timestamp :: Prelude.Maybe Prelude.Text
  }
  deriving (PipeTargetCloudWatchLogsParameters
-> PipeTargetCloudWatchLogsParameters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipeTargetCloudWatchLogsParameters
-> PipeTargetCloudWatchLogsParameters -> Bool
$c/= :: PipeTargetCloudWatchLogsParameters
-> PipeTargetCloudWatchLogsParameters -> Bool
== :: PipeTargetCloudWatchLogsParameters
-> PipeTargetCloudWatchLogsParameters -> Bool
$c== :: PipeTargetCloudWatchLogsParameters
-> PipeTargetCloudWatchLogsParameters -> Bool
Prelude.Eq, ReadPrec [PipeTargetCloudWatchLogsParameters]
ReadPrec PipeTargetCloudWatchLogsParameters
Int -> ReadS PipeTargetCloudWatchLogsParameters
ReadS [PipeTargetCloudWatchLogsParameters]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipeTargetCloudWatchLogsParameters]
$creadListPrec :: ReadPrec [PipeTargetCloudWatchLogsParameters]
readPrec :: ReadPrec PipeTargetCloudWatchLogsParameters
$creadPrec :: ReadPrec PipeTargetCloudWatchLogsParameters
readList :: ReadS [PipeTargetCloudWatchLogsParameters]
$creadList :: ReadS [PipeTargetCloudWatchLogsParameters]
readsPrec :: Int -> ReadS PipeTargetCloudWatchLogsParameters
$creadsPrec :: Int -> ReadS PipeTargetCloudWatchLogsParameters
Prelude.Read, Int -> PipeTargetCloudWatchLogsParameters -> ShowS
[PipeTargetCloudWatchLogsParameters] -> ShowS
PipeTargetCloudWatchLogsParameters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipeTargetCloudWatchLogsParameters] -> ShowS
$cshowList :: [PipeTargetCloudWatchLogsParameters] -> ShowS
show :: PipeTargetCloudWatchLogsParameters -> String
$cshow :: PipeTargetCloudWatchLogsParameters -> String
showsPrec :: Int -> PipeTargetCloudWatchLogsParameters -> ShowS
$cshowsPrec :: Int -> PipeTargetCloudWatchLogsParameters -> ShowS
Prelude.Show, forall x.
Rep PipeTargetCloudWatchLogsParameters x
-> PipeTargetCloudWatchLogsParameters
forall x.
PipeTargetCloudWatchLogsParameters
-> Rep PipeTargetCloudWatchLogsParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PipeTargetCloudWatchLogsParameters x
-> PipeTargetCloudWatchLogsParameters
$cfrom :: forall x.
PipeTargetCloudWatchLogsParameters
-> Rep PipeTargetCloudWatchLogsParameters x
Prelude.Generic)

-- |
-- Create a value of 'PipeTargetCloudWatchLogsParameters' 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:
--
-- 'logStreamName', 'pipeTargetCloudWatchLogsParameters_logStreamName' - The name of the log stream.
--
-- 'timestamp', 'pipeTargetCloudWatchLogsParameters_timestamp' - The time the event occurred, expressed as the number of milliseconds
-- after Jan 1, 1970 00:00:00 UTC.
newPipeTargetCloudWatchLogsParameters ::
  PipeTargetCloudWatchLogsParameters
newPipeTargetCloudWatchLogsParameters :: PipeTargetCloudWatchLogsParameters
newPipeTargetCloudWatchLogsParameters =
  PipeTargetCloudWatchLogsParameters'
    { $sel:logStreamName:PipeTargetCloudWatchLogsParameters' :: Maybe Text
logStreamName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:PipeTargetCloudWatchLogsParameters' :: Maybe Text
timestamp = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the log stream.
pipeTargetCloudWatchLogsParameters_logStreamName :: Lens.Lens' PipeTargetCloudWatchLogsParameters (Prelude.Maybe Prelude.Text)
pipeTargetCloudWatchLogsParameters_logStreamName :: Lens' PipeTargetCloudWatchLogsParameters (Maybe Text)
pipeTargetCloudWatchLogsParameters_logStreamName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipeTargetCloudWatchLogsParameters' {Maybe Text
logStreamName :: Maybe Text
$sel:logStreamName:PipeTargetCloudWatchLogsParameters' :: PipeTargetCloudWatchLogsParameters -> Maybe Text
logStreamName} -> Maybe Text
logStreamName) (\s :: PipeTargetCloudWatchLogsParameters
s@PipeTargetCloudWatchLogsParameters' {} Maybe Text
a -> PipeTargetCloudWatchLogsParameters
s {$sel:logStreamName:PipeTargetCloudWatchLogsParameters' :: Maybe Text
logStreamName = Maybe Text
a} :: PipeTargetCloudWatchLogsParameters)

-- | The time the event occurred, expressed as the number of milliseconds
-- after Jan 1, 1970 00:00:00 UTC.
pipeTargetCloudWatchLogsParameters_timestamp :: Lens.Lens' PipeTargetCloudWatchLogsParameters (Prelude.Maybe Prelude.Text)
pipeTargetCloudWatchLogsParameters_timestamp :: Lens' PipeTargetCloudWatchLogsParameters (Maybe Text)
pipeTargetCloudWatchLogsParameters_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipeTargetCloudWatchLogsParameters' {Maybe Text
timestamp :: Maybe Text
$sel:timestamp:PipeTargetCloudWatchLogsParameters' :: PipeTargetCloudWatchLogsParameters -> Maybe Text
timestamp} -> Maybe Text
timestamp) (\s :: PipeTargetCloudWatchLogsParameters
s@PipeTargetCloudWatchLogsParameters' {} Maybe Text
a -> PipeTargetCloudWatchLogsParameters
s {$sel:timestamp:PipeTargetCloudWatchLogsParameters' :: Maybe Text
timestamp = Maybe Text
a} :: PipeTargetCloudWatchLogsParameters)

instance
  Data.FromJSON
    PipeTargetCloudWatchLogsParameters
  where
  parseJSON :: Value -> Parser PipeTargetCloudWatchLogsParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PipeTargetCloudWatchLogsParameters"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> PipeTargetCloudWatchLogsParameters
PipeTargetCloudWatchLogsParameters'
            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
"LogStreamName")
            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
"Timestamp")
      )

instance
  Prelude.Hashable
    PipeTargetCloudWatchLogsParameters
  where
  hashWithSalt :: Int -> PipeTargetCloudWatchLogsParameters -> Int
hashWithSalt
    Int
_salt
    PipeTargetCloudWatchLogsParameters' {Maybe Text
timestamp :: Maybe Text
logStreamName :: Maybe Text
$sel:timestamp:PipeTargetCloudWatchLogsParameters' :: PipeTargetCloudWatchLogsParameters -> Maybe Text
$sel:logStreamName:PipeTargetCloudWatchLogsParameters' :: PipeTargetCloudWatchLogsParameters -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logStreamName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timestamp

instance
  Prelude.NFData
    PipeTargetCloudWatchLogsParameters
  where
  rnf :: PipeTargetCloudWatchLogsParameters -> ()
rnf PipeTargetCloudWatchLogsParameters' {Maybe Text
timestamp :: Maybe Text
logStreamName :: Maybe Text
$sel:timestamp:PipeTargetCloudWatchLogsParameters' :: PipeTargetCloudWatchLogsParameters -> Maybe Text
$sel:logStreamName:PipeTargetCloudWatchLogsParameters' :: PipeTargetCloudWatchLogsParameters -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logStreamName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timestamp

instance
  Data.ToJSON
    PipeTargetCloudWatchLogsParameters
  where
  toJSON :: PipeTargetCloudWatchLogsParameters -> Value
toJSON PipeTargetCloudWatchLogsParameters' {Maybe Text
timestamp :: Maybe Text
logStreamName :: Maybe Text
$sel:timestamp:PipeTargetCloudWatchLogsParameters' :: PipeTargetCloudWatchLogsParameters -> Maybe Text
$sel:logStreamName:PipeTargetCloudWatchLogsParameters' :: PipeTargetCloudWatchLogsParameters -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"LogStreamName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
logStreamName,
            (Key
"Timestamp" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
timestamp
          ]
      )