Files
ubicloud/sdk/ruby/MIT-LICENSE
Jeremy Evans 7e335516a6 Add Ruby SDK
This adds a custom (i.e. not-autogenerated) Ruby SDK, designed specifically
around Ubicloud.  Examples of use:

```ruby
require "ubicloud"

# Setup SDK context
UBI = Ubicloud.new(:net_http, token: "YOUR_API_TOKEN", project_id: "pj...")

# Get list of VMs
UBI.vm.list

# Create a firewall
UBI.firewall.create(location: "eu-central-h1", name: "my-fw")

# Retrieive a load balancer,
lb = UBI["1b345678901234567890123456"]

# then destroy it
lb.destroy

# Schedule a PostgreSQL database restart
UBI.postgres.new("eu-central-h1/my-fw").restart
```

The SDK comes with two adapters, net_http and rack. net_http uses the
net/http standard library to submit HTTP requests.  rack directly calls
rack applications.  Users are expected to use net_http.  The following
commit will use the rack adapter to implement Ubicloud's CLI using the
Ruby SDK.

This adds a rake task to build the SDK gem.

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Tue Mar 25 17:01:03 2025 -0700
#
# On branch jeremy-ruby-sdk
# Changes to be committed:
#	modified:   .gitignore
#	modified:   Rakefile
#	new file:   sdk/ruby/MIT-LICENSE
#	new file:   sdk/ruby/README.md
#	new file:   sdk/ruby/lib/ubicloud.rb
#	new file:   sdk/ruby/lib/ubicloud/adapter.rb
#	new file:   sdk/ruby/lib/ubicloud/adapter/net_http.rb
#	new file:   sdk/ruby/lib/ubicloud/adapter/rack.rb
#	new file:   sdk/ruby/lib/ubicloud/context.rb
#	new file:   sdk/ruby/lib/ubicloud/model.rb
#	new file:   sdk/ruby/lib/ubicloud/model/firewall.rb
#	new file:   sdk/ruby/lib/ubicloud/model/load_balancer.rb
#	new file:   sdk/ruby/lib/ubicloud/model/postgres.rb
#	new file:   sdk/ruby/lib/ubicloud/model/private_subnet.rb
#	new file:   sdk/ruby/lib/ubicloud/model/vm.rb
#	new file:   sdk/ruby/lib/ubicloud/model_adapter.rb
#	new file:   sdk/ruby/ubicloud.gemspec
#	new file:   spec/ruby_sdk_spec.rb
#	modified:   spec/thawed_mock.rb
#
# Changes not staged for commit:
#	modified:   cli-commands/fw/post/add-rule.rb
#	modified:   cli-commands/fw/post/attach-subnet.rb
#	modified:   cli-commands/fw/post/create.rb
#	modified:   cli-commands/fw/post/delete-rule.rb
#	modified:   cli-commands/fw/post/detach-subnet.rb
#	modified:   cli-commands/fw/post/show.rb
#	modified:   cli-commands/lb/post/attach-vm.rb
#	modified:   cli-commands/lb/post/create.rb
#	modified:   cli-commands/lb/post/detach-vm.rb
#	modified:   cli-commands/lb/post/show.rb
#	modified:   cli-commands/lb/post/update.rb
#	modified:   cli-commands/pg/post/add-firewall-rule.rb
#	modified:   cli-commands/pg/post/add-metric-destination.rb
#	modified:   cli-commands/pg/post/create.rb
#	modified:   cli-commands/pg/post/delete-firewall-rule.rb
#	modified:   cli-commands/pg/post/delete-metric-destination.rb
#	modified:   cli-commands/pg/post/reset-superuser-password.rb
#	modified:   cli-commands/pg/post/restart.rb
#	modified:   cli-commands/pg/post/restore.rb
#	modified:   cli-commands/pg/post/show.rb
#	modified:   cli-commands/ps/post/connect.rb
#	modified:   cli-commands/ps/post/create.rb
#	modified:   cli-commands/ps/post/disconnect.rb
#	modified:   cli-commands/ps/post/show.rb
#	modified:   cli-commands/vm/post/create.rb
#	modified:   cli-commands/vm/post/restart.rb
#	modified:   cli-commands/vm/post/show.rb
#	modified:   lib/ubi_cli.rb
#	modified:   spec/routes/api/cli/golden-files/vm vmdzyppz6j166jh5e9t0dwrfas show.txt
#
2025-03-28 16:25:47 -07:00

22 lines
1.1 KiB
Plaintext

Ubicloud's Ruby SDK is released under the MIT license (the rest of Ubicloud
is released under the AGPL license).
Copyright (c) 2025 Ubicloud, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.