GithubHelp home page GithubHelp logo

Comments (3)

RaphaelPour avatar RaphaelPour commented on June 14, 2024

Server also as a bunch of more attributes:

  • id
  • created
  • image
  • server_type
  • datacenter
  • included_traffic
  • ingoing_traffic
  • outgoing_traffic
  • locked
  • name
  • primary_disk_size
  • rescue_enabled
  • status
  • backup_window
  • iso
  • labels (currently hash)
  • load_balancers (currently array)
  • placement_group
  • private_net (currently array)
  • protection ({"delete"=>false, "rebuild"=>false})
  • public_net (currently hash)
  • volumes (currently list)

At least load_balancers, private_net, public_net and volumes are collections of resources. The schema defined in entry_loader.rb maps the api response to objects, can't handle collections AFAIK. Either we extend the schema, create a collection resource for each one (VolumesCollection containing Volume objects) or create a generic Collection than can be initialized with the wanted resource schema(volumes: Collection(Volume)).

from hcloud-ruby.

 avatar commented on June 14, 2024

Went through the API docs and the code and found the following missing actions:

  • Network
    • change_ip_range
  • Server
    • Get metrics
    • add_to_placement_group
    • change_alias_ips
    • change_dns_ptr
    • remove_from_placement_group

The following attributes on existing actions are missing

  • Firewall
    • labels on update
  • Floating IPs
    • name on create
    • name, labels on update
  • Image
    • status, include_deprecated on get all
    • labels on update
  • Network
    • labels on update
  • Placement Groups
    • label_selector on get all
    • labels on update
  • Server
    • automount, firewalls, placement_group, public_net, volumes on create
    • labels on update
  • SSH key
    • fingerprint on get all
    • labels on update
  • Volume
    • status on get all
    • labels on update

from hcloud-ruby.

 avatar commented on June 14, 2024

It's probably good that the labels fields on :updatable are missing. I just checked what this does, because update(labels: {'foo': 'bar'}) works without problems. :updatable creates attr= methods, so fields can be changed with obj.name = 'new-name'. The changes can then be persisted using obj.save:

obj = client.load_balancers['old-name']
obj.name = 'new-name'
obj.save
# besides: call to save is currently broken, so nobody uses this feature

# alternative (which works):
obj.update({ name: 'new-name' })

For labels being a hash this does not work as expected (at least as I as a user would want to use it). The following code does not save the new label to the Cloud API.

obj = client.load_balancers['old-name']
obj.labels.merge({ 'label' => 'value' })
obj.save

tl;dr: I think we'll have to think a bit more about :updatable to make it work with objects (like hashes) that can be changed in other ways than assignments.

from hcloud-ruby.

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.