{-# 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.UpdateDataSourcePermissions
-- 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 the permissions to a data source.
module Amazonka.QuickSight.UpdateDataSourcePermissions
  ( -- * Creating a Request
    UpdateDataSourcePermissions (..),
    newUpdateDataSourcePermissions,

    -- * Request Lenses
    updateDataSourcePermissions_revokePermissions,
    updateDataSourcePermissions_grantPermissions,
    updateDataSourcePermissions_awsAccountId,
    updateDataSourcePermissions_dataSourceId,

    -- * Destructuring the Response
    UpdateDataSourcePermissionsResponse (..),
    newUpdateDataSourcePermissionsResponse,

    -- * Response Lenses
    updateDataSourcePermissionsResponse_requestId,
    updateDataSourcePermissionsResponse_dataSourceId,
    updateDataSourcePermissionsResponse_dataSourceArn,
    updateDataSourcePermissionsResponse_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:/ 'newUpdateDataSourcePermissions' smart constructor.
data UpdateDataSourcePermissions = UpdateDataSourcePermissions'
  { -- | A list of resource permissions that you want to revoke on the data
    -- source.
    UpdateDataSourcePermissions -> Maybe (NonEmpty ResourcePermission)
revokePermissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | A list of resource permissions that you want to grant on the data
    -- source.
    UpdateDataSourcePermissions -> Maybe (NonEmpty ResourcePermission)
grantPermissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | The Amazon Web Services account ID.
    UpdateDataSourcePermissions -> 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.
    UpdateDataSourcePermissions -> Text
dataSourceId :: Prelude.Text
  }
  deriving (UpdateDataSourcePermissions -> UpdateDataSourcePermissions -> Bool
(UpdateDataSourcePermissions
 -> UpdateDataSourcePermissions -> Bool)
-> (UpdateDataSourcePermissions
    -> UpdateDataSourcePermissions -> Bool)
-> Eq UpdateDataSourcePermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDataSourcePermissions -> UpdateDataSourcePermissions -> Bool
$c/= :: UpdateDataSourcePermissions -> UpdateDataSourcePermissions -> Bool
== :: UpdateDataSourcePermissions -> UpdateDataSourcePermissions -> Bool
$c== :: UpdateDataSourcePermissions -> UpdateDataSourcePermissions -> Bool
Prelude.Eq, ReadPrec [UpdateDataSourcePermissions]
ReadPrec UpdateDataSourcePermissions
Int -> ReadS UpdateDataSourcePermissions
ReadS [UpdateDataSourcePermissions]
(Int -> ReadS UpdateDataSourcePermissions)
-> ReadS [UpdateDataSourcePermissions]
-> ReadPrec UpdateDataSourcePermissions
-> ReadPrec [UpdateDataSourcePermissions]
-> Read UpdateDataSourcePermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDataSourcePermissions]
$creadListPrec :: ReadPrec [UpdateDataSourcePermissions]
readPrec :: ReadPrec UpdateDataSourcePermissions
$creadPrec :: ReadPrec UpdateDataSourcePermissions
readList :: ReadS [UpdateDataSourcePermissions]
$creadList :: ReadS [UpdateDataSourcePermissions]
readsPrec :: Int -> ReadS UpdateDataSourcePermissions
$creadsPrec :: Int -> ReadS UpdateDataSourcePermissions
Prelude.Read, Int -> UpdateDataSourcePermissions -> ShowS
[UpdateDataSourcePermissions] -> ShowS
UpdateDataSourcePermissions -> String
(Int -> UpdateDataSourcePermissions -> ShowS)
-> (UpdateDataSourcePermissions -> String)
-> ([UpdateDataSourcePermissions] -> ShowS)
-> Show UpdateDataSourcePermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDataSourcePermissions] -> ShowS
$cshowList :: [UpdateDataSourcePermissions] -> ShowS
show :: UpdateDataSourcePermissions -> String
$cshow :: UpdateDataSourcePermissions -> String
showsPrec :: Int -> UpdateDataSourcePermissions -> ShowS
$cshowsPrec :: Int -> UpdateDataSourcePermissions -> ShowS
Prelude.Show, (forall x.
 UpdateDataSourcePermissions -> Rep UpdateDataSourcePermissions x)
-> (forall x.
    Rep UpdateDataSourcePermissions x -> UpdateDataSourcePermissions)
-> Generic UpdateDataSourcePermissions
forall x.
Rep UpdateDataSourcePermissions x -> UpdateDataSourcePermissions
forall x.
UpdateDataSourcePermissions -> Rep UpdateDataSourcePermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDataSourcePermissions x -> UpdateDataSourcePermissions
$cfrom :: forall x.
UpdateDataSourcePermissions -> Rep UpdateDataSourcePermissions x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDataSourcePermissions' 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:
--
-- 'revokePermissions', 'updateDataSourcePermissions_revokePermissions' - A list of resource permissions that you want to revoke on the data
-- source.
--
-- 'grantPermissions', 'updateDataSourcePermissions_grantPermissions' - A list of resource permissions that you want to grant on the data
-- source.
--
-- 'awsAccountId', 'updateDataSourcePermissions_awsAccountId' - The Amazon Web Services account ID.
--
-- 'dataSourceId', 'updateDataSourcePermissions_dataSourceId' - The ID of the data source. This ID is unique per Amazon Web Services
-- Region for each Amazon Web Services account.
newUpdateDataSourcePermissions ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'dataSourceId'
  Prelude.Text ->
  UpdateDataSourcePermissions
newUpdateDataSourcePermissions :: Text -> Text -> UpdateDataSourcePermissions
newUpdateDataSourcePermissions
  Text
pAwsAccountId_
  Text
pDataSourceId_ =
    UpdateDataSourcePermissions' :: Maybe (NonEmpty ResourcePermission)
-> Maybe (NonEmpty ResourcePermission)
-> Text
-> Text
-> UpdateDataSourcePermissions
UpdateDataSourcePermissions'
      { $sel:revokePermissions:UpdateDataSourcePermissions' :: Maybe (NonEmpty ResourcePermission)
revokePermissions =
          Maybe (NonEmpty ResourcePermission)
forall a. Maybe a
Prelude.Nothing,
        $sel:grantPermissions:UpdateDataSourcePermissions' :: Maybe (NonEmpty ResourcePermission)
grantPermissions = Maybe (NonEmpty ResourcePermission)
forall a. Maybe a
Prelude.Nothing,
        $sel:awsAccountId:UpdateDataSourcePermissions' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:dataSourceId:UpdateDataSourcePermissions' :: Text
dataSourceId = Text
pDataSourceId_
      }

-- | A list of resource permissions that you want to revoke on the data
-- source.
updateDataSourcePermissions_revokePermissions :: Lens.Lens' UpdateDataSourcePermissions (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
updateDataSourcePermissions_revokePermissions :: (Maybe (NonEmpty ResourcePermission)
 -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateDataSourcePermissions -> f UpdateDataSourcePermissions
updateDataSourcePermissions_revokePermissions = (UpdateDataSourcePermissions
 -> Maybe (NonEmpty ResourcePermission))
-> (UpdateDataSourcePermissions
    -> Maybe (NonEmpty ResourcePermission)
    -> UpdateDataSourcePermissions)
-> Lens
     UpdateDataSourcePermissions
     UpdateDataSourcePermissions
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSourcePermissions' {Maybe (NonEmpty ResourcePermission)
revokePermissions :: Maybe (NonEmpty ResourcePermission)
$sel:revokePermissions:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Maybe (NonEmpty ResourcePermission)
revokePermissions} -> Maybe (NonEmpty ResourcePermission)
revokePermissions) (\s :: UpdateDataSourcePermissions
s@UpdateDataSourcePermissions' {} Maybe (NonEmpty ResourcePermission)
a -> UpdateDataSourcePermissions
s {$sel:revokePermissions:UpdateDataSourcePermissions' :: Maybe (NonEmpty ResourcePermission)
revokePermissions = Maybe (NonEmpty ResourcePermission)
a} :: UpdateDataSourcePermissions) ((Maybe (NonEmpty ResourcePermission)
  -> f (Maybe (NonEmpty ResourcePermission)))
 -> UpdateDataSourcePermissions -> f UpdateDataSourcePermissions)
-> ((Maybe (NonEmpty ResourcePermission)
     -> f (Maybe (NonEmpty ResourcePermission)))
    -> Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> (Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateDataSourcePermissions
-> f UpdateDataSourcePermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
-> Iso
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
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
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of resource permissions that you want to grant on the data
-- source.
updateDataSourcePermissions_grantPermissions :: Lens.Lens' UpdateDataSourcePermissions (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
updateDataSourcePermissions_grantPermissions :: (Maybe (NonEmpty ResourcePermission)
 -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateDataSourcePermissions -> f UpdateDataSourcePermissions
updateDataSourcePermissions_grantPermissions = (UpdateDataSourcePermissions
 -> Maybe (NonEmpty ResourcePermission))
-> (UpdateDataSourcePermissions
    -> Maybe (NonEmpty ResourcePermission)
    -> UpdateDataSourcePermissions)
-> Lens
     UpdateDataSourcePermissions
     UpdateDataSourcePermissions
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSourcePermissions' {Maybe (NonEmpty ResourcePermission)
grantPermissions :: Maybe (NonEmpty ResourcePermission)
$sel:grantPermissions:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Maybe (NonEmpty ResourcePermission)
grantPermissions} -> Maybe (NonEmpty ResourcePermission)
grantPermissions) (\s :: UpdateDataSourcePermissions
s@UpdateDataSourcePermissions' {} Maybe (NonEmpty ResourcePermission)
a -> UpdateDataSourcePermissions
s {$sel:grantPermissions:UpdateDataSourcePermissions' :: Maybe (NonEmpty ResourcePermission)
grantPermissions = Maybe (NonEmpty ResourcePermission)
a} :: UpdateDataSourcePermissions) ((Maybe (NonEmpty ResourcePermission)
  -> f (Maybe (NonEmpty ResourcePermission)))
 -> UpdateDataSourcePermissions -> f UpdateDataSourcePermissions)
-> ((Maybe (NonEmpty ResourcePermission)
     -> f (Maybe (NonEmpty ResourcePermission)))
    -> Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> (Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateDataSourcePermissions
-> f UpdateDataSourcePermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
-> Iso
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
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
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Core.AWSRequest UpdateDataSourcePermissions where
  type
    AWSResponse UpdateDataSourcePermissions =
      UpdateDataSourcePermissionsResponse
  request :: UpdateDataSourcePermissions -> Request UpdateDataSourcePermissions
request = Service
-> UpdateDataSourcePermissions
-> Request UpdateDataSourcePermissions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateDataSourcePermissions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDataSourcePermissions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateDataSourcePermissions))
-> Logger
-> Service
-> Proxy UpdateDataSourcePermissions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDataSourcePermissions)))
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
-> Int
-> UpdateDataSourcePermissionsResponse
UpdateDataSourcePermissionsResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> UpdateDataSourcePermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Int -> UpdateDataSourcePermissionsResponse)
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 -> Int -> UpdateDataSourcePermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> UpdateDataSourcePermissionsResponse)
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 Text -> Int -> UpdateDataSourcePermissionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateDataSourcePermissionsResponse)
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
"DataSourceArn")
            Either String (Int -> UpdateDataSourcePermissionsResponse)
-> Either String Int
-> Either String UpdateDataSourcePermissionsResponse
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 UpdateDataSourcePermissions

instance Prelude.NFData UpdateDataSourcePermissions

instance Core.ToHeaders UpdateDataSourcePermissions where
  toHeaders :: UpdateDataSourcePermissions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateDataSourcePermissions -> 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 UpdateDataSourcePermissions where
  toJSON :: UpdateDataSourcePermissions -> Value
toJSON UpdateDataSourcePermissions' {Maybe (NonEmpty ResourcePermission)
Text
dataSourceId :: Text
awsAccountId :: Text
grantPermissions :: Maybe (NonEmpty ResourcePermission)
revokePermissions :: Maybe (NonEmpty ResourcePermission)
$sel:dataSourceId:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Text
$sel:awsAccountId:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Text
$sel:grantPermissions:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Maybe (NonEmpty ResourcePermission)
$sel:revokePermissions:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Maybe (NonEmpty ResourcePermission)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RevokePermissions" Text -> NonEmpty ResourcePermission -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty ResourcePermission -> Pair)
-> Maybe (NonEmpty ResourcePermission) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ResourcePermission)
revokePermissions,
            (Text
"GrantPermissions" Text -> NonEmpty ResourcePermission -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty ResourcePermission -> Pair)
-> Maybe (NonEmpty ResourcePermission) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ResourcePermission)
grantPermissions
          ]
      )

instance Core.ToPath UpdateDataSourcePermissions where
  toPath :: UpdateDataSourcePermissions -> ByteString
toPath UpdateDataSourcePermissions' {Maybe (NonEmpty ResourcePermission)
Text
dataSourceId :: Text
awsAccountId :: Text
grantPermissions :: Maybe (NonEmpty ResourcePermission)
revokePermissions :: Maybe (NonEmpty ResourcePermission)
$sel:dataSourceId:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Text
$sel:awsAccountId:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Text
$sel:grantPermissions:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Maybe (NonEmpty ResourcePermission)
$sel:revokePermissions:UpdateDataSourcePermissions' :: UpdateDataSourcePermissions -> Maybe (NonEmpty ResourcePermission)
..} =
    [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,
        ByteString
"/permissions"
      ]

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

-- | /See:/ 'newUpdateDataSourcePermissionsResponse' smart constructor.
data UpdateDataSourcePermissionsResponse = UpdateDataSourcePermissionsResponse'
  { -- | The Amazon Web Services request ID for this operation.
    UpdateDataSourcePermissionsResponse -> Maybe Text
requestId :: 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.
    UpdateDataSourcePermissionsResponse -> Maybe Text
dataSourceId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the data source.
    UpdateDataSourcePermissionsResponse -> Maybe Text
dataSourceArn :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    UpdateDataSourcePermissionsResponse -> Int
status :: Prelude.Int
  }
  deriving (UpdateDataSourcePermissionsResponse
-> UpdateDataSourcePermissionsResponse -> Bool
(UpdateDataSourcePermissionsResponse
 -> UpdateDataSourcePermissionsResponse -> Bool)
-> (UpdateDataSourcePermissionsResponse
    -> UpdateDataSourcePermissionsResponse -> Bool)
-> Eq UpdateDataSourcePermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDataSourcePermissionsResponse
-> UpdateDataSourcePermissionsResponse -> Bool
$c/= :: UpdateDataSourcePermissionsResponse
-> UpdateDataSourcePermissionsResponse -> Bool
== :: UpdateDataSourcePermissionsResponse
-> UpdateDataSourcePermissionsResponse -> Bool
$c== :: UpdateDataSourcePermissionsResponse
-> UpdateDataSourcePermissionsResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDataSourcePermissionsResponse]
ReadPrec UpdateDataSourcePermissionsResponse
Int -> ReadS UpdateDataSourcePermissionsResponse
ReadS [UpdateDataSourcePermissionsResponse]
(Int -> ReadS UpdateDataSourcePermissionsResponse)
-> ReadS [UpdateDataSourcePermissionsResponse]
-> ReadPrec UpdateDataSourcePermissionsResponse
-> ReadPrec [UpdateDataSourcePermissionsResponse]
-> Read UpdateDataSourcePermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDataSourcePermissionsResponse]
$creadListPrec :: ReadPrec [UpdateDataSourcePermissionsResponse]
readPrec :: ReadPrec UpdateDataSourcePermissionsResponse
$creadPrec :: ReadPrec UpdateDataSourcePermissionsResponse
readList :: ReadS [UpdateDataSourcePermissionsResponse]
$creadList :: ReadS [UpdateDataSourcePermissionsResponse]
readsPrec :: Int -> ReadS UpdateDataSourcePermissionsResponse
$creadsPrec :: Int -> ReadS UpdateDataSourcePermissionsResponse
Prelude.Read, Int -> UpdateDataSourcePermissionsResponse -> ShowS
[UpdateDataSourcePermissionsResponse] -> ShowS
UpdateDataSourcePermissionsResponse -> String
(Int -> UpdateDataSourcePermissionsResponse -> ShowS)
-> (UpdateDataSourcePermissionsResponse -> String)
-> ([UpdateDataSourcePermissionsResponse] -> ShowS)
-> Show UpdateDataSourcePermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDataSourcePermissionsResponse] -> ShowS
$cshowList :: [UpdateDataSourcePermissionsResponse] -> ShowS
show :: UpdateDataSourcePermissionsResponse -> String
$cshow :: UpdateDataSourcePermissionsResponse -> String
showsPrec :: Int -> UpdateDataSourcePermissionsResponse -> ShowS
$cshowsPrec :: Int -> UpdateDataSourcePermissionsResponse -> ShowS
Prelude.Show, (forall x.
 UpdateDataSourcePermissionsResponse
 -> Rep UpdateDataSourcePermissionsResponse x)
-> (forall x.
    Rep UpdateDataSourcePermissionsResponse x
    -> UpdateDataSourcePermissionsResponse)
-> Generic UpdateDataSourcePermissionsResponse
forall x.
Rep UpdateDataSourcePermissionsResponse x
-> UpdateDataSourcePermissionsResponse
forall x.
UpdateDataSourcePermissionsResponse
-> Rep UpdateDataSourcePermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDataSourcePermissionsResponse x
-> UpdateDataSourcePermissionsResponse
$cfrom :: forall x.
UpdateDataSourcePermissionsResponse
-> Rep UpdateDataSourcePermissionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDataSourcePermissionsResponse' 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', 'updateDataSourcePermissionsResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'dataSourceId', 'updateDataSourcePermissionsResponse_dataSourceId' - The ID of the data source. This ID is unique per Amazon Web Services
-- Region for each Amazon Web Services account.
--
-- 'dataSourceArn', 'updateDataSourcePermissionsResponse_dataSourceArn' - The Amazon Resource Name (ARN) of the data source.
--
-- 'status', 'updateDataSourcePermissionsResponse_status' - The HTTP status of the request.
newUpdateDataSourcePermissionsResponse ::
  -- | 'status'
  Prelude.Int ->
  UpdateDataSourcePermissionsResponse
newUpdateDataSourcePermissionsResponse :: Int -> UpdateDataSourcePermissionsResponse
newUpdateDataSourcePermissionsResponse Int
pStatus_ =
  UpdateDataSourcePermissionsResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> UpdateDataSourcePermissionsResponse
UpdateDataSourcePermissionsResponse'
    { $sel:requestId:UpdateDataSourcePermissionsResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSourceId:UpdateDataSourcePermissionsResponse' :: Maybe Text
dataSourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSourceArn:UpdateDataSourcePermissionsResponse' :: Maybe Text
dataSourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:UpdateDataSourcePermissionsResponse' :: Int
status = Int
pStatus_
    }

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

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

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

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

instance
  Prelude.NFData
    UpdateDataSourcePermissionsResponse