Search in sources :

Example 11 with ConfigNode

use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.

the class MethodMerger method generateTimeout.

private void generateTimeout(ConfigNode prevNode, MethodModel method) {
    ConfigNode timeoutMillisNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(prevNode), "timeout_millis", methodTransformer.getTimeoutMillis(method)).setComment(new FixmeComment("Configure the default timeout for a non-retrying call."));
    prevNode.insertNext(timeoutMillisNode);
}
Also used : FixmeComment(com.google.api.codegen.configgen.nodes.metadata.FixmeComment) ConfigNode(com.google.api.codegen.configgen.nodes.ConfigNode) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode)

Example 12 with ConfigNode

use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.

the class PageStreamingMerger method generatePageStreamingResponseNode.

private ConfigNode generatePageStreamingResponseNode(ConfigNode prevNode, MethodModel method) {
    ConfigNode responseNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "response");
    ConfigNode responseValueNode = pageStreamingTransformer.generateResponseValueNode(responseNode, method, helper);
    if (!responseValueNode.isPresent()) {
        return null;
    }
    prevNode.insertNext(responseNode);
    return responseNode;
}
Also used : FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) NullConfigNode(com.google.api.codegen.configgen.nodes.NullConfigNode) ConfigNode(com.google.api.codegen.configgen.nodes.ConfigNode)

Example 13 with ConfigNode

use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.

the class RetryMerger method generateRetryCodeDefNode.

private ConfigNode generateRetryCodeDefNode(int startLine, String name, List<String> codes) {
    ConfigNode retryCodeDefNode = new ListItemConfigNode(startLine);
    ConfigNode nameNode = FieldConfigNode.createStringPair(startLine, "name", name);
    retryCodeDefNode.setChild(nameNode);
    ConfigNode retryCodesNode = new FieldConfigNode(NodeFinder.getNextLine(nameNode), "retry_codes");
    nameNode.insertNext(retryCodesNode);
    ListTransformer.generateStringList(codes, retryCodesNode);
    return retryCodeDefNode;
}
Also used : FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) ConfigNode(com.google.api.codegen.configgen.nodes.ConfigNode)

Example 14 with ConfigNode

use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.

the class RetryMerger method generateRetryNamesNode.

public ConfigNode generateRetryNamesNode(ConfigNode prevNode, MethodModel method) {
    String retryCodesName = method.isIdempotent() ? RETRY_CODES_IDEMPOTENT_NAME : RETRY_CODES_NON_IDEMPOTENT_NAME;
    ConfigNode retryCodesNameNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(prevNode), "retry_codes_name", retryCodesName).setComment(new FixmeComment("Configure the retryable codes for this method."));
    prevNode.insertNext(retryCodesNameNode);
    ConfigNode retryParamsNameNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(retryCodesNameNode), "retry_params_name", RETRY_PARAMS_DEFAULT_NAME).setComment(new FixmeComment("Configure the retryable params for this method."));
    retryCodesNameNode.insertNext(retryParamsNameNode);
    return retryParamsNameNode;
}
Also used : FixmeComment(com.google.api.codegen.configgen.nodes.metadata.FixmeComment) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) ConfigNode(com.google.api.codegen.configgen.nodes.ConfigNode)

Example 15 with ConfigNode

use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.

the class RetryMerger method generateRetryParamDefNode.

private ConfigNode generateRetryParamDefNode(int startLine, String name) {
    ConfigNode retryParamDefNode = new ListItemConfigNode(startLine);
    ConfigNode nameNode = FieldConfigNode.createStringPair(startLine, "name", name);
    retryParamDefNode.setChild(nameNode);
    ConfigNode initialRetryDelayMillisNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(nameNode), "initial_retry_delay_millis", "100");
    nameNode.insertNext(initialRetryDelayMillisNode);
    ConfigNode retryDelayMultiplierNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(initialRetryDelayMillisNode), "retry_delay_multiplier", "1.3");
    initialRetryDelayMillisNode.insertNext(retryDelayMultiplierNode);
    ConfigNode maxRetryDelayMillisNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(retryDelayMultiplierNode), "max_retry_delay_millis", "60000");
    retryDelayMultiplierNode.insertNext(maxRetryDelayMillisNode);
    ConfigNode initialRpcTimeoutMillisNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(maxRetryDelayMillisNode), "initial_rpc_timeout_millis", "20000");
    maxRetryDelayMillisNode.insertNext(initialRpcTimeoutMillisNode);
    ConfigNode rpcTimeoutMultiplierNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(initialRpcTimeoutMillisNode), "rpc_timeout_multiplier", "1");
    initialRpcTimeoutMillisNode.insertNext(rpcTimeoutMultiplierNode);
    ConfigNode maxRpcTimeoutMillisNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(rpcTimeoutMultiplierNode), "max_rpc_timeout_millis", "20000");
    rpcTimeoutMultiplierNode.insertNext(maxRpcTimeoutMillisNode);
    ConfigNode totalTimeoutMillisNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(maxRpcTimeoutMillisNode), "total_timeout_millis", "600000");
    maxRpcTimeoutMillisNode.insertNext(totalTimeoutMillisNode);
    return retryParamDefNode;
}
Also used : ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) ConfigNode(com.google.api.codegen.configgen.nodes.ConfigNode)

Aggregations

ConfigNode (com.google.api.codegen.configgen.nodes.ConfigNode)39 FieldConfigNode (com.google.api.codegen.configgen.nodes.FieldConfigNode)35 ListItemConfigNode (com.google.api.codegen.configgen.nodes.ListItemConfigNode)22 ScalarConfigNode (com.google.api.codegen.configgen.nodes.ScalarConfigNode)12 NullConfigNode (com.google.api.codegen.configgen.nodes.NullConfigNode)11 Test (org.junit.Test)5 MappingNode (org.yaml.snakeyaml.nodes.MappingNode)5 DefaultComment (com.google.api.codegen.configgen.nodes.metadata.DefaultComment)4 FixmeComment (com.google.api.codegen.configgen.nodes.metadata.FixmeComment)4 Node (org.yaml.snakeyaml.nodes.Node)4 FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)3 ScalarNode (org.yaml.snakeyaml.nodes.ScalarNode)3 SequenceNode (org.yaml.snakeyaml.nodes.SequenceNode)3 ConfigHelper (com.google.api.codegen.configgen.ConfigHelper)2 ConfigYamlReader (com.google.api.codegen.configgen.ConfigYamlReader)2 MessageGenerator (com.google.api.codegen.configgen.MessageGenerator)2 File (java.io.File)2 NodeTuple (org.yaml.snakeyaml.nodes.NodeTuple)2 FieldModel (com.google.api.codegen.config.FieldModel)1 ProtoConfigMerger (com.google.api.codegen.configgen.mergers.ProtoConfigMerger)1