From 6f5e79bf23d05bc1b325ea2f5e496153e8af43d9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 16 Jul 2026 11:42:38 -0700 Subject: [PATCH] feat: add ActionType generic constraint for policy actions ActionType is a union of the policy action types (Action, AdminAction, STSAction, KMSAction, TableAction, VectorsAction, MemoryAction). It lets generic auth helpers accept any typed action without per-call conversion to Action, while a bare string stays excluded. --- policy/action-constraint.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 policy/action-constraint.go diff --git a/policy/action-constraint.go b/policy/action-constraint.go new file mode 100644 index 00000000..4fae7493 --- /dev/null +++ b/policy/action-constraint.go @@ -0,0 +1,26 @@ +// Copyright (c) 2015-2026 MinIO, Inc. +// +// This file is part of MinIO Object Storage stack +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package policy + +// ActionType constrains the set of policy action types. It lets generic helpers +// accept any typed action — S3 (Action), admin, STS, KMS, Tables, Vectors, or +// Memory — without forcing callers to convert to Action at each call site. A +// bare string is intentionally excluded so only real policy action types match. +type ActionType interface { + Action | AdminAction | STSAction | KMSAction | TableAction | VectorsAction | MemoryAction +}