{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateDataSource
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a data source.
module Amazonka.QuickSight.CreateDataSource
  ( -- * Creating a Request
    CreateDataSource (..),
    newCreateDataSource,

    -- * Request Lenses
    createDataSource_credentials,
    createDataSource_dataSourceParameters,
    createDataSource_permissions,
    createDataSource_sslProperties,
    createDataSource_tags,
    createDataSource_vpcConnectionProperties,
    createDataSource_awsAccountId,
    createDataSource_dataSourceId,
    createDataSource_name,
    createDataSource_type,

    -- * Destructuring the Response
    CreateDataSourceResponse (..),
    newCreateDataSourceResponse,

    -- * Response Lenses
    createDataSourceResponse_arn,
    createDataSourceResponse_creationStatus,
    createDataSourceResponse_dataSourceId,
    createDataSourceResponse_requestId,
    createDataSourceResponse_status,
  )
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
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateDataSource' smart constructor.
data CreateDataSource = CreateDataSource'
  { -- | The credentials Amazon QuickSight that uses to connect to your
    -- underlying source. Currently, only credentials based on user name and
    -- password are supported.
    CreateDataSource -> Maybe (Sensitive DataSourceCredentials)
credentials :: Prelude.Maybe (Data.Sensitive DataSourceCredentials),
    -- | The parameters that Amazon QuickSight uses to connect to your underlying
    -- source.
    CreateDataSource -> Maybe DataSourceParameters
dataSourceParameters :: Prelude.Maybe DataSourceParameters,
    -- | A list of resource permissions on the data source.
    CreateDataSource -> Maybe (NonEmpty ResourcePermission)
permissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | Secure Socket Layer (SSL) properties that apply when Amazon QuickSight
    -- connects to your underlying source.
    CreateDataSource -> Maybe SslProperties
sslProperties :: Prelude.Maybe SslProperties,
    -- | Contains a map of the key-value pairs for the resource tag or tags
    -- assigned to the data source.
    CreateDataSource -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | Use this parameter only when you want Amazon QuickSight to use a VPC
    -- connection when connecting to your underlying source.
    CreateDataSource -> Maybe VpcConnectionProperties
vpcConnectionProperties :: Prelude.Maybe VpcConnectionProperties,
    -- | The Amazon Web Services account ID.
    CreateDataSource -> Text
awsAccountId :: Prelude.Text,
    -- | An ID for the data source. This ID is unique per Amazon Web Services
    -- Region for each Amazon Web Services account.
    CreateDataSource -> Text
dataSourceId :: Prelude.Text,
    -- | A display name for the data source.
    CreateDataSource -> Text
name :: Prelude.Text,
    -- | The type of the data source. To return a list of all data sources, use
    -- @ListDataSources@.
    --
    -- Use @AMAZON_ELASTICSEARCH@ for Amazon OpenSearch Service.
    CreateDataSource -> DataSourceType
type' :: DataSourceType
  }
  deriving (CreateDataSource -> CreateDataSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataSource -> CreateDataSource -> Bool
$c/= :: CreateDataSource -> CreateDataSource -> Bool
== :: CreateDataSource -> CreateDataSource -> Bool
$c== :: CreateDataSource -> CreateDataSource -> Bool
Prelude.Eq, Int -> CreateDataSource -> ShowS
[CreateDataSource] -> ShowS
CreateDataSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataSource] -> ShowS
$cshowList :: [CreateDataSource] -> ShowS
show :: CreateDataSource -> String
$cshow :: CreateDataSource -> String
showsPrec :: Int -> CreateDataSource -> ShowS
$cshowsPrec :: Int -> CreateDataSource -> ShowS
Prelude.Show, forall x. Rep CreateDataSource x -> CreateDataSource
forall x. CreateDataSource -> Rep CreateDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDataSource x -> CreateDataSource
$cfrom :: forall x. CreateDataSource -> Rep CreateDataSource x
Prelude.Generic)

