Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
133eb78
initial handlers and cmds impl
ryanulit May 15, 2025
1fdfe86
bump protocol/go package and refactor for new changes
ryanulit May 19, 2025
f227e1e
add other man docs
ryanulit May 19, 2025
e910fbe
add missing delete doc and register docs in cmd
ryanulit May 19, 2025
77d5f0f
add action attribute values initial impl
ryanulit May 21, 2025
ea2391e
Merge branch 'main' into DSPX-896-rr-otdfctl-crud
ryanulit May 21, 2025
3ab551d
add back in GetAttributeValue handler refactor after merge with main
ryanulit May 21, 2025
d9388d9
rename package-level vars for more clarity
ryanulit May 21, 2025
e58511a
fix bad docs
ryanulit May 21, 2025
cab8df2
fix cmd registrations and add create with action attr values
ryanulit May 21, 2025
f368c43
fix lint
ryanulit May 21, 2025
25e8941
add action attr vals support to update command
ryanulit May 22, 2025
799d173
add first bats test
ryanulit May 22, 2025
017aae7
fix bats test
ryanulit May 22, 2025
4b35f19
registered resources bats tests
ryanulit May 23, 2025
e756676
add test data setup for values tests
ryanulit May 23, 2025
5f3de00
add resource value tests
ryanulit May 23, 2025
c548706
add remaining test coverage for action attr vals
ryanulit May 27, 2025
5cc647d
Merge branch 'main' into DSPX-896-rr-otdfctl-crud
ryanulit May 27, 2025
00ed542
update partial check for fqn
ryanulit May 27, 2025
ecc6811
uncomment hidden
ryanulit May 27, 2025
f614efa
address docs PR comments
ryanulit May 27, 2025
b4ad4c1
replace indexed assertions with jq any func
ryanulit May 27, 2025
760567f
add bad test case for action attribute values separators
ryanulit May 27, 2025
637d4c4
add commented update test case for later
ryanulit May 27, 2025
0173ffb
Merge branch 'main' into DSPX-896-rr-otdfctl-crud
ryanulit May 28, 2025
dab29ad
refactor resource-id arg to resource and update tests, also add updat…
ryanulit May 28, 2025
1247142
fix failing tests
ryanulit May 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/kas-grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func policy_unassignKasGrant(cmd *cobra.Command, args []string) {
rowID = []string{"Attribute ID", attrID}
rowFQN = []string{"Attribute FQN", attr.GetFqn()}
} else {
val, err := h.GetAttributeValue(ctx, valID)
val, err := h.GetAttributeValue(ctx, valID, "")
if err != nil || val == nil {
cli.ExitWithError("Failed to get attribute value", err)
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/policy-attributeValues.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func policy_getAttributeValue(cmd *cobra.Command, args []string) {

id := c.FlagHelper.GetRequiredID("id")

v, err := h.GetAttributeValue(cmd.Context(), id)
v, err := h.GetAttributeValue(cmd.Context(), id, "")
if err != nil {
cli.ExitWithError("Failed to find attribute value", err)
}
Expand Down Expand Up @@ -98,7 +98,7 @@ func policy_updateAttributeValue(cmd *cobra.Command, args []string) {
id := c.Flags.GetRequiredID("id")
metadataLabels = c.Flags.GetStringSlice("label", metadataLabels, cli.FlagsStringSliceOptions{Min: 0})

_, err := h.GetAttributeValue(ctx, id)
_, err := h.GetAttributeValue(ctx, id, "")
if err != nil {
cli.ExitWithError(fmt.Sprintf("Failed to get attribute value (%s)", id), err)
}
Expand All @@ -119,7 +119,7 @@ func policy_deactivateAttributeValue(cmd *cobra.Command, args []string) {
ctx := cmd.Context()
id := c.Flags.GetRequiredID("id")

value, err := h.GetAttributeValue(ctx, id)
value, err := h.GetAttributeValue(ctx, id, "")
if err != nil {
cli.ExitWithError(fmt.Sprintf("Failed to get attribute value (%s)", id), err)
}
Expand All @@ -142,7 +142,7 @@ func policy_unsafeReactivateAttributeValue(cmd *cobra.Command, args []string) {
ctx := cmd.Context()
id := c.Flags.GetRequiredID("id")

v, err := h.GetAttributeValue(ctx, id)
v, err := h.GetAttributeValue(ctx, id, "")
if err != nil {
cli.ExitWithError(fmt.Sprintf("Failed to get attribute value (%s)", id), err)
}
Expand Down Expand Up @@ -175,7 +175,7 @@ func policy_unsafeUpdateAttributeValue(cmd *cobra.Command, args []string) {
id := c.Flags.GetRequiredID("id")
value := c.Flags.GetOptionalString("value")

v, err := h.GetAttributeValue(ctx, id)
v, err := h.GetAttributeValue(ctx, id, "")
if err != nil {
cli.ExitWithError(fmt.Sprintf("Failed to get attribute value (%s)", id), err)
}
Expand Down Expand Up @@ -207,7 +207,7 @@ func policy_unsafeDeleteAttributeValue(cmd *cobra.Command, args []string) {
ctx := cmd.Context()
id := c.Flags.GetRequiredID("id")

v, err := h.GetAttributeValue(ctx, id)
v, err := h.GetAttributeValue(ctx, id, "")
if err != nil {
cli.ExitWithError(fmt.Sprintf("Failed to get attribute value (%s)", id), err)
}
Expand Down
16 changes: 8 additions & 8 deletions cmd/policy-attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

var (
forceReplaceMetadataLabels bool
values []string
valuesOrder []string
attributeValues []string
attributeValuesOrder []string

policy_attributesCmd = man.Docs.GetCommand("policy/attributes")
)
Expand All @@ -26,11 +26,11 @@ func policy_createAttribute(cmd *cobra.Command, args []string) {

name := c.Flags.GetRequiredString("name")
rule := c.Flags.GetRequiredString("rule")
values = c.Flags.GetStringSlice("value", values, cli.FlagsStringSliceOptions{})
attributeValues = c.Flags.GetStringSlice("value", attributeValues, cli.FlagsStringSliceOptions{})
namespace := c.Flags.GetRequiredString("namespace")
metadataLabels = c.Flags.GetStringSlice("label", metadataLabels, cli.FlagsStringSliceOptions{Min: 0})

attr, err := h.CreateAttribute(cmd.Context(), name, rule, namespace, values, getMetadataMutable(metadataLabels))
attr, err := h.CreateAttribute(cmd.Context(), name, rule, namespace, attributeValues, getMetadataMutable(metadataLabels))
if err != nil {
cli.ExitWithError("Failed to create attribute", err)
}
Expand Down Expand Up @@ -232,7 +232,7 @@ func policy_unsafeUpdateAttribute(cmd *cobra.Command, args []string) {
id := c.Flags.GetRequiredID("id")
name := c.Flags.GetOptionalString("name")
rule := c.Flags.GetOptionalString("rule")
valuesOrder = c.Flags.GetStringSlice("values-order", valuesOrder, cli.FlagsStringSliceOptions{})
attributeValuesOrder = c.Flags.GetStringSlice("values-order", attributeValuesOrder, cli.FlagsStringSliceOptions{})

a, err := h.GetAttribute(ctx, id)
if err != nil {
Expand All @@ -244,7 +244,7 @@ func policy_unsafeUpdateAttribute(cmd *cobra.Command, args []string) {
cli.ConfirmTextInput(cli.ActionUpdateUnsafe, "attribute", cli.InputNameFQN, a.GetFqn())
}

if err := h.UnsafeUpdateAttribute(ctx, id, name, rule, valuesOrder); err != nil {
if err := h.UnsafeUpdateAttribute(ctx, id, name, rule, attributeValuesOrder); err != nil {
cli.ExitWithError(fmt.Sprintf("Failed to update attribute (%s)", id), err)
} else {
var (
Expand Down Expand Up @@ -322,7 +322,7 @@ func init() {
createDoc.GetDocFlag("rule").Description,
)
createDoc.Flags().StringSliceVarP(
&values,
&attributeValues,
createDoc.GetDocFlag("value").Name,
createDoc.GetDocFlag("value").Shorthand,
[]string{},
Expand Down Expand Up @@ -435,7 +435,7 @@ func init() {
unsafeUpdateCmd.GetDocFlag("rule").Description,
)
unsafeUpdateCmd.Flags().StringSliceVarP(
&valuesOrder,
&attributeValuesOrder,
unsafeUpdateCmd.GetDocFlag("values-order").Name,
unsafeUpdateCmd.GetDocFlag("values-order").Shorthand,
[]string{},
Expand Down
Loading
Loading