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

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

-- | The value of the variable as a structure that specifies an output file
-- URI.
--
-- /See:/ 'newOutputFileUriValue' smart constructor.
data OutputFileUriValue = OutputFileUriValue'
  { -- | The URI of the location where dataset contents are stored, usually the
    -- URI of a file in an S3 bucket.
    OutputFileUriValue -> Text
fileName :: Prelude.Text
  }
  deriving (OutputFileUriValue -> OutputFileUriValue -> Bool
(OutputFileUriValue -> OutputFileUriValue -> Bool)
-> (OutputFileUriValue -> OutputFileUriValue -> Bool)
-> Eq OutputFileUriValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputFileUriValue -> OutputFileUriValue -> Bool
$c/= :: OutputFileUriValue -> OutputFileUriValue -> Bool
== :: OutputFileUriValue -> OutputFileUriValue -> Bool
$c== :: OutputFileUriValue -> OutputFileUriValue -> Bool
Prelude.Eq, ReadPrec [OutputFileUriValue]
ReadPrec OutputFileUriValue
Int -> ReadS OutputFileUriValue
ReadS [OutputFileUriValue]
(Int -> ReadS OutputFileUriValue)
-> ReadS [OutputFileUriValue]
-> ReadPrec OutputFileUriValue
-> ReadPrec [OutputFileUriValue]
-> Read OutputFileUriValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputFileUriValue]
$creadListPrec :: ReadPrec [OutputFileUriValue]
readPrec :: ReadPrec OutputFileUriValue
$creadPrec :: ReadPrec OutputFileUriValue
readList :: ReadS [OutputFileUriValue]
$creadList :: ReadS [OutputFileUriValue]
readsPrec :: Int -> ReadS OutputFileUriValue
$creadsPrec :: Int -> ReadS OutputFileUriValue
Prelude.Read, Int -> OutputFileUriValue -> ShowS
[OutputFileUriValue] -> ShowS
OutputFileUriValue -> String
(Int -> OutputFileUriValue -> ShowS)
-> (OutputFileUriValue -> String)
-> ([OutputFileUriValue] -> ShowS)
-> Show OutputFileUriValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputFileUriValue] -> ShowS
$cshowList :: [OutputFileUriValue] -> ShowS
show :: OutputFileUriValue -> String
$cshow :: OutputFileUriValue -> String
showsPrec :: Int -> OutputFileUriValue -> ShowS
$cshowsPrec :: Int -> OutputFileUriValue -> ShowS
Prelude.Show, (forall x. OutputFileUriValue -> Rep OutputFileUriValue x)
-> (forall x. Rep OutputFileUriValue x -> OutputFileUriValue)
-> Generic OutputFileUriValue
forall x. Rep OutputFileUriValue x -> OutputFileUriValue
forall x. OutputFileUriValue -> Rep OutputFileUriValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputFileUriValue x -> OutputFileUriValue
$cfrom :: forall x. OutputFileUriValue -> Rep OutputFileUriValue x
Prelude.Generic)

-- |
-- Create a value of 'OutputFileUriValue' 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:
--
-- 'fileName', 'outputFileUriValue_fileName' - The URI of the location where dataset contents are stored, usually the
-- URI of a file in an S3 bucket.
newOutputFileUriValue ::
  -- | 'fileName'
  Prelude.Text ->
  OutputFileUriValue
newOutputFileUriValue :: Text -> OutputFileUriValue
newOutputFileUriValue Text
pFileName_ =
  OutputFileUriValue' :: Text -> OutputFileUriValue
OutputFileUriValue' {$sel:fileName:OutputFileUriValue' :: Text
fileName = Text
pFileName_}

-- | The URI of the location where dataset contents are stored, usually the
-- URI of a file in an S3 bucket.
outputFileUriValue_fileName :: Lens.Lens' OutputFileUriValue Prelude.Text
outputFileUriValue_fileName :: (Text -> f Text) -> OutputFileUriValue -> f OutputFileUriValue
outputFileUriValue_fileName = (OutputFileUriValue -> Text)
-> (OutputFileUriValue -> Text -> OutputFileUriValue)
-> Lens OutputFileUriValue OutputFileUriValue Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputFileUriValue' {Text
fileName :: Text
$sel:fileName:OutputFileUriValue' :: OutputFileUriValue -> Text
fileName} -> Text
fileName) (\s :: OutputFileUriValue
s@OutputFileUriValue' {} Text
a -> OutputFileUriValue
s {$sel:fileName:OutputFileUriValue' :: Text
fileName = Text
a} :: OutputFileUriValue)

instance Core.FromJSON OutputFileUriValue where
  parseJSON :: Value -> Parser OutputFileUriValue
parseJSON =
    String
-> (Object -> Parser OutputFileUriValue)
-> Value
-> Parser OutputFileUriValue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputFileUriValue"
      ( \Object
x ->
          Text -> OutputFileUriValue
OutputFileUriValue'
            (Text -> OutputFileUriValue)
-> Parser Text -> Parser OutputFileUriValue
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"fileName")
      )

instance Prelude.Hashable OutputFileUriValue

instance Prelude.NFData OutputFileUriValue

instance Core.ToJSON OutputFileUriValue where
  toJSON :: OutputFileUriValue -> Value
toJSON OutputFileUriValue' {Text
fileName :: Text
$sel:fileName:OutputFileUriValue' :: OutputFileUriValue -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"fileName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fileName)]
      )