{-# 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.UpdateDataSetPermissions
-- 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 on a dataset.
--
-- The permissions resource is
-- @arn:aws:quicksight:region:aws-account-id:dataset\/data-set-id@.
module Amazonka.QuickSight.UpdateDataSetPermissions
  ( -- * Creating a Request
    UpdateDataSetPermissions (..),
    newUpdateDataSetPermissions,

    -- * Request Lenses
    updateDataSetPermissions_revokePermissions,
    updateDataSetPermissions_grantPermissions,
    updateDataSetPermissions_awsAccountId,
    updateDataSetPermissions_dataSetId,

    -- * Destructuring the Response
    UpdateDataSetPermissionsResponse (..),
    newUpdateDataSetPermissionsResponse,

    -- * Response Lenses
    updateDataSetPermissionsResponse_requestId,
    updateDataSetPermissionsResponse_dataSetArn,
    updateDataSetPermissionsResponse_dataSetId,
    updateDataSetPermissionsResponse_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:/ 'newUpdateDataSetPermissions' smart constructor.
data UpdateDataSetPermissions = UpdateDataSetPermissions'
  { -- | The resource permissions that you want to revoke from the dataset.
    UpdateDataSetPermissions -> Maybe (NonEmpty ResourcePermission)
revokePermissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | The resource permissions that you want to grant to the dataset.
    UpdateDataSetPermissions -> Maybe (NonEmpty ResourcePermission)
grantPermissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | The Amazon Web Services account ID.
    UpdateDataSetPermissions -> Text
awsAccountId :: Prelude.Text,
    -- | The ID for the dataset whose permissions you want to update. This ID is
    -- unique per Amazon Web Services Region for each Amazon Web Services
    -- account.
    UpdateDataSetPermissions -> Text
dataSetId :: Prelude.Text
  }
  deriving (UpdateDataSetPermissions -> UpdateDataSetPermissions -> Bool
(UpdateDataSetPermissions -> UpdateDataSetPermissions -> Bool)
-> (UpdateDataSetPermissions -> UpdateDataSetPermissions -> Bool)
-> Eq UpdateDataSetPermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDataSetPermissions -> UpdateDataSetPermissions -> Bool
$c/= :: UpdateDataSetPermissions -> UpdateDataSetPermissions -> Bool
== :: UpdateDataSetPermissions -> UpdateDataSetPermissions -> Bool
$c== :: UpdateDataSetPermissions -> UpdateDataSetPermissions -> Bool
Prelude.Eq, ReadPrec [UpdateDataSetPermissions]
ReadPrec UpdateDataSetPermissions
Int -> ReadS UpdateDataSetPermissions
ReadS [UpdateDataSetPermissions]
(Int -> ReadS UpdateDataSetPermissions)
-> ReadS [UpdateDataSetPermissions]
-> ReadPrec UpdateDataSetPermissions
-> ReadPrec [UpdateDataSetPermissions]
-> Read UpdateDataSetPermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDataSetPermissions]
$creadListPrec :: ReadPrec [UpdateDataSetPermissions]
readPrec :: ReadPrec UpdateDataSetPermissions
$creadPrec :: ReadPrec UpdateDataSetPermissions
readList :: ReadS [UpdateDataSetPermissions]
$creadList :: ReadS [UpdateDataSetPermissions]
readsPrec :: Int -> ReadS UpdateDataSetPermissions
$creadsPrec :: Int -> ReadS UpdateDataSetPermissions
Prelude.Read, Int -> UpdateDataSetPermissions -> ShowS
[UpdateDataSetPermissions] -> ShowS
UpdateDataSetPermissions -> String
(Int -> UpdateDataSetPermissions -> ShowS)
-> (UpdateDataSetPermissions -> String)
-> ([UpdateDataSetPermissions] -> ShowS)
-> Show UpdateDataSetPermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDataSetPermissions] -> ShowS
$cshowList :: [UpdateDataSetPermissions] -> ShowS
show :: UpdateDataSetPermissions -> String
$cshow :: UpdateDataSetPermissions -> String
showsPrec :: Int -> UpdateDataSetPermissions -> ShowS
$cshowsPrec :: Int -> UpdateDataSetPermissions -> ShowS
Prelude.Show, (forall x.
 UpdateDataSetPermissions -> Rep UpdateDataSetPermissions x)
-> (forall x.
    Rep UpdateDataSetPermissions x -> UpdateDataSetPermissions)
-> Generic UpdateDataSetPermissions
forall x.
Rep UpdateDataSetPermissions x -> UpdateDataSetPermissions
forall x.
UpdateDataSetPermissions -> Rep UpdateDataSetPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDataSetPermissions x -> UpdateDataSetPermissions
$cfrom :: forall x.
UpdateDataSetPermissions -> Rep UpdateDataSetPermissions x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDataSetPermissions' 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', 'updateDataSetPermissions_revokePermissions' - The resource permissions that you want to revoke from the dataset.
--
-- 'grantPermissions', 'updateDataSetPermissions_grantPermissions' - The resource permissions that you want to grant to the dataset.
--
-- 'awsAccountId', 'updateDataSetPermissions_awsAccountId' - The Amazon Web Services account ID.
--
-- 'dataSetId', 'updateDataSetPermissions_dataSetId' - The ID for the dataset whose permissions you want to update. This ID is
-- unique per Amazon Web Services Region for each Amazon Web Services
-- account.
newUpdateDataSetPermissions ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'dataSetId'
  Prelude.Text ->
  UpdateDataSetPermissions
newUpdateDataSetPermissions :: Text -> Text -> UpdateDataSetPermissions
newUpdateDataSetPermissions
  Text
pAwsAccountId_
  Text
pDataSetId_ =
    UpdateDataSetPermissions' :: Maybe (NonEmpty ResourcePermission)
-> Maybe (NonEmpty ResourcePermission)
-> Text
-> Text
-> UpdateDataSetPermissions
UpdateDataSetPermissions'
      { $sel:revokePermissions:UpdateDataSetPermissions' :: Maybe (NonEmpty ResourcePermission)
revokePermissions =
          Maybe (NonEmpty ResourcePermission)
forall a. Maybe a
Prelude.Nothing,
        $sel:grantPermissions:UpdateDataSetPermissions' :: Maybe (NonEmpty ResourcePermission)
grantPermissions = Maybe (NonEmpty ResourcePermission)
forall a. Maybe a
Prelude.Nothing,
        $sel:awsAccountId:UpdateDataSetPermissions' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:dataSetId:UpdateDataSetPermissions' :: Text
dataSetId = Text
pDataSetId_
      }

-- | The resource permissions that you want to revoke from the dataset.
updateDataSetPermissions_revokePermissions :: Lens.Lens' UpdateDataSetPermissions (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
updateDataSetPermissions_revokePermissions :: (Maybe (NonEmpty ResourcePermission)
 -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateDataSetPermissions -> f UpdateDataSetPermissions
updateDataSetPermissions_revokePermissions = (UpdateDataSetPermissions -> Maybe (NonEmpty ResourcePermission))
-> (UpdateDataSetPermissions
    -> Maybe (NonEmpty ResourcePermission) -> UpdateDataSetPermissions)
-> Lens
     UpdateDataSetPermissions
     UpdateDataSetPermissions
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSetPermissions' {Maybe (NonEmpty ResourcePermission)
revokePermissions :: Maybe (NonEmpty ResourcePermission)
$sel:revokePermissions:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Maybe (NonEmpty ResourcePermission)
revokePermissions} -> Maybe (NonEmpty ResourcePermission)
revokePermissions) (\s :: UpdateDataSetPermissions
s@UpdateDataSetPermissions' {} Maybe (NonEmpty ResourcePermission)
a -> UpdateDataSetPermissions
s {$sel:revokePermissions:UpdateDataSetPermissions' :: Maybe (NonEmpty ResourcePermission)
revokePermissions = Maybe (NonEmpty ResourcePermission)
a} :: UpdateDataSetPermissions) ((Maybe (NonEmpty ResourcePermission)
  -> f (Maybe (NonEmpty ResourcePermission)))
 -> UpdateDataSetPermissions -> f UpdateDataSetPermissions)
-> ((Maybe (NonEmpty ResourcePermission)
     -> f (Maybe (NonEmpty ResourcePermission)))
    -> Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> (Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateDataSetPermissions
-> f UpdateDataSetPermissions
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 resource permissions that you want to grant to the dataset.
updateDataSetPermissions_grantPermissions :: Lens.Lens' UpdateDataSetPermissions (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
updateDataSetPermissions_grantPermissions :: (Maybe (NonEmpty ResourcePermission)
 -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateDataSetPermissions -> f UpdateDataSetPermissions
updateDataSetPermissions_grantPermissions = (UpdateDataSetPermissions -> Maybe (NonEmpty ResourcePermission))
-> (UpdateDataSetPermissions
    -> Maybe (NonEmpty ResourcePermission) -> UpdateDataSetPermissions)
-> Lens
     UpdateDataSetPermissions
     UpdateDataSetPermissions
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSetPermissions' {Maybe (NonEmpty ResourcePermission)
grantPermissions :: Maybe (NonEmpty ResourcePermission)
$sel:grantPermissions:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Maybe (NonEmpty ResourcePermission)
grantPermissions} -> Maybe (NonEmpty ResourcePermission)
grantPermissions) (\s :: UpdateDataSetPermissions
s@UpdateDataSetPermissions' {} Maybe (NonEmpty ResourcePermission)
a -> UpdateDataSetPermissions
s {$sel:grantPermissions:UpdateDataSetPermissions' :: Maybe (NonEmpty ResourcePermission)
grantPermissions = Maybe (NonEmpty ResourcePermission)
a} :: UpdateDataSetPermissions) ((Maybe (NonEmpty ResourcePermission)
  -> f (Maybe (NonEmpty ResourcePermission)))
 -> UpdateDataSetPermissions -> f UpdateDataSetPermissions)
-> ((Maybe (NonEmpty ResourcePermission)
     -> f (Maybe (NonEmpty ResourcePermission)))
    -> Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> (Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateDataSetPermissions
-> f UpdateDataSetPermissions
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.
updateDataSetPermissions_awsAccountId :: Lens.Lens' UpdateDataSetPermissions Prelude.Text
updateDataSetPermissions_awsAccountId :: (Text -> f Text)
-> UpdateDataSetPermissions -> f UpdateDataSetPermissions
updateDataSetPermissions_awsAccountId = (UpdateDataSetPermissions -> Text)
-> (UpdateDataSetPermissions -> Text -> UpdateDataSetPermissions)
-> Lens UpdateDataSetPermissions UpdateDataSetPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSetPermissions' {Text
awsAccountId :: Text
$sel:awsAccountId:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Text
awsAccountId} -> Text
awsAccountId) (\s :: UpdateDataSetPermissions
s@UpdateDataSetPermissions' {} Text
a -> UpdateDataSetPermissions
s {$sel:awsAccountId:UpdateDataSetPermissions' :: Text
awsAccountId = Text
a} :: UpdateDataSetPermissions)

-- | The ID for the dataset whose permissions you want to update. This ID is
-- unique per Amazon Web Services Region for each Amazon Web Services
-- account.
updateDataSetPermissions_dataSetId :: Lens.Lens' UpdateDataSetPermissions Prelude.Text
updateDataSetPermissions_dataSetId :: (Text -> f Text)
-> UpdateDataSetPermissions -> f UpdateDataSetPermissions
updateDataSetPermissions_dataSetId = (UpdateDataSetPermissions -> Text)
-> (UpdateDataSetPermissions -> Text -> UpdateDataSetPermissions)
-> Lens UpdateDataSetPermissions UpdateDataSetPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSetPermissions' {Text
dataSetId :: Text
$sel:dataSetId:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Text
dataSetId} -> Text
dataSetId) (\s :: UpdateDataSetPermissions
s@UpdateDataSetPermissions' {} Text
a -> UpdateDataSetPermissions
s {$sel:dataSetId:UpdateDataSetPermissions' :: Text
dataSetId = Text
a} :: UpdateDataSetPermissions)

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

instance Prelude.NFData UpdateDataSetPermissions

instance Core.ToHeaders UpdateDataSetPermissions where
  toHeaders :: UpdateDataSetPermissions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateDataSetPermissions -> 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 UpdateDataSetPermissions where
  toJSON :: UpdateDataSetPermissions -> Value
toJSON UpdateDataSetPermissions' {Maybe (NonEmpty ResourcePermission)
Text
dataSetId :: Text
awsAccountId :: Text
grantPermissions :: Maybe (NonEmpty ResourcePermission)
revokePermissions :: Maybe (NonEmpty ResourcePermission)
$sel:dataSetId:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Text
$sel:awsAccountId:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Text
$sel:grantPermissions:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Maybe (NonEmpty ResourcePermission)
$sel:revokePermissions:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> 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 UpdateDataSetPermissions where
  toPath :: UpdateDataSetPermissions -> ByteString
toPath UpdateDataSetPermissions' {Maybe (NonEmpty ResourcePermission)
Text
dataSetId :: Text
awsAccountId :: Text
grantPermissions :: Maybe (NonEmpty ResourcePermission)
revokePermissions :: Maybe (NonEmpty ResourcePermission)
$sel:dataSetId:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Text
$sel:awsAccountId:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Text
$sel:grantPermissions:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> Maybe (NonEmpty ResourcePermission)
$sel:revokePermissions:UpdateDataSetPermissions' :: UpdateDataSetPermissions -> 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-sets/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
dataSetId,
        ByteString
"/permissions"
      ]

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

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

-- |
-- Create a value of 'UpdateDataSetPermissionsResponse' 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', 'updateDataSetPermissionsResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'dataSetArn', 'updateDataSetPermissionsResponse_dataSetArn' - The Amazon Resource Name (ARN) of the dataset.
--
-- 'dataSetId', 'updateDataSetPermissionsResponse_dataSetId' - The ID for the dataset whose permissions you want to update. This ID is
-- unique per Amazon Web Services Region for each Amazon Web Services
-- account.
--
-- 'status', 'updateDataSetPermissionsResponse_status' - The HTTP status of the request.
newUpdateDataSetPermissionsResponse ::
  -- | 'status'
  Prelude.Int ->
  UpdateDataSetPermissionsResponse
newUpdateDataSetPermissionsResponse :: Int -> UpdateDataSetPermissionsResponse
newUpdateDataSetPermissionsResponse Int
pStatus_ =
  UpdateDataSetPermissionsResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> UpdateDataSetPermissionsResponse
UpdateDataSetPermissionsResponse'
    { $sel:requestId:UpdateDataSetPermissionsResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSetArn:UpdateDataSetPermissionsResponse' :: Maybe Text
dataSetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSetId:UpdateDataSetPermissionsResponse' :: Maybe Text
dataSetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:UpdateDataSetPermissionsResponse' :: Int
status = Int
pStatus_
    }

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

-- | The Amazon Resource Name (ARN) of the dataset.
updateDataSetPermissionsResponse_dataSetArn :: Lens.Lens' UpdateDataSetPermissionsResponse (Prelude.Maybe Prelude.Text)
updateDataSetPermissionsResponse_dataSetArn :: (Maybe Text -> f (Maybe Text))
-> UpdateDataSetPermissionsResponse
-> f UpdateDataSetPermissionsResponse
updateDataSetPermissionsResponse_dataSetArn = (UpdateDataSetPermissionsResponse -> Maybe Text)
-> (UpdateDataSetPermissionsResponse
    -> Maybe Text -> UpdateDataSetPermissionsResponse)
-> Lens
     UpdateDataSetPermissionsResponse
     UpdateDataSetPermissionsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSetPermissionsResponse' {Maybe Text
dataSetArn :: Maybe Text
$sel:dataSetArn:UpdateDataSetPermissionsResponse' :: UpdateDataSetPermissionsResponse -> Maybe Text
dataSetArn} -> Maybe Text
dataSetArn) (\s :: UpdateDataSetPermissionsResponse
s@UpdateDataSetPermissionsResponse' {} Maybe Text
a -> UpdateDataSetPermissionsResponse
s {$sel:dataSetArn:UpdateDataSetPermissionsResponse' :: Maybe Text
dataSetArn = Maybe Text
a} :: UpdateDataSetPermissionsResponse)

-- | The ID for the dataset whose permissions you want to update. This ID is
-- unique per Amazon Web Services Region for each Amazon Web Services
-- account.
updateDataSetPermissionsResponse_dataSetId :: Lens.Lens' UpdateDataSetPermissionsResponse (Prelude.Maybe Prelude.Text)
updateDataSetPermissionsResponse_dataSetId :: (Maybe Text -> f (Maybe Text))
-> UpdateDataSetPermissionsResponse
-> f UpdateDataSetPermissionsResponse
updateDataSetPermissionsResponse_dataSetId = (UpdateDataSetPermissionsResponse -> Maybe Text)
-> (UpdateDataSetPermissionsResponse
    -> Maybe Text -> UpdateDataSetPermissionsResponse)
-> Lens
     UpdateDataSetPermissionsResponse
     UpdateDataSetPermissionsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSetPermissionsResponse' {Maybe Text
dataSetId :: Maybe Text
$sel:dataSetId:UpdateDataSetPermissionsResponse' :: UpdateDataSetPermissionsResponse -> Maybe Text
dataSetId} -> Maybe Text
dataSetId) (\s :: UpdateDataSetPermissionsResponse
s@UpdateDataSetPermissionsResponse' {} Maybe Text
a -> UpdateDataSetPermissionsResponse
s {$sel:dataSetId:UpdateDataSetPermissionsResponse' :: Maybe Text
dataSetId = Maybe Text
a} :: UpdateDataSetPermissionsResponse)

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

instance
  Prelude.NFData
    UpdateDataSetPermissionsResponse