Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

feat: Adding firewall samples. #117

Merged
merged 8 commits into from
Sep 24, 2021
Merged

feat: Adding firewall samples. #117

merged 8 commits into from
Sep 24, 2021

Conversation

m-strzelczyk
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes b/198588179

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 3, 2021
@product-auto-label product-auto-label bot added api: compute Issues related to the googleapis/python-compute API. samples Issues that are directly related to samples. labels Sep 3, 2021
@snippet-bot
Copy link

snippet-bot bot commented Sep 3, 2021

Here is the summary of changes.

You are about to add 8 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@m-strzelczyk m-strzelczyk marked this pull request as ready for review September 6, 2021 13:40
@m-strzelczyk m-strzelczyk requested a review from a team as a code owner September 6, 2021 13:40
Copy link
Member

@rsamborski rsamborski left a comment

Choose a reason for hiding this comment

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

I have added couple suggestions.

samples/snippets/sample_firewall.py Outdated Show resolved Hide resolved
samples/snippets/sample_firewall.py Show resolved Hide resolved
samples/snippets/sample_firewall.py Outdated Show resolved Hide resolved
import uuid
rule_name = "firewall-sample-" + uuid.uuid4().hex[:10]
print(f'Creating firewall rule {rule_name}...')
create_firewall_rule(default_project_id, rule_name)
Copy link
Member

Choose a reason for hiding this comment

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

For usage in default values presentation we should probably mention that this will get priority of 1000. This code is not part of the sample, so maybe it should be added in the create_firewall_rule - similar to how we did it in set_usage_reports examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a comment, but I'm not sure how to gracefully add this to the create_firewall_rule sample, without adding the whole code block, which also contains call to functions from outside this sample.

I also expanded the comment in the create_firewall_rule function, to better explain what's going on around the priority.

@m-strzelczyk
Copy link
Contributor Author

@dinagraves can you please review? I don't think this sample will change in any meaningful way.

from sample_firewall import (
create_firewall_rule,
patch_firewall_priority,
delete_firewall_rule,
Copy link
Contributor

Choose a reason for hiding this comment

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

Alphabetical order please!

Copy link
Contributor

@dinagraves dinagraves left a comment

Choose a reason for hiding this comment

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

LGTM - please fix the Lint issue! Imports are in incorrect order.

@m-strzelczyk m-strzelczyk merged commit f32ec97 into main Sep 24, 2021
@m-strzelczyk m-strzelczyk deleted the sample-firewall branch September 24, 2021 12:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: compute Issues related to the googleapis/python-compute API. cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants