def get_target_proxy(properties, res_name, project_id, bs_resources):
    ' Creates a target proxy resource. '
    protocol = get_protocol(properties)
    depends = []
    if ('HTTP' in protocol):
        urlMap = copy.deepcopy(properties['urlMap'])
        if (('name' not in urlMap) and ('name' in properties)):
            urlMap['name'] = '{}-url-map'.format(properties['name'])
        (target, resources, outputs) = get_url_map(urlMap, '{}-url-map'.format(res_name), project_id)
        depends.append(resources[0]['name'])
    else:
        depends.append(bs_resources[0]['name'])
        target = get_ref(bs_resources[0]['name'])
        resources = []
        outputs = []
    name = '{}-target'.format(res_name)
    proxy = {'name': name, 'type': 'target_proxy.py', 'properties': {'name': '{}-target'.format(properties.get('name', res_name)), 'project': project_id, 'protocol': protocol, 'target': target}, 'metadata': {'dependsOn': [depends]}}
    for prop in ['proxyHeader', 'quicOverride']:
        set_optional_property(proxy['properties'], properties, prop)
    outputs.extend([{'name': 'targetProxyName', 'value': '$(ref.{}.name)'.format(name)}, {'name': 'targetProxySelfLink', 'value': '$(ref.{}.selfLink)'.format(name)}, {'name': 'targetProxyKind', 'value': '$(ref.{}.kind)'.format(name)}])
    if ('ssl' in properties):
        ssl_spec = properties['ssl']
        proxy['properties']['ssl'] = ssl_spec
        creates_new_certificate = (not ('url' in ssl_spec['certificate']))
        if creates_new_certificate:
            outputs.extend([{'name': 'certificateName', 'value': '$(ref.{}.certificateName)'.format(name)}, {'name': 'certificateSelfLink', 'value': '$(ref.{}.certificateSelfLink)'.format(name)}])
    return (([proxy] + resources), outputs)
Creates a target proxy resource.
def get_target_proxy(properties, res_name, project_id, bs_resources):
    '  '
    protocol = get_protocol(properties)
    depends = []
    if ('HTTP' in protocol):
        urlMap = copy.deepcopy(properties['urlMap'])
        if (('name' not in urlMap) and ('name' in properties)):
            urlMap['name'] = '{}-url-map'.format(properties['name'])
        (target, resources, outputs) = get_url_map(urlMap, '{}-url-map'.format(res_name), project_id)
        depends.append(resources[0]['name'])
    else:
        depends.append(bs_resources[0]['name'])
        target = get_ref(bs_resources[0]['name'])
        resources = []
        outputs = []
    name = '{}-target'.format(res_name)
    proxy = {'name': name, 'type': 'target_proxy.py', 'properties': {'name': '{}-target'.format(properties.get('name', res_name)), 'project': project_id, 'protocol': protocol, 'target': target}, 'metadata': {'dependsOn': [depends]}}
    for prop in ['proxyHeader', 'quicOverride']:
        set_optional_property(proxy['properties'], properties, prop)
    outputs.extend([{'name': 'targetProxyName', 'value': '$(ref.{}.name)'.format(name)}, {'name': 'targetProxySelfLink', 'value': '$(ref.{}.selfLink)'.format(name)}, {'name': 'targetProxyKind', 'value': '$(ref.{}.kind)'.format(name)}])
    if ('ssl' in properties):
        ssl_spec = properties['ssl']
        proxy['properties']['ssl'] = ssl_spec
        creates_new_certificate = (not ('url' in ssl_spec['certificate']))
        if creates_new_certificate:
            outputs.extend([{'name': 'certificateName', 'value': '$(ref.{}.certificateName)'.format(name)}, {'name': 'certificateSelfLink', 'value': '$(ref.{}.certificateSelfLink)'.format(name)}])
    return (([proxy] + resources), outputs)