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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.Architecture

-- | Information about a source configuration.
--
-- /See:/ 'newSourceConfig' smart constructor.
data SourceConfig = SourceConfig'
  { -- | The s3 object key.
    SourceConfig -> Maybe Text
s3Key :: Prelude.Maybe Prelude.Text,
    -- | The target processor architecture for the application.
    SourceConfig -> Maybe Architecture
architecture :: Prelude.Maybe Architecture,
    -- | The Amazon S3 bucket name.
    SourceConfig -> Maybe Text
s3Bucket :: Prelude.Maybe Prelude.Text
  }
  deriving (SourceConfig -> SourceConfig -> Bool
(SourceConfig -> SourceConfig -> Bool)
-> (SourceConfig -> SourceConfig -> Bool) -> Eq SourceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceConfig -> SourceConfig -> Bool
$c/= :: SourceConfig -> SourceConfig -> Bool
== :: SourceConfig -> SourceConfig -> Bool
$c== :: SourceConfig -> SourceConfig -> Bool
Prelude.Eq, ReadPrec [SourceConfig]
ReadPrec SourceConfig
Int -> ReadS SourceConfig
ReadS [SourceConfig]
(Int -> ReadS SourceConfig)
-> ReadS [SourceConfig]
-> ReadPrec SourceConfig
-> ReadPrec [SourceConfig]
-> Read SourceConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceConfig]
$creadListPrec :: ReadPrec [SourceConfig]
readPrec :: ReadPrec SourceConfig
$creadPrec :: ReadPrec SourceConfig
readList :: ReadS [SourceConfig]
$creadList :: ReadS [SourceConfig]
readsPrec :: Int -> ReadS SourceConfig
$creadsPrec :: Int -> ReadS SourceConfig
Prelude.Read, Int -> SourceConfig -> ShowS
[SourceConfig] -> ShowS
SourceConfig -> String
(Int -> SourceConfig -> ShowS)
-> (SourceConfig -> String)
-> ([SourceConfig] -> ShowS)
-> Show SourceConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceConfig] -> ShowS
$cshowList :: [SourceConfig] -> ShowS
show :: SourceConfig -> String
$cshow :: SourceConfig -> String
showsPrec :: Int -> SourceConfig -> ShowS
$cshowsPrec :: Int -> SourceConfig -> ShowS
Prelude.Show, (forall x. SourceConfig -> Rep SourceConfig x)
-> (forall x. Rep SourceConfig x -> SourceConfig)
-> Generic SourceConfig
forall x. Rep SourceConfig x -> SourceConfig
forall x. SourceConfig -> Rep SourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceConfig x -> SourceConfig
$cfrom :: forall x. SourceConfig -> Rep SourceConfig x
Prelude.Generic)

-- |
-- Create a value of 'SourceConfig' 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:
--
-- 's3Key', 'sourceConfig_s3Key' - The s3 object key.
--
-- 'architecture', 'sourceConfig_architecture' - The target processor architecture for the application.
--
-- 's3Bucket', 'sourceConfig_s3Bucket' - The Amazon S3 bucket name.
newSourceConfig ::
  SourceConfig
newSourceConfig :: SourceConfig
newSourceConfig =
  SourceConfig' :: Maybe Text -> Maybe Architecture -> Maybe Text -> SourceConfig
SourceConfig'
    { $sel:s3Key:SourceConfig' :: Maybe Text
s3Key = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:architecture:SourceConfig' :: Maybe Architecture
architecture = Maybe Architecture
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Bucket:SourceConfig' :: Maybe Text
s3Bucket = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The s3 object key.
sourceConfig_s3Key :: Lens.Lens' SourceConfig (Prelude.Maybe Prelude.Text)
sourceConfig_s3Key :: (Maybe Text -> f (Maybe Text)) -> SourceConfig -> f SourceConfig
sourceConfig_s3Key = (SourceConfig -> Maybe Text)
-> (SourceConfig -> Maybe Text -> SourceConfig)
-> Lens SourceConfig SourceConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceConfig' {Maybe Text
s3Key :: Maybe Text
$sel:s3Key:SourceConfig' :: SourceConfig -> Maybe Text
s3Key} -> Maybe Text
s3Key) (\s :: SourceConfig
s@SourceConfig' {} Maybe Text
a -> SourceConfig
s {$sel:s3Key:SourceConfig' :: Maybe Text
s3Key = Maybe Text
a} :: SourceConfig)

-- | The target processor architecture for the application.
sourceConfig_architecture :: Lens.Lens' SourceConfig (Prelude.Maybe Architecture)
sourceConfig_architecture :: (Maybe Architecture -> f (Maybe Architecture))
-> SourceConfig -> f SourceConfig
sourceConfig_architecture = (SourceConfig -> Maybe Architecture)
-> (SourceConfig -> Maybe Architecture -> SourceConfig)
-> Lens
     SourceConfig SourceConfig (Maybe Architecture) (Maybe Architecture)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceConfig' {Maybe Architecture
architecture :: Maybe Architecture
$sel:architecture:SourceConfig' :: SourceConfig -> Maybe Architecture
architecture} -> Maybe Architecture
architecture) (\s :: SourceConfig
s@SourceConfig' {} Maybe Architecture
a -> SourceConfig
s {$sel:architecture:SourceConfig' :: Maybe Architecture
architecture = Maybe Architecture
a} :: SourceConfig)

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

instance Prelude.Hashable SourceConfig

instance Prelude.NFData SourceConfig

instance Core.ToJSON SourceConfig where
  toJSON :: SourceConfig -> Value
toJSON SourceConfig' {Maybe Text
Maybe Architecture
s3Bucket :: Maybe Text
architecture :: Maybe Architecture
s3Key :: Maybe Text
$sel:s3Bucket:SourceConfig' :: SourceConfig -> Maybe Text
$sel:architecture:SourceConfig' :: SourceConfig -> Maybe Architecture
$sel:s3Key:SourceConfig' :: SourceConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"s3Key" 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
s3Key,
            (Text
"architecture" Text -> Architecture -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Architecture -> Pair) -> Maybe Architecture -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Architecture
architecture,
            (Text
"s3Bucket" 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
s3Bucket
          ]
      )