-
Notifications
You must be signed in to change notification settings - Fork 14
Add OpenAPI generated Power and VPC gems #8
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
Conversation
e5bcabf
to
e84735a
Compare
@agrare I see there is some IBM Cloud Ruby client over at https://github.com/IBM/ruby-sdk-core ... any reason we can't use that one (or update it if it's missing something? Also I see https://github.ibm.com/CloudEngineering/openapi-sdkgen, which seems to be how they generate the SDKs? I'm fine with recreating from the OpenAPI definitions, but was curious if we even need to.
Do you have external links to the OpenAPI specs that you used (so we know where to get them from for future updates)? Or perhaps even better, maybe we can add a bin/rebuild sceript or something that fetches them and runs the generator. |
gems/ibm_cloud_iam/.travis.yml
Outdated
rvm: | ||
- 2.3 | ||
- 2.4 | ||
- 2.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be updated.
You can get them from each API on https://cloud.ibm.com/apidocs For example, got to the Power Cloud API and click the verticle dots next to the title: |
@jaywcarman Strangely I can't find a direct URL (it does some kind of javascript thing). If we wanted to script pulling it down and running the generator, we'd need that. |
Got it...good ol' Firefox Network tab: https://cloud.ibm.com/apidocs/power-cloud.json |
@agrare I'm wondering if we should leave the original json files out, since they are so enormous. Thoughts? |
Yeah when we script building this first step can be downloading the current spec |
That didn't appear to have any generated classes for Power or VPC, it looked like https://github.com/IBM/ruby-sdk-core/blob/master/lib/ibm_cloud_sdk_core/base_service.rb might allow you to manually make calls by passing in the service name but it definitely wasn't going to give us everything that doing a gem for power and vpc would. I could absolutely see using that as a "core" (hey that's even what its called) gem for authentications though. |
Yes @jaywcarman was talking with them, they're planning on building gems for the Power API but nothing for ruby which is why I started doing this. |
9bcdab7
to
6c0a76c
Compare
71e0bab
to
aed5be1
Compare
This rake task is really cool! |
|
||
task :generate => [:download_cli, :download_openapi_specs] do | ||
IBM_CLOUD_GEMS.each do |api_gem, openapi_json| | ||
openapi_json.sub!("/", "-") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just because https://cloud.ibm.com/apidocs/resource-controller/resource-controller.json
downloads resource-controller-resource-controller.json
There is probably a cleaner way of handling this but this works for now.
c005508
to
83c1f7f
Compare
|
||
Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == "https") do |http| | ||
request = Net::HTTP::Get.new(uri) | ||
request["User-Agent"] = "Not-Ruby" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOL
f8cb2e5
to
4f170e0
Compare
Rakefile
Outdated
end | ||
|
||
task :download_openapi_specs do | ||
require "json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super minor, but I don't think this line is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 you're right, I was playing with auto-fixing the vpc spec before generating the clients but now we're deferring that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I dont have merge rights here.
LGTM too 👍 |
Use the IBM Cloud OpenAPI specifications to generate gems for the various SDKs
Similar to
aws-sdk
in structure, there is anibm_cloud
gem which pulls in everything and then each OpenAPI file gets its own gem e.g.ibm_cloud_vpc
oribm_cloud_power_iaas
.To build the client gems run
rake openapi:generate
. This will download the openapi-generator-cli, download each of the API specs, and run the openapi-generator-cli to build the client gem.OpenAPI specifications:
Temporary Manual Steps:
ibm-cloud-sdk-ruby/gems/ibm_cloud_resource_controller/lib/ibm_cloud_resource_controller/models/resource_alias_patch.rb:69: warning: character class has '-' without escape: /^([^[:ascii:]]|[a-zA-Z0-9-._: ])+$/