-
Notifications
You must be signed in to change notification settings - Fork 152
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
droplet_kit documentation/help #84
Comments
Hi Ed, The full API documentation can be found at our developer's portal. It documents each endpoint provided by the API. If you look to the bottom right hand corner of that page, you'll see that you can toggle the examples. Selecting Ruby will give you examples using droplet_kit for each API call: https://developers.digitalocean.com/documentation/v2/ If you're more comfortable working in other programing languages, the developer's portal also has a list of client libraries provided by our community: https://developers.digitalocean.com/libraries/ Here's a minimal example for creating output like require 'droplet_kit'
token = ENV['DO_TOKEN']
client = DropletKit::Client.new(access_token: token)
droplets = client.droplets.all
droplets.each do |droplet|
print droplet.id.to_s + "\t"
print droplet.name.to_s + "\t"
print droplet.status.to_s + "\t"
print droplet.region.name.to_s + "\n"
end Hope that points you in the right direction. Let us know if we can do any more to help. |
That little ruby toggle button helps a lot!!! And thank you for the example! This will get me going in the right direction quite nicely! Cheers, |
Hi Guys! Thanks to @andrewsomething I am cruising right along with my scripts. I am managing with the ruby stuff well enough to get a job done, though I could use a tutor. ;-) But, my new issue is the user_data. I cannot seem to get it to work based on Step Three: Customization with User-Data. Can you please check my code? I am calling this from bash with Everything works but iptables does not shut down. Alternatively, I'd like to run a script that is already in the image, for example
What am I doing wrong? Please help. Cheers, |
Hey! I don't see anything wrong with the Ruby code. When debugging a cloud-config script, check the log files at This is getting a bit out of scope for an issue against |
Hello,
I am new to ruby and droplet_kit but I'm trying to learn. I have been using irb commands and not getting expected results. For example, after
I get the following result ()
=> #<DropletKit::PaginatedResource:0xb95191f4 @current_page=0, @total=nil, @action=#<ResourceKit::Action:0xb97308fc @name=:all, @verb=:get, @path="/v2/droplets", @query_keys=[:per_page, :page], @handlers={:any=>#<Proc:0xb9730a64@/opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/droplet_kit-1.3.3/lib/droplet_kit/error_handling_resourcable.rb:4>, 200=>#<Proc:0xb9730794@/opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/droplet_kit-1.3.3/lib/droplet_kit/resources/droplet_resource.rb:8>}>, @resource=#<DropletKit::DropletResource:0xb989dc6c @connection=#<Faraday::Connection:0xb95b859c @parallel_manager=nil, @headers={"Content-Type"=>"application/json", "Authorization"=>"Bearer SECRET", "User-Agent"=>"Faraday v0.9.2"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0xb95abfa4 @handlers=[Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTPS https://api.digitalocean.com/>, @proxy=nil>, @scope=nil>, @collection=[], @args=[], @options={}>
Just by guessing and trial and error, I was able to get a better result with
client.droplets.all.each
and I saw another example usingclient.droplets.all.first
but other than that, I have no idea what I am doing. :-)My question is, where can I find a list of all available and valid options to
client.droplets.all()
andclient.images.all()
etc.?My goal is to try to automate some things like taking snapshots (saw the snapshots.rb example but I need something more robust) and transferring the resulting images to different data centers and creating droplets based off those snapshot images. I'd like to be able to create some of the results I have seen with
knife digital_ocean
such as:Anything you can do to help would be greatly appreciated!
Cheers,
Ed
The text was updated successfully, but these errors were encountered: