Security group seems awkward
The more I see of how the cli is forming, the more I get concerned about how this will work. If we take a step back and just work on a simple use case. I want to create a security group that defines some set of rules that applies to a set of spaces that span organizations.
Currently the API allows, create-security-group mysecuritygroup --rules [my_rules] --space myspace
But this doesn't seem possible. Although it looks like there is no way to update anything yet. Just throwing it out there now.
We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/74063514.
Moving this to the CLI tracker.
Edit: Just realized that space names are only unique within the context of an org. That makes this ... very awkward indeed.
And will I be able to add a space or update the rules later?
We commented on the story in tracker, but just to bring the conversation here -- we're considering adding new commands to associate / remove spaces from a security group. That way create and update are much, much simpler. How does that strike you, @fraenkel?
Can't update tracker. But yes, those commands would help. One could also come up with something like an org/space naming but --space wouldn't work. And having --org --space would seem a bit awkward. But starting with the basic operations I think will give us a starting point.
What also strikes me odd is that the defaults are just a boolean so why a separate command? Just mark the security group as --default-running --default-staging. The alternative is close to what you have but allow me to specify multiple groups. One seems a bit limiting.
So we're going to change the CLI commands to the following:
- create/read/update delete of the security group
- name specified on the CLI
- rules input via file (triplets of)
- destination
- ports
- type
- assignment of a group to a set of spaces
- rules input via file (pairs of)
- org
- space
- rules input via file (pairs of)
- assignment to staging defaults
- assignment to the running defaults
Sounds good.
Rules are a bit more complicated. There is a common set across all protocols but tcp/udp have ports, icmp has type and code, and all allows nothing additional.
Thanks for reminding me on that. I think there will be both json and csv input.
@fraenkel have you had a chance to see how the cf assign-security-group and cf unassign-security-group commands work? That should be a fairly straightforward way of associating security groups to a space.
Trying to help elucidate what more we can do to close this issue for now. We're inclined to mark these commands as "experimental" for a release or two while we shore up the user experience.
We can close this for now and see how people like the new API and function before we call this "done".