{-# 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.ResilienceHub.Types.AppComponent
-- 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.ResilienceHub.Types.AppComponent 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

-- | Defines an application component.
--
-- /See:/ 'newAppComponent' smart constructor.
data AppComponent = AppComponent'
  { -- | The name of the application component.
    AppComponent -> Text
name :: Prelude.Text,
    -- | The type of application component.
    AppComponent -> Text
type' :: Prelude.Text
  }
  deriving (AppComponent -> AppComponent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppComponent -> AppComponent -> Bool
$c/= :: AppComponent -> AppComponent -> Bool
== :: AppComponent -> AppComponent -> Bool
$c== :: AppComponent -> AppComponent -> Bool
Prelude.Eq, ReadPrec [AppComponent]
ReadPrec AppComponent
Int -> ReadS AppComponent
ReadS [AppComponent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AppComponent]
$creadListPrec :: ReadPrec [AppComponent]
readPrec :: ReadPrec AppComponent
$creadPrec :: ReadPrec AppComponent
readList :: ReadS [AppComponent]
$creadList :: ReadS [AppComponent]
readsPrec :: Int -> ReadS AppComponent
$creadsPrec :: Int -> ReadS AppComponent
Prelude.Read, Int -> AppComponent -> ShowS
[AppComponent] -> ShowS
AppComponent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppComponent] -> ShowS
$cshowList :: [AppComponent] -> ShowS
show :: AppComponent -> String
$cshow :: AppComponent -> String
showsPrec :: Int -> AppComponent -> ShowS
$cshowsPrec :: Int -> AppComponent -> ShowS
Prelude.Show, forall x. Rep AppComponent x -> AppComponent
forall x. AppComponent -> Rep AppComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AppComponent x -> AppComponent
$cfrom :: forall x. AppComponent -> Rep AppComponent x
Prelude.Generic)

-- |
-- Create a value of 'AppComponent' 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:
--
-- 'name', 'appComponent_name' - The name of the application component.
--
-- 'type'', 'appComponent_type' - The type of application component.
newAppComponent ::
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  Prelude.Text ->
  AppComponent
newAppComponent :: Text -> Text -> AppComponent
newAppComponent Text
pName_ Text
pType_ =
  AppComponent' {$sel:name:AppComponent' :: Text
name = Text
pName_, $sel:type':AppComponent' :: Text
type' = Text
pType_}

-- | The name of the application component.
appComponent_name :: Lens.Lens' AppComponent Prelude.Text
appComponent_name :: Lens' AppComponent Text
appComponent_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppComponent' {Text
name :: Text
$sel:name:AppComponent' :: AppComponent -> Text
name} -> Text
name) (\s :: AppComponent
s@AppComponent' {} Text
a -> AppComponent
s {$sel:name:AppComponent' :: Text
name = Text
a} :: AppComponent)

-- | The type of application component.
appComponent_type :: Lens.Lens' AppComponent Prelude.Text
appComponent_type :: Lens' AppComponent Text
appComponent_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppComponent' {Text
type' :: Text
$sel:type':AppComponent' :: AppComponent -> Text
type'} -> Text
type') (\s :: AppComponent
s@AppComponent' {} Text
a -> AppComponent
s {$sel:type':AppComponent' :: Text
type' = Text
a} :: AppComponent)

instance Data.FromJSON AppComponent where
  parseJSON :: Value -> Parser AppComponent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AppComponent"
      ( \Object
x ->
          Text -> Text -> AppComponent
AppComponent'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
      )

instance Prelude.Hashable AppComponent where
  hashWithSalt :: Int -> AppComponent -> Int
hashWithSalt Int
_salt AppComponent' {Text
type' :: Text
name :: Text
$sel:type':AppComponent' :: AppComponent -> Text
$sel:name:AppComponent' :: AppComponent -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
type'

instance Prelude.NFData AppComponent where
  rnf :: AppComponent -> ()
rnf AppComponent' {Text
type' :: Text
name :: Text
$sel:type':AppComponent' :: AppComponent -> Text
$sel:name:AppComponent' :: AppComponent -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
type'