{-# 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-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.Schemas.Types.DiscovererSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Schemas.Types.DiscovererState

-- | /See:/ 'newDiscovererSummary' smart constructor.
data DiscovererSummary = DiscovererSummary'
  { -- | The state of the discoverer.
    DiscovererSummary -> Maybe DiscovererState
state :: Prelude.Maybe DiscovererState,
    -- | 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 event bus.
    DiscovererSummary -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the discoverer.
    DiscovererSummary -> Maybe Text
discovererId :: Prelude.Maybe Prelude.Text,
    -- | Tags associated with the resource.
    DiscovererSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ARN of the discoverer.
    DiscovererSummary -> Maybe Text
discovererArn :: Prelude.Maybe Prelude.Text
  }
  deriving (DiscovererSummary -> DiscovererSummary -> Bool
(DiscovererSummary -> DiscovererSummary -> Bool)
-> (DiscovererSummary -> DiscovererSummary -> Bool)
-> Eq DiscovererSummary
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]
(Int -> ReadS DiscovererSummary)
-> ReadS [DiscovererSummary]
-> ReadPrec DiscovererSummary
-> ReadPrec [DiscovererSummary]
-> Read 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
(Int -> DiscovererSummary -> ShowS)
-> (DiscovererSummary -> String)
-> ([DiscovererSummary] -> ShowS)
-> Show DiscovererSummary
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. DiscovererSummary -> Rep DiscovererSummary x)
-> (forall x. Rep DiscovererSummary x -> DiscovererSummary)
-> Generic DiscovererSummary
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:
--
-- 'state', 'discovererSummary_state' - The state of the discoverer.
--
-- 'crossAccount', 'discovererSummary_crossAccount' - The Status if the discoverer will discover schemas from events sent from
-- another account.
--
-- 'sourceArn', 'discovererSummary_sourceArn' - The ARN of the event bus.
--
-- 'discovererId', 'discovererSummary_discovererId' - The ID of the discoverer.
--
-- 'tags', 'discovererSummary_tags' - Tags associated with the resource.
--
-- 'discovererArn', 'discovererSummary_discovererArn' - The ARN of the discoverer.
newDiscovererSummary ::
  DiscovererSummary
newDiscovererSummary :: DiscovererSummary
newDiscovererSummary =
  DiscovererSummary' :: Maybe DiscovererState
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> DiscovererSummary
DiscovererSummary'
    { $sel:state:DiscovererSummary' :: Maybe DiscovererState
state = Maybe DiscovererState
forall a. Maybe a
Prelude.Nothing,
      $sel:crossAccount:DiscovererSummary' :: Maybe Bool
crossAccount = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceArn:DiscovererSummary' :: Maybe Text
sourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:discovererId:DiscovererSummary' :: Maybe Text
discovererId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DiscovererSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:discovererArn:DiscovererSummary' :: Maybe Text
discovererArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the discoverer.
discovererSummary_state :: Lens.Lens' DiscovererSummary (Prelude.Maybe DiscovererState)
discovererSummary_state :: (Maybe DiscovererState -> f (Maybe DiscovererState))
-> DiscovererSummary -> f DiscovererSummary
discovererSummary_state = (DiscovererSummary -> Maybe DiscovererState)
-> (DiscovererSummary
    -> Maybe DiscovererState -> DiscovererSummary)
-> Lens
     DiscovererSummary
     DiscovererSummary
     (Maybe DiscovererState)
     (Maybe DiscovererState)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> DiscovererSummary -> f DiscovererSummary
discovererSummary_crossAccount = (DiscovererSummary -> Maybe Bool)
-> (DiscovererSummary -> Maybe Bool -> DiscovererSummary)
-> Lens
     DiscovererSummary DiscovererSummary (Maybe Bool) (Maybe Bool)
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 event bus.
discovererSummary_sourceArn :: Lens.Lens' DiscovererSummary (Prelude.Maybe Prelude.Text)
discovererSummary_sourceArn :: (Maybe Text -> f (Maybe Text))
-> DiscovererSummary -> f DiscovererSummary
discovererSummary_sourceArn = (DiscovererSummary -> Maybe Text)
-> (DiscovererSummary -> Maybe Text -> DiscovererSummary)
-> Lens
     DiscovererSummary DiscovererSummary (Maybe Text) (Maybe Text)
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 ID of the discoverer.
discovererSummary_discovererId :: Lens.Lens' DiscovererSummary (Prelude.Maybe Prelude.Text)
discovererSummary_discovererId :: (Maybe Text -> f (Maybe Text))
-> DiscovererSummary -> f DiscovererSummary
discovererSummary_discovererId = (DiscovererSummary -> Maybe Text)
-> (DiscovererSummary -> Maybe Text -> DiscovererSummary)
-> Lens
     DiscovererSummary DiscovererSummary (Maybe Text) (Maybe Text)
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)

-- | Tags associated with the resource.
discovererSummary_tags :: Lens.Lens' DiscovererSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
discovererSummary_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DiscovererSummary -> f DiscovererSummary
discovererSummary_tags = (DiscovererSummary -> Maybe (HashMap Text Text))
-> (DiscovererSummary
    -> Maybe (HashMap Text Text) -> DiscovererSummary)
-> Lens
     DiscovererSummary
     DiscovererSummary
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> DiscovererSummary -> f DiscovererSummary)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DiscovererSummary
-> f DiscovererSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN of the discoverer.
discovererSummary_discovererArn :: Lens.Lens' DiscovererSummary (Prelude.Maybe Prelude.Text)
discovererSummary_discovererArn :: (Maybe Text -> f (Maybe Text))
-> DiscovererSummary -> f DiscovererSummary
discovererSummary_discovererArn = (DiscovererSummary -> Maybe Text)
-> (DiscovererSummary -> Maybe Text -> DiscovererSummary)
-> Lens
     DiscovererSummary DiscovererSummary (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON DiscovererSummary where
  parseJSON :: Value -> Parser DiscovererSummary
parseJSON =
    String
-> (Object -> Parser DiscovererSummary)
-> Value
-> Parser DiscovererSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DiscovererSummary"
      ( \Object
x ->
          Maybe DiscovererState
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> DiscovererSummary
DiscovererSummary'
            (Maybe DiscovererState
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe Text
 -> DiscovererSummary)
-> Parser (Maybe DiscovererState)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> DiscovererSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DiscovererState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> DiscovererSummary)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> DiscovererSummary)
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
"CrossAccount")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> DiscovererSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text) -> Maybe Text -> DiscovererSummary)
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
"SourceArn")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text) -> Maybe Text -> DiscovererSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text) -> Maybe Text -> DiscovererSummary)
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
"DiscovererId")
            Parser
  (Maybe (HashMap Text Text) -> Maybe Text -> DiscovererSummary)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Text -> DiscovererSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> DiscovererSummary)
-> Parser (Maybe Text) -> Parser DiscovererSummary
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
"DiscovererArn")
      )

instance Prelude.Hashable DiscovererSummary

instance Prelude.NFData DiscovererSummary