{-# 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.AppFlow.Types.ConnectorEntity
-- 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.AppFlow.Types.ConnectorEntity where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The high-level entity that can be queried in Amazon AppFlow. For
-- example, a Salesforce entity might be an /Account/ or /Opportunity/,
-- whereas a ServiceNow entity might be an /Incident/.
--
-- /See:/ 'newConnectorEntity' smart constructor.
data ConnectorEntity = ConnectorEntity'
  { -- | Specifies whether the connector entity is a parent or a category and has
    -- more entities nested underneath it. If another call is made with
    -- @entitiesPath = \"the_current_entity_name_with_hasNestedEntities_true\"@,
    -- then it returns the nested entities underneath it. This provides a way
    -- to retrieve all supported entities in a recursive fashion.
    ConnectorEntity -> Maybe Bool
hasNestedEntities :: Prelude.Maybe Prelude.Bool,
    -- | The label applied to the connector entity.
    ConnectorEntity -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
    -- | The name of the connector entity.
    ConnectorEntity -> Text
name :: Prelude.Text
  }
  deriving (ConnectorEntity -> ConnectorEntity -> Bool
(ConnectorEntity -> ConnectorEntity -> Bool)
-> (ConnectorEntity -> ConnectorEntity -> Bool)
-> Eq ConnectorEntity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectorEntity -> ConnectorEntity -> Bool
$c/= :: ConnectorEntity -> ConnectorEntity -> Bool
== :: ConnectorEntity -> ConnectorEntity -> Bool
$c== :: ConnectorEntity -> ConnectorEntity -> Bool
Prelude.Eq, ReadPrec [ConnectorEntity]
ReadPrec ConnectorEntity
Int -> ReadS ConnectorEntity
ReadS [ConnectorEntity]
(Int -> ReadS ConnectorEntity)
-> ReadS [ConnectorEntity]
-> ReadPrec ConnectorEntity
-> ReadPrec [ConnectorEntity]
-> Read ConnectorEntity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectorEntity]
$creadListPrec :: ReadPrec [ConnectorEntity]
readPrec :: ReadPrec ConnectorEntity
$creadPrec :: ReadPrec ConnectorEntity
readList :: ReadS [ConnectorEntity]
$creadList :: ReadS [ConnectorEntity]
readsPrec :: Int -> ReadS ConnectorEntity
$creadsPrec :: Int -> ReadS ConnectorEntity
Prelude.Read, Int -> ConnectorEntity -> ShowS
[ConnectorEntity] -> ShowS
ConnectorEntity -> String
(Int -> ConnectorEntity -> ShowS)
-> (ConnectorEntity -> String)
-> ([ConnectorEntity] -> ShowS)
-> Show ConnectorEntity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectorEntity] -> ShowS
$cshowList :: [ConnectorEntity] -> ShowS
show :: ConnectorEntity -> String
$cshow :: ConnectorEntity -> String
showsPrec :: Int -> ConnectorEntity -> ShowS
$cshowsPrec :: Int -> ConnectorEntity -> ShowS
Prelude.Show, (forall x. ConnectorEntity -> Rep ConnectorEntity x)
-> (forall x. Rep ConnectorEntity x -> ConnectorEntity)
-> Generic ConnectorEntity
forall x. Rep ConnectorEntity x -> ConnectorEntity
forall x. ConnectorEntity -> Rep ConnectorEntity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectorEntity x -> ConnectorEntity
$cfrom :: forall x. ConnectorEntity -> Rep ConnectorEntity x
Prelude.Generic)

-- |
-- Create a value of 'ConnectorEntity' 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:
--
-- 'hasNestedEntities', 'connectorEntity_hasNestedEntities' - Specifies whether the connector entity is a parent or a category and has
-- more entities nested underneath it. If another call is made with
-- @entitiesPath = \"the_current_entity_name_with_hasNestedEntities_true\"@,
-- then it returns the nested entities underneath it. This provides a way
-- to retrieve all supported entities in a recursive fashion.
--
-- 'label', 'connectorEntity_label' - The label applied to the connector entity.
--
-- 'name', 'connectorEntity_name' - The name of the connector entity.
newConnectorEntity ::
  -- | 'name'
  Prelude.Text ->
  ConnectorEntity
newConnectorEntity :: Text -> ConnectorEntity
newConnectorEntity Text
pName_ =
  ConnectorEntity' :: Maybe Bool -> Maybe Text -> Text -> ConnectorEntity
ConnectorEntity'
    { $sel:hasNestedEntities:ConnectorEntity' :: Maybe Bool
hasNestedEntities =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:label:ConnectorEntity' :: Maybe Text
label = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ConnectorEntity' :: Text
name = Text
pName_
    }

-- | Specifies whether the connector entity is a parent or a category and has
-- more entities nested underneath it. If another call is made with
-- @entitiesPath = \"the_current_entity_name_with_hasNestedEntities_true\"@,
-- then it returns the nested entities underneath it. This provides a way
-- to retrieve all supported entities in a recursive fashion.
connectorEntity_hasNestedEntities :: Lens.Lens' ConnectorEntity (Prelude.Maybe Prelude.Bool)
connectorEntity_hasNestedEntities :: (Maybe Bool -> f (Maybe Bool))
-> ConnectorEntity -> f ConnectorEntity
connectorEntity_hasNestedEntities = (ConnectorEntity -> Maybe Bool)
-> (ConnectorEntity -> Maybe Bool -> ConnectorEntity)
-> Lens ConnectorEntity ConnectorEntity (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntity' {Maybe Bool
hasNestedEntities :: Maybe Bool
$sel:hasNestedEntities:ConnectorEntity' :: ConnectorEntity -> Maybe Bool
hasNestedEntities} -> Maybe Bool
hasNestedEntities) (\s :: ConnectorEntity
s@ConnectorEntity' {} Maybe Bool
a -> ConnectorEntity
s {$sel:hasNestedEntities:ConnectorEntity' :: Maybe Bool
hasNestedEntities = Maybe Bool
a} :: ConnectorEntity)

-- | The label applied to the connector entity.
connectorEntity_label :: Lens.Lens' ConnectorEntity (Prelude.Maybe Prelude.Text)
connectorEntity_label :: (Maybe Text -> f (Maybe Text))
-> ConnectorEntity -> f ConnectorEntity
connectorEntity_label = (ConnectorEntity -> Maybe Text)
-> (ConnectorEntity -> Maybe Text -> ConnectorEntity)
-> Lens ConnectorEntity ConnectorEntity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntity' {Maybe Text
label :: Maybe Text
$sel:label:ConnectorEntity' :: ConnectorEntity -> Maybe Text
label} -> Maybe Text
label) (\s :: ConnectorEntity
s@ConnectorEntity' {} Maybe Text
a -> ConnectorEntity
s {$sel:label:ConnectorEntity' :: Maybe Text
label = Maybe Text
a} :: ConnectorEntity)

-- | The name of the connector entity.
connectorEntity_name :: Lens.Lens' ConnectorEntity Prelude.Text
connectorEntity_name :: (Text -> f Text) -> ConnectorEntity -> f ConnectorEntity
connectorEntity_name = (ConnectorEntity -> Text)
-> (ConnectorEntity -> Text -> ConnectorEntity)
-> Lens ConnectorEntity ConnectorEntity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorEntity' {Text
name :: Text
$sel:name:ConnectorEntity' :: ConnectorEntity -> Text
name} -> Text
name) (\s :: ConnectorEntity
s@ConnectorEntity' {} Text
a -> ConnectorEntity
s {$sel:name:ConnectorEntity' :: Text
name = Text
a} :: ConnectorEntity)

instance Core.FromJSON ConnectorEntity where
  parseJSON :: Value -> Parser ConnectorEntity
parseJSON =
    String
-> (Object -> Parser ConnectorEntity)
-> Value
-> Parser ConnectorEntity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConnectorEntity"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> Text -> ConnectorEntity
ConnectorEntity'
            (Maybe Bool -> Maybe Text -> Text -> ConnectorEntity)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Text -> ConnectorEntity)
forall (f :: * -> *) a b. Functor 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
"hasNestedEntities")
            Parser (Maybe Text -> Text -> ConnectorEntity)
-> Parser (Maybe Text) -> Parser (Text -> ConnectorEntity)
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
"label")
            Parser (Text -> ConnectorEntity)
-> Parser Text -> Parser ConnectorEntity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
      )

instance Prelude.Hashable ConnectorEntity

instance Prelude.NFData ConnectorEntity