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

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

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

-- |
-- Create a value of 'InferenceS3OutputConfiguration' 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', 'inferenceS3OutputConfiguration_prefix' - The prefix for the S3 bucket used for the output results from the
-- inference.
--
-- 'bucket', 'inferenceS3OutputConfiguration_bucket' - The bucket containing the output results from the inference
newInferenceS3OutputConfiguration ::
  -- | 'bucket'
  Prelude.Text ->
  InferenceS3OutputConfiguration
newInferenceS3OutputConfiguration :: Text -> InferenceS3OutputConfiguration
newInferenceS3OutputConfiguration Text
pBucket_ =
  InferenceS3OutputConfiguration' :: Maybe Text -> Text -> InferenceS3OutputConfiguration
InferenceS3OutputConfiguration'
    { $sel:prefix:InferenceS3OutputConfiguration' :: Maybe Text
prefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:InferenceS3OutputConfiguration' :: Text
bucket = Text
pBucket_
    }

-- | The prefix for the S3 bucket used for the output results from the
-- inference.
inferenceS3OutputConfiguration_prefix :: Lens.Lens' InferenceS3OutputConfiguration (Prelude.Maybe Prelude.Text)
inferenceS3OutputConfiguration_prefix :: (Maybe Text -> f (Maybe Text))
-> InferenceS3OutputConfiguration
-> f InferenceS3OutputConfiguration
inferenceS3OutputConfiguration_prefix = (InferenceS3OutputConfiguration -> Maybe Text)
-> (InferenceS3OutputConfiguration
    -> Maybe Text -> InferenceS3OutputConfiguration)
-> Lens
     InferenceS3OutputConfiguration
     InferenceS3OutputConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceS3OutputConfiguration' {Maybe Text
prefix :: Maybe Text
$sel:prefix:InferenceS3OutputConfiguration' :: InferenceS3OutputConfiguration -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: InferenceS3OutputConfiguration
s@InferenceS3OutputConfiguration' {} Maybe Text
a -> InferenceS3OutputConfiguration
s {$sel:prefix:InferenceS3OutputConfiguration' :: Maybe Text
prefix = Maybe Text
a} :: InferenceS3OutputConfiguration)

-- | The bucket containing the output results from the inference
inferenceS3OutputConfiguration_bucket :: Lens.Lens' InferenceS3OutputConfiguration Prelude.Text
inferenceS3OutputConfiguration_bucket :: (Text -> f Text)
-> InferenceS3OutputConfiguration
-> f InferenceS3OutputConfiguration
inferenceS3OutputConfiguration_bucket = (InferenceS3OutputConfiguration -> Text)
-> (InferenceS3OutputConfiguration
    -> Text -> InferenceS3OutputConfiguration)
-> Lens
     InferenceS3OutputConfiguration
     InferenceS3OutputConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceS3OutputConfiguration' {Text
bucket :: Text
$sel:bucket:InferenceS3OutputConfiguration' :: InferenceS3OutputConfiguration -> Text
bucket} -> Text
bucket) (\s :: InferenceS3OutputConfiguration
s@InferenceS3OutputConfiguration' {} Text
a -> InferenceS3OutputConfiguration
s {$sel:bucket:InferenceS3OutputConfiguration' :: Text
bucket = Text
a} :: InferenceS3OutputConfiguration)

instance Core.FromJSON InferenceS3OutputConfiguration where
  parseJSON :: Value -> Parser InferenceS3OutputConfiguration
parseJSON =
    String
-> (Object -> Parser InferenceS3OutputConfiguration)
-> Value
-> Parser InferenceS3OutputConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InferenceS3OutputConfiguration"
      ( \Object
x ->
          Maybe Text -> Text -> InferenceS3OutputConfiguration
InferenceS3OutputConfiguration'
            (Maybe Text -> Text -> InferenceS3OutputConfiguration)
-> Parser (Maybe Text)
-> Parser (Text -> InferenceS3OutputConfiguration)
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 -> InferenceS3OutputConfiguration)
-> Parser Text -> Parser InferenceS3OutputConfiguration
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
    InferenceS3OutputConfiguration

instance
  Prelude.NFData
    InferenceS3OutputConfiguration

instance Core.ToJSON InferenceS3OutputConfiguration where
  toJSON :: InferenceS3OutputConfiguration -> Value
toJSON InferenceS3OutputConfiguration' {Maybe Text
Text
bucket :: Text
prefix :: Maybe Text
$sel:bucket:InferenceS3OutputConfiguration' :: InferenceS3OutputConfiguration -> Text
$sel:prefix:InferenceS3OutputConfiguration' :: InferenceS3OutputConfiguration -> 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)
          ]
      )