{-# 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.UpdateTemplatePermissions
-- 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 resource permissions for a template.
module Amazonka.QuickSight.UpdateTemplatePermissions
  ( -- * Creating a Request
    UpdateTemplatePermissions (..),
    newUpdateTemplatePermissions,

    -- * Request Lenses
    updateTemplatePermissions_revokePermissions,
    updateTemplatePermissions_grantPermissions,
    updateTemplatePermissions_awsAccountId,
    updateTemplatePermissions_templateId,

    -- * Destructuring the Response
    UpdateTemplatePermissionsResponse (..),
    newUpdateTemplatePermissionsResponse,

    -- * Response Lenses
    updateTemplatePermissionsResponse_requestId,
    updateTemplatePermissionsResponse_templateId,
    updateTemplatePermissionsResponse_templateArn,
    updateTemplatePermissionsResponse_permissions,
    updateTemplatePermissionsResponse_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:/ 'newUpdateTemplatePermissions' smart constructor.
data UpdateTemplatePermissions = UpdateTemplatePermissions'
  { -- | A list of resource permissions to be revoked from the template.
    UpdateTemplatePermissions -> Maybe [ResourcePermission]
revokePermissions :: Prelude.Maybe [ResourcePermission],
    -- | A list of resource permissions to be granted on the template.
    UpdateTemplatePermissions -> Maybe [ResourcePermission]
grantPermissions :: Prelude.Maybe [ResourcePermission],
    -- | The ID of the Amazon Web Services account that contains the template.
    UpdateTemplatePermissions -> Text
awsAccountId :: Prelude.Text,
    -- | The ID for the template.
    UpdateTemplatePermissions -> Text
templateId :: Prelude.Text
  }
  deriving (UpdateTemplatePermissions -> UpdateTemplatePermissions -> Bool
(UpdateTemplatePermissions -> UpdateTemplatePermissions -> Bool)
-> (UpdateTemplatePermissions -> UpdateTemplatePermissions -> Bool)
-> Eq UpdateTemplatePermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTemplatePermissions -> UpdateTemplatePermissions -> Bool
$c/= :: UpdateTemplatePermissions -> UpdateTemplatePermissions -> Bool
== :: UpdateTemplatePermissions -> UpdateTemplatePermissions -> Bool
$c== :: UpdateTemplatePermissions -> UpdateTemplatePermissions -> Bool
Prelude.Eq, ReadPrec [UpdateTemplatePermissions]
ReadPrec UpdateTemplatePermissions
Int -> ReadS UpdateTemplatePermissions
ReadS [UpdateTemplatePermissions]
(Int -> ReadS UpdateTemplatePermissions)
-> ReadS [UpdateTemplatePermissions]
-> ReadPrec UpdateTemplatePermissions
-> ReadPrec [UpdateTemplatePermissions]
-> Read UpdateTemplatePermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTemplatePermissions]
$creadListPrec :: ReadPrec [UpdateTemplatePermissions]
readPrec :: ReadPrec UpdateTemplatePermissions
$creadPrec :: ReadPrec UpdateTemplatePermissions
readList :: ReadS [UpdateTemplatePermissions]
$creadList :: ReadS [UpdateTemplatePermissions]
readsPrec :: Int -> ReadS UpdateTemplatePermissions
$creadsPrec :: Int -> ReadS UpdateTemplatePermissions
Prelude.Read, Int -> UpdateTemplatePermissions -> ShowS
[UpdateTemplatePermissions] -> ShowS
UpdateTemplatePermissions -> String
(Int -> UpdateTemplatePermissions -> ShowS)
-> (UpdateTemplatePermissions -> String)
-> ([UpdateTemplatePermissions] -> ShowS)
-> Show UpdateTemplatePermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTemplatePermissions] -> ShowS
$cshowList :: [UpdateTemplatePermissions] -> ShowS
show :: UpdateTemplatePermissions -> String
$cshow :: UpdateTemplatePermissions -> String
showsPrec :: Int -> UpdateTemplatePermissions -> ShowS
$cshowsPrec :: Int -> UpdateTemplatePermissions -> ShowS
Prelude.Show, (forall x.
 UpdateTemplatePermissions -> Rep UpdateTemplatePermissions x)
-> (forall x.
    Rep UpdateTemplatePermissions x -> UpdateTemplatePermissions)
-> Generic UpdateTemplatePermissions
forall x.
Rep UpdateTemplatePermissions x -> UpdateTemplatePermissions
forall x.
UpdateTemplatePermissions -> Rep UpdateTemplatePermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateTemplatePermissions x -> UpdateTemplatePermissions
$cfrom :: forall x.
UpdateTemplatePermissions -> Rep UpdateTemplatePermissions x
Prelude.Generic)

-- |
-- Create a value of 'UpdateTemplatePermissions' 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', 'updateTemplatePermissions_revokePermissions' - A list of resource permissions to be revoked from the template.
--
-- 'grantPermissions', 'updateTemplatePermissions_grantPermissions' - A list of resource permissions to be granted on the template.
--
-- 'awsAccountId', 'updateTemplatePermissions_awsAccountId' - The ID of the Amazon Web Services account that contains the template.
--
-- 'templateId', 'updateTemplatePermissions_templateId' - The ID for the template.
newUpdateTemplatePermissions ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'templateId'
  Prelude.Text ->
  UpdateTemplatePermissions
newUpdateTemplatePermissions :: Text -> Text -> UpdateTemplatePermissions
newUpdateTemplatePermissions
  Text
pAwsAccountId_
  Text
pTemplateId_ =
    UpdateTemplatePermissions' :: Maybe [ResourcePermission]
-> Maybe [ResourcePermission]
-> Text
-> Text
-> UpdateTemplatePermissions
UpdateTemplatePermissions'
      { $sel:revokePermissions:UpdateTemplatePermissions' :: Maybe [ResourcePermission]
revokePermissions =
          Maybe [ResourcePermission]
forall a. Maybe a
Prelude.Nothing,
        $sel:grantPermissions:UpdateTemplatePermissions' :: Maybe [ResourcePermission]
grantPermissions = Maybe [ResourcePermission]
forall a. Maybe a
Prelude.Nothing,
        $sel:awsAccountId:UpdateTemplatePermissions' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:templateId:UpdateTemplatePermissions' :: Text
templateId = Text
pTemplateId_
      }

-- | A list of resource permissions to be revoked from the template.
updateTemplatePermissions_revokePermissions :: Lens.Lens' UpdateTemplatePermissions (Prelude.Maybe [ResourcePermission])
updateTemplatePermissions_revokePermissions :: (Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
-> UpdateTemplatePermissions -> f UpdateTemplatePermissions
updateTemplatePermissions_revokePermissions = (UpdateTemplatePermissions -> Maybe [ResourcePermission])
-> (UpdateTemplatePermissions
    -> Maybe [ResourcePermission] -> UpdateTemplatePermissions)
-> Lens
     UpdateTemplatePermissions
     UpdateTemplatePermissions
     (Maybe [ResourcePermission])
     (Maybe [ResourcePermission])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplatePermissions' {Maybe [ResourcePermission]
revokePermissions :: Maybe [ResourcePermission]
$sel:revokePermissions:UpdateTemplatePermissions' :: UpdateTemplatePermissions -> Maybe [ResourcePermission]
revokePermissions} -> Maybe [ResourcePermission]
revokePermissions) (\s :: UpdateTemplatePermissions
s@UpdateTemplatePermissions' {} Maybe [ResourcePermission]
a -> UpdateTemplatePermissions
s {$sel:revokePermissions:UpdateTemplatePermissions' :: Maybe [ResourcePermission]
revokePermissions = Maybe [ResourcePermission]
a} :: UpdateTemplatePermissions) ((Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
 -> UpdateTemplatePermissions -> f UpdateTemplatePermissions)
-> ((Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
    -> Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
-> (Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
-> UpdateTemplatePermissions
-> f UpdateTemplatePermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourcePermission]
  [ResourcePermission]
  [ResourcePermission]
  [ResourcePermission]
-> Iso
     (Maybe [ResourcePermission])
     (Maybe [ResourcePermission])
     (Maybe [ResourcePermission])
     (Maybe [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
  [ResourcePermission]
  [ResourcePermission]
  [ResourcePermission]
  [ResourcePermission]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of resource permissions to be granted on the template.
updateTemplatePermissions_grantPermissions :: Lens.Lens' UpdateTemplatePermissions (Prelude.Maybe [ResourcePermission])
updateTemplatePermissions_grantPermissions :: (Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
-> UpdateTemplatePermissions -> f UpdateTemplatePermissions
updateTemplatePermissions_grantPermissions = (UpdateTemplatePermissions -> Maybe [ResourcePermission])
-> (UpdateTemplatePermissions
    -> Maybe [ResourcePermission] -> UpdateTemplatePermissions)
-> Lens
     UpdateTemplatePermissions
     UpdateTemplatePermissions
     (Maybe [ResourcePermission])
     (Maybe [ResourcePermission])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplatePermissions' {Maybe [ResourcePermission]
grantPermissions :: Maybe [ResourcePermission]
$sel:grantPermissions:UpdateTemplatePermissions' :: UpdateTemplatePermissions -> Maybe [ResourcePermission]
grantPermissions} -> Maybe [ResourcePermission]
grantPermissions) (\s :: UpdateTemplatePermissions
s@UpdateTemplatePermissions' {} Maybe [ResourcePermission]
a -> UpdateTemplatePermissions
s {$sel:grantPermissions:UpdateTemplatePermissions' :: Maybe [ResourcePermission]
grantPermissions = Maybe [ResourcePermission]
a} :: UpdateTemplatePermissions) ((Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
 -> UpdateTemplatePermissions -> f UpdateTemplatePermissions)
-> ((Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
    -> Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
-> (Maybe [ResourcePermission] -> f (Maybe [ResourcePermission]))
-> UpdateTemplatePermissions
-> f UpdateTemplatePermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourcePermission]
  [ResourcePermission]
  [ResourcePermission]
  [ResourcePermission]
-> Iso
     (Maybe [ResourcePermission])
     (Maybe [ResourcePermission])
     (Maybe [ResourcePermission])
     (Maybe [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
  [ResourcePermission]
  [ResourcePermission]
  [ResourcePermission]
  [ResourcePermission]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the Amazon Web Services account that contains the template.
updateTemplatePermissions_awsAccountId :: Lens.Lens' UpdateTemplatePermissions Prelude.Text
updateTemplatePermissions_awsAccountId :: (Text -> f Text)
-> UpdateTemplatePermissions -> f UpdateTemplatePermissions
updateTemplatePermissions_awsAccountId = (UpdateTemplatePermissions -> Text)
-> (UpdateTemplatePermissions -> Text -> UpdateTemplatePermissions)
-> Lens
     UpdateTemplatePermissions UpdateTemplatePermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplatePermissions' {Text
awsAccountId :: Text
$sel:awsAccountId:UpdateTemplatePermissions' :: UpdateTemplatePermissions -> Text
awsAccountId} -> Text
awsAccountId) (\s :: UpdateTemplatePermissions
s@UpdateTemplatePermissions' {} Text
a -> UpdateTemplatePermissions
s {$sel:awsAccountId:UpdateTemplatePermissions' :: Text
awsAccountId = Text
a} :: UpdateTemplatePermissions)

-- | The ID for the template.
updateTemplatePermissions_templateId :: Lens.Lens' UpdateTemplatePermissions Prelude.Text
updateTemplatePermissions_templateId :: (Text -> f Text)
-> UpdateTemplatePermissions -> f UpdateTemplatePermissions
updateTemplatePermissions_templateId = (UpdateTemplatePermissions -> Text)
-> (UpdateTemplatePermissions -> Text -> UpdateTemplatePermissions)
-> Lens
     UpdateTemplatePermissions UpdateTemplatePermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplatePermissions' {Text
templateId :: Text
$sel:templateId:UpdateTemplatePermissions' :: UpdateTemplatePermissions -> Text
templateId} -> Text
templateId) (\s :: UpdateTemplatePermissions
s@UpdateTemplatePermissions' {} Text
a -> UpdateTemplatePermissions
s {$sel:templateId:UpdateTemplatePermissions' :: Text
templateId = Text
a} :: UpdateTemplatePermissions)

instance Core.AWSRequest UpdateTemplatePermissions where
  type
    AWSResponse UpdateTemplatePermissions =
      UpdateTemplatePermissionsResponse
  request :: UpdateTemplatePermissions -> Request UpdateTemplatePermissions
request = Service
-> UpdateTemplatePermissions -> Request UpdateTemplatePermissions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateTemplatePermissions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateTemplatePermissions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateTemplatePermissions))
-> Logger
-> Service
-> Proxy UpdateTemplatePermissions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateTemplatePermissions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty ResourcePermission)
-> Int
-> UpdateTemplatePermissionsResponse
UpdateTemplatePermissionsResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (NonEmpty ResourcePermission)
 -> Int
 -> UpdateTemplatePermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty ResourcePermission)
      -> Int
      -> UpdateTemplatePermissionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RequestId")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty ResourcePermission)
   -> Int
   -> UpdateTemplatePermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe (NonEmpty ResourcePermission)
      -> Int
      -> UpdateTemplatePermissionsResponse)
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
"TemplateId")
            Either
  String
  (Maybe Text
   -> Maybe (NonEmpty ResourcePermission)
   -> Int
   -> UpdateTemplatePermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe (NonEmpty ResourcePermission)
      -> Int -> UpdateTemplatePermissionsResponse)
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
"TemplateArn")
            Either
  String
  (Maybe (NonEmpty ResourcePermission)
   -> Int -> UpdateTemplatePermissionsResponse)
