Uh oh!
There was an error while loading. Please reload this page.
Parse ResourceName into http endpoint path - #481
Conversation
Starting implementation for HTTP/JSON. This was tested by using the surface generated from https://github.com/googleapis/toolkit/tree/discogapic to list, get, insert, and delete Compute Address resources in a live Google Cloud project.
Exception handling and retry logic for http calls.
Merge in updates from the master branch.
…p http status codes to wrapper exception types
andreamlin
commented
Feb 22, 2018
Made the suggested changes. PTAL |
| @BetaApi | ||
| public interface ApiMessage { | ||
| /* For a each fieldName in a set of fieldNames, fetch that field's List<String> value. */ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| ApiMessage getRequestBody(); | ||
| ApiMessage getApiMessageRequestBody(); | ||
| Map<String, String> getApiMessagePathParams(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
andreamlin
commented
Feb 24, 2018
Made the suggested changes. PTAL |
| apiMessage.populateFieldsInMap(Collections.singleton(resourceNameField)); | ||
| String resourceNamePath = pathParamMap.get(resourceNameField).get(0); | ||
| return resourceNameInstance.parseFrom(resourceNamePath).getFieldValues(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| return pathParams; | ||
| public Map<String, String> getPathParams(T apiMessage, String resourceNameField) { | ||
| Map<String, List<String>> pathParamMap = | ||
| apiMessage.populateFieldsInMap(Collections.singleton(resourceNameField)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| public interface ResourceNameStruct extends ResourceName { | ||
| /* Fetch the comprehensive mapping of fieldNames to values. The set of keys of the resulting Map | ||
| should be constant, for a given instance of this interface. */ | ||
| Map<String, String> getFieldValues(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| Map<String, List<String>> pathParamMap = | ||
| apiMessage.populateFieldsInMap(Collections.singleton(resourceNameField)); | ||
| String resourceNamePath = pathParamMap.get(resourceNameField).get(0); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
andreamlin
commented
Feb 27, 2018
Blocked on googleapis/api-common-java#46. |
PTAL The gradle build task passes for me locally. |
| /* Return a new instance of this interface by parsing a formatted String. This should be treated as a static method. */ | ||
| ResourceNameStruct parseFrom(String formattedString); | ||
| } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
garrettjonesgoogle
commented
Mar 1, 2018
I believe that |
| String resourceNamePath = apiMessage.getFieldStringValue(resourceNameField); | ||
| if (resourceNamePath == null) { | ||
| throw new IOException( | ||
| String.format("Resource name field %s is null in message object.", resourceNameField)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| @Override | ||
| public Map<String, String> getPathParams(T apiMessage, String resourceNameField) | ||
| throws IOException { | ||
| throws IllegalArgumentException { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
andreamlin
commented
Mar 7, 2018
Ok, two api-common releases later and this build passes! Further comments welcome. PTAL |
Moving parsing of ResourceNames to gax-java (instead of generated message classes). See googleapis/gapic-generator#1847.