Skip to content

Commit 16f3d23

Browse files
authored
Merge pull request #8 from agrare/openapi_power_vpc_gems
Add OpenAPI generated Power and VPC gems
2 parents 68d0898 + c54b580 commit 16f3d23

File tree

546 files changed

+72162
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

546 files changed

+72162
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
/spec/reports/
88
/tmp/
99
/Gemfile.lock
10+
/*.json
11+
/openapi-generator-cli*
1012

1113
# rspec failure tracking
1214
.rspec_status

Rakefile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,73 @@ require "rspec/core/rake_task"
44
RSpec::Core::RakeTask.new(:spec)
55

66
task :default => :spec
7+
8+
namespace :openapi do
9+
IBM_CLOUD_GEMS = {
10+
"ibm_cloud_iam" => "iam-identity-token-api.json",
11+
"ibm_cloud_power" => "power-cloud.json",
12+
"ibm_cloud_resource_controller" => "resource-controller/resource-controller.json",
13+
}
14+
15+
task :download_cli, [:version] do |_t, args|
16+
version = args[:version] || "5.0.0-beta2"
17+
18+
output_file = "openapi-generator-cli-#{version}.jar"
19+
target_symlink = "openapi-generator-cli"
20+
21+
unless File.exist?(output_file)
22+
puts "Downloading #{output_file}..."
23+
24+
uri = URI("https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/#{version}/#{output_file}")
25+
26+
open(output_file, "wb") { |f| download(uri, f) }
27+
28+
puts "Downloading #{output_file}...Complete"
29+
end
30+
31+
File.unlink(target_symlink) if File.exist?(target_symlink)
32+
File.symlink(output_file, target_symlink)
33+
end
34+
35+
task :download_openapi_specs do
36+
IBM_CLOUD_GEMS.each do |api_gem, openapi_json|
37+
uri = URI("https://cloud.ibm.com/apidocs/#{openapi_json}")
38+
output_file = openapi_json.sub("/", "-")
39+
40+
puts "Downloading #{uri}..."
41+
42+
open(output_file, "w") { |f| download(uri, f) }
43+
44+
puts "Downloading #{uri}...Complete"
45+
end
46+
end
47+
48+
task :generate => [:download_cli, :download_openapi_specs] do
49+
IBM_CLOUD_GEMS.each do |api_gem, openapi_json|
50+
openapi_json.sub!("/", "-")
51+
output_path = "gems/#{api_gem}"
52+
config_file = "#{output_path}/.openapi-config.json"
53+
54+
system("java -jar openapi-generator-cli generate --skip-validate-spec -i #{openapi_json} -c #{config_file} -g ruby -o #{output_path}")
55+
end
56+
end
57+
58+
private
59+
60+
def download(uri, io)
61+
require "net/http"
62+
63+
Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == "https") do |http|
64+
request = Net::HTTP::Get.new(uri)
65+
request["User-Agent"] = "Not-Ruby"
66+
67+
http.request(request) do |response|
68+
if io
69+
response.read_body { |chunk| io.write(chunk) }
70+
else
71+
response.body
72+
end
73+
end
74+
end
75+
end
76+
end

gems/ibm_cloud/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
10+
# rspec failure tracking
11+
.rspec_status

gems/ibm_cloud/.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--format documentation
2+
--color
3+
--require spec_helper

gems/ibm_cloud/.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
language: ruby
3+
cache: bundler
4+
rvm:
5+
- 2.5.8
6+
- 2.6.6
7+
before_install: gem install bundler -v 2.1.4

gems/ibm_cloud/Gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
source "https://rubygems.org"
2+
3+
# Specify your gem's dependencies in ibm_cloud.gemspec
4+
gemspec
5+
6+
gem "rake", "~> 12.0"
7+
gem "rspec", "~> 3.0"

gems/ibm_cloud/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# IbmCloud
2+
3+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ibm_cloud`. To experiment with that code, run `bin/console` for an interactive prompt.
4+
5+
TODO: Delete this and the text above, and describe your gem
6+
7+
## Installation
8+
9+
Add this line to your application's Gemfile:
10+
11+
```ruby
12+
gem 'ibm_cloud'
13+
```
14+
15+
And then execute:
16+
17+
$ bundle install
18+
19+
Or install it yourself as:
20+
21+
$ gem install ibm_cloud
22+
23+
## Usage
24+
25+
TODO: Write usage instructions here
26+
27+
## Development
28+
29+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30+
31+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32+
33+
## Contributing
34+
35+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ibm_cloud.
36+

gems/ibm_cloud/Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require "bundler/gem_tasks"
2+
require "rspec/core/rake_task"
3+
4+
RSpec::Core::RakeTask.new(:spec)
5+
6+
task :default => :spec

gems/ibm_cloud/bin/console

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env ruby
2+
3+
require "bundler/setup"
4+
require "ibm_cloud"
5+
6+
# You can add fixtures and/or initialization code here to make experimenting
7+
# with your gem easier. You can also use a different console, if you like.
8+
9+
# (If you use this, don't forget to add pry to your Gemfile!)
10+
# require "pry"
11+
# Pry.start
12+
13+
require "irb"
14+
IRB.start(__FILE__)

gems/ibm_cloud/bin/setup

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
set -vx
5+
6+
bundle install
7+
8+
# Do any other automated setup that you need to do here

gems/ibm_cloud/ibm_cloud.gemspec

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
require_relative 'lib/ibm_cloud/version'
2+
3+
Gem::Specification.new do |spec|
4+
spec.name = "ibm_cloud"
5+
spec.version = IbmCloud::VERSION
6+
spec.authors = ["IBM Cloud Developers"]
7+
8+
spec.summary = %q{IBM Cloud SDK}
9+
spec.description = %q{A Ruby gem for IBM Cloud APIs.}
10+
spec.homepage = "Put your gem's website or public repo URL here."
11+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
12+
13+
spec.metadata["allowed_push_host"] = "Set to 'http://mygemserver.com'"
14+
15+
spec.metadata["homepage_uri"] = spec.homepage
16+
spec.metadata["source_code_uri"] = "Put your gem's public repo URL here."
17+
spec.metadata["changelog_uri"] = "Put your gem's CHANGELOG.md URL here."
18+
19+
# Specify which files should be added to the gem when it is released.
20+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23+
end
24+
spec.bindir = "exe"
25+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26+
spec.require_paths = ["lib"]
27+
28+
spec.add_dependency("ibm_cloud_iam")
29+
spec.add_dependency("ibm_cloud_power")
30+
spec.add_dependency("ibm_cloud_resource_controller")
31+
end

gems/ibm_cloud/lib/ibm_cloud.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require "ibm_cloud/version"
2+
3+
module IbmCloud
4+
class Error < StandardError; end
5+
# Your code goes here...
6+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module IbmCloud
2+
VERSION = "0.1.0"
3+
end

gems/ibm_cloud/spec/ibm_cloud_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
RSpec.describe IbmCloud do
2+
it "has a version number" do
3+
expect(IbmCloud::VERSION).not_to be nil
4+
end
5+
6+
it "does something useful" do
7+
expect(false).to eq(true)
8+
end
9+
end

gems/ibm_cloud/spec/spec_helper.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require "bundler/setup"
2+
require "ibm_cloud"
3+
4+
RSpec.configure do |config|
5+
# Enable flags like --only-failures and --next-failure
6+
config.example_status_persistence_file_path = ".rspec_status"
7+
8+
# Disable RSpec exposing methods globally on `Module` and `main`
9+
config.disable_monkey_patching!
10+
11+
config.expect_with :rspec do |c|
12+
c.syntax = :expect
13+
end
14+
end

gems/ibm_cloud_iam/.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Generated by: https://openapi-generator.tech
2+
#
3+
4+
*.gem
5+
*.rbc
6+
/.config
7+
/coverage/
8+
/InstalledFiles
9+
/pkg/
10+
/spec/reports/
11+
/spec/examples.txt
12+
/test/tmp/
13+
/test/version_tmp/
14+
/tmp/
15+
16+
## Specific to RubyMotion:
17+
.dat*
18+
.repl_history
19+
build/
20+
21+
## Documentation cache and generated files:
22+
/.yardoc/
23+
/_yardoc/
24+
/doc/
25+
/rdoc/
26+
27+
## Environment normalization:
28+
/.bundle/
29+
/vendor/bundle
30+
/lib/bundler/man/
31+
32+
# for a library or gem, you might want to ignore these files since the code is
33+
# intended to run in multiple environments; otherwise, check them in:
34+
# Gemfile.lock
35+
# .ruby-version
36+
# .ruby-gemset
37+
38+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
39+
.rvmrc
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"gemName": "ibm_cloud_iam",
3+
"gemAuthor": "IBM Cloud Developers",
4+
"gemSummary": "IBM Cloud IAM Identity Services",
5+
"gemDescription": "Ruby gem for IBM Cloud IAM Identity Services",
6+
"gemLicense": "Apache-2.0"
7+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.gitignore
2+
.rspec
3+
.rubocop.yml
4+
.travis.yml
5+
Gemfile
6+
README.md
7+
Rakefile
8+
docs/ApiKey.md
9+
docs/ApiKeyInsideCreateServiceIdRequest.md
10+
docs/ApiKeyList.md
11+
docs/CreateApiKeyRequest.md
12+
docs/CreateServiceIdRequest.md
13+
docs/EnityHistoryRecord.md
14+
docs/Error.md
15+
docs/ExceptionResponse.md
16+
docs/ExceptionResponseContext.md
17+
docs/IdentityOperationsApi.md
18+
docs/InlineObject.md
19+
docs/InlineObject1.md
20+
docs/InlineObject2.md
21+
docs/InlineObject3.md
22+
docs/MFARequirementsResponse.md
23+
docs/OidcExceptionResponse.md
24+
docs/ResponseContext.md
25+
docs/ServiceId.md
26+
docs/ServiceIdList.md
27+
docs/TokenOperationsApi.md
28+
docs/TokenResponse.md
29+
docs/UpdateApiKeyRequest.md
30+
docs/UpdateServiceIdRequest.md
31+
git_push.sh
32+
ibm_cloud_iam.gemspec
33+
lib/ibm_cloud_iam.rb
34+
lib/ibm_cloud_iam/api/identity_operations_api.rb
35+
lib/ibm_cloud_iam/api/token_operations_api.rb
36+
lib/ibm_cloud_iam/api_client.rb
37+
lib/ibm_cloud_iam/api_error.rb
38+
lib/ibm_cloud_iam/configuration.rb
39+
lib/ibm_cloud_iam/configuration.rb
40+
lib/ibm_cloud_iam/models/api_key.rb
41+
lib/ibm_cloud_iam/models/api_key_inside_create_service_id_request.rb
42+
lib/ibm_cloud_iam/models/api_key_list.rb
43+
lib/ibm_cloud_iam/models/create_api_key_request.rb
44+
lib/ibm_cloud_iam/models/create_service_id_request.rb
45+
lib/ibm_cloud_iam/models/enity_history_record.rb
46+
lib/ibm_cloud_iam/models/error.rb
47+
lib/ibm_cloud_iam/models/exception_response.rb
48+
lib/ibm_cloud_iam/models/exception_response_context.rb
49+
lib/ibm_cloud_iam/models/inline_object.rb
50+
lib/ibm_cloud_iam/models/inline_object1.rb
51+
lib/ibm_cloud_iam/models/inline_object2.rb
52+
lib/ibm_cloud_iam/models/inline_object3.rb
53+
lib/ibm_cloud_iam/models/mfa_requirements_response.rb
54+
lib/ibm_cloud_iam/models/oidc_exception_response.rb
55+
lib/ibm_cloud_iam/models/response_context.rb
56+
lib/ibm_cloud_iam/models/service_id.rb
57+
lib/ibm_cloud_iam/models/service_id_list.rb
58+
lib/ibm_cloud_iam/models/token_response.rb
59+
lib/ibm_cloud_iam/models/update_api_key_request.rb
60+
lib/ibm_cloud_iam/models/update_service_id_request.rb
61+
lib/ibm_cloud_iam/version.rb
62+
spec/api_client_spec.rb
63+
spec/configuration_spec.rb
64+
spec/spec_helper.rb
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.0.0-beta2

gems/ibm_cloud_iam/.rspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--require spec_helper

0 commit comments

Comments
 (0)