{-# 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.Greengrass.Types.GroupInformation
-- 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.Greengrass.Types.GroupInformation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a group.
--
-- /See:/ 'newGroupInformation' smart constructor.
data GroupInformation = GroupInformation'
  { -- | The ARN of the latest version associated with the group.
    GroupInformation -> Maybe Text
latestVersionArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the group.
    GroupInformation -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the group.
    GroupInformation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the group was created.
    GroupInformation -> Maybe Text
creationTimestamp :: Prelude.Maybe Prelude.Text,
    -- | The ID of the group.
    GroupInformation -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The ID of the latest version associated with the group.
    GroupInformation -> Maybe Text
latestVersion :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the group was last
    -- updated.
    GroupInformation -> Maybe Text
lastUpdatedTimestamp :: Prelude.Maybe Prelude.Text
  }
  deriving (GroupInformation -> GroupInformation -> Bool
(GroupInformation -> GroupInformation -> Bool)
-> (GroupInformation -> GroupInformation -> Bool)
-> Eq GroupInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GroupInformation -> GroupInformation -> Bool
$c/= :: GroupInformation -> GroupInformation -> Bool
== :: GroupInformation -> GroupInformation -> Bool
$c== :: GroupInformation -> GroupInformation -> Bool
Prelude.Eq, ReadPrec [GroupInformation]
ReadPrec GroupInformation
Int -> ReadS GroupInformation
ReadS [GroupInformation]
(Int -> ReadS GroupInformation)
-> ReadS [GroupInformation]
-> ReadPrec GroupInformation
-> ReadPrec [GroupInformation]
-> Read GroupInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GroupInformation]
$creadListPrec :: ReadPrec [GroupInformation]
readPrec :: ReadPrec GroupInformation
$creadPrec :: ReadPrec GroupInformation
readList :: ReadS [GroupInformation]
$creadList :: ReadS [GroupInformation]
readsPrec :: Int -> ReadS GroupInformation
$creadsPrec :: Int -> ReadS GroupInformation
Prelude.Read, Int -> GroupInformation -> ShowS
[GroupInformation] -> ShowS
GroupInformation -> String
(Int -> GroupInformation -> ShowS)
-> (GroupInformation -> String)
-> ([GroupInformation] -> ShowS)
-> Show GroupInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GroupInformation] -> ShowS
$cshowList :: [GroupInformation] -> ShowS
show :: GroupInformation -> String
$cshow :: GroupInformation -> String
showsPrec :: Int -> GroupInformation -> ShowS
$cshowsPrec :: Int -> GroupInformation -> ShowS
Prelude.Show, (forall x. GroupInformation -> Rep GroupInformation x)
-> (forall x. Rep GroupInformation x -> GroupInformation)
-> Generic GroupInformation
forall x. Rep GroupInformation x -> GroupInformation
forall x. GroupInformation -> Rep GroupInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GroupInformation x -> GroupInformation
$cfrom :: forall x. GroupInformation -> Rep GroupInformation x
Prelude.Generic)

-- |
-- Create a value of 'GroupInformation' 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:
--
-- 'latestVersionArn', 'groupInformation_latestVersionArn' - The ARN of the latest version associated with the group.
--
-- 'arn', 'groupInformation_arn' - The ARN of the group.
--
-- 'name', 'groupInformation_name' - The name of the group.
--
-- 'creationTimestamp', 'groupInformation_creationTimestamp' - The time, in milliseconds since the epoch, when the group was created.
--
-- 'id', 'groupInformation_id' - The ID of the group.
--
-- 'latestVersion', 'groupInformation_latestVersion' - The ID of the latest version associated with the group.
--
-- 'lastUpdatedTimestamp', 'groupInformation_lastUpdatedTimestamp' - The time, in milliseconds since the epoch, when the group was last
-- updated.
newGroupInformation ::
  GroupInformation
newGroupInformation :: GroupInformation
newGroupInformation =
  GroupInformation' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GroupInformation
GroupInformation'
    { $sel:latestVersionArn:GroupInformation' :: Maybe Text
latestVersionArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:GroupInformation' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:GroupInformation' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:GroupInformation' :: Maybe Text
creationTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:GroupInformation' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:latestVersion:GroupInformation' :: Maybe Text
latestVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:GroupInformation' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the latest version associated with the group.
groupInformation_latestVersionArn :: Lens.Lens' GroupInformation (Prelude.Maybe Prelude.Text)
groupInformation_latestVersionArn :: (Maybe Text -> f (Maybe Text))
-> GroupInformation -> f GroupInformation
groupInformation_latestVersionArn = (GroupInformation -> Maybe Text)
-> (GroupInformation -> Maybe Text -> GroupInformation)
-> Lens GroupInformation GroupInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupInformation' {Maybe Text
latestVersionArn :: Maybe Text
$sel:latestVersionArn:GroupInformation' :: GroupInformation -> Maybe Text
latestVersionArn} -> Maybe Text
latestVersionArn) (\s :: GroupInformation
s@GroupInformation' {} Maybe Text
a -> GroupInformation
s {$sel:latestVersionArn:GroupInformation' :: Maybe Text
latestVersionArn = Maybe Text
a} :: GroupInformation)

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

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

-- | The time, in milliseconds since the epoch, when the group was created.
groupInformation_creationTimestamp :: Lens.Lens' GroupInformation (Prelude.Maybe Prelude.Text)
groupInformation_creationTimestamp :: (Maybe Text -> f (Maybe Text))
-> GroupInformation -> f GroupInformation
groupInformation_creationTimestamp = (GroupInformation -> Maybe Text)
-> (GroupInformation -> Maybe Text -> GroupInformation)
-> Lens GroupInformation GroupInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupInformation' {Maybe Text
creationTimestamp :: Maybe Text
$sel:creationTimestamp:GroupInformation' :: GroupInformation -> Maybe Text
creationTimestamp} -> Maybe Text
creationTimestamp) (\s :: GroupInformation
s@GroupInformation' {} Maybe Text
a -> GroupInformation
s {$sel:creationTimestamp:GroupInformation' :: Maybe Text
creationTimestamp = Maybe Text
a} :: GroupInformation)

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

-- | The ID of the latest version associated with the group.
groupInformation_latestVersion :: Lens.Lens' GroupInformation (Prelude.Maybe Prelude.Text)
groupInformation_latestVersion :: (Maybe Text -> f (Maybe Text))
-> GroupInformation -> f GroupInformation
groupInformation_latestVersion = (GroupInformation -> Maybe Text)
-> (GroupInformation -> Maybe Text -> GroupInformation)
-> Lens GroupInformation GroupInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupInformation' {Maybe Text
latestVersion :: Maybe Text
$sel:latestVersion:GroupInformation' :: GroupInformation -> Maybe Text
latestVersion} -> Maybe Text
latestVersion) (\s :: GroupInformation
s@GroupInformation' {} Maybe Text
a -> GroupInformation
s {$sel:latestVersion:GroupInformation' :: Maybe Text
latestVersion = Maybe Text
a} :: GroupInformation)

-- | The time, in milliseconds since the epoch, when the group was last
-- updated.
groupInformation_lastUpdatedTimestamp :: Lens.Lens' GroupInformation (Prelude.Maybe Prelude.Text)
groupInformation_lastUpdatedTimestamp :: (Maybe Text -> f (Maybe Text))
-> GroupInformation -> f GroupInformation
groupInformation_lastUpdatedTimestamp = (GroupInformation -> Maybe Text)
-> (GroupInformation -> Maybe Text -> GroupInformation)
-> Lens GroupInformation GroupInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupInformation' {Maybe Text
lastUpdatedTimestamp :: Maybe Text
$sel:lastUpdatedTimestamp:GroupInformation' :: GroupInformation -> Maybe Text
lastUpdatedTimestamp} -> Maybe Text
lastUpdatedTimestamp) (\s :: GroupInformation
s@GroupInformation' {} Maybe Text
a -> GroupInformation
s {$sel:lastUpdatedTimestamp:GroupInformation' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
a} :: GroupInformation)

instance Core.FromJSON GroupInformation where
  parseJSON :: Value -> Parser GroupInformation
parseJSON =
    String
-> (Object -> Parser GroupInformation)
-> Value
-> Parser GroupInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GroupInformation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GroupInformation
GroupInformation'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> GroupInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> GroupInformation)
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
"LatestVersionArn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> GroupInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> GroupInformation)
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
"Arn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> GroupInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> GroupInformation)
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
"Name")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> GroupInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> GroupInformation)
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
"CreationTimestamp")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> GroupInformation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> GroupInformation)
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
"Id")
            Parser (Maybe Text -> Maybe Text -> GroupInformation)
-> Parser (Maybe Text) -> Parser (Maybe Text -> GroupInformation)
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
"LatestVersion")
            Parser (Maybe Text -> GroupInformation)
-> Parser (Maybe Text) -> Parser GroupInformation
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
"LastUpdatedTimestamp")
      )

instance Prelude.Hashable GroupInformation

instance Prelude.NFData GroupInformation