{-# 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.XRay.Types.Group
-- 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.XRay.Types.Group where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.XRay.Types.InsightsConfiguration

-- | Details and metadata for a group.
--
-- /See:/ 'newGroup' smart constructor.
data Group = Group'
  { -- | The filter expression defining the parameters to include traces.
    Group -> Maybe Text
filterExpression :: Prelude.Maybe Prelude.Text,
    -- | The structure containing configurations related to insights.
    --
    -- -   The InsightsEnabled boolean can be set to true to enable insights
    --     for the group or false to disable insights for the group.
    --
    -- -   The NotificationsEnabled boolean can be set to true to enable
    --     insights notifications through Amazon EventBridge for the group.
    Group -> Maybe InsightsConfiguration
insightsConfiguration :: Prelude.Maybe InsightsConfiguration,
    -- | The Amazon Resource Name (ARN) of the group generated based on the
    -- GroupName.
    Group -> Maybe Text
groupARN :: Prelude.Maybe Prelude.Text,
    -- | The unique case-sensitive name of the group.
    Group -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text
  }
  deriving (Group -> Group -> Bool
(Group -> Group -> Bool) -> (Group -> Group -> Bool) -> Eq Group
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Group -> Group -> Bool
$c/= :: Group -> Group -> Bool
== :: Group -> Group -> Bool
$c== :: Group -> Group -> Bool
Prelude.Eq, ReadPrec [Group]
ReadPrec Group
Int -> ReadS Group
ReadS [Group]
(Int -> ReadS Group)
-> ReadS [Group]
-> ReadPrec Group
-> ReadPrec [Group]
-> Read Group
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Group]
$creadListPrec :: ReadPrec [Group]
readPrec :: ReadPrec Group
$creadPrec :: ReadPrec Group
readList :: ReadS [Group]
$creadList :: ReadS [Group]
readsPrec :: Int -> ReadS Group
$creadsPrec :: Int -> ReadS Group
Prelude.Read, Int -> Group -> ShowS
[Group] -> ShowS
Group -> String
(Int -> Group -> ShowS)
-> (Group -> String) -> ([Group] -> ShowS) -> Show Group
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Group] -> ShowS
$cshowList :: [Group] -> ShowS
show :: Group -> String
$cshow :: Group -> String
showsPrec :: Int -> Group -> ShowS
$cshowsPrec :: Int -> Group -> ShowS
Prelude.Show, (forall x. Group -> Rep Group x)
-> (forall x. Rep Group x -> Group) -> Generic Group
forall x. Rep Group x -> Group
forall x. Group -> Rep Group x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Group x -> Group
$cfrom :: forall x. Group -> Rep Group x
Prelude.Generic)

-- |
-- Create a value of 'Group' 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:
--
-- 'filterExpression', 'group_filterExpression' - The filter expression defining the parameters to include traces.
--
-- 'insightsConfiguration', 'group_insightsConfiguration' - The structure containing configurations related to insights.
--
-- -   The InsightsEnabled boolean can be set to true to enable insights
--     for the group or false to disable insights for the group.
--
-- -   The NotificationsEnabled boolean can be set to true to enable
--     insights notifications through Amazon EventBridge for the group.
--
-- 'groupARN', 'group_groupARN' - The Amazon Resource Name (ARN) of the group generated based on the
-- GroupName.
--
-- 'groupName', 'group_groupName' - The unique case-sensitive name of the group.
newGroup ::
  Group
newGroup :: Group
newGroup =
  Group' :: Maybe Text
-> Maybe InsightsConfiguration -> Maybe Text -> Maybe Text -> Group
Group'
    { $sel:filterExpression:Group' :: Maybe Text
filterExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:insightsConfiguration:Group' :: Maybe InsightsConfiguration
insightsConfiguration = Maybe InsightsConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:groupARN:Group' :: Maybe Text
groupARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:Group' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The filter expression defining the parameters to include traces.
group_filterExpression :: Lens.Lens' Group (Prelude.Maybe Prelude.Text)
group_filterExpression :: (Maybe Text -> f (Maybe Text)) -> Group -> f Group
group_filterExpression = (Group -> Maybe Text)
-> (Group -> Maybe Text -> Group)
-> Lens Group Group (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe Text
filterExpression :: Maybe Text
$sel:filterExpression:Group' :: Group -> Maybe Text
filterExpression} -> Maybe Text
filterExpression) (\s :: Group
s@Group' {} Maybe Text
a -> Group
s {$sel:filterExpression:Group' :: Maybe Text
filterExpression = Maybe Text
a} :: Group)

