Class: IbmCloudResourceController::ResourceKeysApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ibm_cloud_resource_controller/api/resource_keys_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ResourceKeysApi

Returns a new instance of ResourceKeysApi.



19
20
21
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_resource_key(resource_key_post, opts = {}) ⇒ ResourceKey

Create a new resource key Create a new resource key.

Parameters:

  • resource_key_post (ResourceKeyPost)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 27

def create_resource_key(resource_key_post, opts = {})
  data, _status_code, _headers = create_resource_key_with_http_info(resource_key_post, opts)
  data
end

#create_resource_key_with_http_info(resource_key_post, opts = {}) ⇒ Array<(ResourceKey, Integer, Hash)>

Create a new resource key Create a new resource key.

Parameters:

  • resource_key_post (ResourceKeyPost)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ResourceKey, Integer, Hash)>)

    ResourceKey data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 37

def create_resource_key_with_http_info(resource_key_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourceKeysApi.create_resource_key ...'
  end
  # verify the required parameter 'resource_key_post' is set
  if @api_client.config.client_side_validation && resource_key_post.nil?
    fail ArgumentError, "Missing the required parameter 'resource_key_post' when calling ResourceKeysApi.create_resource_key"
  end
  # resource path
  local_var_path = '/v2/resource_keys'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(resource_key_post) 

  # return_type
  return_type = opts[:return_type] || 'ResourceKey' 

  # auth_names
  auth_names = opts[:auth_names] || ['IAM']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourceKeysApi#create_resource_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_resource_key(id, opts = {}) ⇒ nil

Delete a resource key by ID Delete a resource key by ID.

Parameters:

  • id (String)

    The short or long ID of the key.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


91
92
93
94
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 91

def delete_resource_key(id, opts = {})
  delete_resource_key_with_http_info(id, opts)
  nil
end

#delete_resource_key_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a resource key by ID Delete a resource key by ID.

Parameters:

  • id (String)

    The short or long ID of the key.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 101

def delete_resource_key_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourceKeysApi.delete_resource_key ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ResourceKeysApi.delete_resource_key"
  end
  # resource path
  local_var_path = '/v2/resource_keys/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['IAM']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourceKeysApi#delete_resource_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resource_key(id, opts = {}) ⇒ ResourceKey

Get resource key by ID Get resource key by ID.

Parameters:

  • id (String)

    The short or long ID of the key.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



153
154
155
156
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 153

def get_resource_key(id, opts = {})
  data, _status_code, _headers = get_resource_key_with_http_info(id, opts)
  data
end

#get_resource_key_with_http_info(id, opts = {}) ⇒ Array<(ResourceKey, Integer, Hash)>

Get resource key by ID Get resource key by ID.

Parameters:

  • id (String)

    The short or long ID of the key.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ResourceKey, Integer, Hash)>)

    ResourceKey data, response status code and response headers



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 163

def get_resource_key_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourceKeysApi.get_resource_key ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ResourceKeysApi.get_resource_key"
  end
  # resource path
  local_var_path = '/v2/resource_keys/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'ResourceKey' 

  # auth_names
  auth_names = opts[:auth_names] || ['IAM']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourceKeysApi#get_resource_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_resource_keys(opts = {}) ⇒ ResourceKeysList

Get a list of all of the resource keys. List all resource keys.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :guid (String)

    When you create a new key, a GUID (globally unique identifier) is assigned. This is a unique internal GUID managed by Resource controller that corresponds to the key.

  • :name (String)

    The human-readable name of the key.

  • :resource_group_id (String)

    The short ID of the resource group.

  • :resource_id (String)

    The unique ID of the offering. This value is provided by and stored in the global catalog.

  • :limit (String)

    Limit on how many items should be returned.

  • :updated_from (String)

    Start date inclusive filter.

  • :updated_to (String)

    End date inclusive filter.

Returns:



221
222
223
224
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 221

def list_resource_keys(opts = {})
  data, _status_code, _headers = list_resource_keys_with_http_info(opts)
  data
end

#list_resource_keys_with_http_info(opts = {}) ⇒ Array<(ResourceKeysList, Integer, Hash)>

Get a list of all of the resource keys. List all resource keys.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :guid (String)

    When you create a new key, a GUID (globally unique identifier) is assigned. This is a unique internal GUID managed by Resource controller that corresponds to the key.

  • :name (String)

    The human-readable name of the key.

  • :resource_group_id (String)

    The short ID of the resource group.

  • :resource_id (String)

    The unique ID of the offering. This value is provided by and stored in the global catalog.

  • :limit (String)

    Limit on how many items should be returned.

  • :updated_from (String)

    Start date inclusive filter.

  • :updated_to (String)

    End date inclusive filter.

Returns:

  • (Array<(ResourceKeysList, Integer, Hash)>)

    ResourceKeysList data, response status code and response headers



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 237

def list_resource_keys_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourceKeysApi.list_resource_keys ...'
  end
  # resource path
  local_var_path = '/v2/resource_keys'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'guid'] = opts[:'guid'] if !opts[:'guid'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'resource_group_id'] = opts[:'resource_group_id'] if !opts[:'resource_group_id'].nil?
  query_params[:'resource_id'] = opts[:'resource_id'] if !opts[:'resource_id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'updated_from'] = opts[:'updated_from'] if !opts[:'updated_from'].nil?
  query_params[:'updated_to'] = opts[:'updated_to'] if !opts[:'updated_to'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'ResourceKeysList' 

  # auth_names
  auth_names = opts[:auth_names] || ['IAM']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourceKeysApi#list_resource_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_resource_key(id, resource_key_patch, opts = {}) ⇒ ResourceKey

Update a resource key Update a resource key by ID.

Parameters:

  • id (String)

    The short or long ID of the key.

  • resource_key_patch (ResourceKeyPatch)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



293
294
295
296
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 293

def update_resource_key(id, resource_key_patch, opts = {})
  data, _status_code, _headers = update_resource_key_with_http_info(id, resource_key_patch, opts)
  data
end

#update_resource_key_with_http_info(id, resource_key_patch, opts = {}) ⇒ Array<(ResourceKey, Integer, Hash)>

Update a resource key Update a resource key by ID.

Parameters:

  • id (String)

    The short or long ID of the key.

  • resource_key_patch (ResourceKeyPatch)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ResourceKey, Integer, Hash)>)

    ResourceKey data, response status code and response headers



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/ibm_cloud_resource_controller/api/resource_keys_api.rb', line 304

def update_resource_key_with_http_info(id, resource_key_patch, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourceKeysApi.update_resource_key ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ResourceKeysApi.update_resource_key"
  end
  # verify the required parameter 'resource_key_patch' is set
  if @api_client.config.client_side_validation && resource_key_patch.nil?
    fail ArgumentError, "Missing the required parameter 'resource_key_patch' when calling ResourceKeysApi.update_resource_key"
  end
  # resource path
  local_var_path = '/v2/resource_keys/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(resource_key_patch) 

  # return_type
  return_type = opts[:return_type] || 'ResourceKey' 

  # auth_names
  auth_names = opts[:auth_names] || ['IAM']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourceKeysApi#update_resource_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end