{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTAnalytics.Types.DatasetContentDeliveryDestination where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTAnalytics.Types.IotEventsDestinationConfiguration
import Amazonka.IoTAnalytics.Types.S3DestinationConfiguration
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 IoT
    -- Events.
    DatasetContentDeliveryDestination
-> Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration :: Prelude.Maybe IotEventsDestinationConfiguration,
    -- | Configuration information for delivery of dataset contents to Amazon S3.
    DatasetContentDeliveryDestination
-> Maybe S3DestinationConfiguration
s3DestinationConfiguration :: Prelude.Maybe S3DestinationConfiguration
  }
  deriving (DatasetContentDeliveryDestination
-> DatasetContentDeliveryDestination -> Bool
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]
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
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.
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:
--
-- 'iotEventsDestinationConfiguration', 'datasetContentDeliveryDestination_iotEventsDestinationConfiguration' - Configuration information for delivery of dataset contents to IoT
-- Events.
--
-- 's3DestinationConfiguration', 'datasetContentDeliveryDestination_s3DestinationConfiguration' - Configuration information for delivery of dataset contents to Amazon S3.
newDatasetContentDeliveryDestination ::
  DatasetContentDeliveryDestination
newDatasetContentDeliveryDestination :: DatasetContentDeliveryDestination
newDatasetContentDeliveryDestination =
  DatasetContentDeliveryDestination'
    { $sel:iotEventsDestinationConfiguration:DatasetContentDeliveryDestination' :: Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:s3DestinationConfiguration:DatasetContentDeliveryDestination' :: Maybe S3DestinationConfiguration
s3DestinationConfiguration =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Configuration information for delivery of dataset contents to IoT
-- Events.
datasetContentDeliveryDestination_iotEventsDestinationConfiguration :: Lens.Lens' DatasetContentDeliveryDestination (Prelude.Maybe IotEventsDestinationConfiguration)
datasetContentDeliveryDestination_iotEventsDestinationConfiguration :: Lens'
  DatasetContentDeliveryDestination
  (Maybe IotEventsDestinationConfiguration)
datasetContentDeliveryDestination_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)

-- | Configuration information for delivery of dataset contents to Amazon S3.
datasetContentDeliveryDestination_s3DestinationConfiguration :: Lens.Lens' DatasetContentDeliveryDestination (Prelude.Maybe S3DestinationConfiguration)
datasetContentDeliveryDestination_s3DestinationConfiguration :: Lens'
  DatasetContentDeliveryDestination
  (Maybe S3DestinationConfiguration)
datasetContentDeliveryDestination_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)

instance
  Data.FromJSON
    DatasetContentDeliveryDestination
  where
  parseJSON :: Value -> Parser DatasetContentDeliveryDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DatasetContentDeliveryDestination"
      ( \Object
x ->
          Maybe IotEventsDestinationConfiguration
-> Maybe S3DestinationConfiguration
-> DatasetContentDeliveryDestination
DatasetContentDeliveryDestination'
            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
"iotEventsDestinationConfiguration")
            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
"s3DestinationConfiguration")
      )

instance
  Prelude.Hashable
    DatasetContentDeliveryDestination
  where
  hashWithSalt :: Int -> DatasetContentDeliveryDestination -> Int
hashWithSalt
    Int
_salt
    DatasetContentDeliveryDestination' {Maybe IotEventsDestinationConfiguration
Maybe S3DestinationConfiguration
s3DestinationConfiguration :: Maybe S3DestinationConfiguration
iotEventsDestinationConfiguration :: Maybe IotEventsDestinationConfiguration
$sel:s3DestinationConfiguration:DatasetContentDeliveryDestination' :: DatasetContentDeliveryDestination
-> Maybe S3DestinationConfiguration
$sel:iotEventsDestinationConfiguration:DatasetContentDeliveryDestination' :: DatasetContentDeliveryDestination
-> Maybe IotEventsDestinationConfiguration
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3DestinationConfiguration
s3DestinationConfiguration

instance
  Prelude.NFData
    DatasetContentDeliveryDestination
  where
  rnf :: DatasetContentDeliveryDestination -> ()
rnf DatasetContentDeliveryDestination' {Maybe IotEventsDestinationConfiguration
Maybe S3DestinationConfiguration
s3DestinationConfiguration :: Maybe S3DestinationConfiguration
iotEventsDestinationConfiguration :: Maybe IotEventsDestinationConfiguration
$sel:s3DestinationConfiguration:DatasetContentDeliveryDestination' :: DatasetContentDeliveryDestination
-> Maybe S3DestinationConfiguration
$sel:iotEventsDestinationConfiguration:DatasetContentDeliveryDestination' :: DatasetContentDeliveryDestination
-> Maybe IotEventsDestinationConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe IotEventsDestinationConfiguration
iotEventsDestinationConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3DestinationConfiguration
s3DestinationConfiguration

instance
  Data.ToJSON
    DatasetContentDeliveryDestination
  where
  toJSON :: DatasetContentDeliveryDestination -> Value
toJSON DatasetContentDeliveryDestination' {Maybe IotEventsDestinationConfiguration
Maybe S3DestinationConfiguration
s3DestinationConfiguration :: Maybe S3DestinationConfiguration
iotEventsDestinationConfiguration :: Maybe IotEventsDestinationConfiguration
$sel:s3DestinationConfiguration:DatasetContentDeliveryDestination' :: DatasetContentDeliveryDestination
-> Maybe S3DestinationConfiguration
$sel:iotEventsDestinationConfiguration:DatasetContentDeliveryDestination' :: DatasetContentDeliveryDestination
-> Maybe IotEventsDestinationConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"iotEventsDestinationConfiguration" 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 IotEventsDestinationConfiguration
iotEventsDestinationConfiguration,
            (Key
"s3DestinationConfiguration" 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 S3DestinationConfiguration
s3DestinationConfiguration
          ]
      )