def _validate_relationship_fields(rel_obj, plugins, rel_name, resource_base):
    for interfaces in [constants.SOURCE_INTERFACES,
                       constants.TARGET_INTERFACES]:
        for interface_name, interface in rel_obj[interfaces].items():
            operation.process_interface_operations(
                interface=interface,
                plugins=plugins,
                error_code=19,
                partial_error_message="Relationship '{0}'".format(rel_name),
                resource_bases=resource_base)
示例#2
0
def _validate_relationship_fields(rel_obj, plugins, rel_name, resource_base):
    for interfaces in [
            constants.SOURCE_INTERFACES, constants.TARGET_INTERFACES
    ]:
        for interface_name, interface in rel_obj[interfaces].items():
            operation.process_interface_operations(
                interface=interface,
                plugins=plugins,
                error_code=19,
                partial_error_message="Relationship '{0}'".format(rel_name),
                resource_base=resource_base)
def _process_operations(partial_error_message, interfaces, plugins, error_code,
                        resource_base):
    operations = {}
    for interface_name, interface in interfaces.items():
        interface_operations = \
            _operation.process_interface_operations(
                interface=interface,
                plugins=plugins,
                error_code=error_code,
                partial_error_message=(
                    "In interface '{0}' {1}".format(interface_name,
                                                    partial_error_message)),
                resource_bases=resource_base)
        for operation in interface_operations:
            operation_name = operation.pop('name')
            if operation_name in operations:
                # Indicate this implicit operation name needs to be
                # removed as we can only
                # support explicit implementation in this case
                operations[operation_name] = None
            else:
                operations[operation_name] = operation
            operations['{0}.{1}'.format(interface_name,
                                        operation_name)] = operation

    return dict((operation_name, operation)
                for operation_name, operation in operations.iteritems()
                if operation is not None)
def _process_operations(partial_error_message,
                        interfaces,
                        plugins,
                        error_code,
                        resource_base):
    operations = {}
    for interface_name, interface in interfaces.items():
        interface_operations = \
            _operation.process_interface_operations(
                interface=interface,
                plugins=plugins,
                error_code=error_code,
                partial_error_message=(
                    "In interface '{0}' {1}".format(interface_name,
                                                    partial_error_message)),
                resource_base=resource_base)
        for operation in interface_operations:
            operation_name = operation.pop('name')
            if operation_name in operations:
                # Indicate this implicit operation name needs to be
                # removed as we can only
                # support explicit implementation in this case
                operations[operation_name] = None
            else:
                operations[operation_name] = operation
            operations['{0}.{1}'.format(interface_name,
                                        operation_name)] = operation

    return dict((operation_name, operation) for operation_name, operation in
                operations.iteritems() if operation is not None)