{-# 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.LookoutEquipment.Types.InferenceS3InputConfiguration
-- 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.LookoutEquipment.Types.InferenceS3InputConfiguration where

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

-- | Specifies configuration information for the input data for the
-- inference, including input data S3 location.
--
-- /See:/ 'newInferenceS3InputConfiguration' smart constructor.
data InferenceS3InputConfiguration = InferenceS3InputConfiguration'
  { -- | The prefix for the S3 bucket used for the input data for the inference.
    InferenceS3InputConfiguration -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | The bucket containing the input dataset for the inference.
    InferenceS3InputConfiguration -> Text
bucket :: Prelude.Text
  }
  deriving (InferenceS3InputConfiguration
-> InferenceS3InputConfiguration -> Bool
(InferenceS3InputConfiguration
 -> InferenceS3InputConfiguration -> Bool)
-> (InferenceS3InputConfiguration
    -> InferenceS3InputConfiguration -> Bool)
-> Eq InferenceS3InputConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InferenceS3InputConfiguration
-> InferenceS3InputConfiguration -> Bool
$c/= :: InferenceS3InputConfiguration
-> InferenceS3InputConfiguration -> Bool
== :: InferenceS3InputConfiguration
-> InferenceS3InputConfiguration -> Bool
$c== :: InferenceS3InputConfiguration
-> InferenceS3InputConfiguration -> Bool
Prelude.Eq, ReadPrec [InferenceS3InputConfiguration]
ReadPrec InferenceS3InputConfiguration
Int -> ReadS InferenceS3InputConfiguration
ReadS [InferenceS3InputConfiguration]
(Int -> ReadS InferenceS3InputConfiguration)
-> ReadS [InferenceS3InputConfiguration]
-> ReadPrec InferenceS3InputConfiguration
-> ReadPrec [InferenceS3InputConfiguration]
-> Read InferenceS3InputConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InferenceS3InputConfiguration]
$creadListPrec :: ReadPrec [InferenceS3InputConfiguration]
readPrec :: ReadPrec InferenceS3InputConfiguration
$creadPrec :: ReadPrec InferenceS3InputConfiguration
readList :: ReadS [InferenceS3InputConfiguration]
$creadList :: ReadS [InferenceS3InputConfiguration]
readsPrec :: Int -> ReadS InferenceS3InputConfiguration
$creadsPrec :: Int -> ReadS InferenceS3InputConfiguration
Prelude.Read, Int -> InferenceS3InputConfiguration -> ShowS
[InferenceS3InputConfiguration] -> ShowS
InferenceS3InputConfiguration -> String
(Int -> InferenceS3InputConfiguration -> ShowS)
-> (InferenceS3InputConfiguration -> String)
-> ([InferenceS3InputConfiguration] -> ShowS)
-> Show InferenceS3InputConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InferenceS3InputConfiguration] -> ShowS
$cshowList :: [InferenceS3InputConfiguration] -> ShowS
show :: InferenceS3InputConfiguration -> String
$cshow :: InferenceS3InputConfiguration -> String
showsPrec :: Int -> InferenceS3InputConfiguration -> ShowS
$cshowsPrec :: Int -> InferenceS3InputConfiguration -> ShowS
Prelude.Show, (forall x.
 InferenceS3InputConfiguration
 -> Rep InferenceS3InputConfiguration x)
-> (forall x.
    Rep InferenceS3InputConfiguration x
    -> InferenceS3InputConfiguration)
-> Generic InferenceS3InputConfiguration
forall x.
Rep InferenceS3InputConfiguration x
-> InferenceS3InputConfiguration
forall x.
InferenceS3InputConfiguration
-> Rep InferenceS3InputConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InferenceS3InputConfiguration x
-> InferenceS3InputConfiguration
$cfrom :: forall x.
InferenceS3InputConfiguration
-> Rep InferenceS3InputConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'InferenceS3InputConfiguration' 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:
--
-- 'prefix', 'inferenceS3InputConfiguration_prefix' - The prefix for the S3 bucket used for the input data for the inference.
--
-- 'bucket', 'inferenceS3InputConfiguration_bucket' - The bucket containing the input dataset for the inference.
newInferenceS3InputConfiguration ::
  -- | 'bucket'
  Prelude.Text ->
  InferenceS3InputConfiguration
newInferenceS3InputConfiguration :: Text -> InferenceS3InputConfiguration
newInferenceS3InputConfiguration Text
pBucket_ =
  InferenceS3InputConfiguration' :: Maybe Text -> Text -> InferenceS3InputConfiguration
InferenceS3InputConfiguration'
    { $sel:prefix:InferenceS3InputConfiguration' :: Maybe Text
prefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:InferenceS3InputConfiguration' :: Text
bucket = Text
pBucket_
    }

-- | The prefix for the S3 bucket used for the input data for the inference.
inferenceS3InputConfiguration_prefix :: Lens.Lens' InferenceS3InputConfiguration (Prelude.Maybe Prelude.Text)
inferenceS3InputConfiguration_prefix :: (Maybe Text -> f (Maybe Text))
-> InferenceS3InputConfiguration -> f InferenceS3InputConfiguration
inferenceS3InputConfiguration_prefix = (InferenceS3InputConfiguration -> Maybe Text)
-> (InferenceS3InputConfiguration
    -> Maybe Text -> InferenceS3InputConfiguration)
-> Lens
     InferenceS3InputConfiguration
     InferenceS3InputConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceS3InputConfiguration' {Maybe Text
prefix :: Maybe Text
$sel:prefix:InferenceS3InputConfiguration' :: InferenceS3InputConfiguration -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: InferenceS3InputConfiguration
s@InferenceS3InputConfiguration' {} Maybe Text
a -> InferenceS3InputConfiguration
s {$sel:prefix:InferenceS3InputConfiguration' :: Maybe Text
prefix = Maybe Text
a} :: InferenceS3InputConfiguration)

-- | The bucket containing the input dataset for the inference.
inferenceS3InputConfiguration_bucket :: Lens.Lens' InferenceS3InputConfiguration Prelude.Text
inferenceS3InputConfiguration_bucket :: (Text -> f Text)
-> InferenceS3InputConfiguration -> f InferenceS3InputConfiguration
inferenceS3InputConfiguration_bucket = (InferenceS3InputConfiguration -> Text)
-> (InferenceS3InputConfiguration
    -> Text -> InferenceS3InputConfiguration)
-> Lens
     InferenceS3InputConfiguration
     InferenceS3InputConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceS3InputConfiguration' {Text
bucket :: Text
$sel:bucket:InferenceS3InputConfiguration' :: InferenceS3InputConfiguration -> Text
bucket} -> Text
bucket) (\s :: InferenceS3InputConfiguration
s@InferenceS3InputConfiguration' {} Text
a -> InferenceS3InputConfiguration
s {$sel:bucket:InferenceS3InputConfiguration' :: Text
bucket = Text
a} :: InferenceS3InputConfiguration)

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

instance
  Prelude.Hashable
    InferenceS3InputConfiguration

instance Prelude.NFData InferenceS3InputConfiguration

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