use of com.google.api.tools.framework.model.Interface in project toolkit by googleapis.
the class LanguageSettingsRule method getPackageName.
private String getPackageName(Model model) {
String apiName = model.getServiceConfig().getApis(0).getName();
Interface apiInterface = model.getSymbolTable().lookupInterface(apiName);
return apiInterface.getFile().getFullName();
}
use of com.google.api.tools.framework.model.Interface in project toolkit by googleapis.
the class GapicInterfaceConfig method createMethodConfigMap.
private static ImmutableMap<String, GapicMethodConfig> createMethodConfigMap(DiagCollector diagCollector, String language, InterfaceConfigProto interfaceConfigProto, Interface apiInterface, ResourceNameMessageConfigs messageConfigs, ImmutableMap<String, ResourceNameConfig> resourceNameConfigs, ImmutableSet<String> retryCodesConfigNames, ImmutableSet<String> retryParamsConfigNames) {
ImmutableMap.Builder<String, GapicMethodConfig> methodConfigMapBuilder = ImmutableMap.builder();
for (MethodConfigProto methodConfigProto : interfaceConfigProto.getMethodsList()) {
Interface targetInterface = getTargetInterface(apiInterface, methodConfigProto.getRerouteToGrpcInterface());
Method method = targetInterface.lookupMethod(methodConfigProto.getName());
if (method == null) {
diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL, "method not found: %s", methodConfigProto.getName()));
continue;
}
GapicMethodConfig methodConfig = GapicMethodConfig.createMethodConfig(diagCollector, language, methodConfigProto, method, messageConfigs, resourceNameConfigs, retryCodesConfigNames, retryParamsConfigNames);
if (methodConfig == null) {
continue;
}
methodConfigMapBuilder.put(methodConfigProto.getName(), methodConfig);
}
if (diagCollector.getErrorCount() > 0) {
return null;
} else {
return methodConfigMapBuilder.build();
}
}
Aggregations