-> Either String (Maybe (NonEmpty ResourcePermission))
-> Either String (Int -> UpdateTemplatePermissionsResponse)
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 -> UpdateTemplatePermissionsResponse)
-> Either String Int
-> Either String UpdateTemplatePermissionsResponse
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 UpdateTemplatePermissions

instance Prelude.NFData UpdateTemplatePermissions

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

instance Core.ToPath UpdateTemplatePermissions where
  toPath :: UpdateTemplatePermissions -> ByteString
toPath UpdateTemplatePermissions' {Maybe [ResourcePermission]
Text
templateId :: Text
awsAccountId :: Text
grantPermissions :: Maybe [ResourcePermission]
revokePermissions :: Maybe [ResourcePermission]
$sel:templateId:UpdateTemplatePermissions' :: UpdateTemplatePermissions -> Text
$sel:awsAccountId:UpdateTemplatePermissions' :: UpdateTemplatePermissions -> Text
$sel:grantPermissions:UpdateTemplatePermissions' :: UpdateTemplatePermissions -> Maybe [ResourcePermission]
$sel:revokePermissions:UpdateTemplatePermissions' :: UpdateTemplatePermissions -> Maybe [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
"/templates/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
templateId,
        ByteString
"/permissions"
      ]

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

-- | /See:/ 'newUpdateTemplatePermissionsResponse' smart constructor.
data UpdateTemplatePermissionsResponse = UpdateTemplatePermissionsResponse'
  { -- | The Amazon Web Services request ID for this operation.
    UpdateTemplatePermissionsResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The ID for the template.
    UpdateTemplatePermissionsResponse -> Maybe Text
templateId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the template.
    UpdateTemplatePermissionsResponse -> Maybe Text
templateArn :: Prelude.Maybe Prelude.Text,
    -- | A list of resource permissions to be set on the template.
    UpdateTemplatePermissionsResponse
-> Maybe (NonEmpty ResourcePermission)
permissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | The HTTP status of the request.
    UpdateTemplatePermissionsResponse -> Int
status :: Prelude.Int
  }
  deriving (UpdateTemplatePermissionsResponse
-> UpdateTemplatePermissionsResponse -> Bool
(UpdateTemplatePermissionsResponse
 -> UpdateTemplatePermissionsResponse -> Bool)
-> (UpdateTemplatePermissionsResponse
    -> UpdateTemplatePermissionsResponse -> Bool)
-> Eq UpdateTemplatePermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTemplatePermissionsResponse
-> UpdateTemplatePermissionsResponse -> Bool
$c/= :: UpdateTemplatePermissionsResponse
-> UpdateTemplatePermissionsResponse -> Bool
== :: UpdateTemplatePermissionsResponse
-> UpdateTemplatePermissionsResponse -> Bool
$c== :: UpdateTemplatePermissionsResponse
-> UpdateTemplatePermissionsResponse -> Bool
Prelude.Eq, ReadPrec [UpdateTemplatePermissionsResponse]
ReadPrec UpdateTemplatePermissionsResponse
Int -> ReadS UpdateTemplatePermissionsResponse
ReadS [UpdateTemplatePermissionsResponse]
(Int -> ReadS UpdateTemplatePermissionsResponse)
-> ReadS [UpdateTemplatePermissionsResponse]
-> ReadPrec UpdateTemplatePermissionsResponse
-> ReadPrec [UpdateTemplatePermissionsResponse]
-> Read UpdateTemplatePermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTemplatePermissionsResponse]
$creadListPrec :: ReadPrec [UpdateTemplatePermissionsResponse]
readPrec :: ReadPrec UpdateTemplatePermissionsResponse
$creadPrec :: ReadPrec UpdateTemplatePermissionsResponse
readList :: ReadS [UpdateTemplatePermissionsResponse]
$creadList :: ReadS [UpdateTemplatePermissionsResponse]
readsPrec :: Int -> ReadS UpdateTemplatePermissionsResponse
$creadsPrec :: Int -> ReadS UpdateTemplatePermissionsResponse
Prelude.Read, Int -> UpdateTemplatePermissionsResponse -> ShowS
[UpdateTemplatePermissionsResponse] -> ShowS
UpdateTemplatePermissionsResponse -> String
(Int -> UpdateTemplatePermissionsResponse -> ShowS)
-> (UpdateTemplatePermissionsResponse -> String)
-> ([UpdateTemplatePermissionsResponse] -> ShowS)
-> Show UpdateTemplatePermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTemplatePermissionsResponse] -> ShowS
$cshowList :: [UpdateTemplatePermissionsResponse] -> ShowS
show :: UpdateTemplatePermissionsResponse -> String
$cshow :: UpdateTemplatePermissionsResponse -> String
showsPrec :: Int -> UpdateTemplatePermissionsResponse -> ShowS
$cshowsPrec :: Int -> UpdateTemplatePermissionsResponse -> ShowS
Prelude.Show, (forall x.
 UpdateTemplatePermissionsResponse
 -> Rep UpdateTemplatePermissionsResponse x)
-> (forall x.
    Rep UpdateTemplatePermissionsResponse x
    -> UpdateTemplatePermissionsResponse)
-> Generic UpdateTemplatePermissionsResponse
forall x.
Rep UpdateTemplatePermissionsResponse x
-> UpdateTemplatePermissionsResponse
forall x.
UpdateTemplatePermissionsResponse
-> Rep UpdateTemplatePermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateTemplatePermissionsResponse x
-> UpdateTemplatePermissionsResponse
$cfrom :: forall x.
UpdateTemplatePermissionsResponse
-> Rep UpdateTemplatePermissionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateTemplatePermissionsResponse' 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', 'updateTemplatePermissionsResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'templateId', 'updateTemplatePermissionsResponse_templateId' - The ID for the template.
--
-- 'templateArn', 'updateTemplatePermissionsResponse_templateArn' - The Amazon Resource Name (ARN) of the template.
--
-- 'permissions', 'updateTemplatePermissionsResponse_permissions' - A list of resource permissions to be set on the template.
--
-- 'status', 'updateTemplatePermissionsResponse_status' - The HTTP status of the request.
newUpdateTemplatePermissionsResponse ::
  -- | 'status'
  Prelude.Int ->
  UpdateTemplatePermissionsResponse
newUpdateTemplatePermissionsResponse :: Int -> UpdateTemplatePermissionsResponse
newUpdateTemplatePermissionsResponse Int
pStatus_ =
  UpdateTemplatePermissionsResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty ResourcePermission)
-> Int
-> UpdateTemplatePermissionsResponse
UpdateTemplatePermissionsResponse'
    { $sel:requestId:UpdateTemplatePermissionsResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templateId:UpdateTemplatePermissionsResponse' :: Maybe Text
templateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templateArn:UpdateTemplatePermissionsResponse' :: Maybe Text
templateArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:permissions:UpdateTemplatePermissionsResponse' :: Maybe (NonEmpty ResourcePermission)
permissions = Maybe (NonEmpty ResourcePermission)
forall a. Maybe a
Prelude.Nothing,
      $sel:status:UpdateTemplatePermissionsResponse' :: Int
status = Int
pStatus_
    }

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

-- | The ID for the template.
updateTemplatePermissionsResponse_templateId :: Lens.Lens' UpdateTemplatePermissionsResponse (Prelude.Maybe Prelude.Text)
updateTemplatePermissionsResponse_templateId :: (Maybe Text -> f (Maybe Text))
-> UpdateTemplatePermissionsResponse
-> f UpdateTemplatePermissionsResponse
updateTemplatePermissionsResponse_templateId = (UpdateTemplatePermissionsResponse -> Maybe Text)
-> (UpdateTemplatePermissionsResponse
    -> Maybe Text -> UpdateTemplatePermissionsResponse)
-> Lens
     UpdateTemplatePermissionsResponse
     UpdateTemplatePermissionsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplatePermissionsResponse' {Maybe Text
templateId :: Maybe Text
$sel:templateId:UpdateTemplatePermissionsResponse' :: UpdateTemplatePermissionsResponse -> Maybe Text
templateId} -> Maybe Text
templateId) (\s :: UpdateTemplatePermissionsResponse
s@UpdateTemplatePermissionsResponse' {} Maybe Text
a -> UpdateTemplatePermissionsResponse
s {$sel:templateId:UpdateTemplatePermissionsResponse' :: Maybe Text
templateId = Maybe Text
a} :: UpdateTemplatePermissionsResponse)

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

-- | A list of resource permissions to be set on the template.
updateTemplatePermissionsResponse_permissions :: Lens.Lens' UpdateTemplatePermissionsResponse (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
updateTemplatePermissionsResponse_permissions :: (Maybe (NonEmpty ResourcePermission)
 -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateTemplatePermissionsResponse
-> f UpdateTemplatePermissionsResponse
updateTemplatePermissionsResponse_permissions = (UpdateTemplatePermissionsResponse
 -> Maybe (NonEmpty ResourcePermission))
-> (UpdateTemplatePermissionsResponse
    -> Maybe (NonEmpty ResourcePermission)
    -> UpdateTemplatePermissionsResponse)
-> Lens
     UpdateTemplatePermissionsResponse
     UpdateTemplatePermissionsResponse
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplatePermissionsResponse' {Maybe (NonEmpty ResourcePermission)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:permissions:UpdateTemplatePermissionsResponse' :: UpdateTemplatePermissionsResponse
-> Maybe (NonEmpty ResourcePermission)
permissions} -> Maybe (NonEmpty ResourcePermission)
permissions) (\s :: UpdateTemplatePermissionsResponse
s@UpdateTemplatePermissionsResponse' {} Maybe (NonEmpty ResourcePermission)
a -> UpdateTemplatePermissionsResponse
s {$sel:permissions:UpdateTemplatePermissionsResponse' :: Maybe (NonEmpty ResourcePermission)
permissions = Maybe (NonEmpty ResourcePermission)
a} :: UpdateTemplatePermissionsResponse) ((Maybe (NonEmpty ResourcePermission)
  -> f (Maybe (NonEmpty ResourcePermission)))
 -> UpdateTemplatePermissionsResponse
 -> f UpdateTemplatePermissionsResponse)
-> ((Maybe (NonEmpty ResourcePermission)
     -> f (Maybe (NonEmpty ResourcePermission)))
    -> Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> (Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> UpdateTemplatePermissionsResponse
-> f UpdateTemplatePermissionsResponse
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 HTTP status of the request.
updateTemplatePermissionsResponse_status :: Lens.Lens' UpdateTemplatePermissionsResponse Prelude.Int
updateTemplatePermissionsResponse_status :: (Int -> f Int)
-> UpdateTemplatePermissionsResponse
-> f UpdateTemplatePermissionsResponse
updateTemplatePermissionsResponse_status = (UpdateTemplatePermissionsResponse -> Int)
-> (UpdateTemplatePermissionsResponse
    -> Int -> UpdateTemplatePermissionsResponse)
-> Lens
     UpdateTemplatePermissionsResponse
     UpdateTemplatePermissionsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTemplatePermissionsResponse' {Int
status :: Int
$sel:status:UpdateTemplatePermissionsResponse' :: UpdateTemplatePermissionsResponse -> Int
status} -> Int
status) (\s :: UpdateTemplatePermissionsResponse
s@UpdateTemplatePermissionsResponse' {} Int
a -> UpdateTemplatePermissionsResponse
s {$sel:status:UpdateTemplatePermissionsResponse' :: Int
status = Int
a} :: UpdateTemplatePermissionsResponse)

instance
  Prelude.NFData
    UpdateTemplatePermissionsResponse