{-# 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-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.Source 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.
--
-- /See:/ 'newSource' smart constructor.
data Source = Source'
  { -- | A hash of the object specified by @s3Bucket@ and @s3Key@.
    Source -> Maybe Text
etag :: Prelude.Maybe Prelude.Text,
    -- | The s3 object key.
    Source -> Maybe Text
s3Key :: Prelude.Maybe Prelude.Text,
    -- | The taget processor architecture for the application.
    Source -> Maybe Architecture
architecture :: Prelude.Maybe Architecture,
    -- | The s3 bucket name.
    Source -> Maybe Text
s3Bucket :: Prelude.Maybe Prelude.Text
  }
  deriving (Source -> Source -> Bool
(Source -> Source -> Bool)
-> (Source -> Source -> Bool) -> Eq Source
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]
(Int -> ReadS Source)
-> ReadS [Source]
-> ReadPrec Source
-> ReadPrec [Source]
-> Read 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
(Int -> Source -> ShowS)
-> (Source -> String) -> ([Source] -> ShowS) -> Show Source
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. Source -> Rep Source x)
-> (forall x. Rep Source x -> Source) -> Generic Source
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:
--
-- 'etag', 'source_etag' - A hash of the object specified by @s3Bucket@ and @s3Key@.
--
-- 's3Key', 'source_s3Key' - The s3 object key.
--
-- 'architecture', 'source_architecture' - The taget processor architecture for the application.
--
-- 's3Bucket', 'source_s3Bucket' - The s3 bucket name.
newSource ::
  Source
newSource :: Source
newSource =
  Source' :: Maybe Text
-> Maybe Text -> Maybe Architecture -> Maybe Text -> Source
Source'
    { $sel:etag:Source' :: Maybe Text
etag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Key:Source' :: Maybe Text
s3Key = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:architecture:Source' :: Maybe Architecture
architecture = Maybe Architecture
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Bucket:Source' :: Maybe Text
s3Bucket = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A hash of the object specified by @s3Bucket@ and @s3Key@.
source_etag :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_etag :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_etag = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
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 object key.
source_s3Key :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_s3Key :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_s3Key = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
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)

-- | The taget processor architecture for the application.
source_architecture :: Lens.Lens' Source (Prelude.Maybe Architecture)
source_architecture :: (Maybe Architecture -> f (Maybe Architecture))
-> Source -> f Source
source_architecture = (Source -> Maybe Architecture)
-> (Source -> Maybe Architecture -> Source)
-> Lens Source Source (Maybe Architecture) (Maybe 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)

-- | The s3 bucket name.
source_s3Bucket :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_s3Bucket :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_s3Bucket = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON Source where
  parseJSON :: Value -> Parser Source
parseJSON =
    String -> (Object -> Parser Source) -> Value -> Parser Source
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Source"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Architecture -> Maybe Text -> Source
Source'
            (Maybe Text
 -> Maybe Text -> Maybe Architecture -> Maybe Text -> Source)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Architecture -> Maybe Text -> Source)
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
"etag")
            Parser (Maybe Text -> Maybe Architecture -> Maybe Text -> Source)
-> Parser (Maybe Text)
-> Parser (Maybe Architecture -> Maybe Text -> Source)
forall (f :: * -> *) a b. Applicative f => 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
"s3Key")
            Parser (Maybe Architecture -> Maybe Text -> Source)
-> Parser (Maybe Architecture) -> Parser (Maybe Text -> Source)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Architecture)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"architecture")
            Parser (Maybe Text -> Source)
-> Parser (Maybe Text) -> Parser Source
forall (f :: * -> *) a b. Applicative f => 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
"s3Bucket")
      )

instance Prelude.Hashable Source

instance Prelude.NFData Source