{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ManagedBlockChain.Types.MemberSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 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 /Amazon Web Services General Reference/.
    MemberSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the member was created.
    MemberSummary -> Maybe ISO8601
creationDate :: Prelude.Maybe Data.ISO8601,
    -- | An optional description of the member.
    MemberSummary -> Maybe Text
description :: 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 Amazon Web Services
    -- account or a different Amazon Web Services account.
    MemberSummary -> Maybe Bool
isOwned :: Prelude.Maybe Prelude.Bool,
    -- | The name of the member.
    MemberSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The status of the member.
    --
    -- -   @CREATING@ - The Amazon Web Services account is in the process of
    --     creating a member.
    --
    -- -   @AVAILABLE@ - The member has been created and can participate in the
    --     network.
    --
    -- -   @CREATE_FAILED@ - The Amazon Web Services 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 Amazon Web Services 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 Amazon Web Services
    --     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 Key Management Service (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 of revoking a grant
    --     isn\'t immediate. It might take some time for the member resource to
    --     discover 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
  }
  deriving (MemberSummary -> MemberSummary -> Bool
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]
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
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. 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:
--
-- '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 /Amazon Web Services General Reference/.
--
-- 'creationDate', 'memberSummary_creationDate' - The date and time that the member was created.
--
-- 'description', 'memberSummary_description' - An optional description 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 Amazon Web Services
-- account or a different Amazon Web Services account.
--
-- 'name', 'memberSummary_name' - The name of the member.
--
-- 'status', 'memberSummary_status' - The status of the member.
--
-- -   @CREATING@ - The Amazon Web Services account is in the process of
--     creating a member.
--
-- -   @AVAILABLE@ - The member has been created and can participate in the
--     network.
--
-- -   @CREATE_FAILED@ - The Amazon Web Services 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 Amazon Web Services 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 Amazon Web Services
--     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 Key Management Service (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 of revoking a grant
--     isn\'t immediate. It might take some time for the member resource to
--     discover that the key is inaccessible. When a resource is in this
--     state, we recommend deleting and recreating the resource.
newMemberSummary ::
  MemberSummary
newMemberSummary :: MemberSummary
newMemberSummary =
  MemberSummary'
    { $sel:arn:MemberSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:MemberSummary' :: Maybe ISO8601
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:MemberSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:MemberSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:isOwned:MemberSummary' :: Maybe Bool
isOwned = forall a. Maybe a
Prelude.Nothing,
      $sel:name:MemberSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:MemberSummary' :: Maybe MemberStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 /Amazon Web Services General Reference/.
memberSummary_arn :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.Text)
memberSummary_arn :: Lens' MemberSummary (Maybe Text)
memberSummary_arn = 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 date and time that the member was created.
memberSummary_creationDate :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.UTCTime)
memberSummary_creationDate :: Lens' MemberSummary (Maybe UTCTime)
memberSummary_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberSummary' {Maybe ISO8601
creationDate :: Maybe ISO8601
$sel:creationDate:MemberSummary' :: MemberSummary -> Maybe ISO8601
creationDate} -> Maybe ISO8601
creationDate) (\s :: MemberSummary
s@MemberSummary' {} Maybe ISO8601
a -> MemberSummary
s {$sel:creationDate:MemberSummary' :: Maybe ISO8601
creationDate = Maybe ISO8601
a} :: MemberSummary) 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

-- | An optional description of the member.
memberSummary_description :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.Text)
memberSummary_description :: Lens' MemberSummary (Maybe Text)
memberSummary_description = 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)

-- | The unique identifier of the member.
memberSummary_id :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.Text)
memberSummary_id :: Lens' MemberSummary (Maybe Text)
memberSummary_id = 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 Amazon Web Services
-- account or a different Amazon Web Services account.
memberSummary_isOwned :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.Bool)
memberSummary_isOwned :: Lens' MemberSummary (Maybe Bool)
memberSummary_isOwned = 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 name of the member.
memberSummary_name :: Lens.Lens' MemberSummary (Prelude.Maybe Prelude.Text)
memberSummary_name :: Lens' MemberSummary (Maybe Text)
memberSummary_name = 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 status of the member.
--
-- -   @CREATING@ - The Amazon Web Services account is in the process of
--     creating a member.
--
-- -   @AVAILABLE@ - The member has been created and can participate in the
--     network.
--
-- -   @CREATE_FAILED@ - The Amazon Web Services 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 Amazon Web Services 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 Amazon Web Services
--     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 Key Management Service (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 of revoking a grant
--     isn\'t immediate. It might take some time for the member resource to
--     discover 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 :: Lens' MemberSummary (Maybe MemberStatus)
memberSummary_status = 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)

instance Data.FromJSON MemberSummary where
  parseJSON :: Value -> Parser MemberSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MemberSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe MemberStatus
-> MemberSummary
MemberSummary'
            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
"CreationDate")
            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
"Description")
            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
"IsOwned")
            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
"Status")
      )

instance Prelude.Hashable MemberSummary where
  hashWithSalt :: Int -> MemberSummary -> Int
hashWithSalt Int
_salt MemberSummary' {Maybe Bool
Maybe Text
Maybe ISO8601
Maybe MemberStatus
status :: Maybe MemberStatus
name :: Maybe Text
isOwned :: Maybe Bool
id :: Maybe Text
description :: Maybe Text
creationDate :: Maybe ISO8601
arn :: Maybe Text
$sel:status:MemberSummary' :: MemberSummary -> Maybe MemberStatus
$sel:name:MemberSummary' :: MemberSummary -> Maybe Text
$sel:isOwned:MemberSummary' :: MemberSummary -> Maybe Bool
$sel:id:MemberSummary' :: MemberSummary -> Maybe Text
$sel:description:MemberSummary' :: MemberSummary -> Maybe Text
$sel:creationDate:MemberSummary' :: MemberSummary -> Maybe ISO8601
$sel:arn:MemberSummary' :: MemberSummary -> 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 ISO8601
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isOwned
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MemberStatus
status

instance Prelude.NFData MemberSummary where
  rnf :: MemberSummary -> ()
rnf MemberSummary' {Maybe Bool
Maybe Text
Maybe ISO8601
Maybe MemberStatus
status :: Maybe MemberStatus
name :: Maybe Text
isOwned :: Maybe Bool
id :: Maybe Text
description :: Maybe Text
creationDate :: Maybe ISO8601
arn :: Maybe Text
$sel:status:MemberSummary' :: MemberSummary -> Maybe MemberStatus
$sel:name:MemberSummary' :: MemberSummary -> Maybe Text
$sel:isOwned:MemberSummary' :: MemberSummary -> Maybe Bool
$sel:id:MemberSummary' :: MemberSummary -> Maybe Text
$sel:description:MemberSummary' :: MemberSummary -> Maybe Text
$sel:creationDate:MemberSummary' :: MemberSummary -> Maybe ISO8601
$sel:arn:MemberSummary' :: MemberSummary -> 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 ISO8601
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      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 Bool
isOwned
      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 MemberStatus
status