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 #
22 lines
711 B
Ruby
22 lines
711 B
Ruby
# frozen_string_literal: true
|
|
|
|
Gem::Specification.new do |s|
|
|
s.name = "ubicloud"
|
|
s.version = "0.1.0"
|
|
s.summary = "Ubicloud Ruby SDK"
|
|
s.authors = ["Ubicloud, Inc."]
|
|
s.email = ["ruby-gem-owner@ubicloud.com"]
|
|
s.homepage = "https://github.com/ubicloud/ubicloud/tree/main/sdk/ruby"
|
|
s.license = "MIT"
|
|
s.required_ruby_version = ">= 3.1"
|
|
|
|
s.metadata = {
|
|
"bug_tracker_uri" => "https://github.com/ubicloud/ubicloud/issues",
|
|
"mailing_list_uri" => "https://github.com/ubicloud/ubicloud/discussions/new?category=q-a",
|
|
"source_code_uri" => "https://github.com/ubicloud/ubicloud/tree/main/sdk/ruby"
|
|
}
|
|
|
|
s.files = %w[MIT-LICENSE] + Dir["lib/**/*.rb"]
|
|
s.extra_rdoc_files = %w[MIT-LICENSE]
|
|
end
|