{-# 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.Schemas.Types.DiscovererSummary
-- 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.Schemas.Types.DiscovererSummary 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
import Amazonka.Schemas.Types.DiscovererState

-- | /See:/ 'newDiscovererSummary' smart constructor.
data DiscovererSummary = DiscovererSummary'
  { -- | The Status if the discoverer will discover schemas from events sent from
    -- another account.
    DiscovererSummary -> Maybe Bool
crossAccount :: Prelude.Maybe Prelude.Bool,
    -- | The ARN of the discoverer.
    DiscovererSummary -> Maybe Text
discovererArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the discoverer.
    DiscovererSummary -> Maybe Text
discovererId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the event bus.
    DiscovererSummary -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text,
    -- | The state of the discoverer.
    DiscovererSummary -> Maybe DiscovererState
state :: Prelude.Maybe DiscovererState,
    -- | Tags associated with the resource.
    DiscovererSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (DiscovererSummary -> DiscovererSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiscovererSummary -> DiscovererSummary -> Bool
$c/= :: DiscovererSummary -> DiscovererSummary -> Bool
== :: DiscovererSummary -> DiscovererSummary -> Bool
$c== :: DiscovererSummary -> DiscovererSummary -> Bool
Prelude.Eq, ReadPrec [DiscovererSummary]
ReadPrec DiscovererSummary
Int -> ReadS DiscovererSummary
ReadS [DiscovererSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiscovererSummary]
$creadListPrec :: ReadPrec [DiscovererSummary]
readPrec :: ReadPrec DiscovererSummary
$creadPrec :: ReadPrec DiscovererSummary
readList :: ReadS [DiscovererSummary]
$creadList :: ReadS [DiscovererSummary]
readsPrec :: Int -> ReadS DiscovererSummary
$creadsPrec :: Int -> ReadS DiscovererSummary
Prelude.Read, Int -> DiscovererSummary -> ShowS
[DiscovererSummary] -> ShowS
DiscovererSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiscovererSummary] -> ShowS
$cshowList :: [DiscovererSummary] -> ShowS
show :: DiscovererSummary -> String
$cshow :: DiscovererSummary -> String
showsPrec :: Int -> DiscovererSummary -> ShowS
$cshowsPrec :: Int -> DiscovererSummary -> ShowS
Prelude.Show, forall x. Rep DiscovererSummary x -> DiscovererSummary
forall x. DiscovererSummary -> Rep DiscovererSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DiscovererSummary x -> DiscovererSummary
$cfrom :: forall x. DiscovererSummary -> Rep DiscovererSummary x
Prelude.Generic)

-- |
-- Create a value of 'DiscovererSummary' 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:
--
-- 'crossAccount', 'discovererSummary_crossAccount' - The Status if the discoverer will discover schemas from events sent from
-- another account.
--
-- 'discovererArn', 'discovererSummary_discovererArn' - The ARN of the discoverer.
--
-- 'discovererId', 'discovererSummary_discovererId' - The ID of the discoverer.
--
-- 'sourceArn', 'discovererSummary_sourceArn' - The ARN of the event bus.
--
-- 'state', 'discovererSummary_state' - The state of the discoverer.
--
-- 'tags', 'discovererSummary_tags' - Tags associated with the resource.
newDiscovererSummary ::
  DiscovererSummary
newDiscovererSummary :: DiscovererSummary
newDiscovererSummary =
  DiscovererSummary'
    { $sel:crossAccount:DiscovererSummary' :: Maybe Bool
crossAccount = forall a. Maybe a
Prelude.Nothing,
      $sel:discovererArn:DiscovererSummary' :: Maybe Text
discovererArn = forall a. Maybe a
Prelude.Nothing,
      $sel:discovererId:DiscovererSummary' :: Maybe Text
discovererId = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceArn:DiscovererSummary' :: Maybe Text
sourceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:state:DiscovererSummary' :: Maybe DiscovererState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DiscovererSummary' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The Status if the discoverer will discover schemas from events sent from
-- another account.
discovererSummary_crossAccount :: Lens.Lens' DiscovererSummary (Prelude.Maybe Prelude.Bool)
discovererSummary_crossAccount :: Lens' DiscovererSummary (Maybe Bool)
discovererSummary_crossAccount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscovererSummary' {Maybe Bool
crossAccount :: Maybe Bool
$sel:crossAccount:DiscovererSummary' :: DiscovererSummary -> Maybe Bool
crossAccount} -> Maybe Bool
crossAccount) (\s :: DiscovererSummary
s@DiscovererSummary' {} Maybe Bool
a -> DiscovererSummary
s {$sel:crossAccount:DiscovererSummary' :: Maybe Bool
crossAccount = Maybe Bool
a} :: DiscovererSummary)

-- | The ARN of the discoverer.
discovererSummary_discovererArn :: Lens.Lens' DiscovererSummary (Prelude.Maybe Prelude.Text)
discovererSummary_discovererArn :: Lens' DiscovererSummary (Maybe Text)
discovererSummary_discovererArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscovererSummary' {Maybe Text
discovererArn :: Maybe Text
$sel:discovererArn:DiscovererSummary' :: DiscovererSummary -> Maybe Text
discovererArn} -> Maybe Text
discovererArn) (\s :: DiscovererSummary
s@DiscovererSummary' {} Maybe Text
a -> DiscovererSummary
s {$sel:discovererArn:DiscovererSummary' :: Maybe Text
discovererArn = Maybe Text
a} :: DiscovererSummary)

-- | The ID of the discoverer.
discovererSummary_discovererId :: Lens.Lens' DiscovererSummary (Prelude.Maybe Prelude.Text)
discovererSummary_discovererId :: Lens' DiscovererSummary (Maybe Text)
discovererSummary_discovererId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscovererSummary' {Maybe Text
discovererId :: Maybe Text
$sel:discovererId:DiscovererSummary' :: DiscovererSummary -> Maybe Text
discovererId} -> Maybe Text
discovererId) (\s :: DiscovererSummary
s@DiscovererSummary' {} Maybe Text
a -> DiscovererSummary
s {$sel:discovererId:DiscovererSummary' :: Maybe Text
discovererId = Maybe Text
a} :: DiscovererSummary)

-- | The ARN of the event bus.
discovererSummary_sourceArn :: Lens.Lens' DiscovererSummary (Prelude.Maybe Prelude.Text)
discovererSummary_sourceArn :: Lens' DiscovererSummary (Maybe Text)
discovererSummary_sourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscovererSummary' {Maybe Text
sourceArn :: Maybe Text
$sel:sourceArn:DiscovererSummary' :: DiscovererSummary -> Maybe Text
sourceArn} -> Maybe Text
sourceArn) (\s :: DiscovererSummary
s@DiscovererSummary' {} Maybe Text
a -> DiscovererSummary
s {$sel:sourceArn:DiscovererSummary' :: Maybe Text
sourceArn = Maybe Text
a} :: DiscovererSummary)

-- | The state of the discoverer.
discovererSummary_state :: Lens.Lens' DiscovererSummary (Prelude.Maybe DiscovererState)
discovererSummary_state :: Lens' DiscovererSummary (Maybe DiscovererState)
discovererSummary_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscovererSummary' {Maybe DiscovererState
state :: Maybe DiscovererState
$sel:state:DiscovererSummary' :: DiscovererSummary -> Maybe DiscovererState
state} -> Maybe DiscovererState
state) (\s :: DiscovererSummary
s@DiscovererSummary' {} Maybe DiscovererState
a -> DiscovererSummary
s {$sel:state:DiscovererSummary' :: Maybe DiscovererState
state = Maybe DiscovererState
a} :: DiscovererSummary)

-- | Tags associated with the resource.
discovererSummary_tags :: Lens.Lens' DiscovererSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
discovererSummary_tags :: Lens' DiscovererSummary (Maybe (HashMap Text Text))
discovererSummary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscovererSummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:DiscovererSummary' :: DiscovererSummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: DiscovererSummary
s@DiscovererSummary' {} Maybe (HashMap Text Text)
a -> DiscovererSummary
s {$sel:tags:DiscovererSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: DiscovererSummary) 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 DiscovererSummary where
  parseJSON :: Value -> Parser DiscovererSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DiscovererSummary"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscovererState
-> Maybe (HashMap Text Text)
-> DiscovererSummary
DiscovererSummary'
            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
"CrossAccount")
            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
"DiscovererArn")
            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
"DiscovererId")
            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
"SourceArn")
            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
"State")
            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 DiscovererSummary where
  hashWithSalt :: Int -> DiscovererSummary -> Int
hashWithSalt Int
_salt DiscovererSummary' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe DiscovererState
tags :: Maybe (HashMap Text Text)
state :: Maybe DiscovererState
sourceArn :: Maybe Text
discovererId :: Maybe Text
discovererArn :: Maybe Text
crossAccount :: Maybe Bool
$sel:tags:DiscovererSummary' :: DiscovererSummary -> Maybe (HashMap Text Text)
$sel:state:DiscovererSummary' :: DiscovererSummary -> Maybe DiscovererState
$sel:sourceArn:DiscovererSummary' :: DiscovererSummary -> Maybe Text
$sel:discovererId:DiscovererSummary' :: DiscovererSummary -> Maybe Text
$sel:discovererArn:DiscovererSummary' :: DiscovererSummary -> Maybe Text
$sel:crossAccount:DiscovererSummary' :: DiscovererSummary -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
crossAccount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
discovererArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
discovererId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DiscovererState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData DiscovererSummary where
  rnf :: DiscovererSummary -> ()
rnf DiscovererSummary' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe DiscovererState
tags :: Maybe (HashMap Text Text)
state :: Maybe DiscovererState
sourceArn :: Maybe Text
discovererId :: Maybe Text
discovererArn :: Maybe Text
crossAccount :: Maybe Bool
$sel:tags:DiscovererSummary' :: DiscovererSummary -> Maybe (HashMap Text Text)
$sel:state:DiscovererSummary' :: DiscovererSummary -> Maybe DiscovererState
$sel:sourceArn:DiscovererSummary' :: DiscovererSummary -> Maybe Text
$sel:discovererId:DiscovererSummary' :: DiscovererSummary -> Maybe Text
$sel:discovererArn:DiscovererSummary' :: DiscovererSummary -> Maybe Text
$sel:crossAccount:DiscovererSummary' :: DiscovererSummary -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
crossAccount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
discovererArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
discovererId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DiscovererState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags