{-# 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.Source
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.RobOMaker.Types.Source where

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

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

-- |
-- Create a value of 'Source' 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:
--
-- 'architecture', 'source_architecture' - The taget processor architecture for the application.
--
-- 'etag', 'source_etag' - A hash of the object specified by @s3Bucket@ and @s3Key@.
--
-- 's3Bucket', 'source_s3Bucket' - The s3 bucket name.
--
-- 's3Key', 'source_s3Key' - The s3 object key.
newSource ::
  Source
newSource :: Source
newSource =
  Source'
    { $sel:architecture:Source' :: Maybe Architecture
architecture = forall a. Maybe a
Prelude.Nothing,
      $sel:etag:Source' :: Maybe Text
etag = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Bucket:Source' :: Maybe Text
s3Bucket = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Key:Source' :: Maybe Text
s3Key = forall a. Maybe a
Prelude.Nothing
    }

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

-- | A hash of the object specified by @s3Bucket@ and @s3Key@.
source_etag :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_etag :: Lens' Source (Maybe Text)
source_etag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
etag :: Maybe Text
$sel:etag:Source' :: Source -> Maybe Text
etag} -> Maybe Text
etag) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:etag:Source' :: Maybe Text
etag = Maybe Text
a} :: Source)

-- | The s3 bucket name.
source_s3Bucket :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_s3Bucket :: Lens' Source (Maybe Text)
source_s3Bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
s3Bucket :: Maybe Text
$sel:s3Bucket:Source' :: Source -> Maybe Text
s3Bucket} -> Maybe Text
s3Bucket) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:s3Bucket:Source' :: Maybe Text
s3Bucket = Maybe Text
a} :: Source)

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

instance Data.FromJSON Source where
  parseJSON :: Value -> Parser Source
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Source"
      ( \Object
x ->
          Maybe Architecture
-> Maybe Text -> Maybe Text -> Maybe Text -> Source
Source'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"architecture")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"etag")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"s3Bucket")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"s3Key")
      )

instance Prelude.Hashable Source where
  hashWithSalt :: Int -> Source -> Int
hashWithSalt Int
_salt Source' {Maybe Text
Maybe Architecture
s3Key :: Maybe Text
s3Bucket :: Maybe Text
etag :: Maybe Text
architecture :: Maybe Architecture
$sel:s3Key:Source' :: Source -> Maybe Text
$sel:s3Bucket:Source' :: Source -> Maybe Text
$sel:etag:Source' :: Source -> Maybe Text
$sel:architecture:Source' :: Source -> Maybe Architecture
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Architecture
architecture
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
etag
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Key

instance Prelude.NFData Source where
  rnf :: Source -> ()
rnf Source' {Maybe Text
Maybe Architecture
s3Key :: Maybe Text
s3Bucket :: Maybe Text
etag :: Maybe Text
architecture :: Maybe Architecture
$sel:s3Key:Source' :: Source -> Maybe Text
$sel:s3Bucket:Source' :: Source -> Maybe Text
$sel:etag:Source' :: Source -> Maybe Text
$sel:architecture:Source' :: Source -> Maybe Architecture
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Architecture
architecture
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
etag
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Key