TheJumpCloud / jumpcloud-ruby-gem

Source code for JumpCloud's Ruby Gem, a Ruby-based SDK for the JumpCloud System Context API
3 stars 7 forks source link

Groups via API 2.0 #12

Open voltechs opened 7 years ago

voltechs commented 7 years ago

Please implement support for API 2.0 and groups!

run-o commented 6 years ago

@voltechs Hi there! We've just created a new repository for the Ruby API client which supports both APIs (v1 and v2), which includes groups support: https://github.com/TheJumpCloud/jcapi-ruby Thanks and sorry for the delay!

voltechs commented 6 years ago

Hi @run-o, I took a look at the new repo.

Can't say I'm terribly excited about it. Quite a bit of ceremony to do some simple things and it feels a bit convoluted. Currently our user-data.sh "bootstrap" script for our EC2 instances look a little something like this...

curl --silent --show-error --header 'x-connect-key: ${jumpcloud_key}' https://kickstart.jumpcloud.com/Kickstart | bash

sleep 1

# CONFIGURE JUMPCLOUD
gem install jumpcloud

sleep 5

# TODO: Find a way to get this into common.sh
# Cannot currently due to role
echo "require 'jumpcloud'
JumpCloud.set_system_name(\"${environment} - $EC2_ROLE (`hostname`)\")
JumpCloud.set_system_tags('${environment}', '$EC2_ROLE', '${environment}-$EC2_ROLE')" > /etc/jumpcloud_init.rb

# Init jumpcloud tags after a few intervals
echo "* * * * * ruby /etc/jumpcloud_init.rb" >> mycron; crontab mycron; rm mycron
    # ┬ ┬ ┬ ┬ ┬
    # │ │ │ │ └──── Day of week (0 - 7) (Sunday=0 or 7)
    # │ │ │ └────── Month (1 - 12)
    # │ │ └──────── Day of month (1 - 31)
    # │ └────────── Hour (0 - 23)
    # └──────────── Minute (0 - 59)

Frankly I only expected to have to change JumpCloud.set_system_tags to JumpCloud.set_system_groups. Now—it would appear—I must install the gem from GitHub, which means doing a git checkout, which means having git installed on the machines, which has it's own security implications. Furthermore I now need a full-fledged ruby script with a configuration block etc etc.

Am I overlooking something? Is there a replacement for the simple process I have currently with the new API?

jpvajda commented 6 years ago

@voltechs Just following up to see if this is still a problem for you. It seems you just want to run a script to set a group name instead of tag name to a system. Can you confirm if that is what you trying to solve for?

jpvajda commented 6 years ago

@voltechs it's possible you can solve your problem by reviewing our System Context API functionality: https://docs.jumpcloud.com/2.0/authentication-and-authorization/system-context