ibm_cloud_resource_controller 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +13 -0
- data/.gitignore +13 -0
- data/.openapi-generator-ignore +23 -0
- data/.openapi-generator/VERSION +1 -0
- data/.rspec +3 -0
- data/.travis.yml +49 -0
- data/CHANGELOG.md +2 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +13 -0
- data/Gemfile +4 -6
- data/LICENSE +201 -0
- data/README.md +56 -120
- data/Rakefile +3 -7
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ibm_cloud_resource_controller.gemspec +34 -37
- data/lib/ibm_cloud_resource_controller.rb +9 -64
- data/lib/ibm_cloud_resource_controller/authenticators.rb +15 -0
- data/lib/ibm_cloud_resource_controller/common.rb +22 -0
- data/lib/ibm_cloud_resource_controller/resource_controller_v2.rb +982 -0
- data/lib/ibm_cloud_resource_controller/resource_manager_v2.rb +303 -0
- data/lib/ibm_cloud_resource_controller/version.rb +1 -13
- metadata +59 -145
- data/docs/Credentials.md +0 -25
- data/docs/ErrorReport.md +0 -23
- data/docs/PlanHistoryItem.md +0 -19
- data/docs/Reclamation.md +0 -45
- data/docs/ReclamationActionsPost.md +0 -19
- data/docs/ReclamationsList.md +0 -17
- data/docs/ResourceAlias.md +0 -57
- data/docs/ResourceAliasPatch.md +0 -17
- data/docs/ResourceAliasPost.md +0 -21
- data/docs/ResourceAliasesApi.md +0 -302
- data/docs/ResourceAliasesList.md +0 -21
- data/docs/ResourceBinding.md +0 -57
- data/docs/ResourceBindingPatch.md +0 -17
- data/docs/ResourceBindingPost.md +0 -25
- data/docs/ResourceBindingPostParameters.md +0 -17
- data/docs/ResourceBindingsApi.md +0 -300
- data/docs/ResourceBindingsList.md +0 -21
- data/docs/ResourceInstance.md +0 -81
- data/docs/ResourceInstancePatch.md +0 -23
- data/docs/ResourceInstancePost.md +0 -29
- data/docs/ResourceInstancesApi.md +0 -418
- data/docs/ResourceInstancesList.md +0 -21
- data/docs/ResourceKey.md +0 -53
- data/docs/ResourceKeyPatch.md +0 -17
- data/docs/ResourceKeyPost.md +0 -23
- data/docs/ResourceKeysApi.md +0 -298
- data/docs/ResourceKeysList.md +0 -21
- data/docs/ResourceReclamationsApi.md +0 -128
- data/git_push.sh +0 -58
- data/lib/ibm_cloud_resource_controller/api/resource_aliases_api.rb +0 -363
- data/lib/ibm_cloud_resource_controller/api/resource_bindings_api.rb +0 -360
- data/lib/ibm_cloud_resource_controller/api/resource_instances_api.rb +0 -493
- data/lib/ibm_cloud_resource_controller/api/resource_keys_api.rb +0 -357
- data/lib/ibm_cloud_resource_controller/api/resource_reclamations_api.rb +0 -156
- data/lib/ibm_cloud_resource_controller/api_client.rb +0 -388
- data/lib/ibm_cloud_resource_controller/api_error.rb +0 -57
- data/lib/ibm_cloud_resource_controller/configuration.rb +0 -248
- data/lib/ibm_cloud_resource_controller/models/credentials.rb +0 -250
- data/lib/ibm_cloud_resource_controller/models/error_report.rb +0 -240
- data/lib/ibm_cloud_resource_controller/models/plan_history_item.rb +0 -230
- data/lib/ibm_cloud_resource_controller/models/reclamation.rb +0 -352
- data/lib/ibm_cloud_resource_controller/models/reclamation_actions_post.rb +0 -220
- data/lib/ibm_cloud_resource_controller/models/reclamations_list.rb +0 -212
- data/lib/ibm_cloud_resource_controller/models/resource_alias.rb +0 -410
- data/lib/ibm_cloud_resource_controller/models/resource_alias_patch.rb +0 -236
- data/lib/ibm_cloud_resource_controller/models/resource_alias_post.rb +0 -266
- data/lib/ibm_cloud_resource_controller/models/resource_aliases_list.rb +0 -247
- data/lib/ibm_cloud_resource_controller/models/resource_binding.rb +0 -410
- data/lib/ibm_cloud_resource_controller/models/resource_binding_patch.rb +0 -236
- data/lib/ibm_cloud_resource_controller/models/resource_binding_post.rb +0 -278
- data/lib/ibm_cloud_resource_controller/models/resource_binding_post_parameters.rb +0 -210
- data/lib/ibm_cloud_resource_controller/models/resource_bindings_list.rb +0 -247
- data/lib/ibm_cloud_resource_controller/models/resource_instance.rb +0 -536
- data/lib/ibm_cloud_resource_controller/models/resource_instance_patch.rb +0 -259
- data/lib/ibm_cloud_resource_controller/models/resource_instance_post.rb +0 -317
- data/lib/ibm_cloud_resource_controller/models/resource_instances_list.rb +0 -247
- data/lib/ibm_cloud_resource_controller/models/resource_key.rb +0 -390
- data/lib/ibm_cloud_resource_controller/models/resource_key_patch.rb +0 -236
- data/lib/ibm_cloud_resource_controller/models/resource_key_post.rb +0 -251
- data/lib/ibm_cloud_resource_controller/models/resource_keys_list.rb +0 -247
- data/spec/api/resource_aliases_api_spec.rb +0 -104
- data/spec/api/resource_bindings_api_spec.rb +0 -103
- data/spec/api/resource_instances_api_spec.rb +0 -130
- data/spec/api/resource_keys_api_spec.rb +0 -102
- data/spec/api/resource_reclamations_api_spec.rb +0 -62
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/credentials_spec.rb +0 -65
- data/spec/models/error_report_spec.rb +0 -59
- data/spec/models/plan_history_item_spec.rb +0 -47
- data/spec/models/reclamation_actions_post_spec.rb +0 -47
- data/spec/models/reclamation_spec.rb +0 -125
- data/spec/models/reclamations_list_spec.rb +0 -41
- data/spec/models/resource_alias_patch_spec.rb +0 -41
- data/spec/models/resource_alias_post_spec.rb +0 -53
- data/spec/models/resource_alias_spec.rb +0 -143
- data/spec/models/resource_aliases_list_spec.rb +0 -53
- data/spec/models/resource_binding_patch_spec.rb +0 -41
- data/spec/models/resource_binding_post_parameters_spec.rb +0 -41
- data/spec/models/resource_binding_post_spec.rb +0 -65
- data/spec/models/resource_binding_spec.rb +0 -137
- data/spec/models/resource_bindings_list_spec.rb +0 -53
- data/spec/models/resource_instance_patch_spec.rb +0 -59
- data/spec/models/resource_instance_post_spec.rb +0 -77
- data/spec/models/resource_instance_spec.rb +0 -191
- data/spec/models/resource_instances_list_spec.rb +0 -53
- data/spec/models/resource_key_patch_spec.rb +0 -41
- data/spec/models/resource_key_post_spec.rb +0 -59
- data/spec/models/resource_key_spec.rb +0 -125
- data/spec/models/resource_keys_list_spec.rb +0 -53
- data/spec/spec_helper.rb +0 -111
data/Rakefile
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
2
3
|
|
3
|
-
|
4
|
-
require 'rspec/core/rake_task'
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
|
-
|
7
|
-
task default: :spec
|
8
|
-
rescue LoadError
|
9
|
-
# no rspec available
|
10
|
-
end
|
6
|
+
task :default => :spec
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ibm_cloud_resource_controller"
|
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__)
|
data/bin/setup
ADDED
@@ -1,38 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
=
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
s.test_files = `find spec/*`.split("\n")
|
36
|
-
s.executables = []
|
37
|
-
s.require_paths = ["lib"]
|
1
|
+
require_relative 'lib/ibm_cloud_resource_controller/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "ibm_cloud_resource_controller"
|
5
|
+
spec.version = IbmCloudResourceController::VERSION
|
6
|
+
spec.authors = ["IBM Cloud Developers"]
|
7
|
+
spec.email = [""]
|
8
|
+
|
9
|
+
spec.summary = "IBM Cloud Resource Controller API"
|
10
|
+
spec.description = "Ruby gem for IBM Cloud Resource Controller API"
|
11
|
+
spec.homepage = "https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby"
|
12
|
+
spec.licenses = ["Apache-2.0"]
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.metadata["source_code_uri"]}/blob/master/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_runtime_dependency "ibm_cloud_sdk_core", "~> 1.1.1"
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler"
|
33
|
+
spec.add_development_dependency "rake"
|
34
|
+
spec.add_development_dependency "rubocop"
|
38
35
|
end
|
@@ -1,67 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
#Manage lifecycle of your Cloud resources using Resource Controller APIs. Resources are provisioned globally in an account scope. Supports asynchronous provisioning of resources. Enables consumption of a global resource through a Cloud Foundry space in any region.
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 2.0
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.0.0-beta2
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
# Common files
|
14
|
-
require 'ibm_cloud_resource_controller/api_client'
|
15
|
-
require 'ibm_cloud_resource_controller/api_error'
|
16
|
-
require 'ibm_cloud_resource_controller/version'
|
17
|
-
require 'ibm_cloud_resource_controller/configuration'
|
18
|
-
|
19
|
-
# Models
|
20
|
-
require 'ibm_cloud_resource_controller/models/credentials'
|
21
|
-
require 'ibm_cloud_resource_controller/models/error_report'
|
22
|
-
require 'ibm_cloud_resource_controller/models/plan_history_item'
|
23
|
-
require 'ibm_cloud_resource_controller/models/reclamation'
|
24
|
-
require 'ibm_cloud_resource_controller/models/reclamation_actions_post'
|
25
|
-
require 'ibm_cloud_resource_controller/models/reclamations_list'
|
26
|
-
require 'ibm_cloud_resource_controller/models/resource_alias'
|
27
|
-
require 'ibm_cloud_resource_controller/models/resource_alias_patch'
|
28
|
-
require 'ibm_cloud_resource_controller/models/resource_alias_post'
|
29
|
-
require 'ibm_cloud_resource_controller/models/resource_aliases_list'
|
30
|
-
require 'ibm_cloud_resource_controller/models/resource_binding'
|
31
|
-
require 'ibm_cloud_resource_controller/models/resource_binding_patch'
|
32
|
-
require 'ibm_cloud_resource_controller/models/resource_binding_post'
|
33
|
-
require 'ibm_cloud_resource_controller/models/resource_binding_post_parameters'
|
34
|
-
require 'ibm_cloud_resource_controller/models/resource_bindings_list'
|
35
|
-
require 'ibm_cloud_resource_controller/models/resource_instance'
|
36
|
-
require 'ibm_cloud_resource_controller/models/resource_instance_patch'
|
37
|
-
require 'ibm_cloud_resource_controller/models/resource_instance_post'
|
38
|
-
require 'ibm_cloud_resource_controller/models/resource_instances_list'
|
39
|
-
require 'ibm_cloud_resource_controller/models/resource_key'
|
40
|
-
require 'ibm_cloud_resource_controller/models/resource_key_patch'
|
41
|
-
require 'ibm_cloud_resource_controller/models/resource_key_post'
|
42
|
-
require 'ibm_cloud_resource_controller/models/resource_keys_list'
|
43
|
-
|
44
|
-
# APIs
|
45
|
-
require 'ibm_cloud_resource_controller/api/resource_aliases_api'
|
46
|
-
require 'ibm_cloud_resource_controller/api/resource_bindings_api'
|
47
|
-
require 'ibm_cloud_resource_controller/api/resource_instances_api'
|
48
|
-
require 'ibm_cloud_resource_controller/api/resource_keys_api'
|
49
|
-
require 'ibm_cloud_resource_controller/api/resource_reclamations_api'
|
1
|
+
require "ibm_cloud_resource_controller/version"
|
2
|
+
require "ibm_cloud_sdk_core"
|
50
3
|
|
51
4
|
module IbmCloudResourceController
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
def configure
|
60
|
-
if block_given?
|
61
|
-
yield(Configuration.default)
|
62
|
-
else
|
63
|
-
Configuration.default
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
5
|
+
ApiException = IBMCloudSdkCore::ApiException
|
6
|
+
DetailedResponse = IBMCloudSdkCore::DetailedResponse
|
7
|
+
|
8
|
+
require_relative "./ibm_cloud_resource_controller/authenticators.rb"
|
9
|
+
require_relative "./ibm_cloud_resource_controller/common.rb"
|
10
|
+
require_relative "./ibm_cloud_resource_controller/resource_controller_v2.rb"
|
11
|
+
require_relative "./ibm_cloud_resource_controller/resource_manager_v2.rb"
|
67
12
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require("ibm_cloud_sdk_core")
|
4
|
+
|
5
|
+
# Module for the IBM Cloud Resource Controller APIs
|
6
|
+
module IbmCloudResourceController
|
7
|
+
class Authenticators
|
8
|
+
BasicAuthenticator = IBMCloudSdkCore::BasicAuthenticator
|
9
|
+
BearerTokenAuthenticator = IBMCloudSdkCore::BearerTokenAuthenticator
|
10
|
+
CloudPakForDataAuthenticator = IBMCloudSdkCore::CloudPakForDataAuthenticator
|
11
|
+
ConfigBasedAuthenticatorFactory = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory
|
12
|
+
IamAuthenticator = IBMCloudSdkCore::IamAuthenticator
|
13
|
+
NoAuthAuthenticator = IBMCloudSdkCore::NoAuthAuthenticator
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "./version.rb"
|
4
|
+
|
5
|
+
module IbmCloudResourceController
|
6
|
+
# SDK Common class
|
7
|
+
class Common
|
8
|
+
def initialize(*); end
|
9
|
+
|
10
|
+
def get_sdk_headers(service_name, service_version, operation_id)
|
11
|
+
headers = {}
|
12
|
+
user_agent_string = "ibm_cloud_resource_controller-ruby-sdk-" + IbmCloudResourceController::VERSION + " #{RbConfig::CONFIG["host"]}"
|
13
|
+
user_agent_string += " #{RbConfig::CONFIG["RUBY_BASE_NAME"]}-#{RbConfig::CONFIG["RUBY_PROGRAM_VERSION"]}"
|
14
|
+
|
15
|
+
headers["User-Agent"] = user_agent_string
|
16
|
+
return headers if service_name.nil? || service_version.nil? || operation_id.nil?
|
17
|
+
|
18
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=#{service_name};service_version=#{service_version};operation_id=#{operation_id}"
|
19
|
+
headers
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,982 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (C) Copyright IBM Corp. 2021.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
# IBM OpenAPI SDK Code Generator Version: 3.30.0-bd714324-20210406-200538
|
18
|
+
#
|
19
|
+
# Manage lifecycle of your Cloud resources using Resource Controller APIs. Resources are
|
20
|
+
# provisioned globally in an account scope. Supports asynchronous provisioning of
|
21
|
+
# resources. Enables consumption of a global resource through a Cloud Foundry space in any
|
22
|
+
# region.
|
23
|
+
|
24
|
+
require "concurrent"
|
25
|
+
require "erb"
|
26
|
+
require "json"
|
27
|
+
require "ibm_cloud_sdk_core"
|
28
|
+
require_relative "./common.rb"
|
29
|
+
|
30
|
+
module IbmCloudResourceController
|
31
|
+
##
|
32
|
+
# The resource_controller V2 service.
|
33
|
+
class ResourceControllerV2 < IBMCloudSdkCore::BaseService
|
34
|
+
include Concurrent::Async
|
35
|
+
DEFAULT_SERVICE_NAME = "resource_controller"
|
36
|
+
DEFAULT_SERVICE_URL = "https://resource-controller.cloud.ibm.com"
|
37
|
+
##
|
38
|
+
# @!method initialize(args)
|
39
|
+
# Construct a new client for the resource_controller service.
|
40
|
+
#
|
41
|
+
# @param args [Hash] The args to initialize with
|
42
|
+
# @option args service_url [String] The base service URL to use when contacting the service.
|
43
|
+
# The base service_url may differ between IBM Cloud regions.
|
44
|
+
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
45
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
46
|
+
# any external configuration, if applicable.
|
47
|
+
def initialize(args = {})
|
48
|
+
@__async_initialized__ = false
|
49
|
+
defaults = {}
|
50
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
51
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
52
|
+
defaults[:authenticator] = nil
|
53
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
54
|
+
args = defaults.merge(args)
|
55
|
+
super
|
56
|
+
@service_url = user_service_url unless user_service_url.nil?
|
57
|
+
end
|
58
|
+
|
59
|
+
#########################
|
60
|
+
# Resource Instances
|
61
|
+
#########################
|
62
|
+
|
63
|
+
##
|
64
|
+
# @!method list_resource_instances(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, resource_plan_id: nil, type: nil, sub_type: nil, limit: nil, updated_from: nil, updated_to: nil)
|
65
|
+
# Get a list of all resource instances.
|
66
|
+
# Get a list of all resource instances.
|
67
|
+
# @param guid [String] When you provision a new resource in the specified location for the selected plan,
|
68
|
+
# a GUID (globally unique identifier) is created. This is a unique internal GUID
|
69
|
+
# managed by Resource controller that corresponds to the instance.
|
70
|
+
# @param name [String] The human-readable name of the instance.
|
71
|
+
# @param resource_group_id [String] Short ID of a resource group.
|
72
|
+
# @param resource_id [String] The unique ID of the offering. This value is provided by and stored in the global
|
73
|
+
# catalog.
|
74
|
+
# @param resource_plan_id [String] The unique ID of the plan associated with the offering. This value is provided by
|
75
|
+
# and stored in the global catalog.
|
76
|
+
# @param type [String] The type of the instance. For example, `service_instance`.
|
77
|
+
# @param sub_type [String] The sub-type of instance, e.g. `cfaas`.
|
78
|
+
# @param limit [String] Limit on how many items should be returned.
|
79
|
+
# @param updated_from [String] Start date inclusive filter.
|
80
|
+
# @param updated_to [String] End date inclusive filter.
|
81
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
82
|
+
def list_resource_instances(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, resource_plan_id: nil, type: nil, sub_type: nil, limit: nil, updated_from: nil, updated_to: nil)
|
83
|
+
headers = {
|
84
|
+
}
|
85
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_instances")
|
86
|
+
headers.merge!(sdk_headers)
|
87
|
+
|
88
|
+
params = {
|
89
|
+
"guid" => guid,
|
90
|
+
"name" => name,
|
91
|
+
"resource_group_id" => resource_group_id,
|
92
|
+
"resource_id" => resource_id,
|
93
|
+
"resource_plan_id" => resource_plan_id,
|
94
|
+
"type" => type,
|
95
|
+
"sub_type" => sub_type,
|
96
|
+
"limit" => limit,
|
97
|
+
"updated_from" => updated_from,
|
98
|
+
"updated_to" => updated_to
|
99
|
+
}
|
100
|
+
|
101
|
+
method_url = "/v2/resource_instances"
|
102
|
+
|
103
|
+
response = request(
|
104
|
+
method: "GET",
|
105
|
+
url: method_url,
|
106
|
+
headers: headers,
|
107
|
+
params: params,
|
108
|
+
accept_json: true
|
109
|
+
)
|
110
|
+
response
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# @!method create_resource_instance(name:, target:, resource_group:, resource_plan_id:, tags: nil, allow_cleanup: nil, parameters: nil, entity_lock: nil)
|
115
|
+
# Create (provision) a new resource instance.
|
116
|
+
# Provision a new resource in the specified location for the selected plan.
|
117
|
+
# @param name [String] The name of the instance. Must be 180 characters or less and cannot include any
|
118
|
+
# special characters other than `(space) - . _ :`.
|
119
|
+
# @param target [String] The deployment location where the instance should be hosted.
|
120
|
+
# @param resource_group [String] Short or long ID of resource group.
|
121
|
+
# @param resource_plan_id [String] The unique ID of the plan associated with the offering. This value is provided by
|
122
|
+
# and stored in the global catalog.
|
123
|
+
# @param tags [Array[String]] Tags that are attached to the instance after provisioning. These tags can be
|
124
|
+
# searched and managed through the Tagging API in IBM Cloud.
|
125
|
+
# @param allow_cleanup [Boolean] A boolean that dictates if the resource instance should be deleted (cleaned up)
|
126
|
+
# during the processing of a region instance delete call.
|
127
|
+
# @param parameters [Hash] Configuration options represented as key-value pairs that are passed through to
|
128
|
+
# the target resource brokers.
|
129
|
+
# @param entity_lock [Boolean] Indicates if the resource instance is locked for further update or delete
|
130
|
+
# operations. It does not affect actions performed on child resources like aliases,
|
131
|
+
# bindings or keys. False by default.
|
132
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
133
|
+
def create_resource_instance(name:, target:, resource_group:, resource_plan_id:, tags: nil, allow_cleanup: nil, parameters: nil, entity_lock: nil)
|
134
|
+
raise ArgumentError.new("name must be provided") if name.nil?
|
135
|
+
|
136
|
+
raise ArgumentError.new("target must be provided") if target.nil?
|
137
|
+
|
138
|
+
raise ArgumentError.new("resource_group must be provided") if resource_group.nil?
|
139
|
+
|
140
|
+
raise ArgumentError.new("resource_plan_id must be provided") if resource_plan_id.nil?
|
141
|
+
|
142
|
+
headers = {
|
143
|
+
"Entity-Lock" => entity_lock
|
144
|
+
}
|
145
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "create_resource_instance")
|
146
|
+
headers.merge!(sdk_headers)
|
147
|
+
|
148
|
+
data = {
|
149
|
+
"name" => name,
|
150
|
+
"target" => target,
|
151
|
+
"resource_group" => resource_group,
|
152
|
+
"resource_plan_id" => resource_plan_id,
|
153
|
+
"tags" => tags,
|
154
|
+
"allow_cleanup" => allow_cleanup,
|
155
|
+
"parameters" => parameters
|
156
|
+
}
|
157
|
+
|
158
|
+
method_url = "/v2/resource_instances"
|
159
|
+
|
160
|
+
response = request(
|
161
|
+
method: "POST",
|
162
|
+
url: method_url,
|
163
|
+
headers: headers,
|
164
|
+
json: data,
|
165
|
+
accept_json: true
|
166
|
+
)
|
167
|
+
response
|
168
|
+
end
|
169
|
+
|
170
|
+
##
|
171
|
+
# @!method get_resource_instance(id:)
|
172
|
+
# Get a resource instance.
|
173
|
+
# Retrieve a resource instance by ID.
|
174
|
+
# @param id [String] The short or long ID of the instance.
|
175
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
176
|
+
def get_resource_instance(id:)
|
177
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
178
|
+
|
179
|
+
headers = {
|
180
|
+
}
|
181
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "get_resource_instance")
|
182
|
+
headers.merge!(sdk_headers)
|
183
|
+
|
184
|
+
method_url = "/v2/resource_instances/%s" % [ERB::Util.url_encode(id)]
|
185
|
+
|
186
|
+
response = request(
|
187
|
+
method: "GET",
|
188
|
+
url: method_url,
|
189
|
+
headers: headers,
|
190
|
+
accept_json: true
|
191
|
+
)
|
192
|
+
response
|
193
|
+
end
|
194
|
+
|
195
|
+
##
|
196
|
+
# @!method delete_resource_instance(id:, recursive: nil)
|
197
|
+
# Delete a resource instance.
|
198
|
+
# Delete a resource instance by ID.
|
199
|
+
# @param id [String] The short or long ID of the instance.
|
200
|
+
# @param recursive [Boolean] Will delete resource bindings, keys and aliases associated with the instance.
|
201
|
+
# @return [nil]
|
202
|
+
def delete_resource_instance(id:, recursive: nil)
|
203
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
204
|
+
|
205
|
+
headers = {
|
206
|
+
}
|
207
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "delete_resource_instance")
|
208
|
+
headers.merge!(sdk_headers)
|
209
|
+
|
210
|
+
params = {
|
211
|
+
"recursive" => recursive
|
212
|
+
}
|
213
|
+
|
214
|
+
method_url = "/v2/resource_instances/%s" % [ERB::Util.url_encode(id)]
|
215
|
+
|
216
|
+
request(
|
217
|
+
method: "DELETE",
|
218
|
+
url: method_url,
|
219
|
+
headers: headers,
|
220
|
+
params: params,
|
221
|
+
accept_json: false
|
222
|
+
)
|
223
|
+
nil
|
224
|
+
end
|
225
|
+
|
226
|
+
##
|
227
|
+
# @!method update_resource_instance(id:, name: nil, parameters: nil, resource_plan_id: nil, allow_cleanup: nil)
|
228
|
+
# Update a resource instance.
|
229
|
+
# Update a resource instance by ID.
|
230
|
+
# @param id [String] The short or long ID of the instance.
|
231
|
+
# @param name [String] The new name of the instance. Must be 180 characters or less and cannot include
|
232
|
+
# any special characters other than `(space) - . _ :`.
|
233
|
+
# @param parameters [Hash] The new configuration options for the instance.
|
234
|
+
# @param resource_plan_id [String] The unique ID of the plan associated with the offering. This value is provided by
|
235
|
+
# and stored in the global catalog.
|
236
|
+
# @param allow_cleanup [Boolean] A boolean that dictates if the resource instance should be deleted (cleaned up)
|
237
|
+
# during the processing of a region instance delete call.
|
238
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
239
|
+
def update_resource_instance(id:, name: nil, parameters: nil, resource_plan_id: nil, allow_cleanup: nil)
|
240
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
241
|
+
|
242
|
+
headers = {
|
243
|
+
}
|
244
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "update_resource_instance")
|
245
|
+
headers.merge!(sdk_headers)
|
246
|
+
|
247
|
+
data = {
|
248
|
+
"name" => name,
|
249
|
+
"parameters" => parameters,
|
250
|
+
"resource_plan_id" => resource_plan_id,
|
251
|
+
"allow_cleanup" => allow_cleanup
|
252
|
+
}
|
253
|
+
|
254
|
+
method_url = "/v2/resource_instances/%s" % [ERB::Util.url_encode(id)]
|
255
|
+
|
256
|
+
response = request(
|
257
|
+
method: "PATCH",
|
258
|
+
url: method_url,
|
259
|
+
headers: headers,
|
260
|
+
json: data,
|
261
|
+
accept_json: true
|
262
|
+
)
|
263
|
+
response
|
264
|
+
end
|
265
|
+
|
266
|
+
##
|
267
|
+
# @!method list_resource_aliases_for_instance(id:)
|
268
|
+
# Get a list of all resource aliases for the instance.
|
269
|
+
# Get a list of all resource aliases for the instance.
|
270
|
+
# @param id [String] The short or long ID of the instance.
|
271
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
272
|
+
def list_resource_aliases_for_instance(id:)
|
273
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
274
|
+
|
275
|
+
headers = {
|
276
|
+
}
|
277
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_aliases_for_instance")
|
278
|
+
headers.merge!(sdk_headers)
|
279
|
+
|
280
|
+
method_url = "/v2/resource_instances/%s/resource_aliases" % [ERB::Util.url_encode(id)]
|
281
|
+
|
282
|
+
response = request(
|
283
|
+
method: "GET",
|
284
|
+
url: method_url,
|
285
|
+
headers: headers,
|
286
|
+
accept_json: true
|
287
|
+
)
|
288
|
+
response
|
289
|
+
end
|
290
|
+
|
291
|
+
##
|
292
|
+
# @!method list_resource_keys_for_instance(id:)
|
293
|
+
# Get a list of all the resource keys for the instance.
|
294
|
+
# Get a list of all the resource keys for the instance.
|
295
|
+
# @param id [String] The short or long ID of the instance.
|
296
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
297
|
+
def list_resource_keys_for_instance(id:)
|
298
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
299
|
+
|
300
|
+
headers = {
|
301
|
+
}
|
302
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_keys_for_instance")
|
303
|
+
headers.merge!(sdk_headers)
|
304
|
+
|
305
|
+
method_url = "/v2/resource_instances/%s/resource_keys" % [ERB::Util.url_encode(id)]
|
306
|
+
|
307
|
+
response = request(
|
308
|
+
method: "GET",
|
309
|
+
url: method_url,
|
310
|
+
headers: headers,
|
311
|
+
accept_json: true
|
312
|
+
)
|
313
|
+
response
|
314
|
+
end
|
315
|
+
|
316
|
+
##
|
317
|
+
# @!method lock_resource_instance(id:)
|
318
|
+
# Lock a resource instance.
|
319
|
+
# Locks a resource instance by ID. A locked instance can not be updated or deleted.
|
320
|
+
# It does not affect actions performed on child resources like aliases, bindings or
|
321
|
+
# keys.
|
322
|
+
# @param id [String] The short or long ID of the instance.
|
323
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
324
|
+
def lock_resource_instance(id:)
|
325
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
326
|
+
|
327
|
+
headers = {
|
328
|
+
}
|
329
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "lock_resource_instance")
|
330
|
+
headers.merge!(sdk_headers)
|
331
|
+
|
332
|
+
method_url = "/v2/resource_instances/%s/lock" % [ERB::Util.url_encode(id)]
|
333
|
+
|
334
|
+
response = request(
|
335
|
+
method: "POST",
|
336
|
+
url: method_url,
|
337
|
+
headers: headers,
|
338
|
+
accept_json: true
|
339
|
+
)
|
340
|
+
response
|
341
|
+
end
|
342
|
+
|
343
|
+
##
|
344
|
+
# @!method unlock_resource_instance(id:)
|
345
|
+
# Unlock a resource instance.
|
346
|
+
# Unlocks a resource instance by ID.
|
347
|
+
# @param id [String] The short or long ID of the instance.
|
348
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
349
|
+
def unlock_resource_instance(id:)
|
350
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
351
|
+
|
352
|
+
headers = {
|
353
|
+
}
|
354
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "unlock_resource_instance")
|
355
|
+
headers.merge!(sdk_headers)
|
356
|
+
|
357
|
+
method_url = "/v2/resource_instances/%s/lock" % [ERB::Util.url_encode(id)]
|
358
|
+
|
359
|
+
response = request(
|
360
|
+
method: "DELETE",
|
361
|
+
url: method_url,
|
362
|
+
headers: headers,
|
363
|
+
accept_json: true
|
364
|
+
)
|
365
|
+
response
|
366
|
+
end
|
367
|
+
#########################
|
368
|
+
# Resource Keys
|
369
|
+
#########################
|
370
|
+
|
371
|
+
##
|
372
|
+
# @!method list_resource_keys(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, limit: nil, updated_from: nil, updated_to: nil)
|
373
|
+
# Get a list of all of the resource keys.
|
374
|
+
# List all resource keys.
|
375
|
+
# @param guid [String] When you create a new key, a GUID (globally unique identifier) is assigned. This
|
376
|
+
# is a unique internal GUID managed by Resource controller that corresponds to the
|
377
|
+
# key.
|
378
|
+
# @param name [String] The human-readable name of the key.
|
379
|
+
# @param resource_group_id [String] The short ID of the resource group.
|
380
|
+
# @param resource_id [String] The unique ID of the offering. This value is provided by and stored in the global
|
381
|
+
# catalog.
|
382
|
+
# @param limit [String] Limit on how many items should be returned.
|
383
|
+
# @param updated_from [String] Start date inclusive filter.
|
384
|
+
# @param updated_to [String] End date inclusive filter.
|
385
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
386
|
+
def list_resource_keys(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, limit: nil, updated_from: nil, updated_to: nil)
|
387
|
+
headers = {
|
388
|
+
}
|
389
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_keys")
|
390
|
+
headers.merge!(sdk_headers)
|
391
|
+
|
392
|
+
params = {
|
393
|
+
"guid" => guid,
|
394
|
+
"name" => name,
|
395
|
+
"resource_group_id" => resource_group_id,
|
396
|
+
"resource_id" => resource_id,
|
397
|
+
"limit" => limit,
|
398
|
+
"updated_from" => updated_from,
|
399
|
+
"updated_to" => updated_to
|
400
|
+
}
|
401
|
+
|
402
|
+
method_url = "/v2/resource_keys"
|
403
|
+
|
404
|
+
response = request(
|
405
|
+
method: "GET",
|
406
|
+
url: method_url,
|
407
|
+
headers: headers,
|
408
|
+
params: params,
|
409
|
+
accept_json: true
|
410
|
+
)
|
411
|
+
response
|
412
|
+
end
|
413
|
+
|
414
|
+
##
|
415
|
+
# @!method create_resource_key(name:, source:, parameters: nil, role: nil)
|
416
|
+
# Create a new resource key.
|
417
|
+
# Create a new resource key.
|
418
|
+
# @param name [String] The name of the key.
|
419
|
+
# @param source [String] The short or long ID of resource instance or alias.
|
420
|
+
# @param parameters [ResourceKeyPostParameters] Configuration options represented as key-value pairs. Service defined options are
|
421
|
+
# passed through to the target resource brokers, whereas platform defined options
|
422
|
+
# are not.
|
423
|
+
# @param role [String] The role name or it's CRN.
|
424
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
425
|
+
def create_resource_key(name:, source:, parameters: nil, role: nil)
|
426
|
+
raise ArgumentError.new("name must be provided") if name.nil?
|
427
|
+
|
428
|
+
raise ArgumentError.new("source must be provided") if source.nil?
|
429
|
+
|
430
|
+
headers = {
|
431
|
+
}
|
432
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "create_resource_key")
|
433
|
+
headers.merge!(sdk_headers)
|
434
|
+
|
435
|
+
data = {
|
436
|
+
"name" => name,
|
437
|
+
"source" => source,
|
438
|
+
"parameters" => parameters,
|
439
|
+
"role" => role
|
440
|
+
}
|
441
|
+
|
442
|
+
method_url = "/v2/resource_keys"
|
443
|
+
|
444
|
+
response = request(
|
445
|
+
method: "POST",
|
446
|
+
url: method_url,
|
447
|
+
headers: headers,
|
448
|
+
json: data,
|
449
|
+
accept_json: true
|
450
|
+
)
|
451
|
+
response
|
452
|
+
end
|
453
|
+
|
454
|
+
##
|
455
|
+
# @!method get_resource_key(id:)
|
456
|
+
# Get resource key by ID.
|
457
|
+
# Get resource key by ID.
|
458
|
+
# @param id [String] The short or long ID of the key.
|
459
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
460
|
+
def get_resource_key(id:)
|
461
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
462
|
+
|
463
|
+
headers = {
|
464
|
+
}
|
465
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "get_resource_key")
|
466
|
+
headers.merge!(sdk_headers)
|
467
|
+
|
468
|
+
method_url = "/v2/resource_keys/%s" % [ERB::Util.url_encode(id)]
|
469
|
+
|
470
|
+
response = request(
|
471
|
+
method: "GET",
|
472
|
+
url: method_url,
|
473
|
+
headers: headers,
|
474
|
+
accept_json: true
|
475
|
+
)
|
476
|
+
response
|
477
|
+
end
|
478
|
+
|
479
|
+
##
|
480
|
+
# @!method delete_resource_key(id:)
|
481
|
+
# Delete a resource key by ID.
|
482
|
+
# Delete a resource key by ID.
|
483
|
+
# @param id [String] The short or long ID of the key.
|
484
|
+
# @return [nil]
|
485
|
+
def delete_resource_key(id:)
|
486
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
487
|
+
|
488
|
+
headers = {
|
489
|
+
}
|
490
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "delete_resource_key")
|
491
|
+
headers.merge!(sdk_headers)
|
492
|
+
|
493
|
+
method_url = "/v2/resource_keys/%s" % [ERB::Util.url_encode(id)]
|
494
|
+
|
495
|
+
request(
|
496
|
+
method: "DELETE",
|
497
|
+
url: method_url,
|
498
|
+
headers: headers,
|
499
|
+
accept_json: false
|
500
|
+
)
|
501
|
+
nil
|
502
|
+
end
|
503
|
+
|
504
|
+
##
|
505
|
+
# @!method update_resource_key(id:, name:)
|
506
|
+
# Update a resource key.
|
507
|
+
# Update a resource key by ID.
|
508
|
+
# @param id [String] The short or long ID of the key.
|
509
|
+
# @param name [String] The new name of the key. Must be 180 characters or less and cannot include any
|
510
|
+
# special characters other than `(space) - . _ :`.
|
511
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
512
|
+
def update_resource_key(id:, name:)
|
513
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
514
|
+
|
515
|
+
raise ArgumentError.new("name must be provided") if name.nil?
|
516
|
+
|
517
|
+
headers = {
|
518
|
+
}
|
519
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "update_resource_key")
|
520
|
+
headers.merge!(sdk_headers)
|
521
|
+
|
522
|
+
data = {
|
523
|
+
"name" => name
|
524
|
+
}
|
525
|
+
|
526
|
+
method_url = "/v2/resource_keys/%s" % [ERB::Util.url_encode(id)]
|
527
|
+
|
528
|
+
response = request(
|
529
|
+
method: "PATCH",
|
530
|
+
url: method_url,
|
531
|
+
headers: headers,
|
532
|
+
json: data,
|
533
|
+
accept_json: true
|
534
|
+
)
|
535
|
+
response
|
536
|
+
end
|
537
|
+
#########################
|
538
|
+
# Resource Bindings
|
539
|
+
#########################
|
540
|
+
|
541
|
+
##
|
542
|
+
# @!method list_resource_bindings(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, region_binding_id: nil, limit: nil, updated_from: nil, updated_to: nil)
|
543
|
+
# Get a list of all resource bindings.
|
544
|
+
# Get a list of all resource bindings.
|
545
|
+
# @param guid [String] The short ID of the binding.
|
546
|
+
# @param name [String] The human-readable name of the binding.
|
547
|
+
# @param resource_group_id [String] Short ID of the resource group.
|
548
|
+
# @param resource_id [String] The unique ID of the offering (service name). This value is provided by and stored
|
549
|
+
# in the global catalog.
|
550
|
+
# @param region_binding_id [String] Short ID of the binding in the specific targeted environment, e.g.
|
551
|
+
# service_binding_id in a given IBM Cloud environment.
|
552
|
+
# @param limit [String] Limit on how many items should be returned.
|
553
|
+
# @param updated_from [String] Start date inclusive filter.
|
554
|
+
# @param updated_to [String] End date inclusive filter.
|
555
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
556
|
+
def list_resource_bindings(guid: nil, name: nil, resource_group_id: nil, resource_id: nil, region_binding_id: nil, limit: nil, updated_from: nil, updated_to: nil)
|
557
|
+
headers = {
|
558
|
+
}
|
559
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_bindings")
|
560
|
+
headers.merge!(sdk_headers)
|
561
|
+
|
562
|
+
params = {
|
563
|
+
"guid" => guid,
|
564
|
+
"name" => name,
|
565
|
+
"resource_group_id" => resource_group_id,
|
566
|
+
"resource_id" => resource_id,
|
567
|
+
"region_binding_id" => region_binding_id,
|
568
|
+
"limit" => limit,
|
569
|
+
"updated_from" => updated_from,
|
570
|
+
"updated_to" => updated_to
|
571
|
+
}
|
572
|
+
|
573
|
+
method_url = "/v2/resource_bindings"
|
574
|
+
|
575
|
+
response = request(
|
576
|
+
method: "GET",
|
577
|
+
url: method_url,
|
578
|
+
headers: headers,
|
579
|
+
params: params,
|
580
|
+
accept_json: true
|
581
|
+
)
|
582
|
+
response
|
583
|
+
end
|
584
|
+
|
585
|
+
##
|
586
|
+
# @!method create_resource_binding(source:, target:, name: nil, parameters: nil, role: nil)
|
587
|
+
# Create a new resource binding.
|
588
|
+
# Create a new resource binding.
|
589
|
+
# @param source [String] The short or long ID of resource alias.
|
590
|
+
# @param target [String] The CRN of application to bind to in a specific environment, e.g. Dallas YP, CFEE
|
591
|
+
# instance.
|
592
|
+
# @param name [String] The name of the binding. Must be 180 characters or less and cannot include any
|
593
|
+
# special characters other than `(space) - . _ :`.
|
594
|
+
# @param parameters [ResourceBindingPostParameters] Configuration options represented as key-value pairs. Service defined options are
|
595
|
+
# passed through to the target resource brokers, whereas platform defined options
|
596
|
+
# are not.
|
597
|
+
# @param role [String] The role name or it's CRN.
|
598
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
599
|
+
def create_resource_binding(source:, target:, name: nil, parameters: nil, role: nil)
|
600
|
+
raise ArgumentError.new("source must be provided") if source.nil?
|
601
|
+
|
602
|
+
raise ArgumentError.new("target must be provided") if target.nil?
|
603
|
+
|
604
|
+
headers = {
|
605
|
+
}
|
606
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "create_resource_binding")
|
607
|
+
headers.merge!(sdk_headers)
|
608
|
+
|
609
|
+
data = {
|
610
|
+
"source" => source,
|
611
|
+
"target" => target,
|
612
|
+
"name" => name,
|
613
|
+
"parameters" => parameters,
|
614
|
+
"role" => role
|
615
|
+
}
|
616
|
+
|
617
|
+
method_url = "/v2/resource_bindings"
|
618
|
+
|
619
|
+
response = request(
|
620
|
+
method: "POST",
|
621
|
+
url: method_url,
|
622
|
+
headers: headers,
|
623
|
+
json: data,
|
624
|
+
accept_json: true
|
625
|
+
)
|
626
|
+
response
|
627
|
+
end
|
628
|
+
|
629
|
+
##
|
630
|
+
# @!method get_resource_binding(id:)
|
631
|
+
# Get a resource binding.
|
632
|
+
# Retrieve a resource binding by ID.
|
633
|
+
# @param id [String] The short or long ID of the binding.
|
634
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
635
|
+
def get_resource_binding(id:)
|
636
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
637
|
+
|
638
|
+
headers = {
|
639
|
+
}
|
640
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "get_resource_binding")
|
641
|
+
headers.merge!(sdk_headers)
|
642
|
+
|
643
|
+
method_url = "/v2/resource_bindings/%s" % [ERB::Util.url_encode(id)]
|
644
|
+
|
645
|
+
response = request(
|
646
|
+
method: "GET",
|
647
|
+
url: method_url,
|
648
|
+
headers: headers,
|
649
|
+
accept_json: true
|
650
|
+
)
|
651
|
+
response
|
652
|
+
end
|
653
|
+
|
654
|
+
##
|
655
|
+
# @!method delete_resource_binding(id:)
|
656
|
+
# Delete a resource binding.
|
657
|
+
# Delete a resource binding by ID.
|
658
|
+
# @param id [String] The short or long ID of the binding.
|
659
|
+
# @return [nil]
|
660
|
+
def delete_resource_binding(id:)
|
661
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
662
|
+
|
663
|
+
headers = {
|
664
|
+
}
|
665
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "delete_resource_binding")
|
666
|
+
headers.merge!(sdk_headers)
|
667
|
+
|
668
|
+
method_url = "/v2/resource_bindings/%s" % [ERB::Util.url_encode(id)]
|
669
|
+
|
670
|
+
request(
|
671
|
+
method: "DELETE",
|
672
|
+
url: method_url,
|
673
|
+
headers: headers,
|
674
|
+
accept_json: false
|
675
|
+
)
|
676
|
+
nil
|
677
|
+
end
|
678
|
+
|
679
|
+
##
|
680
|
+
# @!method update_resource_binding(id:, name:)
|
681
|
+
# Update a resource binding.
|
682
|
+
# Update a resource binding by ID.
|
683
|
+
# @param id [String] The short or long ID of the binding.
|
684
|
+
# @param name [String] The new name of the binding. Must be 180 characters or less and cannot include any
|
685
|
+
# special characters other than `(space) - . _ :`.
|
686
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
687
|
+
def update_resource_binding(id:, name:)
|
688
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
689
|
+
|
690
|
+
raise ArgumentError.new("name must be provided") if name.nil?
|
691
|
+
|
692
|
+
headers = {
|
693
|
+
}
|
694
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "update_resource_binding")
|
695
|
+
headers.merge!(sdk_headers)
|
696
|
+
|
697
|
+
data = {
|
698
|
+
"name" => name
|
699
|
+
}
|
700
|
+
|
701
|
+
method_url = "/v2/resource_bindings/%s" % [ERB::Util.url_encode(id)]
|
702
|
+
|
703
|
+
response = request(
|
704
|
+
method: "PATCH",
|
705
|
+
url: method_url,
|
706
|
+
headers: headers,
|
707
|
+
json: data,
|
708
|
+
accept_json: true
|
709
|
+
)
|
710
|
+
response
|
711
|
+
end
|
712
|
+
#########################
|
713
|
+
# Resource Aliases
|
714
|
+
#########################
|
715
|
+
|
716
|
+
##
|
717
|
+
# @!method list_resource_aliases(guid: nil, name: nil, resource_instance_id: nil, region_instance_id: nil, resource_id: nil, resource_group_id: nil, limit: nil, updated_from: nil, updated_to: nil)
|
718
|
+
# Get a list of all resource aliases.
|
719
|
+
# Get a list of all resource aliases.
|
720
|
+
# @param guid [String] Short ID of the alias.
|
721
|
+
# @param name [String] The human-readable name of the alias.
|
722
|
+
# @param resource_instance_id [String] Resource instance short ID.
|
723
|
+
# @param region_instance_id [String] Short ID of the instance in a specific targeted environment. For example,
|
724
|
+
# `service_instance_id` in a given IBM Cloud environment.
|
725
|
+
# @param resource_id [String] The unique ID of the offering (service name). This value is provided by and stored
|
726
|
+
# in the global catalog.
|
727
|
+
# @param resource_group_id [String] Short ID of Resource group.
|
728
|
+
# @param limit [String] Limit on how many items should be returned.
|
729
|
+
# @param updated_from [String] Start date inclusive filter.
|
730
|
+
# @param updated_to [String] End date inclusive filter.
|
731
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
732
|
+
def list_resource_aliases(guid: nil, name: nil, resource_instance_id: nil, region_instance_id: nil, resource_id: nil, resource_group_id: nil, limit: nil, updated_from: nil, updated_to: nil)
|
733
|
+
headers = {
|
734
|
+
}
|
735
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_aliases")
|
736
|
+
headers.merge!(sdk_headers)
|
737
|
+
|
738
|
+
params = {
|
739
|
+
"guid" => guid,
|
740
|
+
"name" => name,
|
741
|
+
"resource_instance_id" => resource_instance_id,
|
742
|
+
"region_instance_id" => region_instance_id,
|
743
|
+
"resource_id" => resource_id,
|
744
|
+
"resource_group_id" => resource_group_id,
|
745
|
+
"limit" => limit,
|
746
|
+
"updated_from" => updated_from,
|
747
|
+
"updated_to" => updated_to
|
748
|
+
}
|
749
|
+
|
750
|
+
method_url = "/v2/resource_aliases"
|
751
|
+
|
752
|
+
response = request(
|
753
|
+
method: "GET",
|
754
|
+
url: method_url,
|
755
|
+
headers: headers,
|
756
|
+
params: params,
|
757
|
+
accept_json: true
|
758
|
+
)
|
759
|
+
response
|
760
|
+
end
|
761
|
+
|
762
|
+
##
|
763
|
+
# @!method create_resource_alias(name:, source:, target:)
|
764
|
+
# Create a new resource alias.
|
765
|
+
# Alias a resource instance into a targeted environment's (name)space.
|
766
|
+
# @param name [String] The name of the alias. Must be 180 characters or less and cannot include any
|
767
|
+
# special characters other than `(space) - . _ :`.
|
768
|
+
# @param source [String] The short or long ID of resource instance.
|
769
|
+
# @param target [String] The CRN of target name(space) in a specific environment, e.g. space in Dallas YP,
|
770
|
+
# CFEE instance etc.
|
771
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
772
|
+
def create_resource_alias(name:, source:, target:)
|
773
|
+
raise ArgumentError.new("name must be provided") if name.nil?
|
774
|
+
|
775
|
+
raise ArgumentError.new("source must be provided") if source.nil?
|
776
|
+
|
777
|
+
raise ArgumentError.new("target must be provided") if target.nil?
|
778
|
+
|
779
|
+
headers = {
|
780
|
+
}
|
781
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "create_resource_alias")
|
782
|
+
headers.merge!(sdk_headers)
|
783
|
+
|
784
|
+
data = {
|
785
|
+
"name" => name,
|
786
|
+
"source" => source,
|
787
|
+
"target" => target
|
788
|
+
}
|
789
|
+
|
790
|
+
method_url = "/v2/resource_aliases"
|
791
|
+
|
792
|
+
response = request(
|
793
|
+
method: "POST",
|
794
|
+
url: method_url,
|
795
|
+
headers: headers,
|
796
|
+
json: data,
|
797
|
+
accept_json: true
|
798
|
+
)
|
799
|
+
response
|
800
|
+
end
|
801
|
+
|
802
|
+
##
|
803
|
+
# @!method get_resource_alias(id:)
|
804
|
+
# Get a resource alias.
|
805
|
+
# Retrieve a resource alias by ID.
|
806
|
+
# @param id [String] The short or long ID of the alias.
|
807
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
808
|
+
def get_resource_alias(id:)
|
809
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
810
|
+
|
811
|
+
headers = {
|
812
|
+
}
|
813
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "get_resource_alias")
|
814
|
+
headers.merge!(sdk_headers)
|
815
|
+
|
816
|
+
method_url = "/v2/resource_aliases/%s" % [ERB::Util.url_encode(id)]
|
817
|
+
|
818
|
+
response = request(
|
819
|
+
method: "GET",
|
820
|
+
url: method_url,
|
821
|
+
headers: headers,
|
822
|
+
accept_json: true
|
823
|
+
)
|
824
|
+
response
|
825
|
+
end
|
826
|
+
|
827
|
+
##
|
828
|
+
# @!method delete_resource_alias(id:)
|
829
|
+
# Delete a resource alias.
|
830
|
+
# Delete a resource alias by ID.
|
831
|
+
# @param id [String] The short or long ID of the alias.
|
832
|
+
# @return [nil]
|
833
|
+
def delete_resource_alias(id:)
|
834
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
835
|
+
|
836
|
+
headers = {
|
837
|
+
}
|
838
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "delete_resource_alias")
|
839
|
+
headers.merge!(sdk_headers)
|
840
|
+
|
841
|
+
method_url = "/v2/resource_aliases/%s" % [ERB::Util.url_encode(id)]
|
842
|
+
|
843
|
+
request(
|
844
|
+
method: "DELETE",
|
845
|
+
url: method_url,
|
846
|
+
headers: headers,
|
847
|
+
accept_json: false
|
848
|
+
)
|
849
|
+
nil
|
850
|
+
end
|
851
|
+
|
852
|
+
##
|
853
|
+
# @!method update_resource_alias(id:, name:)
|
854
|
+
# Update a resource alias.
|
855
|
+
# Update a resource alias by ID.
|
856
|
+
# @param id [String] The short or long ID of the alias.
|
857
|
+
# @param name [String] The new name of the alias. Must be 180 characters or less and cannot include any
|
858
|
+
# special characters other than `(space) - . _ :`.
|
859
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
860
|
+
def update_resource_alias(id:, name:)
|
861
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
862
|
+
|
863
|
+
raise ArgumentError.new("name must be provided") if name.nil?
|
864
|
+
|
865
|
+
headers = {
|
866
|
+
}
|
867
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "update_resource_alias")
|
868
|
+
headers.merge!(sdk_headers)
|
869
|
+
|
870
|
+
data = {
|
871
|
+
"name" => name
|
872
|
+
}
|
873
|
+
|
874
|
+
method_url = "/v2/resource_aliases/%s" % [ERB::Util.url_encode(id)]
|
875
|
+
|
876
|
+
response = request(
|
877
|
+
method: "PATCH",
|
878
|
+
url: method_url,
|
879
|
+
headers: headers,
|
880
|
+
json: data,
|
881
|
+
accept_json: true
|
882
|
+
)
|
883
|
+
response
|
884
|
+
end
|
885
|
+
|
886
|
+
##
|
887
|
+
# @!method list_resource_bindings_for_alias(id:)
|
888
|
+
# Get a list of all resource bindings for the alias.
|
889
|
+
# Get a list of all resource bindings for the alias.
|
890
|
+
# @param id [String] The short or long ID of the alias.
|
891
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
892
|
+
def list_resource_bindings_for_alias(id:)
|
893
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
894
|
+
|
895
|
+
headers = {
|
896
|
+
}
|
897
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_resource_bindings_for_alias")
|
898
|
+
headers.merge!(sdk_headers)
|
899
|
+
|
900
|
+
method_url = "/v2/resource_aliases/%s/resource_bindings" % [ERB::Util.url_encode(id)]
|
901
|
+
|
902
|
+
response = request(
|
903
|
+
method: "GET",
|
904
|
+
url: method_url,
|
905
|
+
headers: headers,
|
906
|
+
accept_json: true
|
907
|
+
)
|
908
|
+
response
|
909
|
+
end
|
910
|
+
#########################
|
911
|
+
# Resource Reclamations
|
912
|
+
#########################
|
913
|
+
|
914
|
+
##
|
915
|
+
# @!method list_reclamations(account_id: nil, resource_instance_id: nil)
|
916
|
+
# Get a list of all reclamations.
|
917
|
+
# Get a list of all reclamations.
|
918
|
+
# @param account_id [String] An alpha-numeric value identifying the account ID.
|
919
|
+
# @param resource_instance_id [String] The short ID of the resource instance.
|
920
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
921
|
+
def list_reclamations(account_id: nil, resource_instance_id: nil)
|
922
|
+
headers = {
|
923
|
+
}
|
924
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "list_reclamations")
|
925
|
+
headers.merge!(sdk_headers)
|
926
|
+
|
927
|
+
params = {
|
928
|
+
"account_id" => account_id,
|
929
|
+
"resource_instance_id" => resource_instance_id
|
930
|
+
}
|
931
|
+
|
932
|
+
method_url = "/v1/reclamations"
|
933
|
+
|
934
|
+
response = request(
|
935
|
+
method: "GET",
|
936
|
+
url: method_url,
|
937
|
+
headers: headers,
|
938
|
+
params: params,
|
939
|
+
accept_json: true
|
940
|
+
)
|
941
|
+
response
|
942
|
+
end
|
943
|
+
|
944
|
+
##
|
945
|
+
# @!method run_reclamation_action(id:, action_name:, request_by: nil, comment: nil)
|
946
|
+
# Perform a reclamation action.
|
947
|
+
# Reclaim (provisionally delete) a resource so that it can no longer be used, or
|
948
|
+
# restore a resource so that it's usable again.
|
949
|
+
# @param id [String] The ID associated with the reclamation.
|
950
|
+
# @param action_name [String] The reclamation action name. Specify `reclaim` to delete a resource, or `restore`
|
951
|
+
# to restore a resource.
|
952
|
+
# @param request_by [String] The request initiator, if different from the request token.
|
953
|
+
# @param comment [String] A comment to describe the action.
|
954
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
955
|
+
def run_reclamation_action(id:, action_name:, request_by: nil, comment: nil)
|
956
|
+
raise ArgumentError.new("id must be provided") if id.nil?
|
957
|
+
|
958
|
+
raise ArgumentError.new("action_name must be provided") if action_name.nil?
|
959
|
+
|
960
|
+
headers = {
|
961
|
+
}
|
962
|
+
sdk_headers = Common.new.get_sdk_headers("resource_controller", "V2", "run_reclamation_action")
|
963
|
+
headers.merge!(sdk_headers)
|
964
|
+
|
965
|
+
data = {
|
966
|
+
"request_by" => request_by,
|
967
|
+
"comment" => comment
|
968
|
+
}
|
969
|
+
|
970
|
+
method_url = "/v1/reclamations/%s/actions/%s" % [ERB::Util.url_encode(id), ERB::Util.url_encode(action_name)]
|
971
|
+
|
972
|
+
response = request(
|
973
|
+
method: "POST",
|
974
|
+
url: method_url,
|
975
|
+
headers: headers,
|
976
|
+
json: data,
|
977
|
+
accept_json: true
|
978
|
+
)
|
979
|
+
response
|
980
|
+
end
|
981
|
+
end
|
982
|
+
end
|