-- |
-- Create a value of 'CreateDataSource' 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:
--
-- 'credentials', 'createDataSource_credentials' - The credentials Amazon QuickSight that uses to connect to your
-- underlying source. Currently, only credentials based on user name and
-- password are supported.
--
-- 'dataSourceParameters', 'createDataSource_dataSourceParameters' - The parameters that Amazon QuickSight uses to connect to your underlying
-- source.
--
-- 'permissions', 'createDataSource_permissions' - A list of resource permissions on the data source.
--
-- 'sslProperties', 'createDataSource_sslProperties' - Secure Socket Layer (SSL) properties that apply when Amazon QuickSight
-- connects to your underlying source.
--
-- 'tags', 'createDataSource_tags' - Contains a map of the key-value pairs for the resource tag or tags
-- assigned to the data source.
--
-- 'vpcConnectionProperties', 'createDataSource_vpcConnectionProperties' - Use this parameter only when you want Amazon QuickSight to use a VPC
-- connection when connecting to your underlying source.
--
-- 'awsAccountId', 'createDataSource_awsAccountId' - The Amazon Web Services account ID.
--
-- 'dataSourceId', 'createDataSource_dataSourceId' - An ID for the data source. This ID is unique per Amazon Web Services
-- Region for each Amazon Web Services account.
--
-- 'name', 'createDataSource_name' - A display name for the data source.
--
-- 'type'', 'createDataSource_type' - The type of the data source. To return a list of all data sources, use
-- @ListDataSources@.
--
-- Use @AMAZON_ELASTICSEARCH@ for Amazon OpenSearch Service.
newCreateDataSource ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'dataSourceId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  DataSourceType ->
  CreateDataSource
newCreateDataSource :: Text -> Text -> Text -> DataSourceType -> CreateDataSource
newCreateDataSource
  Text
pAwsAccountId_
  Text
pDataSourceId_
  Text
pName_
  DataSourceType
pType_ =
    CreateDataSource'
      { $sel:credentials:CreateDataSource' :: Maybe (Sensitive DataSourceCredentials)
credentials = forall a. Maybe a
Prelude.Nothing,
        $sel:dataSourceParameters:CreateDataSource' :: Maybe DataSourceParameters
dataSourceParameters = forall a. Maybe a
Prelude.Nothing,
        $sel:permissions:CreateDataSource' :: Maybe (NonEmpty ResourcePermission)
permissions = forall a. Maybe a
Prelude.Nothing,
        $sel:sslProperties:CreateDataSource' :: Maybe SslProperties
sslProperties = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDataSource' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:vpcConnectionProperties:CreateDataSource' :: Maybe VpcConnectionProperties
vpcConnectionProperties = forall a. Maybe a
Prelude.Nothing,
        $sel:awsAccountId:CreateDataSource' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:dataSourceId:CreateDataSource' :: Text
dataSourceId = Text
pDataSourceId_,
        $sel:name:CreateDataSource' :: Text
name = Text
pName_,
        $sel:type':CreateDataSource' :: DataSourceType
type' = DataSourceType
pType_
      }

-- | The credentials Amazon QuickSight that uses to connect to your
-- underlying source. Currently, only credentials based on user name and
-- password are supported.
createDataSource_credentials :: Lens.Lens' CreateDataSource (Prelude.Maybe DataSourceCredentials)
createDataSource_credentials :: Lens' CreateDataSource (Maybe DataSourceCredentials)
createDataSource_credentials = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe (Sensitive DataSourceCredentials)
credentials :: Maybe (Sensitive DataSourceCredentials)
$sel:credentials:CreateDataSource' :: CreateDataSource -> Maybe (Sensitive DataSourceCredentials)
credentials} -> Maybe (Sensitive DataSourceCredentials)
credentials) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe (Sensitive DataSourceCredentials)
a -> CreateDataSource
s {$sel:credentials:CreateDataSource' :: Maybe (Sensitive DataSourceCredentials)
credentials = Maybe (Sensitive DataSourceCredentials)
a} :: CreateDataSource) 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

-- | The parameters that Amazon QuickSight uses to connect to your underlying
-- source.
createDataSource_dataSourceParameters :: Lens.Lens' CreateDataSource (Prelude.Maybe DataSourceParameters)
createDataSource_dataSourceParameters :: Lens' CreateDataSource (Maybe DataSourceParameters)
createDataSource_dataSourceParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe DataSourceParameters
dataSourceParameters :: Maybe DataSourceParameters
$sel:dataSourceParameters:CreateDataSource' :: CreateDataSource -> Maybe DataSourceParameters
dataSourceParameters} -> Maybe DataSourceParameters
dataSourceParameters) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe DataSourceParameters
a -> CreateDataSource
s {$sel:dataSourceParameters:CreateDataSource' :: Maybe DataSourceParameters
dataSourceParameters = Maybe DataSourceParameters
a} :: CreateDataSource)

-- | A list of resource permissions on the data source.
createDataSource_permissions :: Lens.Lens' CreateDataSource (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
createDataSource_permissions :: Lens' CreateDataSource (Maybe (NonEmpty ResourcePermission))
createDataSource_permissions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe (NonEmpty ResourcePermission)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:permissions:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty ResourcePermission)
permissions} -> Maybe (NonEmpty ResourcePermission)
permissions) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe (NonEmpty ResourcePermission)
a -> CreateDataSource
s {$sel:permissions:CreateDataSource' :: Maybe (NonEmpty ResourcePermission)
permissions = Maybe (NonEmpty ResourcePermission)
a} :: CreateDataSource) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Secure Socket Layer (SSL) properties that apply when Amazon QuickSight
-- connects to your underlying source.
createDataSource_sslProperties :: Lens.Lens' CreateDataSource (Prelude.Maybe SslProperties)
createDataSource_sslProperties :: Lens' CreateDataSource (Maybe SslProperties)
createDataSource_sslProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe SslProperties
sslProperties :: Maybe SslProperties
$sel:sslProperties:CreateDataSource' :: CreateDataSource -> Maybe SslProperties
sslProperties} -> Maybe SslProperties
sslProperties) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe SslProperties
a -> CreateDataSource
s {$sel:sslProperties:CreateDataSource' :: Maybe SslProperties
sslProperties = Maybe SslProperties
a} :: CreateDataSource)

-- | Contains a map of the key-value pairs for the resource tag or tags
-- assigned to the data source.
createDataSource_tags :: Lens.Lens' CreateDataSource (Prelude.Maybe (Prelude.NonEmpty Tag))
createDataSource_tags :: Lens' CreateDataSource (Maybe (NonEmpty Tag))
createDataSource_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe (NonEmpty Tag)
a -> CreateDataSource
s {$sel:tags:CreateDataSource' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateDataSource) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Use this parameter only when you want Amazon QuickSight to use a VPC
-- connection when connecting to your underlying source.
createDataSource_vpcConnectionProperties :: Lens.Lens' CreateDataSource (Prelude.Maybe VpcConnectionProperties)
createDataSource_vpcConnectionProperties :: Lens' CreateDataSource (Maybe VpcConnectionProperties)
createDataSource_vpcConnectionProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe VpcConnectionProperties
vpcConnectionProperties :: Maybe VpcConnectionProperties
$sel:vpcConnectionProperties:CreateDataSource' :: CreateDataSource -> Maybe VpcConnectionProperties
vpcConnectionProperties} -> Maybe VpcConnectionProperties
vpcConnectionProperties) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe VpcConnectionProperties
a -> CreateDataSource
s {$sel:vpcConnectionProperties:CreateDataSource' :: Maybe VpcConnectionProperties
vpcConnectionProperties = Maybe VpcConnectionProperties
a} :: CreateDataSource)

-- | The Amazon Web Services account ID.
createDataSource_awsAccountId :: Lens.Lens' CreateDataSource Prelude.Text
createDataSource_awsAccountId :: Lens' CreateDataSource Text
createDataSource_awsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Text
awsAccountId :: Text
$sel:awsAccountId:CreateDataSource' :: CreateDataSource -> Text
awsAccountId} -> Text
awsAccountId) (\s :: CreateDataSource
s@CreateDataSource' {} Text
a -> CreateDataSource
s {$sel:awsAccountId:CreateDataSource' :: Text
awsAccountId = Text
a} :: CreateDataSource)

-- | An ID for the data source. This ID is unique per Amazon Web Services
-- Region for each Amazon Web Services account.
createDataSource_dataSourceId :: Lens.Lens' CreateDataSource Prelude.Text
createDataSource_dataSourceId :: Lens' CreateDataSource Text
createDataSource_dataSourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Text
dataSourceId :: Text
$sel:dataSourceId:CreateDataSource' :: CreateDataSource -> Text
dataSourceId} -> Text
dataSourceId) (\s :: CreateDataSource
s@CreateDataSource' {} Text
a -> CreateDataSource
s {$sel:dataSourceId:CreateDataSource' :: Text
dataSourceId = Text
a} :: CreateDataSource)

-- | A display name for the data source.
createDataSource_name :: Lens.Lens' CreateDataSource Prelude.Text
createDataSource_name :: Lens' CreateDataSource Text
createDataSource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Text
name :: Text
$sel:name:CreateDataSource' :: CreateDataSource -> Text
name} -> Text
name) (\s :: CreateDataSource
s@CreateDataSource' {} Text
a -> CreateDataSource
s {$sel:name:CreateDataSource' :: Text
name = Text
a} :: CreateDataSource)

-- | The type of the data source. To return a list of all data sources, use
-- @ListDataSources@.
--
-- Use @AMAZON_ELASTICSEARCH@ for Amazon OpenSearch Service.
createDataSource_type :: Lens.Lens' CreateDataSource DataSourceType
createDataSource_type :: Lens' CreateDataSource DataSourceType
createDataSource_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {DataSourceType
type' :: DataSourceType
$sel:type':CreateDataSource' :: CreateDataSource -> DataSourceType
type'} -> DataSourceType
type') (\s :: CreateDataSource
s@CreateDataSource' {} DataSourceType
a -> CreateDataSource
s {$sel:type':CreateDataSource' :: DataSourceType
type' = DataSourceType
a} :: CreateDataSource)

instance Core.AWSRequest CreateDataSource where
  type
    AWSResponse CreateDataSource =
      CreateDataSourceResponse
  request :: (Service -> Service)
-> CreateDataSource -> Request CreateDataSource
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateDataSource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDataSource)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe ResourceStatus
-> Maybe Text
-> Maybe Text
-> Int
-> CreateDataSourceResponse
CreateDataSourceResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CreationStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DataSourceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RequestId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateDataSource where
  hashWithSalt :: Int -> CreateDataSource -> Int
hashWithSalt Int
_salt CreateDataSource' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe (Sensitive DataSourceCredentials)
Maybe SslProperties
Maybe DataSourceParameters
Maybe VpcConnectionProperties
Text
DataSourceType
type' :: DataSourceType
name :: Text
dataSourceId :: Text
awsAccountId :: Text
vpcConnectionProperties :: Maybe VpcConnectionProperties
tags :: Maybe (NonEmpty Tag)
sslProperties :: Maybe SslProperties
permissions :: Maybe (NonEmpty ResourcePermission)
dataSourceParameters :: Maybe DataSourceParameters
credentials :: Maybe (Sensitive DataSourceCredentials)
$sel:type':CreateDataSource' :: CreateDataSource -> DataSourceType
$sel:name:CreateDataSource' :: CreateDataSource -> Text
$sel:dataSourceId:CreateDataSource' :: CreateDataSource -> Text
$sel:awsAccountId:CreateDataSource' :: CreateDataSource -> Text
$sel:vpcConnectionProperties:CreateDataSource' :: CreateDataSource -> Maybe VpcConnectionProperties
$sel:tags:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty Tag)
$sel:sslProperties:CreateDataSource' :: CreateDataSource -> Maybe SslProperties
$sel:permissions:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty ResourcePermission)
$sel:dataSourceParameters:CreateDataSource' :: CreateDataSource -> Maybe DataSourceParameters
$sel:credentials:CreateDataSource' :: CreateDataSource -> Maybe (Sensitive DataSourceCredentials)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive DataSourceCredentials)
credentials
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataSourceParameters
dataSourceParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ResourcePermission)
permissions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SslProperties
sslProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcConnectionProperties
vpcConnectionProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
awsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataSourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DataSourceType
type'

instance Prelude.NFData CreateDataSource where
  rnf :: CreateDataSource -> ()
rnf CreateDataSource' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe (Sensitive DataSourceCredentials)
Maybe SslProperties
Maybe DataSourceParameters
Maybe VpcConnectionProperties
Text
DataSourceType
type' :: DataSourceType
name :: Text
dataSourceId :: Text
awsAccountId :: Text
vpcConnectionProperties :: Maybe VpcConnectionProperties
tags :: Maybe (NonEmpty Tag)
sslProperties :: Maybe SslProperties
permissions :: Maybe (NonEmpty ResourcePermission)
dataSourceParameters :: Maybe DataSourceParameters
credentials :: Maybe (Sensitive DataSourceCredentials)
$sel:type':CreateDataSource' :: CreateDataSource -> DataSourceType
$sel:name:CreateDataSource' :: CreateDataSource -> Text
$sel:dataSourceId:CreateDataSource' :: CreateDataSource -> Text
$sel:awsAccountId:CreateDataSource' :: CreateDataSource -> Text
$sel:vpcConnectionProperties:CreateDataSource' :: CreateDataSource -> Maybe VpcConnectionProperties
$sel:tags:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty Tag)
$sel:sslProperties:CreateDataSource' :: CreateDataSource -> Maybe SslProperties
$sel:permissions:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty ResourcePermission)
$sel:dataSourceParameters:CreateDataSource' :: CreateDataSource -> Maybe DataSourceParameters
$sel:credentials:CreateDataSource' :: CreateDataSource -> Maybe (Sensitive DataSourceCredentials)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive DataSourceCredentials)
credentials
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataSourceParameters
dataSourceParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ResourcePermission)
permissions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SslProperties
sslProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcConnectionProperties
vpcConnectionProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
awsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dataSourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DataSourceType
type'

instance Data.ToHeaders CreateDataSource where
  toHeaders :: CreateDataSource -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateDataSource where
  toJSON :: CreateDataSource -> Value
