{-# 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.UpdateFolderPermissions
-- 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 permissions of a folder.
module Amazonka.QuickSight.UpdateFolderPermissions
  ( -- * Creating a Request
    UpdateFolderPermissions (..),
    newUpdateFolderPermissions,

    -- * Request Lenses
    updateFolderPermissions_revokePermissions,
    updateFolderPermissions_grantPermissions,
    updateFolderPermissions_awsAccountId,
    updateFolderPermissions_folderId,

    -- * Destructuring the Response
    UpdateFolderPermissionsResponse (..),
    newUpdateFolderPermissionsResponse,

    -- * Response Lenses
    updateFolderPermissionsResponse_requestId,
    updateFolderPermissionsResponse_status,
    updateFolderPermissionsResponse_arn,
    updateFolderPermissionsResponse_folderId,
    updateFolderPermissionsResponse_permissions,
    updateFolderPermissionsResponse_httpStatus,
  )
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:/ 'newUpdateFolderPermissions' smart constructor.
data UpdateFolderPermissions = UpdateFolderPermissions'
  { -- | The permissions that you want to revoke from a resource.
    UpdateFolderPermissions -> Maybe (NonEmpty ResourcePermission)
revokePermissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | The permissions that you want to grant on a resource.
    UpdateFolderPermissions -> Maybe (NonEmpty ResourcePermission)
grantPermissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | The AWS account ID.
    UpdateFolderPermissions -> Text
awsAccountId :: Prelude.Text,
    -- | The folder ID.
    UpdateFolderPermissions -> Text
folderId :: Prelude.Text
  }
  deriving (UpdateFolderPermissions -> UpdateFolderPermissions -> Bool
(UpdateFolderPermissions -> UpdateFolderPermissions -> Bool)
-> (UpdateFolderPermissions -> UpdateFolderPermissions -> Bool)
-> Eq UpdateFolderPermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFolderPermissions -> UpdateFolderPermissions -> Bool
$c/= :: UpdateFolderPermissions -> UpdateFolderPermissions -> Bool
== :: UpdateFolderPermissions -> UpdateFolderPermissions -> Bool
$c== :: UpdateFolderPermissions -> UpdateFolderPermissions -> Bool
Prelude.Eq, ReadPrec [UpdateFolderPermissions]
ReadPrec UpdateFolderPermissions
Int -> ReadS UpdateFolderPermissions
ReadS [UpdateFolderPermissions]
(Int -> ReadS UpdateFolderPermissions)
-> ReadS [UpdateFolderPermissions]
-> ReadPrec UpdateFolderPermissions
-> ReadPrec [UpdateFolderPermissions]
-> Read UpdateFolderPermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFolderPermissions]
$creadListPrec :: ReadPrec [UpdateFolderPermissions]
readPrec :: ReadPrec UpdateFolderPermissions
$creadPrec :: ReadPrec UpdateFolderPermissions
readList :: ReadS [UpdateFolderPermissions]
$creadList :: ReadS [UpdateFolderPermissions]
readsPrec :: Int -> ReadS UpdateFolderPermissions
$creadsPrec :: Int -> ReadS UpdateFolderPermissions
Prelude.Read, Int -> UpdateFolderPermissions -> ShowS
[UpdateFolderPermissions] -> ShowS
UpdateFolderPermissions -> String
(Int -> UpdateFolderPermissions -> ShowS)
-> (UpdateFolderPermissions -> String)
-> ([UpdateFolderPermissions] -> ShowS)
-> Show UpdateFolderPermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFolderPermissions] -> ShowS
$cshowList :: [UpdateFolderPermissions] -> ShowS
show :: UpdateFolderPermissions -> String
$cshow :: UpdateFolderPermissions -> String
showsPrec :: Int -> UpdateFolderPermissions -> ShowS
$cshowsPrec :: Int -> UpdateFolderPermissions -> ShowS
Prelude.Show, (forall x.
 UpdateFolderPermissions -> Rep UpdateFolderPermissions x)
-> (forall x.
    Rep UpdateFolderPermissions x -> UpdateFolderPermissions)
-> Generic UpdateFolderPermissions
forall x. Rep UpdateFolderPermissions x -> UpdateFolderPermissions
forall x. UpdateFolderPermissions -> Rep UpdateFolderPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFolderPermissions x -> UpdateFolderPermissions
$cfrom :: forall x. UpdateFolderPermissions -> Rep UpdateFolderPermissions x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFolderPermissions' 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', 'updateFolderPermissions_revokePermissions' - The permissions that you want to revoke from a resource.
--
-- 'grantPermissions', 'updateFolderPermissions_grantPermissions' - The permissions that you want to grant on a resource.
--
-- 'awsAccountId', 'updateFolderPermissions_awsAccountId' - The AWS account ID.
--
-- 'folderId', 'updateFolderPermissions_folderId' - The folder ID.
newUpdateFolderPermissions ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'folderId'
  Prelude.Text ->
  UpdateFolderPermissions
newUpdateFolderPermissions :: Text -> Text -> UpdateFolderPermissions
newUpdateFolderPermissions Text
pAwsAccountId_ Text
pFolderId_ =
  UpdateFolderPermissions' :: Maybe (NonEmpty ResourcePermission)
-> Maybe (NonEmpty ResourcePermission)
-> Text
-> Text
-> UpdateFolderPermissions
UpdateFolderPermissions'
    { $sel:revokePermissions:UpdateFolderPermissions' :: Maybe (NonEmpty ResourcePermission)
revokePermissions =
        Maybe (NonEmpty ResourcePermission)
forall a. Maybe a
Prelude.Nothing,
      $sel:grantPermissions:UpdateFolderPermissions' :: Maybe (NonEmpty ResourcePermission)
grantPermissions = Maybe (NonEmpty ResourcePermission)
forall a. Maybe a
Prelude.Nothing,
      $sel:awsAccountId:UpdateFolderPermissions' :: Text
awsAccountId = Text
pAwsAccountId_,
      $sel:folderId:UpdateFolderPermissions' :: Text
folderId = Text
pFolderId_
    }

-- | The permissions that you want to revoke from a resource.
updateFolderPermissions_revokePermissions :: Lens.Lens' UpdateFolderPermissions (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
updateFolderPermissions_revokePermissions :: (Maybe (NonEmpty ResourcePermission)
 -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateFolderPermissions -> f UpdateFolderPermissions
updateFolderPermissions_revokePermissions = (UpdateFolderPermissions -> Maybe (NonEmpty ResourcePermission))
-> (UpdateFolderPermissions
    -> Maybe (NonEmpty ResourcePermission) -> UpdateFolderPermissions)
-> Lens
     UpdateFolderPermissions
     UpdateFolderPermissions
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFolderPermissions' {Maybe (NonEmpty ResourcePermission)
revokePermissions :: Maybe (NonEmpty ResourcePermission)
$sel:revokePermissions:UpdateFolderPermissions' :: UpdateFolderPermissions -> Maybe (NonEmpty ResourcePermission)
revokePermissions} -> Maybe (NonEmpty ResourcePermission)
revokePermissions) (\s :: UpdateFolderPermissions
s@UpdateFolderPermissions' {} Maybe (NonEmpty ResourcePermission)
a -> UpdateFolderPermissions
s {$sel:revokePermissions:UpdateFolderPermissions' :: Maybe (NonEmpty ResourcePermission)
revokePermissions = Maybe (NonEmpty ResourcePermission)
a} :: UpdateFolderPermissions) ((Maybe (NonEmpty ResourcePermission)
  -> f (Maybe (NonEmpty ResourcePermission)))
 -> UpdateFolderPermissions -> f UpdateFolderPermissions)
