Skip to content

Instantly share code, notes, and snippets.

@cleibl
Last active April 2, 2019 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleibl/e6654edf646b5a0b7b48da9652c13458 to your computer and use it in GitHub Desktop.
Save cleibl/e6654edf646b5a0b7b48da9652c13458 to your computer and use it in GitHub Desktop.
Create Service and call a function
# Create Client for the Compute Engine API
service = create_service()
print('Describing Firewall')
# Checks if the Firewall is disabled. Returns True/Faalse
disabled = check_for_disabled(project_id,service,firewall_name)
# Gets the Allowed Source Ranges for the firewall rule. Returns a list of CIDR Blocks
source_ranges = get_source_ranges(project_id, service, firewall_name)
# Checks if the Firewall is an "Allow All" Rule. Returns True/False
allow_all = check_for_allowed_all(project_id, service, firewall_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment