{-# 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.ApplicationInsights.Types.ApplicationComponent
-- 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.ApplicationInsights.Types.ApplicationComponent where

import Amazonka.ApplicationInsights.Types.OsType
import Amazonka.ApplicationInsights.Types.Tier
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

-- | Describes a standalone resource or similarly grouped resources that the
-- application is made up of.
--
-- /See:/ 'newApplicationComponent' smart constructor.
data ApplicationComponent = ApplicationComponent'
  { -- | The name of the component.
    ApplicationComponent -> Maybe Text
componentName :: Prelude.Maybe Prelude.Text,
    -- | If logging is supported for the resource type, indicates whether the
    -- component has configured logs to be monitored.
    ApplicationComponent -> Maybe Text
componentRemarks :: Prelude.Maybe Prelude.Text,
    -- | Workloads detected in the application component.
    ApplicationComponent -> Maybe (HashMap Tier (HashMap Text Text))
detectedWorkload :: Prelude.Maybe (Prelude.HashMap Tier (Prelude.HashMap Prelude.Text Prelude.Text)),
    -- | Indicates whether the application component is monitored.
    ApplicationComponent -> Maybe Bool
monitor :: Prelude.Maybe Prelude.Bool,
    -- | The operating system of the component.
    ApplicationComponent -> Maybe OsType
osType :: Prelude.Maybe OsType,
    -- | The resource type. Supported resource types include EC2 instances, Auto
    -- Scaling group, Classic ELB, Application ELB, and SQS Queue.
    ApplicationComponent -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The stack tier of the application component.
    ApplicationComponent -> Maybe Tier
tier :: Prelude.Maybe Tier
  }
  deriving (ApplicationComponent -> ApplicationComponent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationComponent -> ApplicationComponent -> Bool
$c/= :: ApplicationComponent -> ApplicationComponent -> Bool
== :: ApplicationComponent -> ApplicationComponent -> Bool
$c== :: ApplicationComponent -> ApplicationComponent -> Bool
Prelude.Eq, ReadPrec [ApplicationComponent]
ReadPrec ApplicationComponent
Int -> ReadS ApplicationComponent
ReadS [ApplicationComponent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationComponent]
$creadListPrec :: ReadPrec [ApplicationComponent]
readPrec :: ReadPrec ApplicationComponent
$creadPrec :: ReadPrec ApplicationComponent
readList :: ReadS [ApplicationComponent]
$creadList :: ReadS [ApplicationComponent]
readsPrec :: Int -> ReadS ApplicationComponent
$creadsPrec :: Int -> ReadS ApplicationComponent
Prelude.Read, Int -> ApplicationComponent -> ShowS
[ApplicationComponent] -> ShowS
ApplicationComponent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationComponent] -> ShowS
$cshowList :: [ApplicationComponent] -> ShowS
show :: ApplicationComponent -> String
$cshow :: ApplicationComponent -> String
showsPrec :: Int -> ApplicationComponent -> ShowS
$cshowsPrec :: Int -> ApplicationComponent -> ShowS
Prelude.Show, forall x. Rep ApplicationComponent x -> ApplicationComponent
forall x. ApplicationComponent -> Rep ApplicationComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplicationComponent x -> ApplicationComponent
$cfrom :: forall x. ApplicationComponent -> Rep ApplicationComponent x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationComponent' 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:
--
-- 'componentName', 'applicationComponent_componentName' - The name of the component.
--
-- 'componentRemarks', 'applicationComponent_componentRemarks' - If logging is supported for the resource type, indicates whether the
-- component has configured logs to be monitored.
--
-- 'detectedWorkload', 'applicationComponent_detectedWorkload' - Workloads detected in the application component.
--
-- 'monitor', 'applicationComponent_monitor' - Indicates whether the application component is monitored.
--
-- 'osType', 'applicationComponent_osType' - The operating system of the component.
--
-- 'resourceType', 'applicationComponent_resourceType' - The resource type. Supported resource types include EC2 instances, Auto
-- Scaling group, Classic ELB, Application ELB, and SQS Queue.
--
-- 'tier', 'applicationComponent_tier' - The stack tier of the application component.
newApplicationComponent ::
  ApplicationComponent
newApplicationComponent :: ApplicationComponent
newApplicationComponent =
  ApplicationComponent'
    { $sel:componentName:ApplicationComponent' :: Maybe Text
componentName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:componentRemarks:ApplicationComponent' :: Maybe Text
componentRemarks = forall a. Maybe a
Prelude.Nothing,
      $sel:detectedWorkload:ApplicationComponent' :: Maybe (HashMap Tier (HashMap Text Text))
detectedWorkload = forall a. Maybe a
Prelude.Nothing,
      $sel:monitor:ApplicationComponent' :: Maybe Bool
monitor = forall a. Maybe a
Prelude.Nothing,
      $sel:osType:ApplicationComponent' :: Maybe OsType
osType = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ApplicationComponent' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:tier:ApplicationComponent' :: Maybe Tier
tier = forall a. Maybe a
Prelude.Nothing
    }

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

-- | If logging is supported for the resource type, indicates whether the
-- component has configured logs to be monitored.
applicationComponent_componentRemarks :: Lens.Lens' ApplicationComponent (Prelude.Maybe Prelude.Text)
applicationComponent_componentRemarks :: Lens' ApplicationComponent (Maybe Text)
applicationComponent_componentRemarks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationComponent' {Maybe Text
componentRemarks :: Maybe Text
$sel:componentRemarks:ApplicationComponent' :: ApplicationComponent -> Maybe Text
componentRemarks} -> Maybe Text
componentRemarks) (\s :: ApplicationComponent
s@ApplicationComponent' {} Maybe Text
a -> ApplicationComponent
s {$sel:componentRemarks:ApplicationComponent' :: Maybe Text
componentRemarks = Maybe Text
a} :: ApplicationComponent)

-- | Workloads detected in the application component.
applicationComponent_detectedWorkload :: Lens.Lens' ApplicationComponent (Prelude.Maybe (Prelude.HashMap Tier (Prelude.HashMap Prelude.Text Prelude.Text)))
applicationComponent_detectedWorkload :: Lens'
  ApplicationComponent (Maybe (HashMap Tier (HashMap Text Text)))
applicationComponent_detectedWorkload = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationComponent' {Maybe (HashMap Tier (HashMap Text Text))
detectedWorkload :: Maybe (HashMap Tier (HashMap Text Text))
$sel:detectedWorkload:ApplicationComponent' :: ApplicationComponent -> Maybe (HashMap Tier (HashMap Text Text))
detectedWorkload} -> Maybe (HashMap Tier (HashMap Text Text))
detectedWorkload) (\s :: ApplicationComponent
s@ApplicationComponent' {} Maybe (HashMap Tier (HashMap Text Text))
a -> ApplicationComponent
s {$sel:detectedWorkload:ApplicationComponent' :: Maybe (HashMap Tier (HashMap Text Text))
detectedWorkload = Maybe (HashMap Tier (HashMap Text Text))
a} :: ApplicationComponent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates whether the application component is monitored.
applicationComponent_monitor :: Lens.Lens' ApplicationComponent (Prelude.Maybe Prelude.Bool)
applicationComponent_monitor :: Lens' ApplicationComponent (Maybe Bool)
applicationComponent_monitor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationComponent' {Maybe Bool
monitor :: Maybe Bool
$sel:monitor:ApplicationComponent' :: ApplicationComponent -> Maybe Bool
monitor} -> Maybe Bool
monitor) (\s :: ApplicationComponent
s@ApplicationComponent' {} Maybe Bool
a -> ApplicationComponent
s {$sel:monitor:ApplicationComponent' :: Maybe Bool
monitor = Maybe Bool
a} :: ApplicationComponent)

-- | The operating system of the component.
applicationComponent_osType :: Lens.Lens' ApplicationComponent (Prelude.Maybe OsType)
applicationComponent_osType :: Lens' ApplicationComponent (Maybe OsType)
applicationComponent_osType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationComponent' {Maybe OsType
osType :: Maybe OsType
$sel:osType:ApplicationComponent' :: ApplicationComponent -> Maybe OsType
osType} -> Maybe OsType
osType) (\s :: ApplicationComponent
s@ApplicationComponent' {} Maybe OsType
a -> ApplicationComponent
s {$sel:osType:ApplicationComponent' :: Maybe OsType
osType = Maybe OsType
a} :: ApplicationComponent)

-- | The resource type. Supported resource types include EC2 instances, Auto
-- Scaling group, Classic ELB, Application ELB, and SQS Queue.
applicationComponent_resourceType :: Lens.Lens' ApplicationComponent (Prelude.Maybe Prelude.Text)
applicationComponent_resourceType :: Lens' ApplicationComponent (Maybe Text)
applicationComponent_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationComponent' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:ApplicationComponent' :: ApplicationComponent -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: ApplicationComponent
s@ApplicationComponent' {} Maybe Text
a -> ApplicationComponent
s {$sel:resourceType:ApplicationComponent' :: Maybe Text
resourceType = Maybe Text
a} :: ApplicationComponent)

-- | The stack tier of the application component.
applicationComponent_tier :: Lens.Lens' ApplicationComponent (Prelude.Maybe Tier)
applicationComponent_tier :: Lens' ApplicationComponent (Maybe Tier)
applicationComponent_tier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationComponent' {Maybe Tier
tier :: Maybe Tier
$sel:tier:ApplicationComponent' :: ApplicationComponent -> Maybe Tier
tier} -> Maybe Tier
tier) (\s :: ApplicationComponent
s@ApplicationComponent' {} Maybe Tier
a -> ApplicationComponent
s {$sel:tier:ApplicationComponent' :: Maybe Tier
tier = Maybe Tier
a} :: ApplicationComponent)

instance Data.FromJSON ApplicationComponent where
  parseJSON :: Value -> Parser ApplicationComponent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ApplicationComponent"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (HashMap Tier (HashMap Text Text))
-> Maybe Bool
-> Maybe OsType
-> Maybe Text
-> Maybe Tier
-> ApplicationComponent
ApplicationComponent'
            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
"ComponentName")
            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
"ComponentRemarks")
            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
"DetectedWorkload"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"Monitor")
            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
"OsType")
            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
"ResourceType")
            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
"Tier")
      )

instance Prelude.Hashable ApplicationComponent where
  hashWithSalt :: Int -> ApplicationComponent -> Int
hashWithSalt Int
_salt ApplicationComponent' {Maybe Bool
Maybe Text
Maybe (HashMap Tier (HashMap Text Text))
Maybe OsType
Maybe Tier
tier :: Maybe Tier
resourceType :: Maybe Text
osType :: Maybe OsType
monitor :: Maybe Bool
detectedWorkload :: Maybe (HashMap Tier (HashMap Text Text))
componentRemarks :: Maybe Text
componentName :: Maybe Text
$sel:tier:ApplicationComponent' :: ApplicationComponent -> Maybe Tier
$sel:resourceType:ApplicationComponent' :: ApplicationComponent -> Maybe Text
$sel:osType:ApplicationComponent' :: ApplicationComponent -> Maybe OsType
$sel:monitor:ApplicationComponent' :: ApplicationComponent -> Maybe Bool
$sel:detectedWorkload:ApplicationComponent' :: ApplicationComponent -> Maybe (HashMap Tier (HashMap Text Text))
$sel:componentRemarks:ApplicationComponent' :: ApplicationComponent -> Maybe Text
$sel:componentName:ApplicationComponent' :: ApplicationComponent -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
componentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
componentRemarks
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Tier (HashMap Text Text))
detectedWorkload
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
monitor
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OsType
osType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Tier
tier

instance Prelude.NFData ApplicationComponent where
  rnf :: ApplicationComponent -> ()
rnf ApplicationComponent' {Maybe Bool
Maybe Text
Maybe (HashMap Tier (HashMap Text Text))
Maybe OsType
Maybe Tier
tier :: Maybe Tier
resourceType :: Maybe Text
osType :: Maybe OsType
monitor :: Maybe Bool
detectedWorkload :: Maybe (HashMap Tier (HashMap Text Text))
componentRemarks :: Maybe Text
componentName :: Maybe Text
$sel:tier:ApplicationComponent' :: ApplicationComponent -> Maybe Tier
$sel:resourceType:ApplicationComponent' :: ApplicationComponent -> Maybe Text
$sel:osType:ApplicationComponent' :: ApplicationComponent -> Maybe OsType
$sel:monitor:ApplicationComponent' :: ApplicationComponent -> Maybe Bool
$sel:detectedWorkload:ApplicationComponent' :: ApplicationComponent -> Maybe (HashMap Tier (HashMap Text Text))
$sel:componentRemarks:ApplicationComponent' :: ApplicationComponent -> Maybe Text
$sel:componentName:ApplicationComponent' :: ApplicationComponent -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentRemarks
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Tier (HashMap Text Text))
detectedWorkload
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
monitor
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OsType
osType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Tier
tier