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

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.Types.IotEventsDestinationConfiguration
import Amazonka.IoTAnalytics.Types.S3DestinationConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The destination to which dataset contents are delivered.
--
-- /See:/ 'newDatasetContentDeliveryDestination' smart constructor.
data DatasetContentDeliveryDestination = DatasetContentDeliveryDestination'
  { -- | Configuration information for delivery of dataset contents to Amazon S3.
    DatasetContentDeliveryDestination
-> Maybe S3DestinationConfiguration
s3DestinationConfiguration :: Prelude.Maybe S3DestinationConfiguration,
    -- | Configuration information for delivery of dataset contents to IoT
    -- Events.
    DatasetContentDeliveryDestination
-> Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration :: Prelude.Maybe IotEventsDestinationConfiguration
  }
  deriving (DatasetContentDeliveryDestination
-> DatasetContentDeliveryDestination -> Bool
(DatasetContentDeliveryDestination
 -> DatasetContentDeliveryDestination -> Bool)
-> (DatasetContentDeliveryDestination
    -> DatasetContentDeliveryDestination -> Bool)
-> Eq DatasetContentDeliveryDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatasetContentDeliveryDestination
-> DatasetContentDeliveryDestination -> Bool
$c/= :: DatasetContentDeliveryDestination
-> DatasetContentDeliveryDestination -> Bool
== :: DatasetContentDeliveryDestination
-> DatasetContentDeliveryDestination -> Bool
$c== :: DatasetContentDeliveryDestination
-> DatasetContentDeliveryDestination -> Bool
Prelude.Eq, ReadPrec [DatasetContentDeliveryDestination]
ReadPrec DatasetContentDeliveryDestination
Int -> ReadS DatasetContentDeliveryDestination
ReadS [DatasetContentDeliveryDestination]
(Int -> ReadS DatasetContentDeliveryDestination)
-> ReadS [DatasetContentDeliveryDestination]
-> ReadPrec DatasetContentDeliveryDestination
-> ReadPrec [DatasetContentDeliveryDestination]
-> Read DatasetContentDeliveryDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatasetContentDeliveryDestination]
$creadListPrec :: ReadPrec [DatasetContentDeliveryDestination]
readPrec :: ReadPrec DatasetContentDeliveryDestination
$creadPrec :: ReadPrec DatasetContentDeliveryDestination
readList :: ReadS [DatasetContentDeliveryDestination]
$creadList :: ReadS [DatasetContentDeliveryDestination]
readsPrec :: Int -> ReadS DatasetContentDeliveryDestination
$creadsPrec :: Int -> ReadS DatasetContentDeliveryDestination
Prelude.Read, Int -> DatasetContentDeliveryDestination -> ShowS
[DatasetContentDeliveryDestination] -> ShowS
DatasetContentDeliveryDestination -> String
(Int -> DatasetContentDeliveryDestination -> ShowS)
-> (DatasetContentDeliveryDestination -> String)
-> ([DatasetContentDeliveryDestination] -> ShowS)
-> Show DatasetContentDeliveryDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatasetContentDeliveryDestination] -> ShowS
$cshowList :: [DatasetContentDeliveryDestination] -> ShowS
show :: DatasetContentDeliveryDestination -> String
$cshow :: DatasetContentDeliveryDestination -> String
showsPrec :: Int -> DatasetContentDeliveryDestination -> ShowS
$cshowsPrec :: Int -> DatasetContentDeliveryDestination -> ShowS
Prelude.Show, (forall x.
 DatasetContentDeliveryDestination
 -> Rep DatasetContentDeliveryDestination x)
-> (forall x.
    Rep DatasetContentDeliveryDestination x
    -> DatasetContentDeliveryDestination)
-> Generic DatasetContentDeliveryDestination
forall x.
Rep DatasetContentDeliveryDestination x
-> DatasetContentDeliveryDestination
forall x.
DatasetContentDeliveryDestination
-> Rep DatasetContentDeliveryDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DatasetContentDeliveryDestination x
-> DatasetContentDeliveryDestination
$cfrom :: forall x.
DatasetContentDeliveryDestination
-> Rep DatasetContentDeliveryDestination x
Prelude.Generic)

-- |
-- Create a value of 'DatasetContentDeliveryDestination' 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:
--
-- 's3DestinationConfiguration', 'datasetContentDeliveryDestination_s3DestinationConfiguration' - Configuration information for delivery of dataset contents to Amazon S3.
--
-- 'iotEventsDestinationConfiguration', 'datasetContentDeliveryDestination_iotEventsDestinationConfiguration' - Configuration information for delivery of dataset contents to IoT
-- Events.
newDatasetContentDeliveryDestination ::
  DatasetContentDeliveryDestination
newDatasetContentDeliveryDestination :: DatasetContentDeliveryDestination
newDatasetContentDeliveryDestination =
  DatasetContentDeliveryDestination' :: Maybe S3DestinationConfiguration
-> Maybe IotEventsDestinationConfiguration
-> DatasetContentDeliveryDestination
DatasetContentDeliveryDestination'
    { $sel:s3DestinationConfiguration:DatasetContentDeliveryDestination' :: Maybe S3DestinationConfiguration
s3DestinationConfiguration =
        Maybe S3DestinationConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:iotEventsDestinationConfiguration:DatasetContentDeliveryDestination' :: Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration =
        Maybe IotEventsDestinationConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | Configuration information for delivery of dataset contents to Amazon S3.
datasetContentDeliveryDestination_s3DestinationConfiguration :: Lens.Lens' DatasetContentDeliveryDestination (Prelude.Maybe S3DestinationConfiguration)
datasetContentDeliveryDestination_s3DestinationConfiguration :: (Maybe S3DestinationConfiguration
 -> f (Maybe S3DestinationConfiguration))
-> DatasetContentDeliveryDestination
-> f DatasetContentDeliveryDestination
datasetContentDeliveryDestination_s3DestinationConfiguration = (DatasetContentDeliveryDestination
 -> Maybe S3DestinationConfiguration)
-> (DatasetContentDeliveryDestination
    -> Maybe S3DestinationConfiguration
    -> DatasetContentDeliveryDestination)
-> Lens
     DatasetContentDeliveryDestination
     DatasetContentDeliveryDestination
     (Maybe S3DestinationConfiguration)
     (Maybe S3DestinationConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetContentDeliveryDestination' {Maybe S3DestinationConfiguration
s3DestinationConfiguration :: Maybe S3DestinationConfiguration
$sel:s3DestinationConfiguration:DatasetContentDeliveryDestination' :: DatasetContentDeliveryDestination
-> Maybe S3DestinationConfiguration
s3DestinationConfiguration} -> Maybe S3DestinationConfiguration
s3DestinationConfiguration) (\s :: DatasetContentDeliveryDestination
s@DatasetContentDeliveryDestination' {} Maybe S3DestinationConfiguration
a -> DatasetContentDeliveryDestination
s {$sel:s3DestinationConfiguration:DatasetContentDeliveryDestination' :: Maybe S3DestinationConfiguration
s3DestinationConfiguration = Maybe S3DestinationConfiguration
a} :: DatasetContentDeliveryDestination)

-- | Configuration information for delivery of dataset contents to IoT
-- Events.
datasetContentDeliveryDestination_iotEventsDestinationConfiguration :: Lens.Lens' DatasetContentDeliveryDestination (Prelude.Maybe IotEventsDestinationConfiguration)
datasetContentDeliveryDestination_iotEventsDestinationConfiguration :: (Maybe IotEventsDestinationConfiguration
 -> f (Maybe IotEventsDestinationConfiguration))
-> DatasetContentDeliveryDestination
-> f DatasetContentDeliveryDestination
datasetContentDeliveryDestination_iotEventsDestinationConfiguration = (DatasetContentDeliveryDestination
 -> Maybe IotEventsDestinationConfiguration)
-> (DatasetContentDeliveryDestination
    -> Maybe IotEventsDestinationConfiguration
    -> DatasetContentDeliveryDestination)
-> Lens
     DatasetContentDeliveryDestination
     DatasetContentDeliveryDestination
     (Maybe IotEventsDestinationConfiguration)
     (Maybe IotEventsDestinationConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetContentDeliveryDestination' {Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration :: Maybe IotEventsDestinationConfiguration
$sel:iotEventsDestinationConfiguration:DatasetContentDeliveryDestination' :: DatasetContentDeliveryDestination
-> Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration} -> Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration) (\s :: DatasetContentDeliveryDestination
s@DatasetContentDeliveryDestination' {} Maybe IotEventsDestinationConfiguration
a -> DatasetContentDeliveryDestination
s {$sel:iotEventsDestinationConfiguration:DatasetContentDeliveryDestination' :: Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration = Maybe IotEventsDestinationConfiguration
a} :: DatasetContentDeliveryDestination)

instance
  Core.FromJSON
    DatasetContentDeliveryDestination
  where
  parseJSON :: Value -> Parser DatasetContentDeliveryDestination
parseJSON =
    String
-> (Object -> Parser DatasetContentDeliveryDestination)
-> Value
-> Parser DatasetContentDeliveryDestination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DatasetContentDeliveryDestination"
      ( \Object
x ->
          Maybe S3DestinationConfiguration
-> Maybe IotEventsDestinationConfiguration
-> DatasetContentDeliveryDestination
DatasetContentDeliveryDestination'
            (Maybe S3DestinationConfiguration
 -> Maybe IotEventsDestinationConfiguration
 -> DatasetContentDeliveryDestination)
-> Parser (Maybe S3DestinationConfiguration)
-> Parser
     (Maybe IotEventsDestinationConfiguration
      -> DatasetContentDeliveryDestination)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3DestinationConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3DestinationConfiguration")
            Parser
  (Maybe IotEventsDestinationConfiguration
   -> DatasetContentDeliveryDestination)
-> Parser (Maybe IotEventsDestinationConfiguration)
-> Parser DatasetContentDeliveryDestination
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IotEventsDestinationConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"iotEventsDestinationConfiguration")
      )

instance
  Prelude.Hashable
    DatasetContentDeliveryDestination

instance
  Prelude.NFData
    DatasetContentDeliveryDestination

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