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

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

-- | The connector-specific profile properties required when using
-- Salesforce.
--
-- /See:/ 'newSalesforceConnectorProfileProperties' smart constructor.
data SalesforceConnectorProfileProperties = SalesforceConnectorProfileProperties'
  { -- | The location of the Salesforce resource.
    SalesforceConnectorProfileProperties -> Maybe Text
instanceUrl :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the connector profile applies to a sandbox or
    -- production environment.
    SalesforceConnectorProfileProperties -> Maybe Bool
isSandboxEnvironment :: Prelude.Maybe Prelude.Bool
  }
  deriving (SalesforceConnectorProfileProperties
-> SalesforceConnectorProfileProperties -> Bool
(SalesforceConnectorProfileProperties
 -> SalesforceConnectorProfileProperties -> Bool)
-> (SalesforceConnectorProfileProperties
    -> SalesforceConnectorProfileProperties -> Bool)
-> Eq SalesforceConnectorProfileProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SalesforceConnectorProfileProperties
-> SalesforceConnectorProfileProperties -> Bool
$c/= :: SalesforceConnectorProfileProperties
-> SalesforceConnectorProfileProperties -> Bool
== :: SalesforceConnectorProfileProperties
-> SalesforceConnectorProfileProperties -> Bool
$c== :: SalesforceConnectorProfileProperties
-> SalesforceConnectorProfileProperties -> Bool
Prelude.Eq, ReadPrec [SalesforceConnectorProfileProperties]
ReadPrec SalesforceConnectorProfileProperties
Int -> ReadS SalesforceConnectorProfileProperties
ReadS [SalesforceConnectorProfileProperties]
(Int -> ReadS SalesforceConnectorProfileProperties)
-> ReadS [SalesforceConnectorProfileProperties]
-> ReadPrec SalesforceConnectorProfileProperties
-> ReadPrec [SalesforceConnectorProfileProperties]
-> Read SalesforceConnectorProfileProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SalesforceConnectorProfileProperties]
$creadListPrec :: ReadPrec [SalesforceConnectorProfileProperties]
readPrec :: ReadPrec SalesforceConnectorProfileProperties
$creadPrec :: ReadPrec SalesforceConnectorProfileProperties
readList :: ReadS [SalesforceConnectorProfileProperties]
$creadList :: ReadS [SalesforceConnectorProfileProperties]
readsPrec :: Int -> ReadS SalesforceConnectorProfileProperties
$creadsPrec :: Int -> ReadS SalesforceConnectorProfileProperties
Prelude.Read, Int -> SalesforceConnectorProfileProperties -> ShowS
[SalesforceConnectorProfileProperties] -> ShowS
SalesforceConnectorProfileProperties -> String
(Int -> SalesforceConnectorProfileProperties -> ShowS)
-> (SalesforceConnectorProfileProperties -> String)
-> ([SalesforceConnectorProfileProperties] -> ShowS)
-> Show SalesforceConnectorProfileProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SalesforceConnectorProfileProperties] -> ShowS
$cshowList :: [SalesforceConnectorProfileProperties] -> ShowS
show :: SalesforceConnectorProfileProperties -> String
$cshow :: SalesforceConnectorProfileProperties -> String
showsPrec :: Int -> SalesforceConnectorProfileProperties -> ShowS
$cshowsPrec :: Int -> SalesforceConnectorProfileProperties -> ShowS
Prelude.Show, (forall x.
 SalesforceConnectorProfileProperties
 -> Rep SalesforceConnectorProfileProperties x)
-> (forall x.
    Rep SalesforceConnectorProfileProperties x
    -> SalesforceConnectorProfileProperties)
-> Generic SalesforceConnectorProfileProperties
forall x.
Rep SalesforceConnectorProfileProperties x
-> SalesforceConnectorProfileProperties
forall x.
SalesforceConnectorProfileProperties
-> Rep SalesforceConnectorProfileProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SalesforceConnectorProfileProperties x
-> SalesforceConnectorProfileProperties
$cfrom :: forall x.
SalesforceConnectorProfileProperties
-> Rep SalesforceConnectorProfileProperties x
Prelude.Generic)

-- |
-- Create a value of 'SalesforceConnectorProfileProperties' 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:
--
-- 'instanceUrl', 'salesforceConnectorProfileProperties_instanceUrl' - The location of the Salesforce resource.
--
-- 'isSandboxEnvironment', 'salesforceConnectorProfileProperties_isSandboxEnvironment' - Indicates whether the connector profile applies to a sandbox or
-- production environment.
newSalesforceConnectorProfileProperties ::
  SalesforceConnectorProfileProperties
newSalesforceConnectorProfileProperties :: SalesforceConnectorProfileProperties
newSalesforceConnectorProfileProperties =
  SalesforceConnectorProfileProperties' :: Maybe Text -> Maybe Bool -> SalesforceConnectorProfileProperties
SalesforceConnectorProfileProperties'
    { $sel:instanceUrl:SalesforceConnectorProfileProperties' :: Maybe Text
instanceUrl =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isSandboxEnvironment:SalesforceConnectorProfileProperties' :: Maybe Bool
isSandboxEnvironment =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The location of the Salesforce resource.
salesforceConnectorProfileProperties_instanceUrl :: Lens.Lens' SalesforceConnectorProfileProperties (Prelude.Maybe Prelude.Text)
salesforceConnectorProfileProperties_instanceUrl :: (Maybe Text -> f (Maybe Text))
-> SalesforceConnectorProfileProperties
-> f SalesforceConnectorProfileProperties
salesforceConnectorProfileProperties_instanceUrl = (SalesforceConnectorProfileProperties -> Maybe Text)
-> (SalesforceConnectorProfileProperties
    -> Maybe Text -> SalesforceConnectorProfileProperties)
-> Lens
     SalesforceConnectorProfileProperties
     SalesforceConnectorProfileProperties
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceConnectorProfileProperties' {Maybe Text
instanceUrl :: Maybe Text
$sel:instanceUrl:SalesforceConnectorProfileProperties' :: SalesforceConnectorProfileProperties -> Maybe Text
instanceUrl} -> Maybe Text
instanceUrl) (\s :: SalesforceConnectorProfileProperties
s@SalesforceConnectorProfileProperties' {} Maybe Text
a -> SalesforceConnectorProfileProperties
s {$sel:instanceUrl:SalesforceConnectorProfileProperties' :: Maybe Text
instanceUrl = Maybe Text
a} :: SalesforceConnectorProfileProperties)

-- | Indicates whether the connector profile applies to a sandbox or
-- production environment.
salesforceConnectorProfileProperties_isSandboxEnvironment :: Lens.Lens' SalesforceConnectorProfileProperties (Prelude.Maybe Prelude.Bool)
salesforceConnectorProfileProperties_isSandboxEnvironment :: (Maybe Bool -> f (Maybe Bool))
-> SalesforceConnectorProfileProperties
-> f SalesforceConnectorProfileProperties
salesforceConnectorProfileProperties_isSandboxEnvironment = (SalesforceConnectorProfileProperties -> Maybe Bool)
-> (SalesforceConnectorProfileProperties
    -> Maybe Bool -> SalesforceConnectorProfileProperties)
-> Lens
     SalesforceConnectorProfileProperties
     SalesforceConnectorProfileProperties
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceConnectorProfileProperties' {Maybe Bool
isSandboxEnvironment :: Maybe Bool
$sel:isSandboxEnvironment:SalesforceConnectorProfileProperties' :: SalesforceConnectorProfileProperties -> Maybe Bool
isSandboxEnvironment} -> Maybe Bool
isSandboxEnvironment) (\s :: SalesforceConnectorProfileProperties
s@SalesforceConnectorProfileProperties' {} Maybe Bool
a -> SalesforceConnectorProfileProperties
s {$sel:isSandboxEnvironment:SalesforceConnectorProfileProperties' :: Maybe Bool
isSandboxEnvironment = Maybe Bool
a} :: SalesforceConnectorProfileProperties)

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

instance
  Prelude.Hashable
    SalesforceConnectorProfileProperties

instance
  Prelude.NFData
    SalesforceConnectorProfileProperties

instance
  Core.ToJSON
    SalesforceConnectorProfileProperties
  where
  toJSON :: SalesforceConnectorProfileProperties -> Value
toJSON SalesforceConnectorProfileProperties' {Maybe Bool
Maybe Text
isSandboxEnvironment :: Maybe Bool
instanceUrl :: Maybe Text
$sel:isSandboxEnvironment:SalesforceConnectorProfileProperties' :: SalesforceConnectorProfileProperties -> Maybe Bool
$sel:instanceUrl:SalesforceConnectorProfileProperties' :: SalesforceConnectorProfileProperties -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"instanceUrl" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
instanceUrl,
            (Text
"isSandboxEnvironment" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isSandboxEnvironment
          ]
      )