def METHOD_NAME(is_http, res_name, project_id, properties, optional_properties):
    """ Creates a TCP or HTTP Proxy resource. """
    if is_http:
        # https://cloud.google.com/compute/docs/reference/rest/v1/targetHttpProxies
        type_name = 'gcp-types/compute-v1:targetHttpProxies'
        target_prop = 'urlMap'
    else:
        # https://cloud.google.com/compute/docs/reference/rest/v1/targetTcpProxies
        type_name = 'gcp-types/compute-v1:targetTcpProxies'
        target_prop = 'service'
    resource_props = {
        'name': properties.get('name', res_name),
        'project': project_id,
    }
    resource = {'type': type_name, 'name': res_name, 'properties': resource_props}
    resource_props[target_prop] = properties['target']
    for prop in optional_properties:
        set_optional_property(resource_props, properties, prop)
    return [resource], []