-- | The structure containing configurations related to insights.
--
-- -   The InsightsEnabled boolean can be set to true to enable insights
--     for the group or false to disable insights for the group.
--
-- -   The NotificationsEnabled boolean can be set to true to enable
--     insights notifications through Amazon EventBridge for the group.
group_insightsConfiguration :: Lens.Lens' Group (Prelude.Maybe InsightsConfiguration)
group_insightsConfiguration :: (Maybe InsightsConfiguration -> f (Maybe InsightsConfiguration))
-> Group -> f Group
group_insightsConfiguration = (Group -> Maybe InsightsConfiguration)
-> (Group -> Maybe InsightsConfiguration -> Group)
-> Lens
     Group
     Group
     (Maybe InsightsConfiguration)
     (Maybe InsightsConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe InsightsConfiguration
insightsConfiguration :: Maybe InsightsConfiguration
$sel:insightsConfiguration:Group' :: Group -> Maybe InsightsConfiguration
insightsConfiguration} -> Maybe InsightsConfiguration
insightsConfiguration) (\s :: Group
s@Group' {} Maybe InsightsConfiguration
a -> Group
s {$sel:insightsConfiguration:Group' :: Maybe InsightsConfiguration
insightsConfiguration = Maybe InsightsConfiguration
a} :: Group)

-- | The Amazon Resource Name (ARN) of the group generated based on the
-- GroupName.
group_groupARN :: Lens.Lens' Group (Prelude.Maybe Prelude.Text)
group_groupARN :: (Maybe Text -> f (Maybe Text)) -> Group -> f Group
group_groupARN = (Group -> Maybe Text)
-> (Group -> Maybe Text -> Group)
-> Lens Group Group (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe Text
groupARN :: Maybe Text
$sel:groupARN:Group' :: Group -> Maybe Text
groupARN} -> Maybe Text
groupARN) (\s :: Group
s@Group' {} Maybe Text
a -> Group
s {$sel:groupARN:Group' :: Maybe Text
groupARN = Maybe Text
a} :: Group)

-- | The unique case-sensitive name of the group.
group_groupName :: Lens.Lens' Group (Prelude.Maybe Prelude.Text)
group_groupName :: (Maybe Text -> f (Maybe Text)) -> Group -> f Group
group_groupName = (Group -> Maybe Text)
-> (Group -> Maybe Text -> Group)
-> Lens Group Group (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe Text
groupName :: Maybe Text
$sel:groupName:Group' :: Group -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: Group
s@Group' {} Maybe Text
a -> Group
s {$sel:groupName:Group' :: Maybe Text
groupName = Maybe Text
a} :: Group)

instance Core.FromJSON Group where
  parseJSON :: Value -> Parser Group
parseJSON =
    String -> (Object -> Parser Group) -> Value -> Parser Group
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Group"
      ( \Object
x ->
          Maybe Text
-> Maybe InsightsConfiguration -> Maybe Text -> Maybe Text -> Group
Group'
            (Maybe Text
 -> Maybe InsightsConfiguration
 -> Maybe Text
 -> Maybe Text
 -> Group)
-> Parser (Maybe Text)
-> Parser
     (Maybe InsightsConfiguration -> Maybe Text -> Maybe Text -> Group)
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
"FilterExpression")
            Parser
  (Maybe InsightsConfiguration -> Maybe Text -> Maybe Text -> Group)
-> Parser (Maybe InsightsConfiguration)
-> Parser (Maybe Text -> Maybe Text -> Group)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InsightsConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InsightsConfiguration")
            Parser (Maybe Text -> Maybe Text -> Group)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Group)
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
"GroupARN")
            Parser (Maybe Text -> Group) -> Parser (Maybe Text) -> Parser Group
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
"GroupName")
      )

instance Prelude.Hashable Group

instance Prelude.NFData Group