Skip to content

✨ feat(iaas): add securitygroup rules + simplify flags in securitygrouprule create - #342

Open
jfbus wants to merge 1 commit into
mainfrom
sgr_create
Open

jfbus wants to merge 1 commit into
mainfrom
sgr_create

Conversation

@jfbus

@jfbus jfbus commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds:

  • a new iaas securitygroup rules comand to list all rules (Inbound+Outbound) from a security group,
  • adds a new --ports flag (with a protocol[/fromPort[-toPort]] syntax) to iaas securitygrouprule create,
octl iaas securitygrouprule create --group-id sg-foo --ports icmp,tcp/22,tcp/8080-8081 --remote-ranges 0.0.0.0/0
  • adds a new iaas securitygrouprule delete, using the same syntax,
  • adds a sgr alias to securitygrouprule.

Type of Change

Please check the relevant option(s):

  • 🐛 Bug fix
  • ✨ New feature
  • 🧹 Code cleanup or refactor
  • 📝 Documentation update
  • 🔧 Build or CI-related change
  • 🔒 Security fix
  • Other (specify):

How Has This Been Tested?

Please describe the test strategy:

  • Manual testing
  • Unit tests
  • Integration tests
  • Not tested yet

Checklist

  • I have followed the Contributing Guidelines
  • I have added tests or explained why they are not needed
  • I have updated relevant documentation (README, examples, etc.)
  • My changes follow the Conventional Commits specification
  • My commits include appropriate Gitmoji

Additional Context

@github-actions github-actions Bot added the kind/feature New feature or request label Sep 14, 2026
@github-actions

Copy link
Copy Markdown

🔖 auto-tagging: Adding label "kind/feature"

@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown

DANGER : some flags have changed or have been deleted 😱

+octl_iaas_securitygroup_rules: -h
+octl_iaas_securitygroup_rules: --help
+octl_iaas_securitygroup_rules: -c
+octl_iaas_securitygroup_rules: --columns
+octl_iaas_securitygroup_rules: --config
+octl_iaas_securitygroup_rules: --dry-run
+octl_iaas_securitygroup_rules: --elapsed
+octl_iaas_securitygroup_rules: --watch
+octl_iaas_securitygroup_rules: --filter
+octl_iaas_securitygroup_rules: --interval
+octl_iaas_securitygroup_rules: --jq
+octl_iaas_securitygroup_rules: --max-pages
+octl_iaas_securitygroup_rules: --no-upgrade
+octl_iaas_securitygroup_rules: -O
+octl_iaas_securitygroup_rules: --out-file
+octl_iaas_securitygroup_rules: -o
+octl_iaas_securitygroup_rules: --output
+octl_iaas_securitygroup_rules: --payload
+octl_iaas_securitygroup_rules: --profile
+octl_iaas_securitygroup_rules: -s
+octl_iaas_securitygroup_rules: --silent
+octl_iaas_securitygroup_rules: --single
+octl_iaas_securitygroup_rules: --style
+octl_iaas_securitygroup_rules: --template
+octl_iaas_securitygroup_rules: -v
+octl_iaas_securitygroup_rules: --verbose
+octl_iaas_securitygroup_rules: --waitfor
+octl_iaas_securitygroup_rules: --waitfor-timeout
+octl_iaas_securitygroup_rules: --watch
+octl_iaas_securitygroup_rules: -y
+octl_iaas_securitygroup_rules: --yes
@@ -15645,2 +15675,0 @@
-octl_iaas_securitygrouprule_create: --from-port-range
-octl_iaas_securitygrouprule_create: --group-account-id-to-link
@@ -15648 +15676,0 @@
-octl_iaas_securitygrouprule_create: --group-name-to-link
@@ -15651,14 +15679,6 @@
-octl_iaas_securitygrouprule_create: --ip-protocol
-octl_iaas_securitygrouprule_create: -1
-octl_iaas_securitygrouprule_create: --ip-range
-octl_iaas_securitygrouprule_create: --rule-from-port-range
-octl_iaas_securitygrouprule_create: --rule-ip-protocol
-octl_iaas_securitygrouprule_create: -1
-octl_iaas_securitygrouprule_create: --rule-ip-range
-octl_iaas_securitygrouprule_create: --rule-security-group-member-account-id
-octl_iaas_securitygrouprule_create: --rule-security-group-member-security-group-id
-octl_iaas_securitygrouprule_create: --rule-security-group-member-security-group-name
-octl_iaas_securitygrouprule_create: --rule-security-group-rule-id
-octl_iaas_securitygrouprule_create: --rule-service-id
-octl_iaas_securitygrouprule_create: --rule-to-port-range
-octl_iaas_securitygrouprule_create: --to-port-range
+octl_iaas_securitygrouprule_create: --ports
+octl_iaas_securitygrouprule_create: --remote-account
+octl_iaas_securitygrouprule_create: --remote-ranges
+octl_iaas_securitygrouprule_create: --remote-security-group
+octl_iaas_securitygrouprule_create: --remote-security-group-name
+octl_iaas_securitygrouprule_create: --remote-service
@@ -15693,0 +15714,39 @@
+octl_iaas_securitygrouprule_delete: --flow
+octl_iaas_securitygrouprule_delete: --group-id
+octl_iaas_securitygrouprule_delete: -h
+octl_iaas_securitygrouprule_delete: --help
+octl_iaas_securitygrouprule_delete: --ports
+octl_iaas_securitygrouprule_delete: --remote-account
+octl_iaas_securitygrouprule_delete: --remote-ranges
+octl_iaas_securitygrouprule_delete: --remote-security-group
+octl_iaas_securitygrouprule_delete: --remote-security-group-name
+octl_iaas_securitygrouprule_delete: --remote-service
+octl_iaas_securitygrouprule_delete: -c
+octl_iaas_securitygrouprule_delete: --columns
+octl_iaas_securitygrouprule_delete: --config
+octl_iaas_securitygrouprule_delete: --dry-run
+octl_iaas_securitygrouprule_delete: --elapsed
+octl_iaas_securitygrouprule_delete: --watch
+octl_iaas_securitygrouprule_delete: --filter
+octl_iaas_securitygrouprule_delete: --interval
+octl_iaas_securitygrouprule_delete: --jq
+octl_iaas_securitygrouprule_delete: --max-pages
+octl_iaas_securitygrouprule_delete: --no-upgrade
+octl_iaas_securitygrouprule_delete: -O
+octl_iaas_securitygrouprule_delete: --out-file
+octl_iaas_securitygrouprule_delete: -o
+octl_iaas_securitygrouprule_delete: --output
+octl_iaas_securitygrouprule_delete: --payload
+octl_iaas_securitygrouprule_delete: --profile
+octl_iaas_securitygrouprule_delete: -s
+octl_iaas_securitygrouprule_delete: --silent
+octl_iaas_securitygrouprule_delete: --single
+octl_iaas_securitygrouprule_delete: --style
+octl_iaas_securitygrouprule_delete: --template
+octl_iaas_securitygrouprule_delete: -v
+octl_iaas_securitygrouprule_delete: --verbose
+octl_iaas_securitygrouprule_delete: --waitfor
+octl_iaas_securitygrouprule_delete: --waitfor-timeout
+octl_iaas_securitygrouprule_delete: --watch
+octl_iaas_securitygrouprule_delete: -y
+octl_iaas_securitygrouprule_delete: --yes

Set a "allow-flag-change" label to allow it.

@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown

WARNING : Differences in reference doc 🤔

 docs/reference/octl_iaas_securitygroup.md          |  1 +
 docs/reference/octl_iaas_securitygroup_rules.md    | 51 ++++++++++++++++
 docs/reference/octl_iaas_securitygrouprule.md      |  1 +
 .../octl_iaas_securitygrouprule_create.md          | 27 +++------
 .../octl_iaas_securitygrouprule_delete.md          | 70 ++++++++++++++++++++++
 5 files changed, 132 insertions(+), 18 deletions(-)
Detailed changes

docs/reference/octl_iaas_securitygroup.md

+* [octl iaas securitygroup rules](octl_iaas_securitygroup_rules.md)	 - Lists all rules from a security group.

docs/reference/octl_iaas_securitygroup_rules.md

new file mode 100644
+## octl iaas securitygroup rules
+
+Lists all rules from a security group.
+
+### Synopsis
+
+Lists all rules from a security group.
+
+> alias for ReadSecurityGroups
+
+```
+octl iaas securitygroup rules id [flags]
+```
+
+### Options
+
+```
+  -h, --help   help for rules
+```
+
+### Options inherited from parent commands
+
+```
+  -c, --columns string             columns to display - [+]<title>:<jq query for content>||<title>:<jq query for content>
+      --config string              Path of profile file (by default, ~/.osc/config.json)
+      --dry-run                    Display the request payload that would be sent to the API without sending it
+      --elapsed                    add elapsed time column when using --watch (default true)
+      --filter strings             comma separated list of filters for results - name:value,name:value, alias for jq filter 'select(.name | tostring | test("value"))'
+      --interval duration          interval between two watch/waitfor iterations (default 5s)
+      --jq string                  jq filter
+      --max-pages int              maximum number of pages a command can fetch (default 20)
+      --no-upgrade                 do not check for new versions
+  -O, --out-file string            redirect output to file
+  -o, --output string              output format (json, yaml, raw, rawyaml, table, csv, none, text)
+      --payload string             JSON content for query body
+      --profile string             Profile to use in profile file (by default, "default")
+  -s, --silent                     Hides all information messages
+      --single                     convert single entry lists to a single object
+      --style string               style to use for syntax-highlighting (doom-one, github, monokai, nord, paraiso, solarized) (default "github")
+      --template string            JSON template file for query body
+  -v, --verbose                    Verbose output
+      --waitfor string             repeatedly call the API until the specified jq expression returns 1/true or a non empty result
+      --waitfor-timeout duration   maximum duration of a wait (default 10m0s)
+      --watch                      repeatedly call the API and display changes
+  -y, --yes                        answer yes to all prompts
+```
+
+### SEE ALSO
+
+* [octl iaas securitygroup](octl_iaas_securitygroup.md)	 - Manage SecurityGroup resources
+

docs/reference/octl_iaas_securitygrouprule.md

+* [octl iaas securitygrouprule delete](octl_iaas_securitygrouprule_delete.md)	 - Deletes one or more inbound or outbound rules from a security group.

docs/reference/octl_iaas_securitygrouprule_create.md

-      --flow string                                             [REQUIRED] The direction of the flow: Inbound or Outbound.
-      --from-port-range int                                     The beginning of the port range for the TCP and UDP protocols, or an ICMP type number.
-      --group-account-id-to-link string                         The OUTSCALE account ID that owns the source or destination security group specified in the SecurityGroupNameToLink parameter.
+      --flow string                         [REQUIRED] The direction of the flow: Inbound or Outbound. (default "Inbound")
-      --group-name-to-link string                               The ID of a source or destination security group that you want to link to the security group of the rule.
-      --ip-protocol string                                      The IP protocol name (tcp, udp, icmp, or -1 for all protocols).
-      --ip-range string                                         The IP range for the security group rule, in CIDR notation (for example, 10.0.0.0/16).
-      --rule-from-port-range int                                The beginning of the port range for the TCP and UDP protocols, or an ICMP type number.
-      --rule-ip-protocol string                                 The IP protocol name (tcp, udp, icmp, or -1 for all protocols).
-      --rule-ip-range strings                                   One or more IP ranges for the security group rules, in CIDR notation (for example, ["10.0.0.0/24" , "10.0.1.0/24"]).
-      --rule-security-group-member-account-id string            The OUTSCALE account ID that owns the source or destination security group.
-      --rule-security-group-member-security-group-id string     The ID of a source or destination security group that you want to link to the security group of the rule.
-      --rule-security-group-member-security-group-name string   The name of a source or destination security group that you want to link to the security group of the rule.
-      --rule-security-group-rule-id string                      The ID of the security group rule.
-      --rule-service-id strings                                 One or more service IDs to allow traffic from a Net to access the corresponding OUTSCALE services.
-      --rule-to-port-range int                                  The end of the port range for the TCP and UDP protocols, or an ICMP code number.
-      --to-port-range int                                       The end of the port range for the TCP and UDP protocols, or an ICMP code number.
+      --ports strings                       A list of either protocol (all ports from a protocol, e.g. icmp), protocol/port (a single port/protocol, e.g. tcp/80) or protocol/from-to (a range, e.g. tcp/8080-8082)
+      --remote-account string               The OUTSCALE account ID that owns the source or destination security group.
+      --remote-ranges strings               One or more IP ranges for the security group rules, in CIDR notation (for example, ["10.0.0.0/24" , "10.0.1.0/24"]).
+      --remote-security-group string        The ID of a source or destination security group that you want to link to the security group of the rule.
+      --remote-security-group-name string   The name of a source or destination security group that you want to link to the security group of the rule.
+      --remote-service strings              One or more service IDs to allow traffic from a Net to access the corresponding OUTSCALE services.

docs/reference/octl_iaas_securitygrouprule_delete.md

new file mode 100644
+## octl iaas securitygrouprule delete
+
+Deletes one or more inbound or outbound rules from a security group.
+
+### Synopsis
+
+Deletes one or more inbound or outbound rules from a security group.
+
+For the rule to be deleted, the values specified in the deletion request must exactly match the value of the existing rule.
+
+In case of TCP and UDP protocols, you have to indicate the destination port or range of ports. In case of ICMP protocol, you have to specify the ICMP type and code numbers.
+
+Rules (IP permissions) consist of the protocol, IP range or source security group.
+
+To remove outbound access to a destination security group, we recommend to use a set of IP permissions. We also recommend to specify the protocol in a set of IP permissions.
+
+
+Alternatively, you can use the `Rules` parameter to delete several rules at the same time.
+
+> alias for DeleteSecurityGroupRule
+
+```
+octl iaas securitygrouprule delete [flags]
+```
+
+### Options
+
+```
+      --flow string                         [REQUIRED] The direction of the flow: Inbound or Outbound. (default "Inbound")
+      --group-id string                     [REQUIRED] The ID of the security group you want to delete a rule from.
+  -h, --help                                help for delete
+      --ports strings                       A list of either protocol (all ports from a protocol, e.g. icmp), protocol/port (a single port/protocol, e.g. tcp/80) or protocol/from-to (a range, e.g. tcp/8080-8082)
+      --remote-account string               The OUTSCALE account ID that owns the source or destination security group.
+      --remote-ranges strings               One or more IP ranges for the security group rules, in CIDR notation (for example, ["10.0.0.0/24" , "10.0.1.0/24"]).
+      --remote-security-group string        The ID of a source or destination security group that you want to link to the security group of the rule.
+      --remote-security-group-name string   The name of a source or destination security group that you want to link to the security group of the rule.
+      --remote-service strings              One or more service IDs to allow traffic from a Net to access the corresponding OUTSCALE services.
+```
+
+### Options inherited from parent commands
+
+```
+  -c, --columns string             columns to display - [+]<title>:<jq query for content>||<title>:<jq query for content>
+      --config string              Path of profile file (by default, ~/.osc/config.json)
+      --dry-run                    Display the request payload that would be sent to the API without sending it
+      --elapsed                    add elapsed time column when using --watch (default true)
+      --filter strings             comma separated list of filters for results - name:value,name:value, alias for jq filter 'select(.name | tostring | test("value"))'
+      --interval duration          interval between two watch/waitfor iterations (default 5s)
+      --jq string                  jq filter
+      --max-pages int              maximum number of pages a command can fetch (default 20)
+      --no-upgrade                 do not check for new versions
+  -O, --out-file string            redirect output to file
+  -o, --output string              output format (json, yaml, raw, rawyaml, table, csv, none, text)
+      --payload string             JSON content for query body
+      --profile string             Profile to use in profile file (by default, "default")
+  -s, --silent                     Hides all information messages
+      --single                     convert single entry lists to a single object
+      --style string               style to use for syntax-highlighting (doom-one, github, monokai, nord, paraiso, solarized) (default "github")
+      --template string            JSON template file for query body
+  -v, --verbose                    Verbose output
+      --waitfor string             repeatedly call the API until the specified jq expression returns 1/true or a non empty result
+      --waitfor-timeout duration   maximum duration of a wait (default 10m0s)
+      --watch                      repeatedly call the API and display changes
+  -y, --yes                        answer yes to all prompts
+```
+
+### SEE ALSO
+
+* [octl iaas securitygrouprule](octl_iaas_securitygrouprule.md)	 - Manage SecurityGroupRule resources
+

@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown

Binary size: 82.3MB => 82.3MB (change +16KB, +0.0%) 😉

@jfbus
jfbus force-pushed the sgr_create branch 6 times, most recently from 6b7e931 to a10059d Compare September 15, 2026 14:23
@jfbus
jfbus marked this pull request as ready for review September 15, 2026 14:23
@jfbus
jfbus requested a review from a team September 15, 2026 14:23
@jfbus
jfbus requested a review from a team as a code owner September 15, 2026 14:23
@jfbus jfbus added the allow-flag-change ☢️ allow changes in existing flags label Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-flag-change ☢️ allow changes in existing flags kind/feature New feature or request

Development

Successfully merging this pull request may close these issues.

1 participant