updateTemplatePermissions method

Future<UpdateTemplatePermissionsResponse> updateTemplatePermissions({
  1. required String awsAccountId,
  2. required String templateId,
  3. List<ResourcePermission>? grantPermissions,
  4. List<ResourcePermission>? revokePermissions,
})

Updates the resource permissions for a template.

May throw ThrottlingException. May throw InvalidParameterValueException. May throw ConflictException. May throw ResourceNotFoundException. May throw UnsupportedUserEditionException. May throw InternalFailureException.

Parameter awsAccountId : The ID of the AWS account that contains the template.

Parameter templateId : The ID for the template.

Parameter grantPermissions : A list of resource permissions to be granted on the template.

Parameter revokePermissions : A list of resource permissions to be revoked from the template.

Implementation

Future<UpdateTemplatePermissionsResponse> updateTemplatePermissions({
  required String awsAccountId,
  required String templateId,
  List<ResourcePermission>? grantPermissions,
  List<ResourcePermission>? revokePermissions,
}) async {
  ArgumentError.checkNotNull(awsAccountId, 'awsAccountId');
  _s.validateStringLength(
    'awsAccountId',
    awsAccountId,
    12,
    12,
    isRequired: true,
  );
  ArgumentError.checkNotNull(templateId, 'templateId');
  _s.validateStringLength(
    'templateId',
    templateId,
    1,
    2048,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    if (grantPermissions != null) 'GrantPermissions': grantPermissions,
    if (revokePermissions != null) 'RevokePermissions': revokePermissions,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/templates/${Uri.encodeComponent(templateId)}/permissions',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateTemplatePermissionsResponse.fromJson(response);
}