{-# 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.AccessorSummary
-- 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.AccessorSummary 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.AccessorStatus
import Amazonka.ManagedBlockChain.Types.AccessorType
import qualified Amazonka.Prelude as Prelude

-- | The token based access feature is in preview release for Ethereum on
-- Amazon Managed Blockchain and is subject to change. We recommend that
-- you use this feature only with test scenarios, and not in production
-- environments.
--
-- A summary of accessor properties.
--
-- /See:/ 'newAccessorSummary' smart constructor.
data AccessorSummary = AccessorSummary'
  { -- | The Amazon Resource Name (ARN) of the accessor. 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/.
    AccessorSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The creation date and time of the accessor.
    AccessorSummary -> Maybe ISO8601
creationDate :: Prelude.Maybe Data.ISO8601,
    -- | The unique identifier of the accessor.
    AccessorSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The current status of the accessor.
    AccessorSummary -> Maybe AccessorStatus
status :: Prelude.Maybe AccessorStatus,
    -- | The type of the accessor.
    --
    -- Currently accessor type is restricted to @BILLING_TOKEN@.
    AccessorSummary -> Maybe AccessorType
type' :: Prelude.Maybe AccessorType
  }
  deriving (AccessorSummary -> AccessorSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessorSummary -> AccessorSummary -> Bool
$c/= :: AccessorSummary -> AccessorSummary -> Bool
== :: AccessorSummary -> AccessorSummary -> Bool
$c== :: AccessorSummary -> AccessorSummary -> Bool
Prelude.Eq, ReadPrec [AccessorSummary]
ReadPrec AccessorSummary
Int -> ReadS AccessorSummary
ReadS [AccessorSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccessorSummary]
$creadListPrec :: ReadPrec [AccessorSummary]
readPrec :: ReadPrec AccessorSummary
$creadPrec :: ReadPrec AccessorSummary
readList :: ReadS [AccessorSummary]
$creadList :: ReadS [AccessorSummary]
readsPrec :: Int -> ReadS AccessorSummary
$creadsPrec :: Int -> ReadS AccessorSummary
Prelude.Read, Int -> AccessorSummary -> ShowS
[AccessorSummary] -> ShowS
AccessorSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessorSummary] -> ShowS
$cshowList :: [AccessorSummary] -> ShowS
show :: AccessorSummary -> String
$cshow :: AccessorSummary -> String
showsPrec :: Int -> AccessorSummary -> ShowS
$cshowsPrec :: Int -> AccessorSummary -> ShowS
Prelude.Show, forall x. Rep AccessorSummary x -> AccessorSummary
forall x. AccessorSummary -> Rep AccessorSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccessorSummary x -> AccessorSummary
$cfrom :: forall x. AccessorSummary -> Rep AccessorSummary x
Prelude.Generic)

-- |
-- Create a value of 'AccessorSummary' 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', 'accessorSummary_arn' - The Amazon Resource Name (ARN) of the accessor. 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', 'accessorSummary_creationDate' - The creation date and time of the accessor.
--
-- 'id', 'accessorSummary_id' - The unique identifier of the accessor.
--
-- 'status', 'accessorSummary_status' - The current status of the accessor.
--
-- 'type'', 'accessorSummary_type' - The type of the accessor.
--
-- Currently accessor type is restricted to @BILLING_TOKEN@.
newAccessorSummary ::
  AccessorSummary
newAccessorSummary :: AccessorSummary
newAccessorSummary =
  AccessorSummary'
    { $sel:arn:AccessorSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:AccessorSummary' :: Maybe ISO8601
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:id:AccessorSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:status:AccessorSummary' :: Maybe AccessorStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:type':AccessorSummary' :: Maybe AccessorType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the accessor. 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/.
accessorSummary_arn :: Lens.Lens' AccessorSummary (Prelude.Maybe Prelude.Text)
accessorSummary_arn :: Lens' AccessorSummary (Maybe Text)
accessorSummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessorSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:AccessorSummary' :: AccessorSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: AccessorSummary
s@AccessorSummary' {} Maybe Text
a -> AccessorSummary
s {$sel:arn:AccessorSummary' :: Maybe Text
arn = Maybe Text
a} :: AccessorSummary)

-- | The creation date and time of the accessor.
accessorSummary_creationDate :: Lens.Lens' AccessorSummary (Prelude.Maybe Prelude.UTCTime)
accessorSummary_creationDate :: Lens' AccessorSummary (Maybe UTCTime)
accessorSummary_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessorSummary' {Maybe ISO8601
creationDate :: Maybe ISO8601
$sel:creationDate:AccessorSummary' :: AccessorSummary -> Maybe ISO8601
creationDate} -> Maybe ISO8601
creationDate) (\s :: AccessorSummary
s@AccessorSummary' {} Maybe ISO8601
a -> AccessorSummary
s {$sel:creationDate:AccessorSummary' :: Maybe ISO8601
creationDate = Maybe ISO8601
a} :: AccessorSummary) 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 identifier of the accessor.
accessorSummary_id :: Lens.Lens' AccessorSummary (Prelude.Maybe Prelude.Text)
accessorSummary_id :: Lens' AccessorSummary (Maybe Text)
accessorSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessorSummary' {Maybe Text
id :: Maybe Text
$sel:id:AccessorSummary' :: AccessorSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: AccessorSummary
s@AccessorSummary' {} Maybe Text
a -> AccessorSummary
s {$sel:id:AccessorSummary' :: Maybe Text
id = Maybe Text
a} :: AccessorSummary)

-- | The current status of the accessor.
accessorSummary_status :: Lens.Lens' AccessorSummary (Prelude.Maybe AccessorStatus)
accessorSummary_status :: Lens' AccessorSummary (Maybe AccessorStatus)
accessorSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessorSummary' {Maybe AccessorStatus
status :: Maybe AccessorStatus
$sel:status:AccessorSummary' :: AccessorSummary -> Maybe AccessorStatus
status} -> Maybe AccessorStatus
status) (\s :: AccessorSummary
s@AccessorSummary' {} Maybe AccessorStatus
a -> AccessorSummary
s {$sel:status:AccessorSummary' :: Maybe AccessorStatus
status = Maybe AccessorStatus
a} :: AccessorSummary)

-- | The type of the accessor.
--
-- Currently accessor type is restricted to @BILLING_TOKEN@.
accessorSummary_type :: Lens.Lens' AccessorSummary (Prelude.Maybe AccessorType)
accessorSummary_type :: Lens' AccessorSummary (Maybe AccessorType)
accessorSummary_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessorSummary' {Maybe AccessorType
type' :: Maybe AccessorType
$sel:type':AccessorSummary' :: AccessorSummary -> Maybe AccessorType
type'} -> Maybe AccessorType
type') (\s :: AccessorSummary
s@AccessorSummary' {} Maybe AccessorType
a -> AccessorSummary
s {$sel:type':AccessorSummary' :: Maybe AccessorType
type' = Maybe AccessorType
a} :: AccessorSummary)

instance Data.FromJSON AccessorSummary where
  parseJSON :: Value -> Parser AccessorSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AccessorSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe AccessorStatus
-> Maybe AccessorType
-> AccessorSummary
AccessorSummary'
            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
"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
"Status")
            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
"Type")
      )

instance Prelude.Hashable AccessorSummary where
  hashWithSalt :: Int -> AccessorSummary -> Int
hashWithSalt Int
_salt AccessorSummary' {Maybe Text
Maybe ISO8601
Maybe AccessorStatus
Maybe AccessorType
type' :: Maybe AccessorType
status :: Maybe AccessorStatus
id :: Maybe Text
creationDate :: Maybe ISO8601
arn :: Maybe Text
$sel:type':AccessorSummary' :: AccessorSummary -> Maybe AccessorType
$sel:status:AccessorSummary' :: AccessorSummary -> Maybe AccessorStatus
$sel:id:AccessorSummary' :: AccessorSummary -> Maybe Text
$sel:creationDate:AccessorSummary' :: AccessorSummary -> Maybe ISO8601
$sel:arn:AccessorSummary' :: AccessorSummary -> 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
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AccessorStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AccessorType
type'

instance Prelude.NFData AccessorSummary where
  rnf :: AccessorSummary -> ()
rnf AccessorSummary' {Maybe Text
Maybe ISO8601
Maybe AccessorStatus
Maybe AccessorType
type' :: Maybe AccessorType
status :: Maybe AccessorStatus
id :: Maybe Text
creationDate :: Maybe ISO8601
arn :: Maybe Text
$sel:type':AccessorSummary' :: AccessorSummary -> Maybe AccessorType
$sel:status:AccessorSummary' :: AccessorSummary -> Maybe AccessorStatus
$sel:id:AccessorSummary' :: AccessorSummary -> Maybe Text
$sel:creationDate:AccessorSummary' :: AccessorSummary -> Maybe ISO8601
$sel:arn:AccessorSummary' :: AccessorSummary -> 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
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AccessorStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AccessorType
type'