Giter Club home page Giter Club logo

Comments (4)

rodesousa avatar rodesousa commented on August 15, 2024

Why healthchecks will not be an arg ?

  def list_namespaced_healthchecks!(namespace, custom_resource, -opts) do
    %Kazan.Request{
      body: nil,
      method: "get",
      path: "/apis/group/v1alpha1/namespaces/#{namespace}/#{custom_resource}",
      query_params: %{},
      response_schema: %HealthcheckList{items: [%Healthcheck{}]} # here i don't know
    }
  end

from kazan.

obmarg avatar obmarg commented on August 15, 2024

Hi @drowzy - sorry for the delay getting back to you about this, the past month has been very busy at work and I've not had much spare time to focus on OS work.

This seems like a good idea to me. Seems like it might be easiest to expand Kazan.Request with an optional response_decoder field, which could just be a function that takes the response after it's been JSON decoded, and returns a struct of some sort. Would also let people override the decoding of built in types on a case by case basis if that's what they wanted to do.

I'd be happy to accept a PR around this if you're up for it - otherwise I'll try and get round to doing this at some point (though I can't guarantee when that'll be)

from kazan.

drowzy avatar drowzy commented on August 15, 2024

I understand and thank you for a great lib! I'll try making some time available and submit a PR

from kazan.

obmarg avatar obmarg commented on August 15, 2024

I've started some work on this in #65. Used a slightly different approach in the end - end users can now define their own CRDs by implementing the Kazan.Model behaviour for each CRD.

By default you can just provide a model_desc function that describes the format of your model, like so:

defmodule MyApp.MyCRD do
   use Kazan.Model
   alias Kazan.{ModelDesc, PropertyDesc}

   defstruct [:id]
   
   def model_desc() do
     %ModelDesc{
       properties: [
         %PropertyDesc{field: "id", type: "string"}
       ]
    }
  end
end

If you want more control, you can provide encode & decode functions for the CRD that bypass the default behaviour.

Haven't had a chance to test it out yet, but would be interested in any feedback.

from kazan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.