{-# 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.Kendra.Types.SaaSConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Kendra.Types.SaaSConfiguration where

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

-- | Provides the configuration information to connect to GitHub Enterprise
-- Cloud (SaaS).
--
-- /See:/ 'newSaaSConfiguration' smart constructor.
data SaaSConfiguration = SaaSConfiguration'
  { -- | The name of the organization of the GitHub Enterprise Cloud (SaaS)
    -- account you want to connect to. You can find your organization name by
    -- logging into GitHub desktop and selecting __Your organizations__ under
    -- your profile picture dropdown.
    SaaSConfiguration -> Text
organizationName :: Prelude.Text,
    -- | The GitHub host URL or API endpoint URL. For example,
    -- /https:\/\/api.github.com/.
    SaaSConfiguration -> Text
hostUrl :: Prelude.Text
  }
  deriving (SaaSConfiguration -> SaaSConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SaaSConfiguration -> SaaSConfiguration -> Bool
$c/= :: SaaSConfiguration -> SaaSConfiguration -> Bool
== :: SaaSConfiguration -> SaaSConfiguration -> Bool
$c== :: SaaSConfiguration -> SaaSConfiguration -> Bool
Prelude.Eq, ReadPrec [SaaSConfiguration]
ReadPrec SaaSConfiguration
Int -> ReadS SaaSConfiguration
ReadS [SaaSConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SaaSConfiguration]
$creadListPrec :: ReadPrec [SaaSConfiguration]
readPrec :: ReadPrec SaaSConfiguration
$creadPrec :: ReadPrec SaaSConfiguration
readList :: ReadS [SaaSConfiguration]
$creadList :: ReadS [SaaSConfiguration]
readsPrec :: Int -> ReadS SaaSConfiguration
$creadsPrec :: Int -> ReadS SaaSConfiguration
Prelude.Read, Int -> SaaSConfiguration -> ShowS
[SaaSConfiguration] -> ShowS
SaaSConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SaaSConfiguration] -> ShowS
$cshowList :: [SaaSConfiguration] -> ShowS
show :: SaaSConfiguration -> String
$cshow :: SaaSConfiguration -> String
showsPrec :: Int -> SaaSConfiguration -> ShowS
$cshowsPrec :: Int -> SaaSConfiguration -> ShowS
Prelude.Show, forall x. Rep SaaSConfiguration x -> SaaSConfiguration
forall x. SaaSConfiguration -> Rep SaaSConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SaaSConfiguration x -> SaaSConfiguration
$cfrom :: forall x. SaaSConfiguration -> Rep SaaSConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SaaSConfiguration' 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:
--
-- 'organizationName', 'saaSConfiguration_organizationName' - The name of the organization of the GitHub Enterprise Cloud (SaaS)
-- account you want to connect to. You can find your organization name by
-- logging into GitHub desktop and selecting __Your organizations__ under
-- your profile picture dropdown.
--
-- 'hostUrl', 'saaSConfiguration_hostUrl' - The GitHub host URL or API endpoint URL. For example,
-- /https:\/\/api.github.com/.
newSaaSConfiguration ::
  -- | 'organizationName'
  Prelude.Text ->
  -- | 'hostUrl'
  Prelude.Text ->
  SaaSConfiguration
newSaaSConfiguration :: Text -> Text -> SaaSConfiguration
newSaaSConfiguration Text
pOrganizationName_ Text
pHostUrl_ =
  SaaSConfiguration'
    { $sel:organizationName:SaaSConfiguration' :: Text
organizationName =
        Text
pOrganizationName_,
      $sel:hostUrl:SaaSConfiguration' :: Text
hostUrl = Text
pHostUrl_
    }

-- | The name of the organization of the GitHub Enterprise Cloud (SaaS)
-- account you want to connect to. You can find your organization name by
-- logging into GitHub desktop and selecting __Your organizations__ under
-- your profile picture dropdown.
saaSConfiguration_organizationName :: Lens.Lens' SaaSConfiguration Prelude.Text
saaSConfiguration_organizationName :: Lens' SaaSConfiguration Text
saaSConfiguration_organizationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SaaSConfiguration' {Text
organizationName :: Text
$sel:organizationName:SaaSConfiguration' :: SaaSConfiguration -> Text
organizationName} -> Text
organizationName) (\s :: SaaSConfiguration
s@SaaSConfiguration' {} Text
a -> SaaSConfiguration
s {$sel:organizationName:SaaSConfiguration' :: Text
organizationName = Text
a} :: SaaSConfiguration)

-- | The GitHub host URL or API endpoint URL. For example,
-- /https:\/\/api.github.com/.
saaSConfiguration_hostUrl :: Lens.Lens' SaaSConfiguration Prelude.Text
saaSConfiguration_hostUrl :: Lens' SaaSConfiguration Text
saaSConfiguration_hostUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SaaSConfiguration' {Text
hostUrl :: Text
$sel:hostUrl:SaaSConfiguration' :: SaaSConfiguration -> Text
hostUrl} -> Text
hostUrl) (\s :: SaaSConfiguration
s@SaaSConfiguration' {} Text
a -> SaaSConfiguration
s {$sel:hostUrl:SaaSConfiguration' :: Text
hostUrl = Text
a} :: SaaSConfiguration)

instance Data.FromJSON SaaSConfiguration where
  parseJSON :: Value -> Parser SaaSConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SaaSConfiguration"
      ( \Object
x ->
          Text -> Text -> SaaSConfiguration
SaaSConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"OrganizationName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"HostUrl")
      )

instance Prelude.Hashable SaaSConfiguration where
  hashWithSalt :: Int -> SaaSConfiguration -> Int
hashWithSalt Int
_salt SaaSConfiguration' {Text
hostUrl :: Text
organizationName :: Text
$sel:hostUrl:SaaSConfiguration' :: SaaSConfiguration -> Text
$sel:organizationName:SaaSConfiguration' :: SaaSConfiguration -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
organizationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
hostUrl

instance Prelude.NFData SaaSConfiguration where
  rnf :: SaaSConfiguration -> ()
rnf SaaSConfiguration' {Text
hostUrl :: Text
organizationName :: Text
$sel:hostUrl:SaaSConfiguration' :: SaaSConfiguration -> Text
$sel:organizationName:SaaSConfiguration' :: SaaSConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
organizationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
hostUrl

instance Data.ToJSON SaaSConfiguration where
  toJSON :: SaaSConfiguration -> Value
toJSON SaaSConfiguration' {Text
hostUrl :: Text
organizationName :: Text
$sel:hostUrl:SaaSConfiguration' :: SaaSConfiguration -> Text
$sel:organizationName:SaaSConfiguration' :: SaaSConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"OrganizationName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
organizationName),
            forall a. a -> Maybe a
Prelude.Just (Key
"HostUrl" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
hostUrl)
          ]
      )