{-# 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.SecurityHub.Types.AwsElasticBeanstalkEnvironmentEnvironmentLink
-- 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.SecurityHub.Types.AwsElasticBeanstalkEnvironmentEnvironmentLink where

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

-- | Contains information about a link to another environment that is in the
-- same group.
--
-- /See:/ 'newAwsElasticBeanstalkEnvironmentEnvironmentLink' smart constructor.
data AwsElasticBeanstalkEnvironmentEnvironmentLink = AwsElasticBeanstalkEnvironmentEnvironmentLink'
  { -- | The name of the environment link.
    AwsElasticBeanstalkEnvironmentEnvironmentLink -> Maybe Text
linkName :: Prelude.Maybe Prelude.Text,
    -- | The name of the linked environment.
    AwsElasticBeanstalkEnvironmentEnvironmentLink -> Maybe Text
environmentName :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsElasticBeanstalkEnvironmentEnvironmentLink
-> AwsElasticBeanstalkEnvironmentEnvironmentLink -> Bool
(AwsElasticBeanstalkEnvironmentEnvironmentLink
 -> AwsElasticBeanstalkEnvironmentEnvironmentLink -> Bool)
-> (AwsElasticBeanstalkEnvironmentEnvironmentLink
    -> AwsElasticBeanstalkEnvironmentEnvironmentLink -> Bool)
-> Eq AwsElasticBeanstalkEnvironmentEnvironmentLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsElasticBeanstalkEnvironmentEnvironmentLink
-> AwsElasticBeanstalkEnvironmentEnvironmentLink -> Bool
$c/= :: AwsElasticBeanstalkEnvironmentEnvironmentLink
-> AwsElasticBeanstalkEnvironmentEnvironmentLink -> Bool
== :: AwsElasticBeanstalkEnvironmentEnvironmentLink
-> AwsElasticBeanstalkEnvironmentEnvironmentLink -> Bool
$c== :: AwsElasticBeanstalkEnvironmentEnvironmentLink
-> AwsElasticBeanstalkEnvironmentEnvironmentLink -> Bool
Prelude.Eq, ReadPrec [AwsElasticBeanstalkEnvironmentEnvironmentLink]
ReadPrec AwsElasticBeanstalkEnvironmentEnvironmentLink
Int -> ReadS AwsElasticBeanstalkEnvironmentEnvironmentLink
ReadS [AwsElasticBeanstalkEnvironmentEnvironmentLink]
(Int -> ReadS AwsElasticBeanstalkEnvironmentEnvironmentLink)
-> ReadS [AwsElasticBeanstalkEnvironmentEnvironmentLink]
-> ReadPrec AwsElasticBeanstalkEnvironmentEnvironmentLink
-> ReadPrec [AwsElasticBeanstalkEnvironmentEnvironmentLink]
-> Read AwsElasticBeanstalkEnvironmentEnvironmentLink
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsElasticBeanstalkEnvironmentEnvironmentLink]
$creadListPrec :: ReadPrec [AwsElasticBeanstalkEnvironmentEnvironmentLink]
readPrec :: ReadPrec AwsElasticBeanstalkEnvironmentEnvironmentLink
$creadPrec :: ReadPrec AwsElasticBeanstalkEnvironmentEnvironmentLink
readList :: ReadS [AwsElasticBeanstalkEnvironmentEnvironmentLink]
$creadList :: ReadS [AwsElasticBeanstalkEnvironmentEnvironmentLink]
readsPrec :: Int -> ReadS AwsElasticBeanstalkEnvironmentEnvironmentLink
$creadsPrec :: Int -> ReadS AwsElasticBeanstalkEnvironmentEnvironmentLink
Prelude.Read, Int -> AwsElasticBeanstalkEnvironmentEnvironmentLink -> ShowS
[AwsElasticBeanstalkEnvironmentEnvironmentLink] -> ShowS
AwsElasticBeanstalkEnvironmentEnvironmentLink -> String
(Int -> AwsElasticBeanstalkEnvironmentEnvironmentLink -> ShowS)
-> (AwsElasticBeanstalkEnvironmentEnvironmentLink -> String)
-> ([AwsElasticBeanstalkEnvironmentEnvironmentLink] -> ShowS)
-> Show AwsElasticBeanstalkEnvironmentEnvironmentLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsElasticBeanstalkEnvironmentEnvironmentLink] -> ShowS
$cshowList :: [AwsElasticBeanstalkEnvironmentEnvironmentLink] -> ShowS
show :: AwsElasticBeanstalkEnvironmentEnvironmentLink -> String
$cshow :: AwsElasticBeanstalkEnvironmentEnvironmentLink -> String
showsPrec :: Int -> AwsElasticBeanstalkEnvironmentEnvironmentLink -> ShowS
$cshowsPrec :: Int -> AwsElasticBeanstalkEnvironmentEnvironmentLink -> ShowS
Prelude.Show, (forall x.
 AwsElasticBeanstalkEnvironmentEnvironmentLink
 -> Rep AwsElasticBeanstalkEnvironmentEnvironmentLink x)
-> (forall x.
    Rep AwsElasticBeanstalkEnvironmentEnvironmentLink x
    -> AwsElasticBeanstalkEnvironmentEnvironmentLink)
-> Generic AwsElasticBeanstalkEnvironmentEnvironmentLink
forall x.
Rep AwsElasticBeanstalkEnvironmentEnvironmentLink x
-> AwsElasticBeanstalkEnvironmentEnvironmentLink
forall x.
AwsElasticBeanstalkEnvironmentEnvironmentLink
-> Rep AwsElasticBeanstalkEnvironmentEnvironmentLink x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsElasticBeanstalkEnvironmentEnvironmentLink x
-> AwsElasticBeanstalkEnvironmentEnvironmentLink
$cfrom :: forall x.
AwsElasticBeanstalkEnvironmentEnvironmentLink
-> Rep AwsElasticBeanstalkEnvironmentEnvironmentLink x
Prelude.Generic)

-- |
-- Create a value of 'AwsElasticBeanstalkEnvironmentEnvironmentLink' 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:
--
-- 'linkName', 'awsElasticBeanstalkEnvironmentEnvironmentLink_linkName' - The name of the environment link.
--
-- 'environmentName', 'awsElasticBeanstalkEnvironmentEnvironmentLink_environmentName' - The name of the linked environment.
newAwsElasticBeanstalkEnvironmentEnvironmentLink ::
  AwsElasticBeanstalkEnvironmentEnvironmentLink
newAwsElasticBeanstalkEnvironmentEnvironmentLink :: AwsElasticBeanstalkEnvironmentEnvironmentLink
newAwsElasticBeanstalkEnvironmentEnvironmentLink =
  AwsElasticBeanstalkEnvironmentEnvironmentLink' :: Maybe Text
-> Maybe Text -> AwsElasticBeanstalkEnvironmentEnvironmentLink
AwsElasticBeanstalkEnvironmentEnvironmentLink'
    { $sel:linkName:AwsElasticBeanstalkEnvironmentEnvironmentLink' :: Maybe Text
linkName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentName:AwsElasticBeanstalkEnvironmentEnvironmentLink' :: Maybe Text
environmentName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the environment link.
awsElasticBeanstalkEnvironmentEnvironmentLink_linkName :: Lens.Lens' AwsElasticBeanstalkEnvironmentEnvironmentLink (Prelude.Maybe Prelude.Text)
awsElasticBeanstalkEnvironmentEnvironmentLink_linkName :: (Maybe Text -> f (Maybe Text))
-> AwsElasticBeanstalkEnvironmentEnvironmentLink
-> f AwsElasticBeanstalkEnvironmentEnvironmentLink
awsElasticBeanstalkEnvironmentEnvironmentLink_linkName = (AwsElasticBeanstalkEnvironmentEnvironmentLink -> Maybe Text)
-> (AwsElasticBeanstalkEnvironmentEnvironmentLink
    -> Maybe Text -> AwsElasticBeanstalkEnvironmentEnvironmentLink)
-> Lens
     AwsElasticBeanstalkEnvironmentEnvironmentLink
     AwsElasticBeanstalkEnvironmentEnvironmentLink
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElasticBeanstalkEnvironmentEnvironmentLink' {Maybe Text
linkName :: Maybe Text
$sel:linkName:AwsElasticBeanstalkEnvironmentEnvironmentLink' :: AwsElasticBeanstalkEnvironmentEnvironmentLink -> Maybe Text
linkName} -> Maybe Text
linkName) (\s :: AwsElasticBeanstalkEnvironmentEnvironmentLink
s@AwsElasticBeanstalkEnvironmentEnvironmentLink' {} Maybe Text
a -> AwsElasticBeanstalkEnvironmentEnvironmentLink
s {$sel:linkName:AwsElasticBeanstalkEnvironmentEnvironmentLink' :: Maybe Text
linkName = Maybe Text
a} :: AwsElasticBeanstalkEnvironmentEnvironmentLink)

-- | The name of the linked environment.
awsElasticBeanstalkEnvironmentEnvironmentLink_environmentName :: Lens.Lens' AwsElasticBeanstalkEnvironmentEnvironmentLink (Prelude.Maybe Prelude.Text)
awsElasticBeanstalkEnvironmentEnvironmentLink_environmentName :: (Maybe Text -> f (Maybe Text))
-> AwsElasticBeanstalkEnvironmentEnvironmentLink
-> f AwsElasticBeanstalkEnvironmentEnvironmentLink
awsElasticBeanstalkEnvironmentEnvironmentLink_environmentName = (AwsElasticBeanstalkEnvironmentEnvironmentLink -> Maybe Text)
-> (AwsElasticBeanstalkEnvironmentEnvironmentLink
    -> Maybe Text -> AwsElasticBeanstalkEnvironmentEnvironmentLink)
-> Lens
     AwsElasticBeanstalkEnvironmentEnvironmentLink
     AwsElasticBeanstalkEnvironmentEnvironmentLink
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElasticBeanstalkEnvironmentEnvironmentLink' {Maybe Text
environmentName :: Maybe Text
$sel:environmentName:AwsElasticBeanstalkEnvironmentEnvironmentLink' :: AwsElasticBeanstalkEnvironmentEnvironmentLink -> Maybe Text
environmentName} -> Maybe Text
environmentName) (\s :: AwsElasticBeanstalkEnvironmentEnvironmentLink
s@AwsElasticBeanstalkEnvironmentEnvironmentLink' {} Maybe Text
a -> AwsElasticBeanstalkEnvironmentEnvironmentLink
s {$sel:environmentName:AwsElasticBeanstalkEnvironmentEnvironmentLink' :: Maybe Text
environmentName = Maybe Text
a} :: AwsElasticBeanstalkEnvironmentEnvironmentLink)

instance
  Core.FromJSON
    AwsElasticBeanstalkEnvironmentEnvironmentLink
  where
  parseJSON :: Value -> Parser AwsElasticBeanstalkEnvironmentEnvironmentLink
parseJSON =
    String
-> (Object -> Parser AwsElasticBeanstalkEnvironmentEnvironmentLink)
-> Value
-> Parser AwsElasticBeanstalkEnvironmentEnvironmentLink
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsElasticBeanstalkEnvironmentEnvironmentLink"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> AwsElasticBeanstalkEnvironmentEnvironmentLink
AwsElasticBeanstalkEnvironmentEnvironmentLink'
            (Maybe Text
 -> Maybe Text -> AwsElasticBeanstalkEnvironmentEnvironmentLink)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> AwsElasticBeanstalkEnvironmentEnvironmentLink)
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
"LinkName")
              Parser
  (Maybe Text -> AwsElasticBeanstalkEnvironmentEnvironmentLink)
-> Parser (Maybe Text)
-> Parser AwsElasticBeanstalkEnvironmentEnvironmentLink
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
"EnvironmentName")
      )

instance
  Prelude.Hashable
    AwsElasticBeanstalkEnvironmentEnvironmentLink

instance
  Prelude.NFData
    AwsElasticBeanstalkEnvironmentEnvironmentLink

instance
  Core.ToJSON
    AwsElasticBeanstalkEnvironmentEnvironmentLink
  where
  toJSON :: AwsElasticBeanstalkEnvironmentEnvironmentLink -> Value
toJSON
    AwsElasticBeanstalkEnvironmentEnvironmentLink' {Maybe Text
environmentName :: Maybe Text
linkName :: Maybe Text
$sel:environmentName:AwsElasticBeanstalkEnvironmentEnvironmentLink' :: AwsElasticBeanstalkEnvironmentEnvironmentLink -> Maybe Text
$sel:linkName:AwsElasticBeanstalkEnvironmentEnvironmentLink' :: AwsElasticBeanstalkEnvironmentEnvironmentLink -> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"LinkName" 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
linkName,
              (Text
"EnvironmentName" 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
environmentName
            ]
        )