Esempio n. 1
0
def AddServiceEndpointIfNeeded(context):
    """If the endpoint property is present, it will add a service endpoint."""
    prop = context.properties
    if ENDPOINT_NAME not in prop:
        return []
    network = common.MakeGlobalComputeLink(context, default.NETWORK)
    reference = '$(ref.' + MakeVMName(context) + '.name)'
    address = common.MakeFQHN(context, reference)
    name = prop[ENDPOINT_NAME]
    resource = [{
        'name': name,
        'type': default.ENDPOINT,
        'properties': {
            'address': address,
            'visibility': {
                'networks': [network]
            }
        }
    }]
    return resource
Esempio n. 2
0
def AddServiceEndpointIfNeeded(context):
    """If the endpoint property is present, it will add a service endpoint."""
    prop = context.properties
    if ENDPOINT_NAME not in prop:
        return []
    network = common.MakeNetworkComputeLink(context, prop[default.NETWORKS][0])
    reference = "$(ref." + MakeVMName(context) + ".name)"
    address = common.MakeFQHN(context, reference)
    name = prop[ENDPOINT_NAME]
    resource = [{
        "name": name,
        "type": default.ENDPOINT,
        "properties": {
            "addresses": [{
                "address": address
            }],
            "dnsIntegration": {
                "networks": [network]
            },
        },
    }]
    return resource