ibm_cloud_iam 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +131 -0
- data/Rakefile +10 -0
- data/docs/ApiKey.md +43 -0
- data/docs/ApiKeyInsideCreateServiceIdRequest.md +23 -0
- data/docs/ApiKeyList.md +29 -0
- data/docs/CreateApiKeyRequest.md +27 -0
- data/docs/CreateServiceIdRequest.md +25 -0
- data/docs/EnityHistoryRecord.md +27 -0
- data/docs/Error.md +23 -0
- data/docs/ExceptionResponse.md +23 -0
- data/docs/ExceptionResponseContext.md +39 -0
- data/docs/IdentityOperationsApi.md +828 -0
- data/docs/InlineObject.md +19 -0
- data/docs/InlineObject1.md +23 -0
- data/docs/InlineObject2.md +21 -0
- data/docs/InlineObject3.md +25 -0
- data/docs/MFARequirementsResponse.md +21 -0
- data/docs/OidcExceptionResponse.md +25 -0
- data/docs/ResponseContext.md +37 -0
- data/docs/ServiceId.md +43 -0
- data/docs/ServiceIdList.md +29 -0
- data/docs/TokenOperationsApi.md +226 -0
- data/docs/TokenResponse.md +27 -0
- data/docs/UpdateApiKeyRequest.md +19 -0
- data/docs/UpdateServiceIdRequest.md +21 -0
- data/git_push.sh +58 -0
- data/ibm_cloud_iam-1.0.0.gem +0 -0
- data/ibm_cloud_iam.gemspec +38 -0
- data/lib/ibm_cloud_iam.rb +62 -0
- data/lib/ibm_cloud_iam/api/identity_operations_api.rb +1083 -0
- data/lib/ibm_cloud_iam/api/token_operations_api.rb +351 -0
- data/lib/ibm_cloud_iam/api_client.rb +387 -0
- data/lib/ibm_cloud_iam/api_error.rb +57 -0
- data/lib/ibm_cloud_iam/configuration.rb +241 -0
- data/lib/ibm_cloud_iam/models/api_key.rb +381 -0
- data/lib/ibm_cloud_iam/models/api_key_inside_create_service_id_request.rb +245 -0
- data/lib/ibm_cloud_iam/models/api_key_list.rb +276 -0
- data/lib/ibm_cloud_iam/models/create_api_key_request.rb +270 -0
- data/lib/ibm_cloud_iam/models/create_service_id_request.rb +261 -0
- data/lib/ibm_cloud_iam/models/enity_history_record.rb +292 -0
- data/lib/ibm_cloud_iam/models/error.rb +255 -0
- data/lib/ibm_cloud_iam/models/exception_response.rb +251 -0
- data/lib/ibm_cloud_iam/models/exception_response_context.rb +320 -0
- data/lib/ibm_cloud_iam/models/inline_object.rb +229 -0
- data/lib/ibm_cloud_iam/models/inline_object1.rb +254 -0
- data/lib/ibm_cloud_iam/models/inline_object2.rb +244 -0
- data/lib/ibm_cloud_iam/models/inline_object3.rb +269 -0
- data/lib/ibm_cloud_iam/models/mfa_requirements_response.rb +245 -0
- data/lib/ibm_cloud_iam/models/oidc_exception_response.rb +258 -0
- data/lib/ibm_cloud_iam/models/response_context.rb +310 -0
- data/lib/ibm_cloud_iam/models/service_id.rb +377 -0
- data/lib/ibm_cloud_iam/models/service_id_list.rb +276 -0
- data/lib/ibm_cloud_iam/models/token_response.rb +260 -0
- data/lib/ibm_cloud_iam/models/update_api_key_request.rb +220 -0
- data/lib/ibm_cloud_iam/models/update_service_id_request.rb +232 -0
- data/lib/ibm_cloud_iam/version.rb +15 -0
- data/spec/api/identity_operations_api_spec.rb +253 -0
- data/spec/api/token_operations_api_spec.rb +94 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/api_key_inside_create_service_id_request_spec.rb +59 -0
- data/spec/models/api_key_list_spec.rb +77 -0
- data/spec/models/api_key_spec.rb +119 -0
- data/spec/models/create_api_key_request_spec.rb +71 -0
- data/spec/models/create_service_id_request_spec.rb +65 -0
- data/spec/models/enity_history_record_spec.rb +71 -0
- data/spec/models/error_spec.rb +59 -0
- data/spec/models/exception_response_context_spec.rb +107 -0
- data/spec/models/exception_response_spec.rb +59 -0
- data/spec/models/inline_object1_spec.rb +59 -0
- data/spec/models/inline_object2_spec.rb +53 -0
- data/spec/models/inline_object3_spec.rb +65 -0
- data/spec/models/inline_object_spec.rb +47 -0
- data/spec/models/mfa_requirements_response_spec.rb +53 -0
- data/spec/models/oidc_exception_response_spec.rb +65 -0
- data/spec/models/response_context_spec.rb +101 -0
- data/spec/models/service_id_list_spec.rb +77 -0
- data/spec/models/service_id_spec.rb +119 -0
- data/spec/models/token_response_spec.rb +71 -0
- data/spec/models/update_api_key_request_spec.rb +47 -0
- data/spec/models/update_service_id_request_spec.rb +53 -0
- data/spec/spec_helper.rb +111 -0
- metadata +192 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
=begin
|
2
|
+
#IAM Identity Services API
|
3
|
+
|
4
|
+
#The IAM Identity Service API allows for the management of Identities (Service IDs, ApiKeys).
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-beta2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module IbmCloudIam
|
14
|
+
VERSION = '1.0.1'
|
15
|
+
end
|
@@ -0,0 +1,253 @@
|
|
1
|
+
=begin
|
2
|
+
#IAM Identity Services API
|
3
|
+
|
4
|
+
#The IAM Identity Service API allows for the management of Identities (Service IDs, ApiKeys).
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-beta2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for IbmCloudIam::IdentityOperationsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'IdentityOperationsApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = IbmCloudIam::IdentityOperationsApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of IdentityOperationsApi' do
|
30
|
+
it 'should create an instance of IdentityOperationsApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(IbmCloudIam::IdentityOperationsApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for create_api_key
|
36
|
+
# Create an API key
|
37
|
+
# Creates an API key for a UserID or service ID. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to.
|
38
|
+
# @param create_api_key_request Request to create an API key
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
41
|
+
# @option opts [String] :entity_lock Indicates if the API key is locked for further write operations. False by default.
|
42
|
+
# @return [ApiKey]
|
43
|
+
describe 'create_api_key test' do
|
44
|
+
it 'should work' do
|
45
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# unit tests for create_service_id
|
50
|
+
# Create a service ID
|
51
|
+
# Creates a service ID for an IBM Cloud account. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to.
|
52
|
+
# @param create_service_id_request Request to create a service ID
|
53
|
+
# @param [Hash] opts the optional parameters
|
54
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
55
|
+
# @option opts [String] :entity_lock Indicates if the service ID is locked for further write operations. False by default.
|
56
|
+
# @return [ServiceId]
|
57
|
+
describe 'create_service_id test' do
|
58
|
+
it 'should work' do
|
59
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# unit tests for delete_api_key
|
64
|
+
# Deletes an API key
|
65
|
+
# Deletes an API key. Existing tokens will remain valid until expired. Refresh tokens will not work any more for this API key. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to.
|
66
|
+
# @param id Unique ID of the API key.
|
67
|
+
# @param [Hash] opts the optional parameters
|
68
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
69
|
+
# @return [nil]
|
70
|
+
describe 'delete_api_key test' do
|
71
|
+
it 'should work' do
|
72
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# unit tests for delete_service_id
|
77
|
+
# Deletes a service ID and associated API keys
|
78
|
+
# Deletes a service ID and all API keys associated to it. Before deleting the service ID, all associated API keys are deleted. In case a Delete Conflict (status code 409) a retry of the request may help as the service ID is only deleted if the associated API keys were successfully deleted before. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to.
|
79
|
+
# @param id Unique ID of the service ID.
|
80
|
+
# @param [Hash] opts the optional parameters
|
81
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
82
|
+
# @return [nil]
|
83
|
+
describe 'delete_service_id test' do
|
84
|
+
it 'should work' do
|
85
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# unit tests for get_api_key
|
90
|
+
# Get details of an API key
|
91
|
+
# Returns the details of an API key. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity.
|
92
|
+
# @param id Unique ID of the API key.
|
93
|
+
# @param [Hash] opts the optional parameters
|
94
|
+
# @option opts [Boolean] :include_history Defines if the entity history is included in the response.
|
95
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
96
|
+
# @return [ApiKey]
|
97
|
+
describe 'get_api_key test' do
|
98
|
+
it 'should work' do
|
99
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# unit tests for get_api_keys_details
|
104
|
+
# Get details of an API key by its value
|
105
|
+
# Returns the details of an API key by its value. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to.
|
106
|
+
# @param [Hash] opts the optional parameters
|
107
|
+
# @option opts [String] :iam_api_key API key value.
|
108
|
+
# @option opts [Boolean] :include_history Defines if the entity history is included in the response
|
109
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
110
|
+
# @return [ApiKey]
|
111
|
+
describe 'get_api_keys_details test' do
|
112
|
+
it 'should work' do
|
113
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# unit tests for get_service_id
|
118
|
+
# Get details of a service ID
|
119
|
+
# Returns the details of a service ID. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to.
|
120
|
+
# @param id Unique ID of the service ID.
|
121
|
+
# @param [Hash] opts the optional parameters
|
122
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
123
|
+
# @option opts [Boolean] :include_history Defines if the entity history is included in the response.
|
124
|
+
# @return [ServiceId]
|
125
|
+
describe 'get_service_id test' do
|
126
|
+
it 'should work' do
|
127
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# unit tests for list_api_keys
|
132
|
+
# Get API keys for a given service or user IAM ID and account ID.
|
133
|
+
# Returns the list of API key details for a given service or user IAM ID and account ID. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity.
|
134
|
+
# @param [Hash] opts the optional parameters
|
135
|
+
# @option opts [String] :account_id Account ID of the API keys(s) to query. If a service IAM ID is specified in iam_id then account_id must match the account of the IAM ID. If a user IAM ID is specified in iam_id then then account_id must match the account of the Authorization token.
|
136
|
+
# @option opts [String] :iam_id IAM ID of the API key(s) to be queried. The IAM ID may be that of a user or a service. For a user IAM ID iam_id must match the Authorization token.
|
137
|
+
# @option opts [Integer] :pagesize Optional size of a single page. Default is 20 items per page. Valid range is 1 to 100.
|
138
|
+
# @option opts [String] :pagetoken Optional Prev or Next page token returned from a previous query execution. Default is start with first page.
|
139
|
+
# @option opts [String] :scope Optional parameter to define the scope of the queried API Keys. Can be 'entity' (default) or 'account'.
|
140
|
+
# @option opts [String] :type Optional parameter to filter the type of the queried API Keys. Can be 'user' or 'serviceid'.
|
141
|
+
# @option opts [String] :sort Optional sort property, valid values are name, description, created_at and created_by. If specified, the items are sorted by the value of this property.
|
142
|
+
# @option opts [String] :order Optional sort order, valid values are asc and desc. Default: asc.
|
143
|
+
# @option opts [Boolean] :include_history Defines if the entity history is included in the response.
|
144
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
145
|
+
# @return [ApiKeyList]
|
146
|
+
describe 'list_api_keys test' do
|
147
|
+
it 'should work' do
|
148
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# unit tests for list_service_ids
|
153
|
+
# List service IDs
|
154
|
+
# Returns a list of service IDs. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to.
|
155
|
+
# @param [Hash] opts the optional parameters
|
156
|
+
# @option opts [String] :account_id Account ID of the service ID(s) to query. This parameter is required (unless using a pagetoken).
|
157
|
+
# @option opts [String] :name Name of the service ID(s) to query. Optional.20 items per page. Valid range is 1 to 100.
|
158
|
+
# @option opts [Integer] :pagesize Optional size of a single page. Default is 20 items per page. Valid range is 1 to 100.
|
159
|
+
# @option opts [String] :pagetoken Optional Prev or Next page token returned from a previous query execution. Default is start with first page.
|
160
|
+
# @option opts [String] :sort Optional sort property, valid values are name, description, created_at and modified_at. If specified, the items are sorted by the value of this property.
|
161
|
+
# @option opts [String] :order Optional sort order, valid values are asc and desc. Default: asc.
|
162
|
+
# @option opts [Boolean] :include_history Defines if the entity history is included in the response
|
163
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
164
|
+
# @return [ServiceIdList]
|
165
|
+
describe 'list_service_ids test' do
|
166
|
+
it 'should work' do
|
167
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# unit tests for lock_api_key
|
172
|
+
# Lock the API key
|
173
|
+
# Locks an API key by ID. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity.
|
174
|
+
# @param id Unique ID of the API key.
|
175
|
+
# @param [Hash] opts the optional parameters
|
176
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
177
|
+
# @return [nil]
|
178
|
+
describe 'lock_api_key test' do
|
179
|
+
it 'should work' do
|
180
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# unit tests for lock_service_id
|
185
|
+
# Lock the service ID
|
186
|
+
# Locks a service ID by ID. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity.
|
187
|
+
# @param id Unique ID of the service ID.
|
188
|
+
# @param [Hash] opts the optional parameters
|
189
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
190
|
+
# @return [ServiceId]
|
191
|
+
describe 'lock_service_id test' do
|
192
|
+
it 'should work' do
|
193
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# unit tests for unlock_api_key
|
198
|
+
# Unlock the API key
|
199
|
+
# Unlocks an API key by ID. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity.
|
200
|
+
# @param id Unique ID of the API key.
|
201
|
+
# @param [Hash] opts the optional parameters
|
202
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
203
|
+
# @return [nil]
|
204
|
+
describe 'unlock_api_key test' do
|
205
|
+
it 'should work' do
|
206
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# unit tests for unlock_service_id
|
211
|
+
# Unlock the service ID
|
212
|
+
# Unlocks a service ID by ID. Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity.
|
213
|
+
# @param id Unique ID of the service ID.
|
214
|
+
# @param [Hash] opts the optional parameters
|
215
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
216
|
+
# @return [ServiceId]
|
217
|
+
describe 'unlock_service_id test' do
|
218
|
+
it 'should work' do
|
219
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
# unit tests for update_api_key
|
224
|
+
# Updates an API key
|
225
|
+
# Updates properties of an API key. This does NOT affect existing access tokens. Their token content will stay unchanged until the access token is refreshed. To update an API key, pass the property to be modified. To delete one property's value, pass the property with an empty value \"\".Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to.
|
226
|
+
# @param id Unique ID of the API key to be updated.
|
227
|
+
# @param if_match Version of the API key to be updated. Specify the version that you retrieved when reading the API key. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.
|
228
|
+
# @param update_api_key_request Request to update an API key
|
229
|
+
# @param [Hash] opts the optional parameters
|
230
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
231
|
+
# @return [ApiKey]
|
232
|
+
describe 'update_api_key test' do
|
233
|
+
it 'should work' do
|
234
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
# unit tests for update_service_id
|
239
|
+
# Update service ID
|
240
|
+
# Updates properties of a service ID. This does NOT affect existing access tokens. Their token content will stay unchanged until the access token is refreshed. To update a service ID, pass the property to be modified. To delete one property's value, pass the property with an empty value \"\".Users can manage user API keys for themself, or service ID API keys for service IDs that are bound to an entity they have access to.
|
241
|
+
# @param id Unique ID of the service ID to be updated.
|
242
|
+
# @param if_match Version of the service ID to be updated. Specify the version that you retrieved as entity_tag (ETag header) when reading the service ID. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates.
|
243
|
+
# @param update_service_id_request Request to update a service ID
|
244
|
+
# @param [Hash] opts the optional parameters
|
245
|
+
# @option opts [String] :authorization Authorization Token used for the request. The supported token type is a Cloud IAM Access Token. If the token is omitted the request will fail with BXNIM0308E: 'No authorization header found'. Please make sure that the provided token has the required authority for the request.
|
246
|
+
# @return [ServiceId]
|
247
|
+
describe 'update_service_id test' do
|
248
|
+
it 'should work' do
|
249
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
=begin
|
2
|
+
#IAM Identity Services API
|
3
|
+
|
4
|
+
#The IAM Identity Service API allows for the management of Identities (Service IDs, ApiKeys).
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-beta2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for IbmCloudIam::TokenOperationsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'TokenOperationsApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = IbmCloudIam::TokenOperationsApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of TokenOperationsApi' do
|
30
|
+
it 'should create an instance of TokenOperationsApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(IbmCloudIam::TokenOperationsApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for get_token_api_key
|
36
|
+
# Create an IAM access token for a user or service ID using an API key.
|
37
|
+
# Creates a non-opaque access token for an API key.
|
38
|
+
# @param grant_type Grant type for this API call. You must set the grant type to `urn:ibm:params:oauth:grant-type:apikey`.
|
39
|
+
# @param apikey The value of the api key
|
40
|
+
# @param [Hash] opts the optional parameters
|
41
|
+
# @return [TokenResponse]
|
42
|
+
describe 'get_token_api_key test' do
|
43
|
+
it 'should work' do
|
44
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# unit tests for get_token_api_key_delegated_refresh_token
|
49
|
+
# Create an IAM access token and delegated refresh token for a user or service ID.
|
50
|
+
# Creates a non-opaque access token and a delegated refresh token for an API key.
|
51
|
+
# @param grant_type Grant type for this API call. You must set the grant type to `urn:ibm:params:oauth:grant-type:apikey`.
|
52
|
+
# @param apikey The value of the API key.
|
53
|
+
# @param response_type Either 'delegated_refresh_token' to receive a delegated refresh token only, or 'cloud_iam delegated_refresh_token' to receive both an IAM access token and a delegated refresh token in one API call.
|
54
|
+
# @param receiver_client_ids A comma separated list of one or more client IDs that will be able to consume the delegated refresh token. The service that accepts a delegated refresh token as API parameter must expose its client ID to allow this API call. The receiver of the delegated refresh token will be able to use the refresh token until it expires.
|
55
|
+
# @param [Hash] opts the optional parameters
|
56
|
+
# @option opts [Integer] :delegated_refresh_token_expiry Expiration in seconds until the delegated refresh token must be consumed by the receiver client IDs. After the expiration, no client ID can consume the delegated refresh token, even if the life time of the refresh token inside is still not expired. The default, if not specified, is 518,400 seconds which corresponds to 6 days.
|
57
|
+
# @return [TokenResponse]
|
58
|
+
describe 'get_token_api_key_delegated_refresh_token test' do
|
59
|
+
it 'should work' do
|
60
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# unit tests for get_token_iam_authz
|
65
|
+
# Create an IAM access token based on an authorization policy.
|
66
|
+
# Creates a non-opaque access token, if an appropriate authorization policy is in place. This kind of IAM access token is typically used for access between services.
|
67
|
+
# @param grant_type Grant type for this API call. You must set the grant type to `urn:ibm:params:oauth:grant-type:iam-authz`.
|
68
|
+
# @param access_token The IAM access token of the identity that has the appropriate authorization to create an IAM access token for a given resource.
|
69
|
+
# @param desired_iam_id The IAM ID of the IAM access token identity that should be created. The desired_iam_id identifies a resource identity. The IAM ID consists of the prefix crn- and the CRN of the target identity, e.g. crn-crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4::.
|
70
|
+
# @param [Hash] opts the optional parameters
|
71
|
+
# @return [TokenResponse]
|
72
|
+
describe 'get_token_iam_authz test' do
|
73
|
+
it 'should work' do
|
74
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# unit tests for get_token_password
|
79
|
+
# Create an IAM access token for a user using username / password credentials and an optional account identifier.
|
80
|
+
# Creates a non-opaque access token for a username and password. To be able to call IBM Cloud APIs, the token must be made account-specific. For this purpose, also pass the 32 character long identifier for your account in the API call. This API call is possible only for non-federated IBMid users.
|
81
|
+
# @param authorization Basic Authorization Header containing a valid client ID and secret. If this header is omitted the request fails with BXNIM0308E: 'No authorization header found'. You can use the client ID and secret that is used by the IBM Cloud CLI: `bx / bx`
|
82
|
+
# @param grant_type Grant type for this API call. You must set the grant type to `password`.
|
83
|
+
# @param username The value of the username
|
84
|
+
# @param password The value of the password
|
85
|
+
# @param [Hash] opts the optional parameters
|
86
|
+
# @option opts [String] :account The 32 character identifier of the account. Specify this parameter to get an account-specific IAM token. IBM Cloud APIs require that IAM tokens are account-specific.
|
87
|
+
# @return [TokenResponse]
|
88
|
+
describe 'get_token_password test' do
|
89
|
+
it 'should work' do
|
90
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -0,0 +1,226 @@
|
|
1
|
+
=begin
|
2
|
+
#IAM Identity Services API
|
3
|
+
|
4
|
+
#The IAM Identity Service API allows for the management of Identities (Service IDs, ApiKeys).
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-beta2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
|
15
|
+
describe IbmCloudIam::ApiClient do
|
16
|
+
context 'initialization' do
|
17
|
+
context 'URL stuff' do
|
18
|
+
context 'host' do
|
19
|
+
it 'removes http from host' do
|
20
|
+
IbmCloudIam.configure { |c| c.host = 'http://example.com' }
|
21
|
+
expect(IbmCloudIam::Configuration.default.host).to eq('example.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes https from host' do
|
25
|
+
IbmCloudIam.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
+
expect(IbmCloudIam::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'removes trailing path from host' do
|
30
|
+
IbmCloudIam.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
+
expect(IbmCloudIam::Configuration.default.host).to eq('hobo.com')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
IbmCloudIam.configure { |c| c.base_path = 'v4/dog' }
|
38
|
+
expect(IbmCloudIam::Configuration.default.base_path).to eq('/v4/dog')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
42
|
+
IbmCloudIam.configure { |c| c.base_path = '/v4/dog' }
|
43
|
+
expect(IbmCloudIam::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "ends up as a blank string if nil" do
|
47
|
+
IbmCloudIam.configure { |c| c.base_path = nil }
|
48
|
+
expect(IbmCloudIam::Configuration.default.base_path).to eq('')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'params_encoding in #build_request' do
|
55
|
+
let(:config) { IbmCloudIam::Configuration.new }
|
56
|
+
let(:api_client) { IbmCloudIam::ApiClient.new(config) }
|
57
|
+
|
58
|
+
it 'defaults to nil' do
|
59
|
+
expect(IbmCloudIam::Configuration.default.params_encoding).to eq(nil)
|
60
|
+
expect(config.params_encoding).to eq(nil)
|
61
|
+
|
62
|
+
request = api_client.build_request(:get, '/test')
|
63
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'can be customized' do
|
67
|
+
config.params_encoding = :multi
|
68
|
+
request = api_client.build_request(:get, '/test')
|
69
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'timeout in #build_request' do
|
74
|
+
let(:config) { IbmCloudIam::Configuration.new }
|
75
|
+
let(:api_client) { IbmCloudIam::ApiClient.new(config) }
|
76
|
+
|
77
|
+
it 'defaults to 0' do
|
78
|
+
expect(IbmCloudIam::Configuration.default.timeout).to eq(0)
|
79
|
+
expect(config.timeout).to eq(0)
|
80
|
+
|
81
|
+
request = api_client.build_request(:get, '/test')
|
82
|
+
expect(request.options[:timeout]).to eq(0)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'can be customized' do
|
86
|
+
config.timeout = 100
|
87
|
+
request = api_client.build_request(:get, '/test')
|
88
|
+
expect(request.options[:timeout]).to eq(100)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#deserialize' do
|
93
|
+
it "handles Array<Integer>" do
|
94
|
+
api_client = IbmCloudIam::ApiClient.new
|
95
|
+
headers = { 'Content-Type' => 'application/json' }
|
96
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
97
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
98
|
+
expect(data).to be_instance_of(Array)
|
99
|
+
expect(data).to eq([12, 34])
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'handles Array<Array<Integer>>' do
|
103
|
+
api_client = IbmCloudIam::ApiClient.new
|
104
|
+
headers = { 'Content-Type' => 'application/json' }
|
105
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
106
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
107
|
+
expect(data).to be_instance_of(Array)
|
108
|
+
expect(data).to eq([[12, 34], [56]])
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'handles Hash<String, String>' do
|
112
|
+
api_client = IbmCloudIam::ApiClient.new
|
113
|
+
headers = { 'Content-Type' => 'application/json' }
|
114
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
115
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
116
|
+
expect(data).to be_instance_of(Hash)
|
117
|
+
expect(data).to eq(:message => 'Hello')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe "#object_to_hash" do
|
122
|
+
it 'ignores nils and includes empty arrays' do
|
123
|
+
# uncomment below to test object_to_hash for model
|
124
|
+
# api_client = IbmCloudIam::ApiClient.new
|
125
|
+
# _model = IbmCloudIam::ModelName.new
|
126
|
+
# update the model attribute below
|
127
|
+
# _model.id = 1
|
128
|
+
# update the expected value (hash) below
|
129
|
+
# expected = {id: 1, name: '', tags: []}
|
130
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe '#build_collection_param' do
|
135
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
136
|
+
let(:api_client) { IbmCloudIam::ApiClient.new }
|
137
|
+
|
138
|
+
it 'works for csv' do
|
139
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'works for ssv' do
|
143
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'works for tsv' do
|
147
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'works for pipes' do
|
151
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'works for multi' do
|
155
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'fails for invalid collection format' do
|
159
|
+
expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe '#json_mime?' do
|
164
|
+
let(:api_client) { IbmCloudIam::ApiClient.new }
|
165
|
+
|
166
|
+
it 'works' do
|
167
|
+
expect(api_client.json_mime?(nil)).to eq false
|
168
|
+
expect(api_client.json_mime?('')).to eq false
|
169
|
+
|
170
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
171
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
172
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
173
|
+
|
174
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
175
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
176
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe '#select_header_accept' do
|
181
|
+
let(:api_client) { IbmCloudIam::ApiClient.new }
|
182
|
+
|
183
|
+
it 'works' do
|
184
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
185
|
+
expect(api_client.select_header_accept([])).to be_nil
|
186
|
+
|
187
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
188
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
189
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
190
|
+
|
191
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
192
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe '#select_header_content_type' do
|
197
|
+
let(:api_client) { IbmCloudIam::ApiClient.new }
|
198
|
+
|
199
|
+
it 'works' do
|
200
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
201
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
202
|
+
|
203
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
204
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
205
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
206
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
207
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
describe '#sanitize_filename' do
|
212
|
+
let(:api_client) { IbmCloudIam::ApiClient.new }
|
213
|
+
|
214
|
+
it 'works' do
|
215
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
216
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
217
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
218
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
219
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
220
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
221
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
222
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
223
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|