(context)
return instances
Generates a firewall if prop[ADD_FIREWALL] is true.
Generates a firewall if prop[ADD_FIREWALL] is true.
Generates a firewall if prop [ ADD_FIREWALL ] is true .
def GenerateFirewall(context):
  """Generates a firewall if prop[ADD_FIREWALL] is true."""
  name = context.env['name']
  prop = context.properties
  src_ranges = prop[SRC_RANGES]
  add_firewall = prop[ADD_FIREWALL]
  instances = []
  if add_firewall:
    # pyformat: disable
    instances.append({
        'name': common.AutoName(name, default.FIREWALL),
        'type': default.FIREWALL,
        'properties': {
            'sourceRanges': src_ranges,
            'allowed': [{
                'IPProtocol': prop[IP_PROTO],
                'ports': [prop[PORT]],
            }],
        }
    })
  # pyformat: enable
  return instances
def GenerateFirewall ( context ) : name = context . env [ 'name' ] prop = context . properties src_ranges = prop [ SRC_RANGES ] add_firewall = prop [ ADD_FIREWALL ] instances = [ ] if add_firewall : # pyformat: disable instances . append ( { 'name' : common . AutoName ( name , default . FIREWALL ) , 'type' : default . FIREWALL , 'properties' : { 'sourceRanges' : src_ranges , 'allowed' : [ { 'IPProtocol' : prop [ IP_PROTO ] , 'ports' : [ prop [ PORT ] ] , } ] , } } ) # pyformat: enable return instances