{-# 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.UpdateDataSource
-- 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)
--
-- Updates a data source.
module Amazonka.QuickSight.UpdateDataSource
  ( -- * Creating a Request
    UpdateDataSource (..),
    newUpdateDataSource,

    -- * Request Lenses
    updateDataSource_dataSourceParameters,
    updateDataSource_sslProperties,
    updateDataSource_credentials,
    updateDataSource_vpcConnectionProperties,
    updateDataSource_awsAccountId,
    updateDataSource_dataSourceId,
    updateDataSource_name,

    -- * Destructuring the Response
    UpdateDataSourceResponse (..),
    newUpdateDataSourceResponse,

    -- * Response Lenses
    updateDataSourceResponse_requestId,
    updateDataSourceResponse_arn,
    updateDataSourceResponse_dataSourceId,
    updateDataSourceResponse_updateStatus,
    updateDataSourceResponse_status,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateDataSource' smart constructor.
data UpdateDataSource = UpdateDataSource'
  { -- | The parameters that Amazon QuickSight uses to connect to your underlying
    -- source.
    UpdateDataSource -> Maybe DataSourceParameters
dataSourceParameters :: Prelude.Maybe DataSourceParameters,
    -- | Secure Socket Layer (SSL) properties that apply when Amazon QuickSight
    -- connects to your underlying source.
    UpdateDataSource -> Maybe SslProperties
sslProperties :: Prelude.Maybe SslProperties,
    -- | The credentials that Amazon QuickSight that uses to connect to your
    -- underlying source. Currently, only credentials based on user name and
    -- password are supported.
    UpdateDataSource -> Maybe (Sensitive DataSourceCredentials)
credentials :: Prelude.Maybe (Core.Sensitive DataSourceCredentials),
    -- | Use this parameter only when you want Amazon QuickSight to use a VPC
    -- connection when connecting to your underlying source.
    UpdateDataSource -> Maybe VpcConnectionProperties
vpcConnectionProperties :: Prelude.Maybe VpcConnectionProperties,
    -- | The Amazon Web Services account ID.
    UpdateDataSource -> Text
awsAccountId :: Prelude.Text,
    -- | The ID of the data source. This ID is unique per Amazon Web Services
    -- Region for each Amazon Web Services account.
    UpdateDataSource -> Text
dataSourceId :: Prelude.Text,
    -- | A display name for the data source.
    UpdateDataSource -> Text
name :: Prelude.Text
  }
  deriving (UpdateDataSource -> UpdateDataSource -> Bool
(UpdateDataSource -> UpdateDataSource -> Bool)
-> (UpdateDataSource -> UpdateDataSource -> Bool)
-> Eq UpdateDataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDataSource -> UpdateDataSource -> Bool
$c/= :: UpdateDataSource -> UpdateDataSource -> Bool
== :: UpdateDataSource -> UpdateDataSource -> Bool
$c== :: UpdateDataSource -> UpdateDataSource -> Bool
Prelude.Eq, Int -> UpdateDataSource -> ShowS
[UpdateDataSource] -> ShowS
UpdateDataSource -> String
(Int -> UpdateDataSource -> ShowS)
-> (UpdateDataSource -> String)
-> ([UpdateDataSource] -> ShowS)
-> Show UpdateDataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDataSource] -> ShowS
$cshowList :: [UpdateDataSource] -> ShowS
show :: UpdateDataSource -> String
$cshow :: UpdateDataSource -> String
showsPrec :: Int -> UpdateDataSource -> ShowS
$cshowsPrec :: Int -> UpdateDataSource -> ShowS
Prelude.Show, (forall x. UpdateDataSource -> Rep UpdateDataSource x)
-> (forall x. Rep UpdateDataSource x -> UpdateDataSource)
-> Generic UpdateDataSource
forall x. Rep UpdateDataSource x -> UpdateDataSource
forall x. UpdateDataSource -> Rep UpdateDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDataSource x -> UpdateDataSource
$cfrom :: forall x. UpdateDataSource -> Rep UpdateDataSource x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDataSource' 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:
--
-- 'dataSourceParameters', 'updateDataSource_dataSourceParameters' - The parameters that Amazon QuickSight uses to connect to your underlying
-- source.
--
-- 'sslProperties', 'updateDataSource_sslProperties' - Secure Socket Layer (SSL) properties that apply when Amazon QuickSight
-- connects to your underlying source.
--
-- 'credentials', 'updateDataSource_credentials' - The credentials that Amazon QuickSight that uses to connect to your
-- underlying source. Currently, only credentials based on user name and
-- password are supported.
--
-- 'vpcConnectionProperties', 'updateDataSource_vpcConnectionProperties' - Use this parameter only when you want Amazon QuickSight to use a VPC
-- connection when connecting to your underlying source.
--
-- 'awsAccountId', 'updateDataSource_awsAccountId' - The Amazon Web Services account ID.
--
-- 'dataSourceId', 'updateDataSource_dataSourceId' - The ID of the data source. This ID is unique per Amazon Web Services
-- Region for each Amazon Web Services account.
--
-- 'name', 'updateDataSource_name' - A display name for the data source.
newUpdateDataSource ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'dataSourceId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  UpdateDataSource
newUpdateDataSource :: Text -> Text -> Text -> UpdateDataSource
newUpdateDataSource
  Text
pAwsAccountId_
  Text
pDataSourceId_
  Text
pName_ =
    UpdateDataSource' :: Maybe DataSourceParameters
-> Maybe SslProperties
-> Maybe (Sensitive DataSourceCredentials)
-> Maybe VpcConnectionProperties
-> Text
-> Text
-> Text
-> UpdateDataSource
UpdateDataSource'
      { $sel:dataSourceParameters:UpdateDataSource' :: Maybe DataSourceParameters
dataSourceParameters =
          Maybe DataSourceParameters
forall a. Maybe a
Prelude.Nothing,
        $sel:sslProperties:UpdateDataSource' :: Maybe SslProperties
sslProperties = Maybe SslProperties
forall a. Maybe a
Prelude.Nothing,
        $sel:credentials:UpdateDataSource' :: Maybe (Sensitive DataSourceCredentials)
credentials = Maybe (Sensitive DataSourceCredentials)
forall a. Maybe a
Prelude.Nothing,
        $sel:vpcConnectionProperties:UpdateDataSource' :: Maybe VpcConnectionProperties
vpcConnectionProperties = Maybe VpcConnectionProperties
forall a. Maybe a
Prelude.Nothing,
        $sel:awsAccountId:UpdateDataSource' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:dataSourceId:UpdateDataSource' :: Text
dataSourceId = Text
pDataSourceId_,
        $sel:name:UpdateDataSource' :: Text
name = Text
pName_
      }

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

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

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

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

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

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

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

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

instance Prelude.Hashable UpdateDataSource

instance Prelude.NFData UpdateDataSource

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

instance Core.ToJSON UpdateDataSource where
  toJSON :: UpdateDataSource -> Value
toJSON UpdateDataSource' {Maybe (Sensitive DataSourceCredentials)
Maybe SslProperties
Maybe DataSourceParameters
Maybe VpcConnectionProperties
Text
name :: Text
dataSourceId :: Text
awsAccountId :: Text
vpcConnectionProperties :: Maybe VpcConnectionProperties
credentials :: Maybe (Sensitive DataSourceCredentials)
sslProperties :: Maybe SslProperties
dataSourceParameters :: Maybe DataSourceParameters
$sel:name:UpdateDataSource' :: UpdateDataSource -> Text
$sel:dataSourceId:UpdateDataSource' :: UpdateDataSource -> Text
$sel:awsAccountId:UpdateDataSource' :: UpdateDataSource -> Text
$sel:vpcConnectionProperties:UpdateDataSource' :: UpdateDataSource -> Maybe VpcConnectionProperties
$sel:credentials:UpdateDataSource' :: UpdateDataSource -> Maybe (Sensitive DataSourceCredentials)
$sel:sslProperties:UpdateDataSource' :: UpdateDataSource -> Maybe SslProperties
$sel:dataSourceParameters:UpdateDataSource' :: UpdateDataSource -> Maybe DataSourceParameters
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DataSourceParameters" Text -> DataSourceParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DataSourceParameters -> Pair)
-> Maybe DataSourceParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataSourceParameters
dataSourceParameters,
            (Text
"SslProperties" Text -> SslProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SslProperties -> Pair) -> Maybe SslProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SslProperties
sslProperties,
            (Text
"Credentials" Text -> Sensitive DataSourceCredentials -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive DataSourceCredentials -> Pair)
-> Maybe (Sensitive DataSourceCredentials) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive DataSourceCredentials)
credentials,
            (Text
"VpcConnectionProperties" Text -> VpcConnectionProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (VpcConnectionProperties -> Pair)
-> Maybe VpcConnectionProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VpcConnectionProperties
vpcConnectionProperties,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateDataSourceResponse' 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:
--
-- 'requestId', 'updateDataSourceResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'arn', 'updateDataSourceResponse_arn' - The Amazon Resource Name (ARN) of the data source.
--
-- 'dataSourceId', 'updateDataSourceResponse_dataSourceId' - The ID of the data source. This ID is unique per Amazon Web Services
-- Region for each Amazon Web Services account.
--
-- 'updateStatus', 'updateDataSourceResponse_updateStatus' - The update status of the data source\'s last update.
--
-- 'status', 'updateDataSourceResponse_status' - The HTTP status of the request.
newUpdateDataSourceResponse ::
  -- | 'status'
  Prelude.Int ->
  UpdateDataSourceResponse
newUpdateDataSourceResponse :: Int -> UpdateDataSourceResponse
newUpdateDataSourceResponse Int
pStatus_ =
  UpdateDataSourceResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ResourceStatus
-> Int
-> UpdateDataSourceResponse
UpdateDataSourceResponse'
    { $sel:requestId:UpdateDataSourceResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:UpdateDataSourceResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSourceId:UpdateDataSourceResponse' :: Maybe Text
dataSourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updateStatus:UpdateDataSourceResponse' :: Maybe ResourceStatus
updateStatus = Maybe ResourceStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:status:UpdateDataSourceResponse' :: Int
status = Int
pStatus_
    }

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

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

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

-- | The update status of the data source\'s last update.
updateDataSourceResponse_updateStatus :: Lens.Lens' UpdateDataSourceResponse (Prelude.Maybe ResourceStatus)
updateDataSourceResponse_updateStatus :: (Maybe ResourceStatus -> f (Maybe ResourceStatus))
-> UpdateDataSourceResponse -> f UpdateDataSourceResponse
updateDataSourceResponse_updateStatus = (UpdateDataSourceResponse -> Maybe ResourceStatus)
-> (UpdateDataSourceResponse
    -> Maybe ResourceStatus -> UpdateDataSourceResponse)
-> Lens
     UpdateDataSourceResponse
     UpdateDataSourceResponse
     (Maybe ResourceStatus)
     (Maybe ResourceStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSourceResponse' {Maybe ResourceStatus
updateStatus :: Maybe ResourceStatus
$sel:updateStatus:UpdateDataSourceResponse' :: UpdateDataSourceResponse -> Maybe ResourceStatus
updateStatus} -> Maybe ResourceStatus
updateStatus) (\s :: UpdateDataSourceResponse
s@UpdateDataSourceResponse' {} Maybe ResourceStatus
a -> UpdateDataSourceResponse
s {$sel:updateStatus:UpdateDataSourceResponse' :: Maybe ResourceStatus
updateStatus = Maybe ResourceStatus
a} :: UpdateDataSourceResponse)

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

instance Prelude.NFData UpdateDataSourceResponse