{-# 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.RobOMaker.Types.TemplateLocation
-- 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.RobOMaker.Types.TemplateLocation where

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

-- | Information about a template location.
--
-- /See:/ 'newTemplateLocation' smart constructor.
data TemplateLocation = TemplateLocation'
  { -- | The Amazon S3 bucket name.
    TemplateLocation -> Text
s3Bucket :: Prelude.Text,
    -- | The list of S3 keys identifying the data source files.
    TemplateLocation -> Text
s3Key :: Prelude.Text
  }
  deriving (TemplateLocation -> TemplateLocation -> Bool
(TemplateLocation -> TemplateLocation -> Bool)
-> (TemplateLocation -> TemplateLocation -> Bool)
-> Eq TemplateLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateLocation -> TemplateLocation -> Bool
$c/= :: TemplateLocation -> TemplateLocation -> Bool
== :: TemplateLocation -> TemplateLocation -> Bool
$c== :: TemplateLocation -> TemplateLocation -> Bool
Prelude.Eq, ReadPrec [TemplateLocation]
ReadPrec TemplateLocation
Int -> ReadS TemplateLocation
ReadS [TemplateLocation]
(Int -> ReadS TemplateLocation)
-> ReadS [TemplateLocation]
-> ReadPrec TemplateLocation
-> ReadPrec [TemplateLocation]
-> Read TemplateLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateLocation]
$creadListPrec :: ReadPrec [TemplateLocation]
readPrec :: ReadPrec TemplateLocation
$creadPrec :: ReadPrec TemplateLocation
readList :: ReadS [TemplateLocation]
$creadList :: ReadS [TemplateLocation]
readsPrec :: Int -> ReadS TemplateLocation
$creadsPrec :: Int -> ReadS TemplateLocation
Prelude.Read, Int -> TemplateLocation -> ShowS
[TemplateLocation] -> ShowS
TemplateLocation -> String
(Int -> TemplateLocation -> ShowS)
-> (TemplateLocation -> String)
-> ([TemplateLocation] -> ShowS)
-> Show TemplateLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateLocation] -> ShowS
$cshowList :: [TemplateLocation] -> ShowS
show :: TemplateLocation -> String
$cshow :: TemplateLocation -> String
showsPrec :: Int -> TemplateLocation -> ShowS
$cshowsPrec :: Int -> TemplateLocation -> ShowS
Prelude.Show, (forall x. TemplateLocation -> Rep TemplateLocation x)
-> (forall x. Rep TemplateLocation x -> TemplateLocation)
-> Generic TemplateLocation
forall x. Rep TemplateLocation x -> TemplateLocation
forall x. TemplateLocation -> Rep TemplateLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateLocation x -> TemplateLocation
$cfrom :: forall x. TemplateLocation -> Rep TemplateLocation x
Prelude.Generic)

-- |
-- Create a value of 'TemplateLocation' 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:
--
-- 's3Bucket', 'templateLocation_s3Bucket' - The Amazon S3 bucket name.
--
-- 's3Key', 'templateLocation_s3Key' - The list of S3 keys identifying the data source files.
newTemplateLocation ::
  -- | 's3Bucket'
  Prelude.Text ->
  -- | 's3Key'
  Prelude.Text ->
  TemplateLocation
newTemplateLocation :: Text -> Text -> TemplateLocation
newTemplateLocation Text
pS3Bucket_ Text
pS3Key_ =
  TemplateLocation' :: Text -> Text -> TemplateLocation
TemplateLocation'
    { $sel:s3Bucket:TemplateLocation' :: Text
s3Bucket = Text
pS3Bucket_,
      $sel:s3Key:TemplateLocation' :: Text
s3Key = Text
pS3Key_
    }

-- | The Amazon S3 bucket name.
templateLocation_s3Bucket :: Lens.Lens' TemplateLocation Prelude.Text
templateLocation_s3Bucket :: (Text -> f Text) -> TemplateLocation -> f TemplateLocation
templateLocation_s3Bucket = (TemplateLocation -> Text)
-> (TemplateLocation -> Text -> TemplateLocation)
-> Lens TemplateLocation TemplateLocation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateLocation' {Text
s3Bucket :: Text
$sel:s3Bucket:TemplateLocation' :: TemplateLocation -> Text
s3Bucket} -> Text
s3Bucket) (\s :: TemplateLocation
s@TemplateLocation' {} Text
a -> TemplateLocation
s {$sel:s3Bucket:TemplateLocation' :: Text
s3Bucket = Text
a} :: TemplateLocation)

-- | The list of S3 keys identifying the data source files.
templateLocation_s3Key :: Lens.Lens' TemplateLocation Prelude.Text
templateLocation_s3Key :: (Text -> f Text) -> TemplateLocation -> f TemplateLocation
templateLocation_s3Key = (TemplateLocation -> Text)
-> (TemplateLocation -> Text -> TemplateLocation)
-> Lens TemplateLocation TemplateLocation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateLocation' {Text
s3Key :: Text
$sel:s3Key:TemplateLocation' :: TemplateLocation -> Text
s3Key} -> Text
s3Key) (\s :: TemplateLocation
s@TemplateLocation' {} Text
a -> TemplateLocation
s {$sel:s3Key:TemplateLocation' :: Text
s3Key = Text
a} :: TemplateLocation)

instance Prelude.Hashable TemplateLocation

instance Prelude.NFData TemplateLocation

instance Core.ToJSON TemplateLocation where
  toJSON :: TemplateLocation -> Value
toJSON TemplateLocation' {Text
s3Key :: Text
s3Bucket :: Text
$sel:s3Key:TemplateLocation' :: TemplateLocation -> Text
$sel:s3Bucket:TemplateLocation' :: TemplateLocation -> 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
"s3Bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Bucket),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"s3Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Key)
          ]
      )