{-# 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.DMS.Types.SybaseSettings
-- 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.DMS.Types.SybaseSettings 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 information that defines a SAP ASE endpoint.
--
-- /See:/ 'newSybaseSettings' smart constructor.
data SybaseSettings = SybaseSettings'
  { -- | Database name for the endpoint.
    SybaseSettings -> Maybe Text
databaseName :: Prelude.Maybe Prelude.Text,
    -- | Endpoint connection password.
    SybaseSettings -> Maybe (Sensitive Text)
password :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | Endpoint TCP port. The default is 5000.
    SybaseSettings -> Maybe Int
port :: Prelude.Maybe Prelude.Int,
    -- | The full Amazon Resource Name (ARN) of the IAM role that specifies DMS
    -- as the trusted entity and grants the required permissions to access the
    -- value in @SecretsManagerSecret@. The role must allow the @iam:PassRole@
    -- action. @SecretsManagerSecret@ has the value of the Amazon Web Services
    -- Secrets Manager secret that allows access to the SAP ASE endpoint.
    --
    -- You can specify one of two sets of values for these permissions. You can
    -- specify the values for this setting and @SecretsManagerSecretId@. Or you
    -- can specify clear-text values for @UserName@, @Password@, @ServerName@,
    -- and @Port@. You can\'t specify both. For more information on creating
    -- this @SecretsManagerSecret@ and the @SecretsManagerAccessRoleArn@ and
    -- @SecretsManagerSecretId@ required to access it, see
    -- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Security.html#security-iam-secretsmanager Using secrets to access Database Migration Service resources>
    -- in the /Database Migration Service User Guide/.
    SybaseSettings -> Maybe Text
secretsManagerAccessRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The full ARN, partial ARN, or friendly name of the
    -- @SecretsManagerSecret@ that contains the SAP SAE endpoint connection
    -- details.
    SybaseSettings -> Maybe Text
secretsManagerSecretId :: Prelude.Maybe Prelude.Text,
    -- | Fully qualified domain name of the endpoint.
    SybaseSettings -> Maybe Text
serverName :: Prelude.Maybe Prelude.Text,
    -- | Endpoint connection user name.
    SybaseSettings -> Maybe Text
username :: Prelude.Maybe Prelude.Text
  }
  deriving (SybaseSettings -> SybaseSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SybaseSettings -> SybaseSettings -> Bool
$c/= :: SybaseSettings -> SybaseSettings -> Bool
== :: SybaseSettings -> SybaseSettings -> Bool
$c== :: SybaseSettings -> SybaseSettings -> Bool
Prelude.Eq, Int -> SybaseSettings -> ShowS
[SybaseSettings] -> ShowS
SybaseSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SybaseSettings] -> ShowS
$cshowList :: [SybaseSettings] -> ShowS
show :: SybaseSettings -> String
$cshow :: SybaseSettings -> String
showsPrec :: Int -> SybaseSettings -> ShowS
$cshowsPrec :: Int -> SybaseSettings -> ShowS
Prelude.Show, forall x. Rep SybaseSettings x -> SybaseSettings
forall x. SybaseSettings -> Rep SybaseSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SybaseSettings x -> SybaseSettings
$cfrom :: forall x. SybaseSettings -> Rep SybaseSettings x
Prelude.Generic)

-- |
-- Create a value of 'SybaseSettings' 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:
--
-- 'databaseName', 'sybaseSettings_databaseName' - Database name for the endpoint.
--
-- 'password', 'sybaseSettings_password' - Endpoint connection password.
--
-- 'port', 'sybaseSettings_port' - Endpoint TCP port. The default is 5000.
--
-- 'secretsManagerAccessRoleArn', 'sybaseSettings_secretsManagerAccessRoleArn' - The full Amazon Resource Name (ARN) of the IAM role that specifies DMS
-- as the trusted entity and grants the required permissions to access the
-- value in @SecretsManagerSecret@. The role must allow the @iam:PassRole@
-- action. @SecretsManagerSecret@ has the value of the Amazon Web Services
-- Secrets Manager secret that allows access to the SAP ASE endpoint.
--
-- You can specify one of two sets of values for these permissions. You can
-- specify the values for this setting and @SecretsManagerSecretId@. Or you
-- can specify clear-text values for @UserName@, @Password@, @ServerName@,
-- and @Port@. You can\'t specify both. For more information on creating
-- this @SecretsManagerSecret@ and the @SecretsManagerAccessRoleArn@ and
-- @SecretsManagerSecretId@ required to access it, see
-- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Security.html#security-iam-secretsmanager Using secrets to access Database Migration Service resources>
-- in the /Database Migration Service User Guide/.
--
-- 'secretsManagerSecretId', 'sybaseSettings_secretsManagerSecretId' - The full ARN, partial ARN, or friendly name of the
-- @SecretsManagerSecret@ that contains the SAP SAE endpoint connection
-- details.
--
-- 'serverName', 'sybaseSettings_serverName' - Fully qualified domain name of the endpoint.
--
-- 'username', 'sybaseSettings_username' - Endpoint connection user name.
newSybaseSettings ::
  SybaseSettings
newSybaseSettings :: SybaseSettings
newSybaseSettings =
  SybaseSettings'
    { $sel:databaseName:SybaseSettings' :: Maybe Text
databaseName = forall a. Maybe a
Prelude.Nothing,
      $sel:password:SybaseSettings' :: Maybe (Sensitive Text)
password = forall a. Maybe a
Prelude.Nothing,
      $sel:port:SybaseSettings' :: Maybe Int
port = forall a. Maybe a
Prelude.Nothing,
      $sel:secretsManagerAccessRoleArn:SybaseSettings' :: Maybe Text
secretsManagerAccessRoleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:secretsManagerSecretId:SybaseSettings' :: Maybe Text
secretsManagerSecretId = forall a. Maybe a
Prelude.Nothing,
      $sel:serverName:SybaseSettings' :: Maybe Text
serverName = forall a. Maybe a
Prelude.Nothing,
      $sel:username:SybaseSettings' :: Maybe Text
username = forall a. Maybe a
Prelude.Nothing
    }

-- | Database name for the endpoint.
sybaseSettings_databaseName :: Lens.Lens' SybaseSettings (Prelude.Maybe Prelude.Text)
sybaseSettings_databaseName :: Lens' SybaseSettings (Maybe Text)
sybaseSettings_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SybaseSettings' {Maybe Text
databaseName :: Maybe Text
$sel:databaseName:SybaseSettings' :: SybaseSettings -> Maybe Text
databaseName} -> Maybe Text
databaseName) (\s :: SybaseSettings
s@SybaseSettings' {} Maybe Text
a -> SybaseSettings
s {$sel:databaseName:SybaseSettings' :: Maybe Text
databaseName = Maybe Text
a} :: SybaseSettings)

-- | Endpoint connection password.
sybaseSettings_password :: Lens.Lens' SybaseSettings (Prelude.Maybe Prelude.Text)
sybaseSettings_password :: Lens' SybaseSettings (Maybe Text)
sybaseSettings_password = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SybaseSettings' {Maybe (Sensitive Text)
password :: Maybe (Sensitive Text)
$sel:password:SybaseSettings' :: SybaseSettings -> Maybe (Sensitive Text)
password} -> Maybe (Sensitive Text)
password) (\s :: SybaseSettings
s@SybaseSettings' {} Maybe (Sensitive Text)
a -> SybaseSettings
s {$sel:password:SybaseSettings' :: Maybe (Sensitive Text)
password = Maybe (Sensitive Text)
a} :: SybaseSettings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | Endpoint TCP port. The default is 5000.
sybaseSettings_port :: Lens.Lens' SybaseSettings (Prelude.Maybe Prelude.Int)
sybaseSettings_port :: Lens' SybaseSettings (Maybe Int)
sybaseSettings_port = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SybaseSettings' {Maybe Int
port :: Maybe Int
$sel:port:SybaseSettings' :: SybaseSettings -> Maybe Int
port} -> Maybe Int
port) (\s :: SybaseSettings
s@SybaseSettings' {} Maybe Int
a -> SybaseSettings
s {$sel:port:SybaseSettings' :: Maybe Int
port = Maybe Int
a} :: SybaseSettings)

-- | The full Amazon Resource Name (ARN) of the IAM role that specifies DMS
-- as the trusted entity and grants the required permissions to access the
-- value in @SecretsManagerSecret@. The role must allow the @iam:PassRole@
-- action. @SecretsManagerSecret@ has the value of the Amazon Web Services
-- Secrets Manager secret that allows access to the SAP ASE endpoint.
--
-- You can specify one of two sets of values for these permissions. You can
-- specify the values for this setting and @SecretsManagerSecretId@. Or you
-- can specify clear-text values for @UserName@, @Password@, @ServerName@,
-- and @Port@. You can\'t specify both. For more information on creating
-- this @SecretsManagerSecret@ and the @SecretsManagerAccessRoleArn@ and
-- @SecretsManagerSecretId@ required to access it, see
-- <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Security.html#security-iam-secretsmanager Using secrets to access Database Migration Service resources>
-- in the /Database Migration Service User Guide/.
sybaseSettings_secretsManagerAccessRoleArn :: Lens.Lens' SybaseSettings (Prelude.Maybe Prelude.Text)
sybaseSettings_secretsManagerAccessRoleArn :: Lens' SybaseSettings (Maybe Text)
sybaseSettings_secretsManagerAccessRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SybaseSettings' {Maybe Text
secretsManagerAccessRoleArn :: Maybe Text
$sel:secretsManagerAccessRoleArn:SybaseSettings' :: SybaseSettings -> Maybe Text
secretsManagerAccessRoleArn} -> Maybe Text
secretsManagerAccessRoleArn) (\s :: SybaseSettings
s@SybaseSettings' {} Maybe Text
a -> SybaseSettings
s {$sel:secretsManagerAccessRoleArn:SybaseSettings' :: Maybe Text
secretsManagerAccessRoleArn = Maybe Text
a} :: SybaseSettings)

-- | The full ARN, partial ARN, or friendly name of the
-- @SecretsManagerSecret@ that contains the SAP SAE endpoint connection
-- details.
sybaseSettings_secretsManagerSecretId :: Lens.Lens' SybaseSettings (Prelude.Maybe Prelude.Text)
sybaseSettings_secretsManagerSecretId :: Lens' SybaseSettings (Maybe Text)
sybaseSettings_secretsManagerSecretId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SybaseSettings' {Maybe Text
secretsManagerSecretId :: Maybe Text
$sel:secretsManagerSecretId:SybaseSettings' :: SybaseSettings -> Maybe Text
secretsManagerSecretId} -> Maybe Text
secretsManagerSecretId) (\s :: SybaseSettings
s@SybaseSettings' {} Maybe Text
a -> SybaseSettings
s {$sel:secretsManagerSecretId:SybaseSettings' :: Maybe Text
secretsManagerSecretId = Maybe Text
a} :: SybaseSettings)

-- | Fully qualified domain name of the endpoint.
sybaseSettings_serverName :: Lens.Lens' SybaseSettings (Prelude.Maybe Prelude.Text)
sybaseSettings_serverName :: Lens' SybaseSettings (Maybe Text)
sybaseSettings_serverName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SybaseSettings' {Maybe Text
serverName :: Maybe Text
$sel:serverName:SybaseSettings' :: SybaseSettings -> Maybe Text
serverName} -> Maybe Text
serverName) (\s :: SybaseSettings
s@SybaseSettings' {} Maybe Text
a -> SybaseSettings
s {$sel:serverName:SybaseSettings' :: Maybe Text
serverName = Maybe Text
a} :: SybaseSettings)

-- | Endpoint connection user name.
sybaseSettings_username :: Lens.Lens' SybaseSettings (Prelude.Maybe Prelude.Text)
sybaseSettings_username :: Lens' SybaseSettings (Maybe Text)
sybaseSettings_username = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SybaseSettings' {Maybe Text
username :: Maybe Text
$sel:username:SybaseSettings' :: SybaseSettings -> Maybe Text
username} -> Maybe Text
username) (\s :: SybaseSettings
s@SybaseSettings' {} Maybe Text
a -> SybaseSettings
s {$sel:username:SybaseSettings' :: Maybe Text
username = Maybe Text
a} :: SybaseSettings)

instance Data.FromJSON SybaseSettings where
  parseJSON :: Value -> Parser SybaseSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SybaseSettings"
      ( \Object
x ->
          Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> SybaseSettings
SybaseSettings'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DatabaseName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Password")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Port")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SecretsManagerAccessRoleArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SecretsManagerSecretId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ServerName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Username")
      )

instance Prelude.Hashable SybaseSettings where
  hashWithSalt :: Int -> SybaseSettings -> Int
hashWithSalt Int
_salt SybaseSettings' {Maybe Int
Maybe Text
Maybe (Sensitive Text)
username :: Maybe Text
serverName :: Maybe Text
secretsManagerSecretId :: Maybe Text
secretsManagerAccessRoleArn :: Maybe Text
port :: Maybe Int
password :: Maybe (Sensitive Text)
databaseName :: Maybe Text
$sel:username:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:serverName:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:secretsManagerSecretId:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:secretsManagerAccessRoleArn:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:port:SybaseSettings' :: SybaseSettings -> Maybe Int
$sel:password:SybaseSettings' :: SybaseSettings -> Maybe (Sensitive Text)
$sel:databaseName:SybaseSettings' :: SybaseSettings -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
databaseName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
password
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
port
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
secretsManagerAccessRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
secretsManagerSecretId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serverName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
username

instance Prelude.NFData SybaseSettings where
  rnf :: SybaseSettings -> ()
rnf SybaseSettings' {Maybe Int
Maybe Text
Maybe (Sensitive Text)
username :: Maybe Text
serverName :: Maybe Text
secretsManagerSecretId :: Maybe Text
secretsManagerAccessRoleArn :: Maybe Text
port :: Maybe Int
password :: Maybe (Sensitive Text)
databaseName :: Maybe Text
$sel:username:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:serverName:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:secretsManagerSecretId:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:secretsManagerAccessRoleArn:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:port:SybaseSettings' :: SybaseSettings -> Maybe Int
$sel:password:SybaseSettings' :: SybaseSettings -> Maybe (Sensitive Text)
$sel:databaseName:SybaseSettings' :: SybaseSettings -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
databaseName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
password
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
port
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
secretsManagerAccessRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
secretsManagerSecretId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serverName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
username

instance Data.ToJSON SybaseSettings where
  toJSON :: SybaseSettings -> Value
toJSON SybaseSettings' {Maybe Int
Maybe Text
Maybe (Sensitive Text)
username :: Maybe Text
serverName :: Maybe Text
secretsManagerSecretId :: Maybe Text
secretsManagerAccessRoleArn :: Maybe Text
port :: Maybe Int
password :: Maybe (Sensitive Text)
databaseName :: Maybe Text
$sel:username:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:serverName:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:secretsManagerSecretId:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:secretsManagerAccessRoleArn:SybaseSettings' :: SybaseSettings -> Maybe Text
$sel:port:SybaseSettings' :: SybaseSettings -> Maybe Int
$sel:password:SybaseSettings' :: SybaseSettings -> Maybe (Sensitive Text)
$sel:databaseName:SybaseSettings' :: SybaseSettings -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DatabaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
databaseName,
            (Key
"Password" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
password,
            (Key
"Port" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
port,
            (Key
"SecretsManagerAccessRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
secretsManagerAccessRoleArn,
            (Key
"SecretsManagerSecretId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
secretsManagerSecretId,
            (Key
"ServerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
serverName,
            (Key
"Username" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
username
          ]
      )