-> ((Maybe (NonEmpty ResourcePermission)
     -> f (Maybe (NonEmpty ResourcePermission)))
    -> Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> (Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateFolderPermissions
-> f UpdateFolderPermissions
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 permissions that you want to grant on a resource.
updateFolderPermissions_grantPermissions :: Lens.Lens' UpdateFolderPermissions (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
updateFolderPermissions_grantPermissions :: (Maybe (NonEmpty ResourcePermission)
 -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateFolderPermissions -> f UpdateFolderPermissions
updateFolderPermissions_grantPermissions = (UpdateFolderPermissions -> Maybe (NonEmpty ResourcePermission))
-> (UpdateFolderPermissions
    -> Maybe (NonEmpty ResourcePermission) -> UpdateFolderPermissions)
-> Lens
     UpdateFolderPermissions
     UpdateFolderPermissions
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFolderPermissions' {Maybe (NonEmpty ResourcePermission)
grantPermissions :: Maybe (NonEmpty ResourcePermission)
$sel:grantPermissions:UpdateFolderPermissions' :: UpdateFolderPermissions -> Maybe (NonEmpty ResourcePermission)
grantPermissions} -> Maybe (NonEmpty ResourcePermission)
grantPermissions) (\s :: UpdateFolderPermissions
s@UpdateFolderPermissions' {} Maybe (NonEmpty ResourcePermission)
a -> UpdateFolderPermissions
s {$sel:grantPermissions:UpdateFolderPermissions' :: Maybe (NonEmpty ResourcePermission)
grantPermissions = Maybe (NonEmpty ResourcePermission)
a} :: UpdateFolderPermissions) ((Maybe (NonEmpty ResourcePermission)
  -> f (Maybe (NonEmpty ResourcePermission)))
 -> UpdateFolderPermissions -> f UpdateFolderPermissions)
-> ((Maybe (NonEmpty ResourcePermission)
     -> f (Maybe (NonEmpty ResourcePermission)))
    -> Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> (Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateFolderPermissions
-> f UpdateFolderPermissions
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 AWS account ID.
updateFolderPermissions_awsAccountId :: Lens.Lens' UpdateFolderPermissions Prelude.Text
updateFolderPermissions_awsAccountId :: (Text -> f Text)
-> UpdateFolderPermissions -> f UpdateFolderPermissions
updateFolderPermissions_awsAccountId = (UpdateFolderPermissions -> Text)
-> (UpdateFolderPermissions -> Text -> UpdateFolderPermissions)
-> Lens UpdateFolderPermissions UpdateFolderPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFolderPermissions' {Text
awsAccountId :: Text
$sel:awsAccountId:UpdateFolderPermissions' :: UpdateFolderPermissions -> Text
awsAccountId} -> Text
awsAccountId) (\s :: UpdateFolderPermissions
s@UpdateFolderPermissions' {} Text
a -> UpdateFolderPermissions
s {$sel:awsAccountId:UpdateFolderPermissions' :: Text
awsAccountId = Text
a} :: UpdateFolderPermissions)

-- | The folder ID.
updateFolderPermissions_folderId :: Lens.Lens' UpdateFolderPermissions Prelude.Text
updateFolderPermissions_folderId :: (Text -> f Text)
-> UpdateFolderPermissions -> f UpdateFolderPermissions
updateFolderPermissions_folderId = (UpdateFolderPermissions -> Text)
-> (UpdateFolderPermissions -> Text -> UpdateFolderPermissions)
-> Lens UpdateFolderPermissions UpdateFolderPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFolderPermissions' {Text
folderId :: Text
$sel:folderId:UpdateFolderPermissions' :: UpdateFolderPermissions -> Text
folderId} -> Text
folderId) (\s :: UpdateFolderPermissions
s@UpdateFolderPermissions' {} Text
a -> UpdateFolderPermissions
s {$sel:folderId:UpdateFolderPermissions' :: Text
folderId = Text
a} :: UpdateFolderPermissions)

instance Core.AWSRequest UpdateFolderPermissions where
  type
    AWSResponse UpdateFolderPermissions =
      UpdateFolderPermissionsResponse
  request :: UpdateFolderPermissions -> Request UpdateFolderPermissions
request = Service
-> UpdateFolderPermissions -> Request UpdateFolderPermissions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateFolderPermissions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFolderPermissions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateFolderPermissions))
-> Logger
-> Service
-> Proxy UpdateFolderPermissions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFolderPermissions)))
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 Int
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty ResourcePermission)
-> Int
-> UpdateFolderPermissionsResponse
UpdateFolderPermissionsResponse'
            (Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe (NonEmpty ResourcePermission)
 -> Int
 -> UpdateFolderPermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty ResourcePermission)
      -> Int
      -> UpdateFolderPermissionsResponse)
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 Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty ResourcePermission)
   -> Int
   -> UpdateFolderPermissionsResponse)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty ResourcePermission)
      -> Int
      -> UpdateFolderPermissionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty ResourcePermission)
   -> Int
   -> UpdateFolderPermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe (NonEmpty ResourcePermission)
      -> Int
      -> UpdateFolderPermissionsResponse)
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 (NonEmpty ResourcePermission)
   -> Int
   -> UpdateFolderPermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe (NonEmpty ResourcePermission)
      -> Int -> UpdateFolderPermissionsResponse)
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
"FolderId")
            Either
  String
  (Maybe (NonEmpty ResourcePermission)
   -> Int -> UpdateFolderPermissionsResponse)
-> Either String (Maybe (NonEmpty ResourcePermission))
-> Either String (Int -> UpdateFolderPermissionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (NonEmpty ResourcePermission))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Permissions")
            Either String (Int -> UpdateFolderPermissionsResponse)
-> Either String Int
-> Either String UpdateFolderPermissionsResponse
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 UpdateFolderPermissions

instance Prelude.NFData UpdateFolderPermissions

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

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

-- | /See:/ 'newUpdateFolderPermissionsResponse' smart constructor.
data UpdateFolderPermissionsResponse = UpdateFolderPermissionsResponse'
  { -- | The request ID.
    UpdateFolderPermissionsResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The status. If succeeded, the status is @SC_OK@.
    UpdateFolderPermissionsResponse -> Maybe Int
status :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN).
    UpdateFolderPermissionsResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The folder ID.
    UpdateFolderPermissionsResponse -> Maybe Text
folderId :: Prelude.Maybe Prelude.Text,
    -- | Information about the permissions on the dashboard.
    UpdateFolderPermissionsResponse
-> Maybe (NonEmpty ResourcePermission)
permissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | The response's http status code.
    UpdateFolderPermissionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateFolderPermissionsResponse
-> UpdateFolderPermissionsResponse -> Bool
(UpdateFolderPermissionsResponse
 -> UpdateFolderPermissionsResponse -> Bool)
-> (UpdateFolderPermissionsResponse
    -> UpdateFolderPermissionsResponse -> Bool)
-> Eq UpdateFolderPermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFolderPermissionsResponse
-> UpdateFolderPermissionsResponse -> Bool
$c/= :: UpdateFolderPermissionsResponse
-> UpdateFolderPermissionsResponse -> Bool
== :: UpdateFolderPermissionsResponse
-> UpdateFolderPermissionsResponse -> Bool
$c== :: UpdateFolderPermissionsResponse
-> UpdateFolderPermissionsResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFolderPermissionsResponse]
ReadPrec UpdateFolderPermissionsResponse
Int -> ReadS UpdateFolderPermissionsResponse
ReadS [UpdateFolderPermissionsResponse]
(Int -> ReadS UpdateFolderPermissionsResponse)
-> ReadS [UpdateFolderPermissionsResponse]
-> ReadPrec UpdateFolderPermissionsResponse
-> ReadPrec [UpdateFolderPermissionsResponse]
-> Read UpdateFolderPermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFolderPermissionsResponse]
$creadListPrec :: ReadPrec [UpdateFolderPermissionsResponse]
readPrec :: ReadPrec UpdateFolderPermissionsResponse
$creadPrec :: ReadPrec UpdateFolderPermissionsResponse
readList :: ReadS [UpdateFolderPermissionsResponse]
$creadList :: ReadS [UpdateFolderPermissionsResponse]
readsPrec :: Int -> ReadS UpdateFolderPermissionsResponse
$creadsPrec :: Int -> ReadS UpdateFolderPermissionsResponse
Prelude.Read, Int -> UpdateFolderPermissionsResponse -> ShowS
[UpdateFolderPermissionsResponse] -> ShowS
UpdateFolderPermissionsResponse -> String
(Int -> UpdateFolderPermissionsResponse -> ShowS)
-> (UpdateFolderPermissionsResponse -> String)
-> ([UpdateFolderPermissionsResponse] -> ShowS)
-> Show UpdateFolderPermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFolderPermissionsResponse] -> ShowS
$cshowList :: [UpdateFolderPermissionsResponse] -> ShowS
show :: UpdateFolderPermissionsResponse -> String
$cshow :: UpdateFolderPermissionsResponse -> String
showsPrec :: Int -> UpdateFolderPermissionsResponse -> ShowS
$cshowsPrec :: Int -> UpdateFolderPermissionsResponse -> ShowS
Prelude.Show, (forall x.
 UpdateFolderPermissionsResponse
 -> Rep UpdateFolderPermissionsResponse x)
-> (forall x.
    Rep UpdateFolderPermissionsResponse x
    -> UpdateFolderPermissionsResponse)
-> Generic UpdateFolderPermissionsResponse
forall x.
Rep UpdateFolderPermissionsResponse x
-> UpdateFolderPermissionsResponse
forall x.
UpdateFolderPermissionsResponse
-> Rep UpdateFolderPermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFolderPermissionsResponse x
-> UpdateFolderPermissionsResponse
$cfrom :: forall x.
UpdateFolderPermissionsResponse
-> Rep UpdateFolderPermissionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFolderPermissionsResponse' 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', 'updateFolderPermissionsResponse_requestId' - The request ID.
--
-- 'status', 'updateFolderPermissionsResponse_status' - The status. If succeeded, the status is @SC_OK@.
--
-- 'arn', 'updateFolderPermissionsResponse_arn' - The Amazon Resource Name (ARN).
--
-- 'folderId', 'updateFolderPermissionsResponse_folderId' - The folder ID.
--
-- 'permissions', 'updateFolderPermissionsResponse_permissions' - Information about the permissions on the dashboard.
--
-- 'httpStatus', 'updateFolderPermissionsResponse_httpStatus' - The response's http status code.
newUpdateFolderPermissionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateFolderPermissionsResponse
newUpdateFolderPermissionsResponse :: Int -> UpdateFolderPermissionsResponse
newUpdateFolderPermissionsResponse Int
pHttpStatus_ =
  UpdateFolderPermissionsResponse' :: Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty ResourcePermission)
-> Int
-> UpdateFolderPermissionsResponse
UpdateFolderPermissionsResponse'
    { $sel:requestId:UpdateFolderPermissionsResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:UpdateFolderPermissionsResponse' :: Maybe Int
status = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:UpdateFolderPermissionsResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:folderId:UpdateFolderPermissionsResponse' :: Maybe Text
folderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:permissions:UpdateFolderPermissionsResponse' :: Maybe (NonEmpty ResourcePermission)
permissions = Maybe (NonEmpty ResourcePermission)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateFolderPermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The request ID.
updateFolderPermissionsResponse_requestId :: Lens.Lens' UpdateFolderPermissionsResponse (Prelude.Maybe Prelude.Text)
updateFolderPermissionsResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> UpdateFolderPermissionsResponse
-> f UpdateFolderPermissionsResponse
updateFolderPermissionsResponse_requestId = (UpdateFolderPermissionsResponse -> Maybe Text)
-> (UpdateFolderPermissionsResponse
    -> Maybe Text -> UpdateFolderPermissionsResponse)
-> Lens
     UpdateFolderPermissionsResponse
     UpdateFolderPermissionsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFolderPermissionsResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:UpdateFolderPermissionsResponse' :: UpdateFolderPermissionsResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: UpdateFolderPermissionsResponse
s@UpdateFolderPermissionsResponse' {} Maybe Text
a -> UpdateFolderPermissionsResponse
s {$sel:requestId:UpdateFolderPermissionsResponse' :: Maybe Text
requestId = Maybe Text
a} :: UpdateFolderPermissionsResponse)

-- | The status. If succeeded, the status is @SC_OK@.
updateFolderPermissionsResponse_status :: Lens.Lens' UpdateFolderPermissionsResponse (Prelude.Maybe Prelude.Int)
updateFolderPermissionsResponse_status :: (Maybe Int -> f (Maybe Int))
-> UpdateFolderPermissionsResponse
-> f UpdateFolderPermissionsResponse
updateFolderPermissionsResponse_status = (UpdateFolderPermissionsResponse -> Maybe Int)
-> (UpdateFolderPermissionsResponse
    -> Maybe Int -> UpdateFolderPermissionsResponse)
-> Lens
     UpdateFolderPermissionsResponse
     UpdateFolderPermissionsResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFolderPermissionsResponse' {Maybe Int
status :: Maybe Int
$sel:status:UpdateFolderPermissionsResponse' :: UpdateFolderPermissionsResponse -> Maybe Int
status} -> Maybe Int
status) (\s :: UpdateFolderPermissionsResponse
s@UpdateFolderPermissionsResponse' {} Maybe Int
a -> UpdateFolderPermissionsResponse
s {$sel:status:UpdateFolderPermissionsResponse' :: Maybe Int
status = Maybe Int
a} :: UpdateFolderPermissionsResponse)

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

-- | The folder ID.
updateFolderPermissionsResponse_folderId :: Lens.Lens' UpdateFolderPermissionsResponse (Prelude.Maybe Prelude.Text)
updateFolderPermissionsResponse_folderId :: (Maybe Text -> f (Maybe Text))
-> UpdateFolderPermissionsResponse
-> f UpdateFolderPermissionsResponse
updateFolderPermissionsResponse_folderId = (UpdateFolderPermissionsResponse -> Maybe Text)
-> (UpdateFolderPermissionsResponse
    -> Maybe Text -> UpdateFolderPermissionsResponse)
-> Lens
     UpdateFolderPermissionsResponse
     UpdateFolderPermissionsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFolderPermissionsResponse' {Maybe Text
folderId :: Maybe Text
$sel:folderId:UpdateFolderPermissionsResponse' :: UpdateFolderPermissionsResponse -> Maybe Text
folderId} -> Maybe Text
folderId) (\s :: UpdateFolderPermissionsResponse
s@UpdateFolderPermissionsResponse' {} Maybe Text
a -> UpdateFolderPermissionsResponse
s {$sel:folderId:UpdateFolderPermissionsResponse' :: Maybe Text
folderId = Maybe Text
a} :: UpdateFolderPermissionsResponse)

-- | Information about the permissions on the dashboard.
updateFolderPermissionsResponse_permissions :: Lens.Lens' UpdateFolderPermissionsResponse (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
updateFolderPermissionsResponse_permissions :: (Maybe (NonEmpty ResourcePermission)
 -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateFolderPermissionsResponse
-> f UpdateFolderPermissionsResponse
updateFolderPermissionsResponse_permissions = (UpdateFolderPermissionsResponse
 -> Maybe (NonEmpty ResourcePermission))
-> (UpdateFolderPermissionsResponse
    -> Maybe (NonEmpty ResourcePermission)
    -> UpdateFolderPermissionsResponse)
-> Lens
     UpdateFolderPermissionsResponse
     UpdateFolderPermissionsResponse
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFolderPermissionsResponse' {Maybe (NonEmpty ResourcePermission)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:permissions:UpdateFolderPermissionsResponse' :: UpdateFolderPermissionsResponse
-> Maybe (NonEmpty ResourcePermission)
permissions} -> Maybe (NonEmpty ResourcePermission)
permissions) (\s :: UpdateFolderPermissionsResponse
s@UpdateFolderPermissionsResponse' {} Maybe (NonEmpty ResourcePermission)
a -> UpdateFolderPermissionsResponse
s {$sel:permissions:UpdateFolderPermissionsResponse' :: Maybe (NonEmpty ResourcePermission)
permissions = Maybe (NonEmpty ResourcePermission)
a} :: UpdateFolderPermissionsResponse) ((Maybe (NonEmpty ResourcePermission)
  -> f (Maybe (NonEmpty ResourcePermission)))
 -> UpdateFolderPermissionsResponse
 -> f UpdateFolderPermissionsResponse)
-> ((Maybe (NonEmpty ResourcePermission)
     -> f (Maybe (NonEmpty ResourcePermission)))
    -> Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> (Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateFolderPermissionsResponse
-> f UpdateFolderPermissionsResponse
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 response's http status code.
updateFolderPermissionsResponse_httpStatus :: Lens.Lens' UpdateFolderPermissionsResponse Prelude.Int
updateFolderPermissionsResponse_httpStatus :: (Int -> f Int)
-> UpdateFolderPermissionsResponse
-> f UpdateFolderPermissionsResponse
updateFolderPermissionsResponse_httpStatus = (UpdateFolderPermissionsResponse -> Int)
-> (UpdateFolderPermissionsResponse
    -> Int -> UpdateFolderPermissionsResponse)
-> Lens
     UpdateFolderPermissionsResponse
     UpdateFolderPermissionsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFolderPermissionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFolderPermissionsResponse' :: UpdateFolderPermissionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateFolderPermissionsResponse
s@UpdateFolderPermissionsResponse' {} Int
a -> UpdateFolderPermissionsResponse
s {$sel:httpStatus:UpdateFolderPermissionsResponse' :: Int
httpStatus = Int
a} :: UpdateFolderPermissionsResponse)

instance
  Prelude.NFData
    UpdateFolderPermissionsResponse