Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(policy): add cli crud for attributes #48

Merged
merged 5 commits into from
Feb 6, 2024
Merged

Conversation

jrschumacher
Copy link
Member

@jrschumacher jrschumacher commented Feb 5, 2024

Add CLI CRUD for attributes w/ values

Assuming export NAMESPACE_ID=752cbd4d-9fa4-4c8e-853c-0dfa2ebc6956

# Create attribute wwithout values
tructl attributes create \
       --name "test" \
       --rule "ANY_OF" \
       --namespace $NAMESPACE_ID
       
# Create attribute with single value
tructl attributes create \
       --name "test1" \
       --rule "ANY_OF" \
       --namespace $NAMESPACE_ID \
       --values "test-a"

# Create attribute with multi value
tructl attributes create \
       --name "test1" \
       --rule "ANY_OF" \
       --namespace $NAMESPACE_ID \
       --values "test-a" \
       --values "test-b" \
       --values "test-c"

@jrschumacher jrschumacher linked an issue Feb 5, 2024 that may be closed by this pull request
@jrschumacher jrschumacher changed the title Jrschumacher/issue34 feat(policy): add cli crud for attributes Feb 5, 2024
flagHelper := cli.NewFlagHelper(cmd)
id := flagHelper.GetRequiredString("id")

if _, err := h.UpdateAttribute(id); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we holding off on an implementation for this until the policy api issues are handled? If so, that makes sense to me.

Policy api issues: [https://github.com/opentdf/platform/issues/115, https://github.com/opentdf/platform/issues/114, https://github.com/opentdf/platform/issues/108]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakedoublev yea I should have added a comment to let users know it's in flight

{"Namespace", a.Namespace},
}...).Render(),
)
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use the same --json global output flag and "full output" suggestion prompt as with subject mappings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'll add this as a separate ticket. Still thinking about how to abstract this in a way where we don't have to think about it.

I think I'll have to do some reflection.

@jrschumacher jrschumacher merged commit ec70a83 into main Feb 6, 2024
5 checks passed
@jrschumacher jrschumacher deleted the jrschumacher/issue34 branch February 6, 2024 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update CLI attribute definitions CRUD commands
2 participants