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

import Amazonka.ApplicationInsights.Types.OsType
import Amazonka.ApplicationInsights.Types.Tier
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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 stack tier of the application component.
    ApplicationComponent -> Maybe Tier
tier :: Prelude.Maybe Tier,
    -- | 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
  }
  deriving (ApplicationComponent -> ApplicationComponent -> Bool
(ApplicationComponent -> ApplicationComponent -> Bool)
-> (ApplicationComponent -> ApplicationComponent -> Bool)
-> Eq ApplicationComponent
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]
(Int -> ReadS ApplicationComponent)
-> ReadS [ApplicationComponent]
-> ReadPrec ApplicationComponent
-> ReadPrec [ApplicationComponent]
-> Read 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
(Int -> ApplicationComponent -> ShowS)
-> (ApplicationComponent -> String)
-> ([ApplicationComponent] -> ShowS)
-> Show ApplicationComponent
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. ApplicationComponent -> Rep ApplicationComponent x)
-> (forall x. Rep ApplicationComponent x -> ApplicationComponent)
-> Generic ApplicationComponent
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:
--
-- '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.
--
-- 'detectedWorkload', 'applicationComponent_detectedWorkload' - Workloads detected in the application component.
--
-- 'monitor', 'applicationComponent_monitor' - Indicates whether the application component is monitored.
--
-- 'tier', 'applicationComponent_tier' - The stack tier of the application component.
--
-- '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.
newApplicationComponent ::
  ApplicationComponent
newApplicationComponent :: ApplicationComponent
newApplicationComponent =
  ApplicationComponent' :: Maybe OsType
-> Maybe Text
-> Maybe (HashMap Tier (HashMap Text Text))
-> Maybe Bool
-> Maybe Tier
-> Maybe Text
-> Maybe Text
-> ApplicationComponent
ApplicationComponent'
    { $sel:osType:ApplicationComponent' :: Maybe OsType
osType = Maybe OsType
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ApplicationComponent' :: Maybe Text
resourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:detectedWorkload:ApplicationComponent' :: Maybe (HashMap Tier (HashMap Text Text))
detectedWorkload = Maybe (HashMap Tier (HashMap Text Text))
forall a. Maybe a
Prelude.Nothing,
      $sel:monitor:ApplicationComponent' :: Maybe Bool
monitor = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:tier:ApplicationComponent' :: Maybe Tier
tier = Maybe Tier
forall a. Maybe a
Prelude.Nothing,
      $sel:componentName:ApplicationComponent' :: Maybe Text
componentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:componentRemarks:ApplicationComponent' :: Maybe Text
componentRemarks = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The operating system of the component.
applicationComponent_osType :: Lens.Lens' ApplicationComponent (Prelude.Maybe OsType)
applicationComponent_osType :: (Maybe OsType -> f (Maybe OsType))
-> ApplicationComponent -> f ApplicationComponent
applicationComponent_osType = (ApplicationComponent -> Maybe OsType)
-> (ApplicationComponent -> Maybe OsType -> ApplicationComponent)
-> Lens
     ApplicationComponent
     ApplicationComponent
     (Maybe OsType)
     (Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> ApplicationComponent -> f ApplicationComponent
applicationComponent_resourceType = (ApplicationComponent -> Maybe Text)
-> (ApplicationComponent -> Maybe Text -> ApplicationComponent)
-> Lens
     ApplicationComponent ApplicationComponent (Maybe Text) (Maybe Text)
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)

-- | Workloads detected in the application component.
applicationComponent_detectedWorkload :: Lens.Lens' ApplicationComponent (Prelude.Maybe (Prelude.HashMap Tier (Prelude.HashMap Prelude.Text Prelude.Text)))
applicationComponent_detectedWorkload :: (Maybe (HashMap Tier (HashMap Text Text))
 -> f (Maybe (HashMap Tier (HashMap Text Text))))
-> ApplicationComponent -> f ApplicationComponent
applicationComponent_detectedWorkload = (ApplicationComponent -> Maybe (HashMap Tier (HashMap Text Text)))
-> (ApplicationComponent
    -> Maybe (HashMap Tier (HashMap Text Text))
    -> ApplicationComponent)
-> Lens
     ApplicationComponent
     ApplicationComponent
     (Maybe (HashMap Tier (HashMap Text Text)))
     (Maybe (HashMap Tier (HashMap Text Text)))
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) ((Maybe (HashMap Tier (HashMap Text Text))
  -> f (Maybe (HashMap Tier (HashMap Text Text))))
 -> ApplicationComponent -> f ApplicationComponent)
-> ((Maybe (HashMap Tier (HashMap Text Text))
     -> f (Maybe (HashMap Tier (HashMap Text Text))))
    -> Maybe (HashMap Tier (HashMap Text Text))
    -> f (Maybe (HashMap Tier (HashMap Text Text))))
-> (Maybe (HashMap Tier (HashMap Text Text))
    -> f (Maybe (HashMap Tier (HashMap Text Text))))
-> ApplicationComponent
-> f ApplicationComponent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Tier (HashMap Text Text))
  (HashMap Tier (HashMap Text Text))
  (HashMap Tier (HashMap Text Text))
  (HashMap Tier (HashMap Text Text))
-> Iso
     (Maybe (HashMap Tier (HashMap Text Text)))
     (Maybe (HashMap Tier (HashMap Text Text)))
     (Maybe (HashMap Tier (HashMap Text Text)))
     (Maybe (HashMap Tier (HashMap Text Text)))
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 AnIso
  (HashMap Tier (HashMap Text Text))
  (HashMap Tier (HashMap Text Text))
  (HashMap Tier (HashMap Text Text))
  (HashMap Tier (HashMap Text Text))
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 :: (Maybe Bool -> f (Maybe Bool))
-> ApplicationComponent -> f ApplicationComponent
applicationComponent_monitor = (ApplicationComponent -> Maybe Bool)
-> (ApplicationComponent -> Maybe Bool -> ApplicationComponent)
-> Lens
     ApplicationComponent ApplicationComponent (Maybe Bool) (Maybe Bool)
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 stack tier of the application component.
applicationComponent_tier :: Lens.Lens' ApplicationComponent (Prelude.Maybe Tier)
applicationComponent_tier :: (Maybe Tier -> f (Maybe Tier))
-> ApplicationComponent -> f ApplicationComponent
applicationComponent_tier = (ApplicationComponent -> Maybe Tier)
-> (ApplicationComponent -> Maybe Tier -> ApplicationComponent)
-> Lens
     ApplicationComponent ApplicationComponent (Maybe Tier) (Maybe 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)

-- | The name of the component.
applicationComponent_componentName :: Lens.Lens' ApplicationComponent (Prelude.Maybe Prelude.Text)
applicationComponent_componentName :: (Maybe Text -> f (Maybe Text))
-> ApplicationComponent -> f ApplicationComponent
applicationComponent_componentName = (ApplicationComponent -> Maybe Text)
-> (ApplicationComponent -> Maybe Text -> ApplicationComponent)
-> Lens
     ApplicationComponent ApplicationComponent (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> ApplicationComponent -> f ApplicationComponent
applicationComponent_componentRemarks = (ApplicationComponent -> Maybe Text)
-> (ApplicationComponent -> Maybe Text -> ApplicationComponent)
-> Lens
     ApplicationComponent ApplicationComponent (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable ApplicationComponent

instance Prelude.NFData ApplicationComponent