toJSON CreateDataSource' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe (Sensitive DataSourceCredentials)
Maybe SslProperties
Maybe DataSourceParameters
Maybe VpcConnectionProperties
Text
DataSourceType
type' :: DataSourceType
name :: Text
dataSourceId :: Text
awsAccountId :: Text
vpcConnectionProperties :: Maybe VpcConnectionProperties
tags :: Maybe (NonEmpty Tag)
sslProperties :: Maybe SslProperties
permissions :: Maybe (NonEmpty ResourcePermission)
dataSourceParameters :: Maybe DataSourceParameters
credentials :: Maybe (Sensitive DataSourceCredentials)
$sel:type':CreateDataSource' :: CreateDataSource -> DataSourceType
$sel:name:CreateDataSource' :: CreateDataSource -> Text
$sel:dataSourceId:CreateDataSource' :: CreateDataSource -> Text
$sel:awsAccountId:CreateDataSource' :: CreateDataSource -> Text
$sel:vpcConnectionProperties:CreateDataSource' :: CreateDataSource -> Maybe VpcConnectionProperties
$sel:tags:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty Tag)
$sel:sslProperties:CreateDataSource' :: CreateDataSource -> Maybe SslProperties
$sel:permissions:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty ResourcePermission)
$sel:dataSourceParameters:CreateDataSource' :: CreateDataSource -> Maybe DataSourceParameters
$sel:credentials:CreateDataSource' :: CreateDataSource -> Maybe (Sensitive DataSourceCredentials)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Credentials" 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 DataSourceCredentials)
credentials,
            (Key
"DataSourceParameters" 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 DataSourceParameters
dataSourceParameters,
            (Key
"Permissions" 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 (NonEmpty ResourcePermission)
permissions,
            (Key
"SslProperties" 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 SslProperties
sslProperties,
            (Key
"Tags" 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 (NonEmpty Tag)
tags,
            (Key
"VpcConnectionProperties" 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 VpcConnectionProperties
vpcConnectionProperties,
            forall a. a -> Maybe a
Prelude.Just (Key
"DataSourceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
dataSourceId),
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DataSourceType
type')
          ]
      )

instance Data.ToPath CreateDataSource where
  toPath :: CreateDataSource -> ByteString
toPath CreateDataSource' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe (Sensitive DataSourceCredentials)
Maybe SslProperties
Maybe DataSourceParameters
Maybe VpcConnectionProperties
Text
DataSourceType
type' :: DataSourceType
name :: Text
dataSourceId :: Text
awsAccountId :: Text
vpcConnectionProperties :: Maybe VpcConnectionProperties
tags :: Maybe (NonEmpty Tag)
sslProperties :: Maybe SslProperties
permissions :: Maybe (NonEmpty ResourcePermission)
dataSourceParameters :: Maybe DataSourceParameters
credentials :: Maybe (Sensitive DataSourceCredentials)
$sel:type':CreateDataSource' :: CreateDataSource -> DataSourceType
$sel:name:CreateDataSource' :: CreateDataSource -> Text
$sel:dataSourceId:CreateDataSource' :: CreateDataSource -> Text
$sel:awsAccountId:CreateDataSource' :: CreateDataSource -> Text
$sel:vpcConnectionProperties:CreateDataSource' :: CreateDataSource -> Maybe VpcConnectionProperties
$sel:tags:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty Tag)
$sel:sslProperties:CreateDataSource' :: CreateDataSource -> Maybe SslProperties
$sel:permissions:CreateDataSource' :: CreateDataSource -> Maybe (NonEmpty ResourcePermission)
$sel:dataSourceParameters:CreateDataSource' :: CreateDataSource -> Maybe DataSourceParameters
$sel:credentials:CreateDataSource' :: CreateDataSource -> Maybe (Sensitive DataSourceCredentials)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
awsAccountId,
        ByteString
"/data-sources"
      ]

instance Data.ToQuery CreateDataSource where
  toQuery :: CreateDataSource -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateDataSourceResponse' smart constructor.
data CreateDataSourceResponse = CreateDataSourceResponse'
  { -- | The Amazon Resource Name (ARN) of the data source.
    CreateDataSourceResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The status of creating the data source.
    CreateDataSourceResponse -> Maybe ResourceStatus
creationStatus :: Prelude.Maybe ResourceStatus,
    -- | The ID of the data source. This ID is unique per Amazon Web Services
    -- Region for each Amazon Web Services account.
    CreateDataSourceResponse -> Maybe Text
dataSourceId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services request ID for this operation.
    CreateDataSourceResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    CreateDataSourceResponse -> Int
status :: Prelude.Int
  }
  deriving (CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
$c/= :: CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
== :: CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
$c== :: CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
Prelude.Eq, ReadPrec [CreateDataSourceResponse]
ReadPrec CreateDataSourceResponse
Int -> ReadS CreateDataSourceResponse
ReadS [CreateDataSourceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDataSourceResponse]
$creadListPrec :: ReadPrec [CreateDataSourceResponse]
readPrec :: ReadPrec CreateDataSourceResponse
$creadPrec :: ReadPrec CreateDataSourceResponse
readList :: ReadS [CreateDataSourceResponse]
$creadList :: ReadS [CreateDataSourceResponse]
readsPrec :: Int -> ReadS CreateDataSourceResponse
$creadsPrec :: Int -> ReadS CreateDataSourceResponse
Prelude.Read, Int -> CreateDataSourceResponse -> ShowS
[CreateDataSourceResponse] -> ShowS
CreateDataSourceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataSourceResponse] -> ShowS
$cshowList :: [CreateDataSourceResponse] -> ShowS
show :: CreateDataSourceResponse -> String
$cshow :: CreateDataSourceResponse -> String
showsPrec :: Int -> CreateDataSourceResponse -> ShowS
$cshowsPrec :: Int -> CreateDataSourceResponse -> ShowS
Prelude.Show, forall x.
Rep CreateDataSourceResponse x -> CreateDataSourceResponse
forall x.
CreateDataSourceResponse -> Rep CreateDataSourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDataSourceResponse x -> CreateDataSourceResponse
$cfrom :: forall x.
CreateDataSourceResponse -> Rep CreateDataSourceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDataSourceResponse' 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:
--
-- 'arn', 'createDataSourceResponse_arn' - The Amazon Resource Name (ARN) of the data source.
--
-- 'creationStatus', 'createDataSourceResponse_creationStatus' - The status of creating the data source.
--
-- 'dataSourceId', 'createDataSourceResponse_dataSourceId' - The ID of the data source. This ID is unique per Amazon Web Services
-- Region for each Amazon Web Services account.
--
-- 'requestId', 'createDataSourceResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'status', 'createDataSourceResponse_status' - The HTTP status of the request.
newCreateDataSourceResponse ::
  -- | 'status'
  Prelude.Int ->
  CreateDataSourceResponse
newCreateDataSourceResponse :: Int -> CreateDataSourceResponse
newCreateDataSourceResponse Int
pStatus_ =
  CreateDataSourceResponse'
    { $sel:arn:CreateDataSourceResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationStatus:CreateDataSourceResponse' :: Maybe ResourceStatus
creationStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:dataSourceId:CreateDataSourceResponse' :: Maybe Text
dataSourceId = forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:CreateDataSourceResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:CreateDataSourceResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Resource Name (ARN) of the data source.
createDataSourceResponse_arn :: Lens.Lens' CreateDataSourceResponse (Prelude.Maybe Prelude.Text)
createDataSourceResponse_arn :: Lens' CreateDataSourceResponse (Maybe Text)
createDataSourceResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateDataSourceResponse' :: CreateDataSourceResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateDataSourceResponse
s@CreateDataSourceResponse' {} Maybe Text
a -> CreateDataSourceResponse
s {$sel:arn:CreateDataSourceResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateDataSourceResponse)

-- | The status of creating the data source.
createDataSourceResponse_creationStatus :: Lens.Lens' CreateDataSourceResponse (Prelude.Maybe ResourceStatus)
createDataSourceResponse_creationStatus :: Lens' CreateDataSourceResponse (Maybe ResourceStatus)
createDataSourceResponse_creationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceResponse' {Maybe ResourceStatus
creationStatus :: Maybe ResourceStatus
$sel:creationStatus:CreateDataSourceResponse' :: CreateDataSourceResponse -> Maybe ResourceStatus
creationStatus} -> Maybe ResourceStatus
creationStatus) (\s :: CreateDataSourceResponse
s@CreateDataSourceResponse' {} Maybe ResourceStatus
a -> CreateDataSourceResponse
s {$sel:creationStatus:CreateDataSourceResponse' :: Maybe ResourceStatus
creationStatus = Maybe ResourceStatus
a} :: CreateDataSourceResponse)

-- | The ID of the data source. This ID is unique per Amazon Web Services
-- Region for each Amazon Web Services account.
createDataSourceResponse_dataSourceId :: Lens.Lens' CreateDataSourceResponse (Prelude.Maybe Prelude.Text)
createDataSourceResponse_dataSourceId :: Lens' CreateDataSourceResponse (Maybe Text)
createDataSourceResponse_dataSourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceResponse' {Maybe Text
dataSourceId :: Maybe Text
$sel:dataSourceId:CreateDataSourceResponse' :: CreateDataSourceResponse -> Maybe Text
dataSourceId} -> Maybe Text
dataSourceId) (\s :: CreateDataSourceResponse
s@CreateDataSourceResponse' {} Maybe Text
a -> CreateDataSourceResponse
s {$sel:dataSourceId:CreateDataSourceResponse' :: Maybe Text
dataSourceId = Maybe Text
a} :: CreateDataSourceResponse)

-- | The Amazon Web Services request ID for this operation.
createDataSourceResponse_requestId :: Lens.Lens' CreateDataSourceResponse (Prelude.Maybe Prelude.Text)
createDataSourceResponse_requestId :: Lens' CreateDataSourceResponse (Maybe Text)
createDataSourceResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:CreateDataSourceResponse' :: CreateDataSourceResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: CreateDataSourceResponse
s@CreateDataSourceResponse' {} Maybe Text
a -> CreateDataSourceResponse
s {$sel:requestId:CreateDataSourceResponse' :: Maybe Text
requestId = Maybe Text
a} :: CreateDataSourceResponse)

-- | The HTTP status of the request.
createDataSourceResponse_status :: Lens.Lens' CreateDataSourceResponse Prelude.Int
createDataSourceResponse_status :: Lens' CreateDataSourceResponse Int
createDataSourceResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceResponse' {Int
status :: Int
$sel:status:CreateDataSourceResponse' :: CreateDataSourceResponse -> Int
status} -> Int
status) (\s :: CreateDataSourceResponse
s@CreateDataSourceResponse' {} Int
a -> CreateDataSourceResponse
s {$sel:status:CreateDataSourceResponse' :: Int
status = Int
a} :: CreateDataSourceResponse)

instance Prelude.NFData CreateDataSourceResponse where
  rnf :: CreateDataSourceResponse -> ()
rnf CreateDataSourceResponse' {Int
Maybe Text
Maybe ResourceStatus
status :: Int
requestId :: Maybe Text
dataSourceId :: Maybe Text
creationStatus :: Maybe ResourceStatus
arn :: Maybe Text
$sel:status:CreateDataSourceResponse' :: CreateDataSourceResponse -> Int
$sel:requestId:CreateDataSourceResponse' :: CreateDataSourceResponse -> Maybe Text
$sel:dataSourceId:CreateDataSourceResponse' :: CreateDataSourceResponse -> Maybe Text
$sel:creationStatus:CreateDataSourceResponse' :: CreateDataSourceResponse -> Maybe ResourceStatus
$sel:arn:CreateDataSourceResponse' :: CreateDataSourceResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceStatus
creationStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dataSourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
status