{-# 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.QuickSight.Types.ServiceNowParameters
-- 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.QuickSight.Types.ServiceNowParameters where

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

-- | The parameters for ServiceNow.
--
-- /See:/ 'newServiceNowParameters' smart constructor.
data ServiceNowParameters = ServiceNowParameters'
  { -- | URL of the base site.
    ServiceNowParameters -> Text
siteBaseUrl :: Prelude.Text
  }
  deriving (ServiceNowParameters -> ServiceNowParameters -> Bool
(ServiceNowParameters -> ServiceNowParameters -> Bool)
-> (ServiceNowParameters -> ServiceNowParameters -> Bool)
-> Eq ServiceNowParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceNowParameters -> ServiceNowParameters -> Bool
$c/= :: ServiceNowParameters -> ServiceNowParameters -> Bool
== :: ServiceNowParameters -> ServiceNowParameters -> Bool
$c== :: ServiceNowParameters -> ServiceNowParameters -> Bool
Prelude.Eq, ReadPrec [ServiceNowParameters]
ReadPrec ServiceNowParameters
Int -> ReadS ServiceNowParameters
ReadS [ServiceNowParameters]
(Int -> ReadS ServiceNowParameters)
-> ReadS [ServiceNowParameters]
-> ReadPrec ServiceNowParameters
-> ReadPrec [ServiceNowParameters]
-> Read ServiceNowParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceNowParameters]
$creadListPrec :: ReadPrec [ServiceNowParameters]
readPrec :: ReadPrec ServiceNowParameters
$creadPrec :: ReadPrec ServiceNowParameters
readList :: ReadS [ServiceNowParameters]
$creadList :: ReadS [ServiceNowParameters]
readsPrec :: Int -> ReadS ServiceNowParameters
$creadsPrec :: Int -> ReadS ServiceNowParameters
Prelude.Read, Int -> ServiceNowParameters -> ShowS
[ServiceNowParameters] -> ShowS
ServiceNowParameters -> String
(Int -> ServiceNowParameters -> ShowS)
-> (ServiceNowParameters -> String)
-> ([ServiceNowParameters] -> ShowS)
-> Show ServiceNowParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceNowParameters] -> ShowS
$cshowList :: [ServiceNowParameters] -> ShowS
show :: ServiceNowParameters -> String
$cshow :: ServiceNowParameters -> String
showsPrec :: Int -> ServiceNowParameters -> ShowS
$cshowsPrec :: Int -> ServiceNowParameters -> ShowS
Prelude.Show, (forall x. ServiceNowParameters -> Rep ServiceNowParameters x)
-> (forall x. Rep ServiceNowParameters x -> ServiceNowParameters)
-> Generic ServiceNowParameters
forall x. Rep ServiceNowParameters x -> ServiceNowParameters
forall x. ServiceNowParameters -> Rep ServiceNowParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceNowParameters x -> ServiceNowParameters
$cfrom :: forall x. ServiceNowParameters -> Rep ServiceNowParameters x
Prelude.Generic)

-- |
-- Create a value of 'ServiceNowParameters' 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:
--
-- 'siteBaseUrl', 'serviceNowParameters_siteBaseUrl' - URL of the base site.
newServiceNowParameters ::
  -- | 'siteBaseUrl'
  Prelude.Text ->
  ServiceNowParameters
newServiceNowParameters :: Text -> ServiceNowParameters
newServiceNowParameters Text
pSiteBaseUrl_ =
  ServiceNowParameters' :: Text -> ServiceNowParameters
ServiceNowParameters' {$sel:siteBaseUrl:ServiceNowParameters' :: Text
siteBaseUrl = Text
pSiteBaseUrl_}

-- | URL of the base site.
serviceNowParameters_siteBaseUrl :: Lens.Lens' ServiceNowParameters Prelude.Text
serviceNowParameters_siteBaseUrl :: (Text -> f Text) -> ServiceNowParameters -> f ServiceNowParameters
serviceNowParameters_siteBaseUrl = (ServiceNowParameters -> Text)
-> (ServiceNowParameters -> Text -> ServiceNowParameters)
-> Lens ServiceNowParameters ServiceNowParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceNowParameters' {Text
siteBaseUrl :: Text
$sel:siteBaseUrl:ServiceNowParameters' :: ServiceNowParameters -> Text
siteBaseUrl} -> Text
siteBaseUrl) (\s :: ServiceNowParameters
s@ServiceNowParameters' {} Text
a -> ServiceNowParameters
s {$sel:siteBaseUrl:ServiceNowParameters' :: Text
siteBaseUrl = Text
a} :: ServiceNowParameters)

instance Core.FromJSON ServiceNowParameters where
  parseJSON :: Value -> Parser ServiceNowParameters
parseJSON =
    String
-> (Object -> Parser ServiceNowParameters)
-> Value
-> Parser ServiceNowParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceNowParameters"
      ( \Object
x ->
          Text -> ServiceNowParameters
ServiceNowParameters'
            (Text -> ServiceNowParameters)
-> Parser Text -> Parser ServiceNowParameters
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
"SiteBaseUrl")
      )

instance Prelude.Hashable ServiceNowParameters

instance Prelude.NFData ServiceNowParameters

instance Core.ToJSON ServiceNowParameters where
  toJSON :: ServiceNowParameters -> Value
toJSON ServiceNowParameters' {Text
siteBaseUrl :: Text
$sel:siteBaseUrl:ServiceNowParameters' :: ServiceNowParameters -> 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
"SiteBaseUrl" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
siteBaseUrl)]
      )