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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types.S3Path
import qualified Amazonka.Prelude as Prelude

-- | Provides the configuration information to connect to GitHub Enterprise
-- Server (on premises).
--
-- /See:/ 'newOnPremiseConfiguration' smart constructor.
data OnPremiseConfiguration = OnPremiseConfiguration'
  { -- | The GitHub host URL or API endpoint URL. For example,
    -- /https:\/\/on-prem-host-url\/api\/v3\//
    OnPremiseConfiguration -> Text
hostUrl :: Prelude.Text,
    -- | The name of the organization of the GitHub Enterprise Server
    -- (in-premise) 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.
    OnPremiseConfiguration -> Text
organizationName :: Prelude.Text,
    -- | The path to the SSL certificate stored in an Amazon S3 bucket. You use
    -- this to connect to GitHub if you require a secure SSL connection.
    --
    -- You can simply generate a self-signed X509 certificate on any computer
    -- using OpenSSL. For an example of using OpenSSL to create an X509
    -- certificate, see
    -- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-ssl.html Create and sign an X509 certificate>.
    OnPremiseConfiguration -> S3Path
sslCertificateS3Path :: S3Path
  }
  deriving (OnPremiseConfiguration -> OnPremiseConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OnPremiseConfiguration -> OnPremiseConfiguration -> Bool
$c/= :: OnPremiseConfiguration -> OnPremiseConfiguration -> Bool
== :: OnPremiseConfiguration -> OnPremiseConfiguration -> Bool
$c== :: OnPremiseConfiguration -> OnPremiseConfiguration -> Bool
Prelude.Eq, ReadPrec [OnPremiseConfiguration]
ReadPrec OnPremiseConfiguration
Int -> ReadS OnPremiseConfiguration
ReadS [OnPremiseConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OnPremiseConfiguration]
$creadListPrec :: ReadPrec [OnPremiseConfiguration]
readPrec :: ReadPrec OnPremiseConfiguration
$creadPrec :: ReadPrec OnPremiseConfiguration
readList :: ReadS [OnPremiseConfiguration]
$creadList :: ReadS [OnPremiseConfiguration]
readsPrec :: Int -> ReadS OnPremiseConfiguration
$creadsPrec :: Int -> ReadS OnPremiseConfiguration
Prelude.Read, Int -> OnPremiseConfiguration -> ShowS
[OnPremiseConfiguration] -> ShowS
OnPremiseConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OnPremiseConfiguration] -> ShowS
$cshowList :: [OnPremiseConfiguration] -> ShowS
show :: OnPremiseConfiguration -> String
$cshow :: OnPremiseConfiguration -> String
showsPrec :: Int -> OnPremiseConfiguration -> ShowS
$cshowsPrec :: Int -> OnPremiseConfiguration -> ShowS
Prelude.Show, forall x. Rep OnPremiseConfiguration x -> OnPremiseConfiguration
forall x. OnPremiseConfiguration -> Rep OnPremiseConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OnPremiseConfiguration x -> OnPremiseConfiguration
$cfrom :: forall x. OnPremiseConfiguration -> Rep OnPremiseConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'OnPremiseConfiguration' 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:
--
-- 'hostUrl', 'onPremiseConfiguration_hostUrl' - The GitHub host URL or API endpoint URL. For example,
-- /https:\/\/on-prem-host-url\/api\/v3\//
--
-- 'organizationName', 'onPremiseConfiguration_organizationName' - The name of the organization of the GitHub Enterprise Server
-- (in-premise) 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.
--
-- 'sslCertificateS3Path', 'onPremiseConfiguration_sslCertificateS3Path' - The path to the SSL certificate stored in an Amazon S3 bucket. You use
-- this to connect to GitHub if you require a secure SSL connection.
--
-- You can simply generate a self-signed X509 certificate on any computer
-- using OpenSSL. For an example of using OpenSSL to create an X509
-- certificate, see
-- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-ssl.html Create and sign an X509 certificate>.
newOnPremiseConfiguration ::
  -- | 'hostUrl'
  Prelude.Text ->
  -- | 'organizationName'
  Prelude.Text ->
  -- | 'sslCertificateS3Path'
  S3Path ->
  OnPremiseConfiguration
newOnPremiseConfiguration :: Text -> Text -> S3Path -> OnPremiseConfiguration
newOnPremiseConfiguration
  Text
pHostUrl_
  Text
pOrganizationName_
  S3Path
pSslCertificateS3Path_ =
    OnPremiseConfiguration'
      { $sel:hostUrl:OnPremiseConfiguration' :: Text
hostUrl = Text
pHostUrl_,
        $sel:organizationName:OnPremiseConfiguration' :: Text
organizationName = Text
pOrganizationName_,
        $sel:sslCertificateS3Path:OnPremiseConfiguration' :: S3Path
sslCertificateS3Path = S3Path
pSslCertificateS3Path_
      }

-- | The GitHub host URL or API endpoint URL. For example,
-- /https:\/\/on-prem-host-url\/api\/v3\//
onPremiseConfiguration_hostUrl :: Lens.Lens' OnPremiseConfiguration Prelude.Text
onPremiseConfiguration_hostUrl :: Lens' OnPremiseConfiguration Text
onPremiseConfiguration_hostUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OnPremiseConfiguration' {Text
hostUrl :: Text
$sel:hostUrl:OnPremiseConfiguration' :: OnPremiseConfiguration -> Text
hostUrl} -> Text
hostUrl) (\s :: OnPremiseConfiguration
s@OnPremiseConfiguration' {} Text
a -> OnPremiseConfiguration
s {$sel:hostUrl:OnPremiseConfiguration' :: Text
hostUrl = Text
a} :: OnPremiseConfiguration)

-- | The name of the organization of the GitHub Enterprise Server
-- (in-premise) 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.
onPremiseConfiguration_organizationName :: Lens.Lens' OnPremiseConfiguration Prelude.Text
onPremiseConfiguration_organizationName :: Lens' OnPremiseConfiguration Text
onPremiseConfiguration_organizationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OnPremiseConfiguration' {Text
organizationName :: Text
$sel:organizationName:OnPremiseConfiguration' :: OnPremiseConfiguration -> Text
organizationName} -> Text
organizationName) (\s :: OnPremiseConfiguration
s@OnPremiseConfiguration' {} Text
a -> OnPremiseConfiguration
s {$sel:organizationName:OnPremiseConfiguration' :: Text
organizationName = Text
a} :: OnPremiseConfiguration)

-- | The path to the SSL certificate stored in an Amazon S3 bucket. You use
-- this to connect to GitHub if you require a secure SSL connection.
--
-- You can simply generate a self-signed X509 certificate on any computer
-- using OpenSSL. For an example of using OpenSSL to create an X509
-- certificate, see
-- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-ssl.html Create and sign an X509 certificate>.
onPremiseConfiguration_sslCertificateS3Path :: Lens.Lens' OnPremiseConfiguration S3Path
onPremiseConfiguration_sslCertificateS3Path :: Lens' OnPremiseConfiguration S3Path
onPremiseConfiguration_sslCertificateS3Path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OnPremiseConfiguration' {S3Path
sslCertificateS3Path :: S3Path
$sel:sslCertificateS3Path:OnPremiseConfiguration' :: OnPremiseConfiguration -> S3Path
sslCertificateS3Path} -> S3Path
sslCertificateS3Path) (\s :: OnPremiseConfiguration
s@OnPremiseConfiguration' {} S3Path
a -> OnPremiseConfiguration
s {$sel:sslCertificateS3Path:OnPremiseConfiguration' :: S3Path
sslCertificateS3Path = S3Path
a} :: OnPremiseConfiguration)

instance Data.FromJSON OnPremiseConfiguration where
  parseJSON :: Value -> Parser OnPremiseConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OnPremiseConfiguration"
      ( \Object
x ->
          Text -> Text -> S3Path -> OnPremiseConfiguration
OnPremiseConfiguration'
            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
"HostUrl")
            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
"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
"SslCertificateS3Path")
      )

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

instance Prelude.NFData OnPremiseConfiguration where
  rnf :: OnPremiseConfiguration -> ()
rnf OnPremiseConfiguration' {Text
S3Path
sslCertificateS3Path :: S3Path
organizationName :: Text
hostUrl :: Text
$sel:sslCertificateS3Path:OnPremiseConfiguration' :: OnPremiseConfiguration -> S3Path
$sel:organizationName:OnPremiseConfiguration' :: OnPremiseConfiguration -> Text
$sel:hostUrl:OnPremiseConfiguration' :: OnPremiseConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
hostUrl
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 S3Path
sslCertificateS3Path

instance Data.ToJSON OnPremiseConfiguration where
  toJSON :: OnPremiseConfiguration -> Value
toJSON OnPremiseConfiguration' {Text
S3Path
sslCertificateS3Path :: S3Path
organizationName :: Text
hostUrl :: Text
$sel:sslCertificateS3Path:OnPremiseConfiguration' :: OnPremiseConfiguration -> S3Path
$sel:organizationName:OnPremiseConfiguration' :: OnPremiseConfiguration -> Text
$sel:hostUrl:OnPremiseConfiguration' :: OnPremiseConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"HostUrl" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
hostUrl),
            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
"SslCertificateS3Path"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3Path
sslCertificateS3Path
              )
          ]
      )