{-# 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.IoTAnalytics.Types.ChannelMessages
-- 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.IoTAnalytics.Types.ChannelMessages where

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

-- | Specifies one or more sets of channel messages.
--
-- /See:/ 'newChannelMessages' smart constructor.
data ChannelMessages = ChannelMessages'
  { -- | Specifies one or more keys that identify the Amazon Simple Storage
    -- Service (Amazon S3) objects that save your channel messages.
    --
    -- You must use the full path for the key.
    --
    -- Example path:
    -- @channel\/mychannel\/__dt=2020-02-29 00:00:00\/1582940490000_1582940520000_123456789012_mychannel_0_2118.0.json.gz@
    ChannelMessages -> Maybe (NonEmpty Text)
s3Paths :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (ChannelMessages -> ChannelMessages -> Bool
(ChannelMessages -> ChannelMessages -> Bool)
-> (ChannelMessages -> ChannelMessages -> Bool)
-> Eq ChannelMessages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelMessages -> ChannelMessages -> Bool
$c/= :: ChannelMessages -> ChannelMessages -> Bool
== :: ChannelMessages -> ChannelMessages -> Bool
$c== :: ChannelMessages -> ChannelMessages -> Bool
Prelude.Eq, ReadPrec [ChannelMessages]
ReadPrec ChannelMessages
Int -> ReadS ChannelMessages
ReadS [ChannelMessages]
(Int -> ReadS ChannelMessages)
-> ReadS [ChannelMessages]
-> ReadPrec ChannelMessages
-> ReadPrec [ChannelMessages]
-> Read ChannelMessages
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelMessages]
$creadListPrec :: ReadPrec [ChannelMessages]
readPrec :: ReadPrec ChannelMessages
$creadPrec :: ReadPrec ChannelMessages
readList :: ReadS [ChannelMessages]
$creadList :: ReadS [ChannelMessages]
readsPrec :: Int -> ReadS ChannelMessages
$creadsPrec :: Int -> ReadS ChannelMessages
Prelude.Read, Int -> ChannelMessages -> ShowS
[ChannelMessages] -> ShowS
ChannelMessages -> String
(Int -> ChannelMessages -> ShowS)
-> (ChannelMessages -> String)
-> ([ChannelMessages] -> ShowS)
-> Show ChannelMessages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelMessages] -> ShowS
$cshowList :: [ChannelMessages] -> ShowS
show :: ChannelMessages -> String
$cshow :: ChannelMessages -> String
showsPrec :: Int -> ChannelMessages -> ShowS
$cshowsPrec :: Int -> ChannelMessages -> ShowS
Prelude.Show, (forall x. ChannelMessages -> Rep ChannelMessages x)
-> (forall x. Rep ChannelMessages x -> ChannelMessages)
-> Generic ChannelMessages
forall x. Rep ChannelMessages x -> ChannelMessages
forall x. ChannelMessages -> Rep ChannelMessages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelMessages x -> ChannelMessages
$cfrom :: forall x. ChannelMessages -> Rep ChannelMessages x
Prelude.Generic)

-- |
-- Create a value of 'ChannelMessages' 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:
--
-- 's3Paths', 'channelMessages_s3Paths' - Specifies one or more keys that identify the Amazon Simple Storage
-- Service (Amazon S3) objects that save your channel messages.
--
-- You must use the full path for the key.
--
-- Example path:
-- @channel\/mychannel\/__dt=2020-02-29 00:00:00\/1582940490000_1582940520000_123456789012_mychannel_0_2118.0.json.gz@
newChannelMessages ::
  ChannelMessages
newChannelMessages :: ChannelMessages
newChannelMessages =
  ChannelMessages' :: Maybe (NonEmpty Text) -> ChannelMessages
ChannelMessages' {$sel:s3Paths:ChannelMessages' :: Maybe (NonEmpty Text)
s3Paths = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing}

-- | Specifies one or more keys that identify the Amazon Simple Storage
-- Service (Amazon S3) objects that save your channel messages.
--
-- You must use the full path for the key.
--
-- Example path:
-- @channel\/mychannel\/__dt=2020-02-29 00:00:00\/1582940490000_1582940520000_123456789012_mychannel_0_2118.0.json.gz@
channelMessages_s3Paths :: Lens.Lens' ChannelMessages (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
channelMessages_s3Paths :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ChannelMessages -> f ChannelMessages
channelMessages_s3Paths = (ChannelMessages -> Maybe (NonEmpty Text))
-> (ChannelMessages -> Maybe (NonEmpty Text) -> ChannelMessages)
-> Lens
     ChannelMessages
     ChannelMessages
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelMessages' {Maybe (NonEmpty Text)
s3Paths :: Maybe (NonEmpty Text)
$sel:s3Paths:ChannelMessages' :: ChannelMessages -> Maybe (NonEmpty Text)
s3Paths} -> Maybe (NonEmpty Text)
s3Paths) (\s :: ChannelMessages
s@ChannelMessages' {} Maybe (NonEmpty Text)
a -> ChannelMessages
s {$sel:s3Paths:ChannelMessages' :: Maybe (NonEmpty Text)
s3Paths = Maybe (NonEmpty Text)
a} :: ChannelMessages) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ChannelMessages -> f ChannelMessages)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ChannelMessages
-> f ChannelMessages
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable ChannelMessages

instance Prelude.NFData ChannelMessages

instance Core.ToJSON ChannelMessages where
  toJSON :: ChannelMessages -> Value
toJSON ChannelMessages' {Maybe (NonEmpty Text)
s3Paths :: Maybe (NonEmpty Text)
$sel:s3Paths:ChannelMessages' :: ChannelMessages -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"s3Paths" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
s3Paths]
      )