{-# 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.ServiceNowSourceProperties
-- 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.ServiceNowSourceProperties where

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

-- | The properties that are applied when ServiceNow is being used as a
-- source.
--
-- /See:/ 'newServiceNowSourceProperties' smart constructor.
data ServiceNowSourceProperties = ServiceNowSourceProperties'
  { -- | The object specified in the ServiceNow flow source.
    ServiceNowSourceProperties -> Text
object' :: Prelude.Text
  }
  deriving (ServiceNowSourceProperties -> ServiceNowSourceProperties -> Bool
(ServiceNowSourceProperties -> ServiceNowSourceProperties -> Bool)
-> (ServiceNowSourceProperties
    -> ServiceNowSourceProperties -> Bool)
-> Eq ServiceNowSourceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceNowSourceProperties -> ServiceNowSourceProperties -> Bool
$c/= :: ServiceNowSourceProperties -> ServiceNowSourceProperties -> Bool
== :: ServiceNowSourceProperties -> ServiceNowSourceProperties -> Bool
$c== :: ServiceNowSourceProperties -> ServiceNowSourceProperties -> Bool
Prelude.Eq, ReadPrec [ServiceNowSourceProperties]
ReadPrec ServiceNowSourceProperties
Int -> ReadS ServiceNowSourceProperties
ReadS [ServiceNowSourceProperties]
(Int -> ReadS ServiceNowSourceProperties)
-> ReadS [ServiceNowSourceProperties]
-> ReadPrec ServiceNowSourceProperties
-> ReadPrec [ServiceNowSourceProperties]
-> Read ServiceNowSourceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceNowSourceProperties]
$creadListPrec :: ReadPrec [ServiceNowSourceProperties]
readPrec :: ReadPrec ServiceNowSourceProperties
$creadPrec :: ReadPrec ServiceNowSourceProperties
readList :: ReadS [ServiceNowSourceProperties]
$creadList :: ReadS [ServiceNowSourceProperties]
readsPrec :: Int -> ReadS ServiceNowSourceProperties
$creadsPrec :: Int -> ReadS ServiceNowSourceProperties
Prelude.Read, Int -> ServiceNowSourceProperties -> ShowS
[ServiceNowSourceProperties] -> ShowS
ServiceNowSourceProperties -> String
(Int -> ServiceNowSourceProperties -> ShowS)
-> (ServiceNowSourceProperties -> String)
-> ([ServiceNowSourceProperties] -> ShowS)
-> Show ServiceNowSourceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceNowSourceProperties] -> ShowS
$cshowList :: [ServiceNowSourceProperties] -> ShowS
show :: ServiceNowSourceProperties -> String
$cshow :: ServiceNowSourceProperties -> String
showsPrec :: Int -> ServiceNowSourceProperties -> ShowS
$cshowsPrec :: Int -> ServiceNowSourceProperties -> ShowS
Prelude.Show, (forall x.
 ServiceNowSourceProperties -> Rep ServiceNowSourceProperties x)
-> (forall x.
    Rep ServiceNowSourceProperties x -> ServiceNowSourceProperties)
-> Generic ServiceNowSourceProperties
forall x.
Rep ServiceNowSourceProperties x -> ServiceNowSourceProperties
forall x.
ServiceNowSourceProperties -> Rep ServiceNowSourceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServiceNowSourceProperties x -> ServiceNowSourceProperties
$cfrom :: forall x.
ServiceNowSourceProperties -> Rep ServiceNowSourceProperties x
Prelude.Generic)

-- |
-- Create a value of 'ServiceNowSourceProperties' 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:
--
-- 'object'', 'serviceNowSourceProperties_object' - The object specified in the ServiceNow flow source.
newServiceNowSourceProperties ::
  -- | 'object''
  Prelude.Text ->
  ServiceNowSourceProperties
newServiceNowSourceProperties :: Text -> ServiceNowSourceProperties
newServiceNowSourceProperties Text
pObject_ =
  ServiceNowSourceProperties' :: Text -> ServiceNowSourceProperties
ServiceNowSourceProperties' {$sel:object':ServiceNowSourceProperties' :: Text
object' = Text
pObject_}

-- | The object specified in the ServiceNow flow source.
serviceNowSourceProperties_object :: Lens.Lens' ServiceNowSourceProperties Prelude.Text
serviceNowSourceProperties_object :: (Text -> f Text)
-> ServiceNowSourceProperties -> f ServiceNowSourceProperties
serviceNowSourceProperties_object = (ServiceNowSourceProperties -> Text)
-> (ServiceNowSourceProperties
    -> Text -> ServiceNowSourceProperties)
-> Lens
     ServiceNowSourceProperties ServiceNowSourceProperties Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceNowSourceProperties' {Text
object' :: Text
$sel:object':ServiceNowSourceProperties' :: ServiceNowSourceProperties -> Text
object'} -> Text
object') (\s :: ServiceNowSourceProperties
s@ServiceNowSourceProperties' {} Text
a -> ServiceNowSourceProperties
s {$sel:object':ServiceNowSourceProperties' :: Text
object' = Text
a} :: ServiceNowSourceProperties)

instance Core.FromJSON ServiceNowSourceProperties where
  parseJSON :: Value -> Parser ServiceNowSourceProperties
parseJSON =
    String
-> (Object -> Parser ServiceNowSourceProperties)
-> Value
-> Parser ServiceNowSourceProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceNowSourceProperties"
      ( \Object
x ->
          Text -> ServiceNowSourceProperties
ServiceNowSourceProperties'
            (Text -> ServiceNowSourceProperties)
-> Parser Text -> Parser ServiceNowSourceProperties
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"object")
      )

instance Prelude.Hashable ServiceNowSourceProperties

instance Prelude.NFData ServiceNowSourceProperties

instance Core.ToJSON ServiceNowSourceProperties where
  toJSON :: ServiceNowSourceProperties -> Value
toJSON ServiceNowSourceProperties' {Text
object' :: Text
$sel:object':ServiceNowSourceProperties' :: ServiceNowSourceProperties -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"object" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
object')]
      )