{-# 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.SageMaker.Types.S3DataSource
-- 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.SageMaker.Types.S3DataSource 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
import Amazonka.SageMaker.Types.S3DataDistribution
import Amazonka.SageMaker.Types.S3DataType

-- | Describes the S3 data source.
--
-- /See:/ 'newS3DataSource' smart constructor.
data S3DataSource = S3DataSource'
  { -- | A list of one or more attribute names to use that are found in a
    -- specified augmented manifest file.
    S3DataSource -> Maybe [Text]
attributeNames :: Prelude.Maybe [Prelude.Text],
    -- | A list of names of instance groups that get data from the S3 data
    -- source.
    S3DataSource -> Maybe [Text]
instanceGroupNames :: Prelude.Maybe [Prelude.Text],
    -- | If you want SageMaker to replicate the entire dataset on each ML compute
    -- instance that is launched for model training, specify @FullyReplicated@.
    --
    -- If you want SageMaker to replicate a subset of data on each ML compute
    -- instance that is launched for model training, specify @ShardedByS3Key@.
    -- If there are /n/ ML compute instances launched for a training job, each
    -- instance gets approximately 1\//n/ of the number of S3 objects. In this
    -- case, model training on each machine uses only the subset of training
    -- data.
    --
    -- Don\'t choose more ML compute instances for training than available S3
    -- objects. If you do, some nodes won\'t get any data and you will pay for
    -- nodes that aren\'t getting any training data. This applies in both File
    -- and Pipe modes. Keep this in mind when developing algorithms.
    --
    -- In distributed training, where you use multiple ML compute EC2
    -- instances, you might choose @ShardedByS3Key@. If the algorithm requires
    -- copying training data to the ML storage volume (when @TrainingInputMode@
    -- is set to @File@), this copies 1\//n/ of the number of objects.
    S3DataSource -> Maybe S3DataDistribution
s3DataDistributionType :: Prelude.Maybe S3DataDistribution,
    -- | If you choose @S3Prefix@, @S3Uri@ identifies a key name prefix.
    -- SageMaker uses all objects that match the specified key name prefix for
    -- model training.
    --
    -- If you choose @ManifestFile@, @S3Uri@ identifies an object that is a
    -- manifest file containing a list of object keys that you want SageMaker
    -- to use for model training.
    --
    -- If you choose @AugmentedManifestFile@, S3Uri identifies an object that
    -- is an augmented manifest file in JSON lines format. This file contains
    -- the data you want to use for model training. @AugmentedManifestFile@ can
    -- only be used if the Channel\'s input mode is @Pipe@.
    S3DataSource -> S3DataType
s3DataType :: S3DataType,
    -- | Depending on the value specified for the @S3DataType@, identifies either
    -- a key name prefix or a manifest. For example:
    --
    -- -   A key name prefix might look like this:
    --     @s3:\/\/bucketname\/exampleprefix@
    --
    -- -   A manifest might look like this:
    --     @s3:\/\/bucketname\/example.manifest@
    --
    --     A manifest is an S3 object which is a JSON file consisting of an
    --     array of elements. The first element is a prefix which is followed
    --     by one or more suffixes. SageMaker appends the suffix elements to
    --     the prefix to get a full set of @S3Uri@. Note that the prefix must
    --     be a valid non-empty @S3Uri@ that precludes users from specifying a
    --     manifest whose individual @S3Uri@ is sourced from different S3
    --     buckets.
    --
    --     The following code example shows a valid manifest format:
    --
    --     @[ {\"prefix\": \"s3:\/\/customer_bucket\/some\/prefix\/\"},@
    --
    --     @ \"relative\/path\/to\/custdata-1\",@
    --
    --     @ \"relative\/path\/custdata-2\",@
    --
    --     @ ...@
    --
    --     @ \"relative\/path\/custdata-N\"@
    --
    --     @]@
    --
    --     This JSON is equivalent to the following @S3Uri@ list:
    --
    --     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/to\/custdata-1@
    --
    --     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-2@
    --
    --     @...@
    --
    --     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-N@
    --
    --     The complete set of @S3Uri@ in this manifest is the input data for
    --     the channel for this data source. The object that each @S3Uri@
    --     points to must be readable by the IAM role that SageMaker uses to
    --     perform tasks on your behalf.
    S3DataSource -> Text
s3Uri :: Prelude.Text
  }
  deriving (S3DataSource -> S3DataSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3DataSource -> S3DataSource -> Bool
$c/= :: S3DataSource -> S3DataSource -> Bool
== :: S3DataSource -> S3DataSource -> Bool
$c== :: S3DataSource -> S3DataSource -> Bool
Prelude.Eq, ReadPrec [S3DataSource]
ReadPrec S3DataSource
Int -> ReadS S3DataSource
ReadS [S3DataSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3DataSource]
$creadListPrec :: ReadPrec [S3DataSource]
readPrec :: ReadPrec S3DataSource
$creadPrec :: ReadPrec S3DataSource
readList :: ReadS [S3DataSource]
$creadList :: ReadS [S3DataSource]
readsPrec :: Int -> ReadS S3DataSource
$creadsPrec :: Int -> ReadS S3DataSource
Prelude.Read, Int -> S3DataSource -> ShowS
[S3DataSource] -> ShowS
S3DataSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3DataSource] -> ShowS
$cshowList :: [S3DataSource] -> ShowS
show :: S3DataSource -> String
$cshow :: S3DataSource -> String
showsPrec :: Int -> S3DataSource -> ShowS
$cshowsPrec :: Int -> S3DataSource -> ShowS
Prelude.Show, forall x. Rep S3DataSource x -> S3DataSource
forall x. S3DataSource -> Rep S3DataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3DataSource x -> S3DataSource
$cfrom :: forall x. S3DataSource -> Rep S3DataSource x
Prelude.Generic)

-- |
-- Create a value of 'S3DataSource' 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:
--
-- 'attributeNames', 's3DataSource_attributeNames' - A list of one or more attribute names to use that are found in a
-- specified augmented manifest file.
--
-- 'instanceGroupNames', 's3DataSource_instanceGroupNames' - A list of names of instance groups that get data from the S3 data
-- source.
--
-- 's3DataDistributionType', 's3DataSource_s3DataDistributionType' - If you want SageMaker to replicate the entire dataset on each ML compute
-- instance that is launched for model training, specify @FullyReplicated@.
--
-- If you want SageMaker to replicate a subset of data on each ML compute
-- instance that is launched for model training, specify @ShardedByS3Key@.
-- If there are /n/ ML compute instances launched for a training job, each
-- instance gets approximately 1\//n/ of the number of S3 objects. In this
-- case, model training on each machine uses only the subset of training
-- data.
--
-- Don\'t choose more ML compute instances for training than available S3
-- objects. If you do, some nodes won\'t get any data and you will pay for
-- nodes that aren\'t getting any training data. This applies in both File
-- and Pipe modes. Keep this in mind when developing algorithms.
--
-- In distributed training, where you use multiple ML compute EC2
-- instances, you might choose @ShardedByS3Key@. If the algorithm requires
-- copying training data to the ML storage volume (when @TrainingInputMode@
-- is set to @File@), this copies 1\//n/ of the number of objects.
--
-- 's3DataType', 's3DataSource_s3DataType' - If you choose @S3Prefix@, @S3Uri@ identifies a key name prefix.
-- SageMaker uses all objects that match the specified key name prefix for
-- model training.
--
-- If you choose @ManifestFile@, @S3Uri@ identifies an object that is a
-- manifest file containing a list of object keys that you want SageMaker
-- to use for model training.
--
-- If you choose @AugmentedManifestFile@, S3Uri identifies an object that
-- is an augmented manifest file in JSON lines format. This file contains
-- the data you want to use for model training. @AugmentedManifestFile@ can
-- only be used if the Channel\'s input mode is @Pipe@.
--
-- 's3Uri', 's3DataSource_s3Uri' - Depending on the value specified for the @S3DataType@, identifies either
-- a key name prefix or a manifest. For example:
--
-- -   A key name prefix might look like this:
--     @s3:\/\/bucketname\/exampleprefix@
--
-- -   A manifest might look like this:
--     @s3:\/\/bucketname\/example.manifest@
--
--     A manifest is an S3 object which is a JSON file consisting of an
--     array of elements. The first element is a prefix which is followed
--     by one or more suffixes. SageMaker appends the suffix elements to
--     the prefix to get a full set of @S3Uri@. Note that the prefix must
--     be a valid non-empty @S3Uri@ that precludes users from specifying a
--     manifest whose individual @S3Uri@ is sourced from different S3
--     buckets.
--
--     The following code example shows a valid manifest format:
--
--     @[ {\"prefix\": \"s3:\/\/customer_bucket\/some\/prefix\/\"},@
--
--     @ \"relative\/path\/to\/custdata-1\",@
--
--     @ \"relative\/path\/custdata-2\",@
--
--     @ ...@
--
--     @ \"relative\/path\/custdata-N\"@
--
--     @]@
--
--     This JSON is equivalent to the following @S3Uri@ list:
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/to\/custdata-1@
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-2@
--
--     @...@
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-N@
--
--     The complete set of @S3Uri@ in this manifest is the input data for
--     the channel for this data source. The object that each @S3Uri@
--     points to must be readable by the IAM role that SageMaker uses to
--     perform tasks on your behalf.
newS3DataSource ::
  -- | 's3DataType'
  S3DataType ->
  -- | 's3Uri'
  Prelude.Text ->
  S3DataSource
newS3DataSource :: S3DataType -> Text -> S3DataSource
newS3DataSource S3DataType
pS3DataType_ Text
pS3Uri_ =
  S3DataSource'
    { $sel:attributeNames:S3DataSource' :: Maybe [Text]
attributeNames = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceGroupNames:S3DataSource' :: Maybe [Text]
instanceGroupNames = forall a. Maybe a
Prelude.Nothing,
      $sel:s3DataDistributionType:S3DataSource' :: Maybe S3DataDistribution
s3DataDistributionType = forall a. Maybe a
Prelude.Nothing,
      $sel:s3DataType:S3DataSource' :: S3DataType
s3DataType = S3DataType
pS3DataType_,
      $sel:s3Uri:S3DataSource' :: Text
s3Uri = Text
pS3Uri_
    }

-- | A list of one or more attribute names to use that are found in a
-- specified augmented manifest file.
s3DataSource_attributeNames :: Lens.Lens' S3DataSource (Prelude.Maybe [Prelude.Text])
s3DataSource_attributeNames :: Lens' S3DataSource (Maybe [Text])
s3DataSource_attributeNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DataSource' {Maybe [Text]
attributeNames :: Maybe [Text]
$sel:attributeNames:S3DataSource' :: S3DataSource -> Maybe [Text]
attributeNames} -> Maybe [Text]
attributeNames) (\s :: S3DataSource
s@S3DataSource' {} Maybe [Text]
a -> S3DataSource
s {$sel:attributeNames:S3DataSource' :: Maybe [Text]
attributeNames = Maybe [Text]
a} :: S3DataSource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of names of instance groups that get data from the S3 data
-- source.
s3DataSource_instanceGroupNames :: Lens.Lens' S3DataSource (Prelude.Maybe [Prelude.Text])
s3DataSource_instanceGroupNames :: Lens' S3DataSource (Maybe [Text])
s3DataSource_instanceGroupNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DataSource' {Maybe [Text]
instanceGroupNames :: Maybe [Text]
$sel:instanceGroupNames:S3DataSource' :: S3DataSource -> Maybe [Text]
instanceGroupNames} -> Maybe [Text]
instanceGroupNames) (\s :: S3DataSource
s@S3DataSource' {} Maybe [Text]
a -> S3DataSource
s {$sel:instanceGroupNames:S3DataSource' :: Maybe [Text]
instanceGroupNames = Maybe [Text]
a} :: S3DataSource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If you want SageMaker to replicate the entire dataset on each ML compute
-- instance that is launched for model training, specify @FullyReplicated@.
--
-- If you want SageMaker to replicate a subset of data on each ML compute
-- instance that is launched for model training, specify @ShardedByS3Key@.
-- If there are /n/ ML compute instances launched for a training job, each
-- instance gets approximately 1\//n/ of the number of S3 objects. In this
-- case, model training on each machine uses only the subset of training
-- data.
--
-- Don\'t choose more ML compute instances for training than available S3
-- objects. If you do, some nodes won\'t get any data and you will pay for
-- nodes that aren\'t getting any training data. This applies in both File
-- and Pipe modes. Keep this in mind when developing algorithms.
--
-- In distributed training, where you use multiple ML compute EC2
-- instances, you might choose @ShardedByS3Key@. If the algorithm requires
-- copying training data to the ML storage volume (when @TrainingInputMode@
-- is set to @File@), this copies 1\//n/ of the number of objects.
s3DataSource_s3DataDistributionType :: Lens.Lens' S3DataSource (Prelude.Maybe S3DataDistribution)
s3DataSource_s3DataDistributionType :: Lens' S3DataSource (Maybe S3DataDistribution)
s3DataSource_s3DataDistributionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DataSource' {Maybe S3DataDistribution
s3DataDistributionType :: Maybe S3DataDistribution
$sel:s3DataDistributionType:S3DataSource' :: S3DataSource -> Maybe S3DataDistribution
s3DataDistributionType} -> Maybe S3DataDistribution
s3DataDistributionType) (\s :: S3DataSource
s@S3DataSource' {} Maybe S3DataDistribution
a -> S3DataSource
s {$sel:s3DataDistributionType:S3DataSource' :: Maybe S3DataDistribution
s3DataDistributionType = Maybe S3DataDistribution
a} :: S3DataSource)

-- | If you choose @S3Prefix@, @S3Uri@ identifies a key name prefix.
-- SageMaker uses all objects that match the specified key name prefix for
-- model training.
--
-- If you choose @ManifestFile@, @S3Uri@ identifies an object that is a
-- manifest file containing a list of object keys that you want SageMaker
-- to use for model training.
--
-- If you choose @AugmentedManifestFile@, S3Uri identifies an object that
-- is an augmented manifest file in JSON lines format. This file contains
-- the data you want to use for model training. @AugmentedManifestFile@ can
-- only be used if the Channel\'s input mode is @Pipe@.
s3DataSource_s3DataType :: Lens.Lens' S3DataSource S3DataType
s3DataSource_s3DataType :: Lens' S3DataSource S3DataType
s3DataSource_s3DataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DataSource' {S3DataType
s3DataType :: S3DataType
$sel:s3DataType:S3DataSource' :: S3DataSource -> S3DataType
s3DataType} -> S3DataType
s3DataType) (\s :: S3DataSource
s@S3DataSource' {} S3DataType
a -> S3DataSource
s {$sel:s3DataType:S3DataSource' :: S3DataType
s3DataType = S3DataType
a} :: S3DataSource)

-- | Depending on the value specified for the @S3DataType@, identifies either
-- a key name prefix or a manifest. For example:
--
-- -   A key name prefix might look like this:
--     @s3:\/\/bucketname\/exampleprefix@
--
-- -   A manifest might look like this:
--     @s3:\/\/bucketname\/example.manifest@
--
--     A manifest is an S3 object which is a JSON file consisting of an
--     array of elements. The first element is a prefix which is followed
--     by one or more suffixes. SageMaker appends the suffix elements to
--     the prefix to get a full set of @S3Uri@. Note that the prefix must
--     be a valid non-empty @S3Uri@ that precludes users from specifying a
--     manifest whose individual @S3Uri@ is sourced from different S3
--     buckets.
--
--     The following code example shows a valid manifest format:
--
--     @[ {\"prefix\": \"s3:\/\/customer_bucket\/some\/prefix\/\"},@
--
--     @ \"relative\/path\/to\/custdata-1\",@
--
--     @ \"relative\/path\/custdata-2\",@
--
--     @ ...@
--
--     @ \"relative\/path\/custdata-N\"@
--
--     @]@
--
--     This JSON is equivalent to the following @S3Uri@ list:
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/to\/custdata-1@
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-2@
--
--     @...@
--
--     @s3:\/\/customer_bucket\/some\/prefix\/relative\/path\/custdata-N@
--
--     The complete set of @S3Uri@ in this manifest is the input data for
--     the channel for this data source. The object that each @S3Uri@
--     points to must be readable by the IAM role that SageMaker uses to
--     perform tasks on your behalf.
s3DataSource_s3Uri :: Lens.Lens' S3DataSource Prelude.Text
s3DataSource_s3Uri :: Lens' S3DataSource Text
s3DataSource_s3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DataSource' {Text
s3Uri :: Text
$sel:s3Uri:S3DataSource' :: S3DataSource -> Text
s3Uri} -> Text
s3Uri) (\s :: S3DataSource
s@S3DataSource' {} Text
a -> S3DataSource
s {$sel:s3Uri:S3DataSource' :: Text
s3Uri = Text
a} :: S3DataSource)

instance Data.FromJSON S3DataSource where
  parseJSON :: Value -> Parser S3DataSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3DataSource"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text]
-> Maybe S3DataDistribution
-> S3DataType
-> Text
-> S3DataSource
S3DataSource'
            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
"AttributeNames" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"InstanceGroupNames"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"S3DataDistributionType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"S3DataType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"S3Uri")
      )

instance Prelude.Hashable S3DataSource where
  hashWithSalt :: Int -> S3DataSource -> Int
hashWithSalt Int
_salt S3DataSource' {Maybe [Text]
Maybe S3DataDistribution
Text
S3DataType
s3Uri :: Text
s3DataType :: S3DataType
s3DataDistributionType :: Maybe S3DataDistribution
instanceGroupNames :: Maybe [Text]
attributeNames :: Maybe [Text]
$sel:s3Uri:S3DataSource' :: S3DataSource -> Text
$sel:s3DataType:S3DataSource' :: S3DataSource -> S3DataType
$sel:s3DataDistributionType:S3DataSource' :: S3DataSource -> Maybe S3DataDistribution
$sel:instanceGroupNames:S3DataSource' :: S3DataSource -> Maybe [Text]
$sel:attributeNames:S3DataSource' :: S3DataSource -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
attributeNames
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
instanceGroupNames
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3DataDistribution
s3DataDistributionType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3DataType
s3DataType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Uri

instance Prelude.NFData S3DataSource where
  rnf :: S3DataSource -> ()
rnf S3DataSource' {Maybe [Text]
Maybe S3DataDistribution
Text
S3DataType
s3Uri :: Text
s3DataType :: S3DataType
s3DataDistributionType :: Maybe S3DataDistribution
instanceGroupNames :: Maybe [Text]
attributeNames :: Maybe [Text]
$sel:s3Uri:S3DataSource' :: S3DataSource -> Text
$sel:s3DataType:S3DataSource' :: S3DataSource -> S3DataType
$sel:s3DataDistributionType:S3DataSource' :: S3DataSource -> Maybe S3DataDistribution
$sel:instanceGroupNames:S3DataSource' :: S3DataSource -> Maybe [Text]
$sel:attributeNames:S3DataSource' :: S3DataSource -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
attributeNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
instanceGroupNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3DataDistribution
s3DataDistributionType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf S3DataType
s3DataType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3Uri

instance Data.ToJSON S3DataSource where
  toJSON :: S3DataSource -> Value
toJSON S3DataSource' {Maybe [Text]
Maybe S3DataDistribution
Text
S3DataType
s3Uri :: Text
s3DataType :: S3DataType
s3DataDistributionType :: Maybe S3DataDistribution
instanceGroupNames :: Maybe [Text]
attributeNames :: Maybe [Text]
$sel:s3Uri:S3DataSource' :: S3DataSource -> Text
$sel:s3DataType:S3DataSource' :: S3DataSource -> S3DataType
$sel:s3DataDistributionType:S3DataSource' :: S3DataSource -> Maybe S3DataDistribution
$sel:instanceGroupNames:S3DataSource' :: S3DataSource -> Maybe [Text]
$sel:attributeNames:S3DataSource' :: S3DataSource -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AttributeNames" 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]
attributeNames,
            (Key
"InstanceGroupNames" 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]
instanceGroupNames,
            (Key
"S3DataDistributionType" 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 S3DataDistribution
s3DataDistributionType,
            forall a. a -> Maybe a
Prelude.Just (Key
"S3DataType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3DataType
s3DataType),
            forall a. a -> Maybe a
Prelude.Just (Key
"S3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Uri)
          ]
      )