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

-- | This structure contains information about one group.
--
-- /See:/ 'newGroup' smart constructor.
data Group = Group'
  { -- | The ARN of the group.
    Group -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the group was created.
    Group -> Maybe POSIX
createdTime :: Prelude.Maybe Data.POSIX,
    -- | The unique ID of the group.
    Group -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the group was most recently updated.
    Group -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The name of the group.
    Group -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The list of key-value pairs that are associated with the canary.
    Group -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (Group -> Group -> Bool
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]
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
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. 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:
--
-- 'arn', 'group_arn' - The ARN of the group.
--
-- 'createdTime', 'group_createdTime' - The date and time that the group was created.
--
-- 'id', 'group_id' - The unique ID of the group.
--
-- 'lastModifiedTime', 'group_lastModifiedTime' - The date and time that the group was most recently updated.
--
-- 'name', 'group_name' - The name of the group.
--
-- 'tags', 'group_tags' - The list of key-value pairs that are associated with the canary.
newGroup ::
  Group
newGroup :: Group
newGroup =
  Group'
    { $sel:arn:Group' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:Group' :: Maybe POSIX
createdTime = forall a. Maybe a
Prelude.Nothing,
      $sel:id:Group' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:Group' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Group' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Group' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the group.
group_arn :: Lens.Lens' Group (Prelude.Maybe Prelude.Text)
group_arn :: Lens' Group (Maybe Text)
group_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe Text
arn :: Maybe Text
$sel:arn:Group' :: Group -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Group
s@Group' {} Maybe Text
a -> Group
s {$sel:arn:Group' :: Maybe Text
arn = Maybe Text
a} :: Group)

-- | The date and time that the group was created.
group_createdTime :: Lens.Lens' Group (Prelude.Maybe Prelude.UTCTime)
group_createdTime :: Lens' Group (Maybe UTCTime)
group_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:Group' :: Group -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: Group
s@Group' {} Maybe POSIX
a -> Group
s {$sel:createdTime:Group' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: Group) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The unique ID of the group.
group_id :: Lens.Lens' Group (Prelude.Maybe Prelude.Text)
group_id :: Lens' Group (Maybe Text)
group_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe Text
id :: Maybe Text
$sel:id:Group' :: Group -> Maybe Text
id} -> Maybe Text
id) (\s :: Group
s@Group' {} Maybe Text
a -> Group
s {$sel:id:Group' :: Maybe Text
id = Maybe Text
a} :: Group)

-- | The date and time that the group was most recently updated.
group_lastModifiedTime :: Lens.Lens' Group (Prelude.Maybe Prelude.UTCTime)
group_lastModifiedTime :: Lens' Group (Maybe UTCTime)
group_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:Group' :: Group -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: Group
s@Group' {} Maybe POSIX
a -> Group
s {$sel:lastModifiedTime:Group' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: Group) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

-- | The list of key-value pairs that are associated with the canary.
group_tags :: Lens.Lens' Group (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
group_tags :: Lens' Group (Maybe (HashMap Text Text))
group_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Group' :: Group -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Group
s@Group' {} Maybe (HashMap Text Text)
a -> Group
s {$sel:tags:Group' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Group) 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

instance Data.FromJSON Group where
  parseJSON :: Value -> Parser Group
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Group"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Group
Group'
            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
"Arn")
            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
"CreatedTime")
            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
"Id")
            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
"LastModifiedTime")
            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
"Name")
            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
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Group where
  hashWithSalt :: Int -> Group -> Int
hashWithSalt Int
_salt Group' {Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
lastModifiedTime :: Maybe POSIX
id :: Maybe Text
createdTime :: Maybe POSIX
arn :: Maybe Text
$sel:tags:Group' :: Group -> Maybe (HashMap Text Text)
$sel:name:Group' :: Group -> Maybe Text
$sel:lastModifiedTime:Group' :: Group -> Maybe POSIX
$sel:id:Group' :: Group -> Maybe Text
$sel:createdTime:Group' :: Group -> Maybe POSIX
$sel:arn:Group' :: Group -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData Group where
  rnf :: Group -> ()
rnf Group' {Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
lastModifiedTime :: Maybe POSIX
id :: Maybe Text
createdTime :: Maybe POSIX
arn :: Maybe Text
$sel:tags:Group' :: Group -> Maybe (HashMap Text Text)
$sel:name:Group' :: Group -> Maybe Text
$sel:lastModifiedTime:Group' :: Group -> Maybe POSIX
$sel:id:Group' :: Group -> Maybe Text
$sel:createdTime:Group' :: Group -> Maybe POSIX
$sel:arn:Group' :: Group -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags