Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes Resource Serialization #26

Closed
lwander opened this issue Jun 8, 2017 · 2 comments
Closed

Kubernetes Resource Serialization #26

lwander opened this issue Jun 8, 2017 · 2 comments

Comments

@lwander
Copy link
Contributor

lwander commented Jun 8, 2017

Hi team,

Assuming I have the JSON representation of some Kubernetes resource retrieved from the Kubernetes API server - would I be able to deserialize this into the corresponding resource in this client library? For example, would something like this work?

V1Pod v1pod = new ObjectMapper().convertValue(jsonPayload, V1Pod.class)

Poking through the generated code I don't see why not, but just wanted to make sure that this is the intended behavior.

Thanks

@brendandburns
Copy link
Contributor

I have not tested this, but this should work:

 Gson gson = new Gson() ;
 V1Pod pod = gson.fromJson(jsonFile, V1Pod.class) ;

Now if you want us to do the API detection for you and then parse out the right version, that'd be trickier...

@brendandburns
Copy link
Contributor

Closing this because I believe the question is answered, please re-open if it doesn't work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants