{-# 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.ElasticBeanstalk.Types.SourceConfiguration
-- 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.ElasticBeanstalk.Types.SourceConfiguration where

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

-- | A specification for an environment configuration.
--
-- /See:/ 'newSourceConfiguration' smart constructor.
data SourceConfiguration = SourceConfiguration'
  { -- | The name of the configuration template.
    SourceConfiguration -> Maybe Text
templateName :: Prelude.Maybe Prelude.Text,
    -- | The name of the application associated with the configuration.
    SourceConfiguration -> Maybe Text
applicationName :: Prelude.Maybe Prelude.Text
  }
  deriving (SourceConfiguration -> SourceConfiguration -> Bool
(SourceConfiguration -> SourceConfiguration -> Bool)
-> (SourceConfiguration -> SourceConfiguration -> Bool)
-> Eq SourceConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceConfiguration -> SourceConfiguration -> Bool
$c/= :: SourceConfiguration -> SourceConfiguration -> Bool
== :: SourceConfiguration -> SourceConfiguration -> Bool
$c== :: SourceConfiguration -> SourceConfiguration -> Bool
Prelude.Eq, ReadPrec [SourceConfiguration]
ReadPrec SourceConfiguration
Int -> ReadS SourceConfiguration
ReadS [SourceConfiguration]
(Int -> ReadS SourceConfiguration)
-> ReadS [SourceConfiguration]
-> ReadPrec SourceConfiguration
-> ReadPrec [SourceConfiguration]
-> Read SourceConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceConfiguration]
$creadListPrec :: ReadPrec [SourceConfiguration]
readPrec :: ReadPrec SourceConfiguration
$creadPrec :: ReadPrec SourceConfiguration
readList :: ReadS [SourceConfiguration]
$creadList :: ReadS [SourceConfiguration]
readsPrec :: Int -> ReadS SourceConfiguration
$creadsPrec :: Int -> ReadS SourceConfiguration
Prelude.Read, Int -> SourceConfiguration -> ShowS
[SourceConfiguration] -> ShowS
SourceConfiguration -> String
(Int -> SourceConfiguration -> ShowS)
-> (SourceConfiguration -> String)
-> ([SourceConfiguration] -> ShowS)
-> Show SourceConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceConfiguration] -> ShowS
$cshowList :: [SourceConfiguration] -> ShowS
show :: SourceConfiguration -> String
$cshow :: SourceConfiguration -> String
showsPrec :: Int -> SourceConfiguration -> ShowS
$cshowsPrec :: Int -> SourceConfiguration -> ShowS
Prelude.Show, (forall x. SourceConfiguration -> Rep SourceConfiguration x)
-> (forall x. Rep SourceConfiguration x -> SourceConfiguration)
-> Generic SourceConfiguration
forall x. Rep SourceConfiguration x -> SourceConfiguration
forall x. SourceConfiguration -> Rep SourceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceConfiguration x -> SourceConfiguration
$cfrom :: forall x. SourceConfiguration -> Rep SourceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SourceConfiguration' 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:
--
-- 'templateName', 'sourceConfiguration_templateName' - The name of the configuration template.
--
-- 'applicationName', 'sourceConfiguration_applicationName' - The name of the application associated with the configuration.
newSourceConfiguration ::
  SourceConfiguration
newSourceConfiguration :: SourceConfiguration
newSourceConfiguration =
  SourceConfiguration' :: Maybe Text -> Maybe Text -> SourceConfiguration
SourceConfiguration'
    { $sel:templateName:SourceConfiguration' :: Maybe Text
templateName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationName:SourceConfiguration' :: Maybe Text
applicationName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the configuration template.
sourceConfiguration_templateName :: Lens.Lens' SourceConfiguration (Prelude.Maybe Prelude.Text)
sourceConfiguration_templateName :: (Maybe Text -> f (Maybe Text))
-> SourceConfiguration -> f SourceConfiguration
sourceConfiguration_templateName = (SourceConfiguration -> Maybe Text)
-> (SourceConfiguration -> Maybe Text -> SourceConfiguration)
-> Lens
     SourceConfiguration SourceConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceConfiguration' {Maybe Text
templateName :: Maybe Text
$sel:templateName:SourceConfiguration' :: SourceConfiguration -> Maybe Text
templateName} -> Maybe Text
templateName) (\s :: SourceConfiguration
s@SourceConfiguration' {} Maybe Text
a -> SourceConfiguration
s {$sel:templateName:SourceConfiguration' :: Maybe Text
templateName = Maybe Text
a} :: SourceConfiguration)

-- | The name of the application associated with the configuration.
sourceConfiguration_applicationName :: Lens.Lens' SourceConfiguration (Prelude.Maybe Prelude.Text)
sourceConfiguration_applicationName :: (Maybe Text -> f (Maybe Text))
-> SourceConfiguration -> f SourceConfiguration
sourceConfiguration_applicationName = (SourceConfiguration -> Maybe Text)
-> (SourceConfiguration -> Maybe Text -> SourceConfiguration)
-> Lens
     SourceConfiguration SourceConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceConfiguration' {Maybe Text
applicationName :: Maybe Text
$sel:applicationName:SourceConfiguration' :: SourceConfiguration -> Maybe Text
applicationName} -> Maybe Text
applicationName) (\s :: SourceConfiguration
s@SourceConfiguration' {} Maybe Text
a -> SourceConfiguration
s {$sel:applicationName:SourceConfiguration' :: Maybe Text
applicationName = Maybe Text
a} :: SourceConfiguration)

instance Prelude.Hashable SourceConfiguration

instance Prelude.NFData SourceConfiguration

instance Core.ToQuery SourceConfiguration where
  toQuery :: SourceConfiguration -> QueryString
toQuery SourceConfiguration' {Maybe Text
applicationName :: Maybe Text
templateName :: Maybe Text
$sel:applicationName:SourceConfiguration' :: SourceConfiguration -> Maybe Text
$sel:templateName:SourceConfiguration' :: SourceConfiguration -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"TemplateName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
templateName,
        ByteString
"ApplicationName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
applicationName
      ]