{-# 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.ManagedBlockChain.Types.MemberSummary
-- 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.ManagedBlockChain.Types.MemberSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.ManagedBlockChain.Types.MemberStatus
import qualified Amazonka.Prelude as Prelude

-- | A summary of configuration properties for a member.
--
-- Applies only to Hyperledger Fabric.
--
-- /See:/ 'newMemberSummary' smart constructor.
data MemberSummary = MemberSummary'
  { -- | The status of the member.
    --
    -- -   @CREATING@ - The AWS account is in the process of creating a member.
    --
    -- -   @AVAILABLE@ - The member has been created and can participate in the
    --     network.
    --
    -- -   @CREATE_FAILED@ - The AWS account attempted to create a member and
    --     creation failed.
    --
    -- -   @UPDATING@ - The member is in the process of being updated.
    --
    -- -   @DELETING@ - The member and all associated resources are in the
    --     process of being deleted. Either the AWS account that owns the
    --     member deleted it, or the member is being deleted as the result of
    --     an @APPROVED@ @PROPOSAL@ to remove the member.
    --
    -- -   @DELETED@ - The member can no longer participate on the network and
    --     all associated resources are deleted. Either the AWS account that
    --     owns the member deleted it, or the member is being deleted as the
    --     result of an @APPROVED@ @PROPOSAL@ to remove the member.
    --
    -- -   @INACCESSIBLE_ENCRYPTION_KEY@ - The member is impaired and might not
    --     function as expected because it cannot access the specified customer
    --     managed key in AWS Key Management Service (AWS KMS) for encryption
    --     at rest. Either the KMS key was disabled or deleted, or the grants
    --     on the key were revoked.
    --
    --     The effect of disabling or deleting a key, or revoking a grant is
    --     not immediate. The member resource might take some time to find that
    --     the key is inaccessible. When a resource is in this state, we
    --     recommend deleting and recreating the resource.
    MemberSummary -> Maybe MemberStatus
status :: Prelude.Maybe MemberStatus,
    -- | The Amazon Resource Name (ARN) of the member. For more information about
    -- ARNs and their format, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
    -- in the /AWS General Reference/.
    MemberSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the member.
    MemberSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the member.
    MemberSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | An indicator of whether the member is owned by your AWS account or a
    -- different AWS account.
    MemberSummary -> Maybe Bool
isOwned :: Prelude.Maybe Prelude.Bool,
    -- | The date and time that the member was created.
    MemberSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | An optional description of the member.
    MemberSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (MemberSummary -> MemberSummary -> Bool
(MemberSummary -> MemberSummary -> Bool)
-> (MemberSummary -> MemberSummary -> Bool) -> Eq MemberSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemberSummary -> MemberSummary -> Bool
$c/= :: MemberSummary -> MemberSummary -> Bool
== :: MemberSummary -> MemberSummary -> Bool
$c== :: MemberSummary -> MemberSummary -> Bool
Prelude.Eq, ReadPrec [MemberSummary]
ReadPrec MemberSummary
Int -> ReadS MemberSummary
ReadS [MemberSummary]
(Int -> ReadS MemberSummary)
-> ReadS [MemberSummary]
-> ReadPrec MemberSummary
-> ReadPrec [MemberSummary]
-> Read MemberSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MemberSummary]
$creadListPrec :: ReadPrec [MemberSummary]
readPrec :: ReadPrec MemberSummary
$creadPrec :: ReadPrec MemberSummary
readList :: ReadS [MemberSummary]
$creadList :: ReadS [MemberSummary]
readsPrec :: Int -> ReadS MemberSummary
$creadsPrec :: Int -> ReadS MemberSummary
Prelude.Read, Int -> MemberSummary -> ShowS
[MemberSummary] -> ShowS
MemberSummary -> String
(Int -> MemberSummary -> ShowS)
-> (MemberSummary -> String)
-> ([MemberSummary] -> ShowS)
-> Show MemberSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MemberSummary] -> ShowS
$cshowList :: [MemberSummary] -> ShowS
show :: MemberSummary -> String
$cshow :: MemberSummary -> String
showsPrec :: Int -> MemberSummary -> ShowS
$cshowsPrec :: Int -> MemberSummary -> ShowS
Prelude.Show, (forall x. MemberSummary -> Rep MemberSummary x)
-> (forall x. Rep MemberSummary x -> MemberSummary)
-> Generic MemberSummary
forall x. Rep MemberSummary x -> MemberSummary
forall x. MemberSummary -> Rep MemberSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MemberSummary x -> MemberSummary
$cfrom :: forall x. MemberSummary -> Rep MemberSummary x
Prelude.Generic)

-- |
-- Create a value of 'MemberSummary' 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:
--
-- 'status', 'memberSummary_status' - The status of the member.
--
-- -   @CREATING@ - The AWS account is in the process of creating a member.
--
-- -   @AVAILABLE@ - The member has been created and can participate in the
--     network.
--
-- -   @CREATE_FAILED@ - The AWS account attempted to create a member and
--     creation failed.
--
-- -   @UPDATING@ - The member is in the process of being updated.
--
-- -   @DELETING@ - The member and all associated resources are in the
--     process of being deleted. Either the AWS account that owns the
--     member deleted it, or the member is being deleted as the result of
--     an @APPROVED@ @PROPOSAL@ to remove the member.
--
-- -   @DELETED@ - The member can no longer participate on the network and
--     all associated resources are deleted. Either the AWS account that
--     owns the member deleted it, or the member is being deleted as the
--     result of an @APPROVED@ @PROPOSAL@ to remove the member.
--
-- -   @INACCESSIBLE_ENCRYPTION_KEY@ - The member is impaired and might not
--     function as expected because it cannot access the specified customer
--     managed key in AWS Key Management Service (AWS KMS) for encryption
--     at rest. Either the KMS key was disabled or deleted, or the grants
--     on the key were revoked.
--
--     The effect of disabling or deleting a key, or revoking a grant is
--     not immediate. The member resource might take some time to find that
--     the key is inaccessible. When a resource is in this state, we
--     recommend deleting and recreating the resource.
--
-- 'arn', 'memberSummary_arn' - The Amazon Resource Name (ARN) of the member. For more information about
-- ARNs and their format, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /AWS General Reference/.
--
-- 'name', 'memberSummary_name' - The name of the member.
--
-- 'id', 'memberSummary_id' - The unique identifier of the member.
--
-- 'isOwned', 'memberSummary_isOwned' - An indicator of whether the member is owned by your AWS account or a
-- different AWS account.
--
-- 'creationDate', 'memberSummary_creationDate' - The date and time that the member was created.
--
-- 'description', 'memberSummary_description' - An optional description of the member.
newMemberSummary ::
  MemberSummary
newMemberSummary :: MemberSummary
newMemberSummary =
  MemberSummary' :: Maybe MemberStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe POSIX
-> Maybe Text
-> MemberSummary
MemberSummary'
    { $sel:status:MemberSummary' :: Maybe MemberStatus
status = Maybe MemberStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:MemberSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:MemberSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:MemberSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isOwned:MemberSummary' :: Maybe Bool
isOwned = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:MemberSummary' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:description:MemberSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the member.
--
-- -   @CREATING@ - The AWS account is in the process of creating a member.
--
-- -   @AVAILABLE@ - The member has been created and can participate in the
--     network.
--
-- -   @CREATE_FAILED@ - The AWS account attempted to create a member and
--     creation failed.
--
-- -   @UPDATING@ - The member is in the process of being updated.
--
-- -   @DELETING@ - The member and all associated resources are in the
--     process of being deleted. Either the AWS account that owns the
--     member deleted it, or the member is being deleted as the result of
--     an @APPROVED@ @PROPOSAL@ to remove the member.
--
-- -   @DELETED@ - The member can no longer participate on the network and
--     all associated resources are deleted. Either the AWS account that
--     owns the member deleted it, or the member is being deleted as the
--     result of an @APPROVED@ @PROPOSAL@ to remove the member.
--
-- -   @INACCESSIBLE_ENCRYPTION_KEY@ - The member is impaired and might not
--     function as expected because it cannot access the specified customer
--     managed key in AWS Key Management Service (AWS KMS) for encryption
--     at rest. Either the KMS key was disabled or deleted, or the grants
--     on the key were revoked.
--
--     The effect of disabling or deleting a key, or revoking a grant is
--     not immediate. The member resource might take some time to find that
--     the key is inaccessible. When a resource is in this state, we
--     recommend deleting and recreating the resource.
memberSummary_status :: Lens.Lens' MemberSummary (Prelude.Maybe MemberStatus)
memberSummary_status :: (Maybe MemberStatus -> f (Maybe MemberStatus))
-> MemberSummary -> f MemberSummary
memberSummary_status = (MemberSummary -> Maybe MemberStatus)
-> (MemberSummary -> Maybe MemberStatus -> MemberSummary)
-> Lens
     MemberSummary
     MemberSummary
     (Maybe MemberStatus)
     (Maybe MemberStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberSummary' {Maybe MemberStatus
status :: Maybe MemberStatus
$sel:status:MemberSummary' :: MemberSummary -> Maybe MemberStatus
status} -> Maybe MemberStatus
status) (\s :: MemberSummary
s@MemberSummary' {} Maybe MemberStatus
a -> MemberSummary
s {$sel:status:MemberSummary' :: Maybe MemberStatus
status = Maybe MemberStatus
a} :: MemberSummary)

-- | The Amazon Resource Name (ARN) of the member. For more information about
-- ARNs and their format, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /AWS General Reference/.
memberSummary_arn :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.Text)
memberSummary_arn :: (Maybe Text -> f (Maybe Text)) -> MemberSummary -> f MemberSummary
memberSummary_arn = (MemberSummary -> Maybe Text)
-> (MemberSummary -> Maybe Text -> MemberSummary)
-> Lens MemberSummary MemberSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:MemberSummary' :: MemberSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: MemberSummary
s@MemberSummary' {} Maybe Text
a -> MemberSummary
s {$sel:arn:MemberSummary' :: Maybe Text
arn = Maybe Text
a} :: MemberSummary)

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

-- | The unique identifier of the member.
memberSummary_id :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.Text)
memberSummary_id :: (Maybe Text -> f (Maybe Text)) -> MemberSummary -> f MemberSummary
memberSummary_id = (MemberSummary -> Maybe Text)
-> (MemberSummary -> Maybe Text -> MemberSummary)
-> Lens MemberSummary MemberSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberSummary' {Maybe Text
id :: Maybe Text
$sel:id:MemberSummary' :: MemberSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: MemberSummary
s@MemberSummary' {} Maybe Text
a -> MemberSummary
s {$sel:id:MemberSummary' :: Maybe Text
id = Maybe Text
a} :: MemberSummary)

-- | An indicator of whether the member is owned by your AWS account or a
-- different AWS account.
memberSummary_isOwned :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.Bool)
memberSummary_isOwned :: (Maybe Bool -> f (Maybe Bool)) -> MemberSummary -> f MemberSummary
memberSummary_isOwned = (MemberSummary -> Maybe Bool)
-> (MemberSummary -> Maybe Bool -> MemberSummary)
-> Lens MemberSummary MemberSummary (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberSummary' {Maybe Bool
isOwned :: Maybe Bool
$sel:isOwned:MemberSummary' :: MemberSummary -> Maybe Bool
isOwned} -> Maybe Bool
isOwned) (\s :: MemberSummary
s@MemberSummary' {} Maybe Bool
a -> MemberSummary
s {$sel:isOwned:MemberSummary' :: Maybe Bool
isOwned = Maybe Bool
a} :: MemberSummary)

-- | The date and time that the member was created.
memberSummary_creationDate :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.UTCTime)
memberSummary_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MemberSummary -> f MemberSummary
memberSummary_creationDate = (MemberSummary -> Maybe POSIX)
-> (MemberSummary -> Maybe POSIX -> MemberSummary)
-> Lens MemberSummary MemberSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberSummary' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:MemberSummary' :: MemberSummary -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: MemberSummary
s@MemberSummary' {} Maybe POSIX
a -> MemberSummary
s {$sel:creationDate:MemberSummary' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: MemberSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> MemberSummary -> f MemberSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MemberSummary
-> f MemberSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | An optional description of the member.
memberSummary_description :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.Text)
memberSummary_description :: (Maybe Text -> f (Maybe Text)) -> MemberSummary -> f MemberSummary
memberSummary_description = (MemberSummary -> Maybe Text)
-> (MemberSummary -> Maybe Text -> MemberSummary)
-> Lens MemberSummary MemberSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberSummary' {Maybe Text
description :: Maybe Text
$sel:description:MemberSummary' :: MemberSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: MemberSummary
s@MemberSummary' {} Maybe Text
a -> MemberSummary
s {$sel:description:MemberSummary' :: Maybe Text
description = Maybe Text
a} :: MemberSummary)

instance Core.FromJSON MemberSummary where
  parseJSON :: Value -> Parser MemberSummary
parseJSON =
    String
-> (Object -> Parser MemberSummary)
-> Value
-> Parser MemberSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MemberSummary"
      ( \Object
x ->
          Maybe MemberStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe POSIX
-> Maybe Text
-> MemberSummary
MemberSummary'
            (Maybe MemberStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe POSIX
 -> Maybe Text
 -> MemberSummary)
-> Parser (Maybe MemberStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe POSIX
      -> Maybe Text
      -> MemberSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MemberStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe POSIX
   -> Maybe Text
   -> MemberSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe POSIX
      -> Maybe Text
      -> MemberSummary)
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 Bool
   -> Maybe POSIX
   -> Maybe Text
   -> MemberSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool -> Maybe POSIX -> Maybe Text -> MemberSummary)
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 Bool -> Maybe POSIX -> Maybe Text -> MemberSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe POSIX -> Maybe Text -> MemberSummary)
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 Bool -> Maybe POSIX -> Maybe Text -> MemberSummary)
-> Parser (Maybe Bool)
-> Parser (Maybe POSIX -> Maybe Text -> MemberSummary)
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
"IsOwned")
            Parser (Maybe POSIX -> Maybe Text -> MemberSummary)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> MemberSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationDate")
            Parser (Maybe Text -> MemberSummary)
-> Parser (Maybe Text) -> Parser MemberSummary
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
"Description")
      )

instance Prelude.Hashable MemberSummary

instance Prelude.NFData MemberSummary