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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations