pnap_tag_api 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +155 -0
- data/Rakefile +10 -0
- data/VERSION +1 -0
- data/docs/DeleteResult.md +20 -0
- data/docs/Error.md +20 -0
- data/docs/ResourceAssignment.md +20 -0
- data/docs/Tag.md +30 -0
- data/docs/TagCreate.md +22 -0
- data/docs/TagUpdate.md +22 -0
- data/docs/TagsApi.md +361 -0
- data/lib/pnap_tag_api/api/tags_api.rb +350 -0
- data/lib/pnap_tag_api/api_client.rb +392 -0
- data/lib/pnap_tag_api/api_error.rb +57 -0
- data/lib/pnap_tag_api/configuration.rb +278 -0
- data/lib/pnap_tag_api/models/delete_result.rb +240 -0
- data/lib/pnap_tag_api/models/error.rb +236 -0
- data/lib/pnap_tag_api/models/resource_assignment.rb +235 -0
- data/lib/pnap_tag_api/models/tag.rb +335 -0
- data/lib/pnap_tag_api/models/tag_create.rb +250 -0
- data/lib/pnap_tag_api/models/tag_update.rb +250 -0
- data/lib/pnap_tag_api/version.rb +19 -0
- data/lib/pnap_tag_api.rb +46 -0
- data/pnap_tag_api.gemspec +39 -0
- data/spec/api/tags_api_spec.rb +96 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/delete_result_spec.rb +40 -0
- data/spec/models/error_spec.rb +40 -0
- data/spec/models/resource_assignment_spec.rb +40 -0
- data/spec/models/tag_create_spec.rb +46 -0
- data/spec/models/tag_spec.rb +74 -0
- data/spec/models/tag_update_spec.rb +46 -0
- data/spec/spec_helper.rb +111 -0
- metadata +128 -0
@@ -0,0 +1,350 @@
|
|
1
|
+
=begin
|
2
|
+
#Tags API
|
3
|
+
|
4
|
+
#Tags are case-sensitive key-value pairs that simplify resource management. The Tag Manager API allows you to create and manage such tags to later assign them to related resources in your Bare Metal Cloud (through the respective resource apis) in order to group and categorize them.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#server-tag-manager-api' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/tag-manager/v1/)</b>
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
Contact: support@phoenixnap.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module TagApi
|
16
|
+
class TagsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# List tags.
|
23
|
+
# Retrieve all tags belonging to the BMC Account.
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [String] :name Query a tag by its name.
|
26
|
+
# @return [Array<Tag>]
|
27
|
+
def tags_get(opts = {})
|
28
|
+
data, _status_code, _headers = tags_get_with_http_info(opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# List tags.
|
33
|
+
# Retrieve all tags belonging to the BMC Account.
|
34
|
+
# @param [Hash] opts the optional parameters
|
35
|
+
# @option opts [String] :name Query a tag by its name.
|
36
|
+
# @return [Array<(Array<Tag>, Integer, Hash)>] Array<Tag> data, response status code and response headers
|
37
|
+
def tags_get_with_http_info(opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: TagsApi.tags_get ...'
|
40
|
+
end
|
41
|
+
# resource path
|
42
|
+
local_var_path = '/tags'
|
43
|
+
|
44
|
+
# query parameters
|
45
|
+
query_params = opts[:query_params] || {}
|
46
|
+
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
|
47
|
+
|
48
|
+
# header parameters
|
49
|
+
header_params = opts[:header_params] || {}
|
50
|
+
# HTTP header 'Accept' (if needed)
|
51
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
52
|
+
|
53
|
+
# form parameters
|
54
|
+
form_params = opts[:form_params] || {}
|
55
|
+
|
56
|
+
# http body (model)
|
57
|
+
post_body = opts[:debug_body]
|
58
|
+
|
59
|
+
# return_type
|
60
|
+
return_type = opts[:debug_return_type] || 'Array<Tag>'
|
61
|
+
|
62
|
+
# auth_names
|
63
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
64
|
+
|
65
|
+
new_options = opts.merge(
|
66
|
+
:operation => :"TagsApi.tags_get",
|
67
|
+
:header_params => header_params,
|
68
|
+
:query_params => query_params,
|
69
|
+
:form_params => form_params,
|
70
|
+
:body => post_body,
|
71
|
+
:auth_names => auth_names,
|
72
|
+
:return_type => return_type
|
73
|
+
)
|
74
|
+
|
75
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
76
|
+
if @api_client.config.debugging
|
77
|
+
@api_client.config.logger.debug "API called: TagsApi#tags_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
+
end
|
79
|
+
return data, status_code, headers
|
80
|
+
end
|
81
|
+
|
82
|
+
# Create a Tag.
|
83
|
+
# Create a tag with the provided information.
|
84
|
+
# @param tag_create [TagCreate] The body containing the tag details.
|
85
|
+
# @param [Hash] opts the optional parameters
|
86
|
+
# @return [Tag]
|
87
|
+
def tags_post(tag_create, opts = {})
|
88
|
+
data, _status_code, _headers = tags_post_with_http_info(tag_create, opts)
|
89
|
+
data
|
90
|
+
end
|
91
|
+
|
92
|
+
# Create a Tag.
|
93
|
+
# Create a tag with the provided information.
|
94
|
+
# @param tag_create [TagCreate] The body containing the tag details.
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @return [Array<(Tag, Integer, Hash)>] Tag data, response status code and response headers
|
97
|
+
def tags_post_with_http_info(tag_create, opts = {})
|
98
|
+
if @api_client.config.debugging
|
99
|
+
@api_client.config.logger.debug 'Calling API: TagsApi.tags_post ...'
|
100
|
+
end
|
101
|
+
# verify the required parameter 'tag_create' is set
|
102
|
+
if @api_client.config.client_side_validation && tag_create.nil?
|
103
|
+
fail ArgumentError, "Missing the required parameter 'tag_create' when calling TagsApi.tags_post"
|
104
|
+
end
|
105
|
+
# resource path
|
106
|
+
local_var_path = '/tags'
|
107
|
+
|
108
|
+
# query parameters
|
109
|
+
query_params = opts[:query_params] || {}
|
110
|
+
|
111
|
+
# header parameters
|
112
|
+
header_params = opts[:header_params] || {}
|
113
|
+
# HTTP header 'Accept' (if needed)
|
114
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
115
|
+
# HTTP header 'Content-Type'
|
116
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
117
|
+
if !content_type.nil?
|
118
|
+
header_params['Content-Type'] = content_type
|
119
|
+
end
|
120
|
+
|
121
|
+
# form parameters
|
122
|
+
form_params = opts[:form_params] || {}
|
123
|
+
|
124
|
+
# http body (model)
|
125
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_create)
|
126
|
+
|
127
|
+
# return_type
|
128
|
+
return_type = opts[:debug_return_type] || 'Tag'
|
129
|
+
|
130
|
+
# auth_names
|
131
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
132
|
+
|
133
|
+
new_options = opts.merge(
|
134
|
+
:operation => :"TagsApi.tags_post",
|
135
|
+
:header_params => header_params,
|
136
|
+
:query_params => query_params,
|
137
|
+
:form_params => form_params,
|
138
|
+
:body => post_body,
|
139
|
+
:auth_names => auth_names,
|
140
|
+
:return_type => return_type
|
141
|
+
)
|
142
|
+
|
143
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
144
|
+
if @api_client.config.debugging
|
145
|
+
@api_client.config.logger.debug "API called: TagsApi#tags_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
146
|
+
end
|
147
|
+
return data, status_code, headers
|
148
|
+
end
|
149
|
+
|
150
|
+
# Delete a Tag.
|
151
|
+
# Delete the tag with the given ID.
|
152
|
+
# @param tag_id [String] The tag's ID.
|
153
|
+
# @param [Hash] opts the optional parameters
|
154
|
+
# @return [DeleteResult]
|
155
|
+
def tags_tag_id_delete(tag_id, opts = {})
|
156
|
+
data, _status_code, _headers = tags_tag_id_delete_with_http_info(tag_id, opts)
|
157
|
+
data
|
158
|
+
end
|
159
|
+
|
160
|
+
# Delete a Tag.
|
161
|
+
# Delete the tag with the given ID.
|
162
|
+
# @param tag_id [String] The tag's ID.
|
163
|
+
# @param [Hash] opts the optional parameters
|
164
|
+
# @return [Array<(DeleteResult, Integer, Hash)>] DeleteResult data, response status code and response headers
|
165
|
+
def tags_tag_id_delete_with_http_info(tag_id, opts = {})
|
166
|
+
if @api_client.config.debugging
|
167
|
+
@api_client.config.logger.debug 'Calling API: TagsApi.tags_tag_id_delete ...'
|
168
|
+
end
|
169
|
+
# verify the required parameter 'tag_id' is set
|
170
|
+
if @api_client.config.client_side_validation && tag_id.nil?
|
171
|
+
fail ArgumentError, "Missing the required parameter 'tag_id' when calling TagsApi.tags_tag_id_delete"
|
172
|
+
end
|
173
|
+
# resource path
|
174
|
+
local_var_path = '/tags/{tagId}'.sub('{' + 'tagId' + '}', CGI.escape(tag_id.to_s))
|
175
|
+
|
176
|
+
# query parameters
|
177
|
+
query_params = opts[:query_params] || {}
|
178
|
+
|
179
|
+
# header parameters
|
180
|
+
header_params = opts[:header_params] || {}
|
181
|
+
# HTTP header 'Accept' (if needed)
|
182
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
183
|
+
|
184
|
+
# form parameters
|
185
|
+
form_params = opts[:form_params] || {}
|
186
|
+
|
187
|
+
# http body (model)
|
188
|
+
post_body = opts[:debug_body]
|
189
|
+
|
190
|
+
# return_type
|
191
|
+
return_type = opts[:debug_return_type] || 'DeleteResult'
|
192
|
+
|
193
|
+
# auth_names
|
194
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
195
|
+
|
196
|
+
new_options = opts.merge(
|
197
|
+
:operation => :"TagsApi.tags_tag_id_delete",
|
198
|
+
:header_params => header_params,
|
199
|
+
:query_params => query_params,
|
200
|
+
:form_params => form_params,
|
201
|
+
:body => post_body,
|
202
|
+
:auth_names => auth_names,
|
203
|
+
:return_type => return_type
|
204
|
+
)
|
205
|
+
|
206
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
207
|
+
if @api_client.config.debugging
|
208
|
+
@api_client.config.logger.debug "API called: TagsApi#tags_tag_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
209
|
+
end
|
210
|
+
return data, status_code, headers
|
211
|
+
end
|
212
|
+
|
213
|
+
# Get a Tag.
|
214
|
+
# Retrieve the tag with the given ID
|
215
|
+
# @param tag_id [String] The tag's ID.
|
216
|
+
# @param [Hash] opts the optional parameters
|
217
|
+
# @return [Tag]
|
218
|
+
def tags_tag_id_get(tag_id, opts = {})
|
219
|
+
data, _status_code, _headers = tags_tag_id_get_with_http_info(tag_id, opts)
|
220
|
+
data
|
221
|
+
end
|
222
|
+
|
223
|
+
# Get a Tag.
|
224
|
+
# Retrieve the tag with the given ID
|
225
|
+
# @param tag_id [String] The tag's ID.
|
226
|
+
# @param [Hash] opts the optional parameters
|
227
|
+
# @return [Array<(Tag, Integer, Hash)>] Tag data, response status code and response headers
|
228
|
+
def tags_tag_id_get_with_http_info(tag_id, opts = {})
|
229
|
+
if @api_client.config.debugging
|
230
|
+
@api_client.config.logger.debug 'Calling API: TagsApi.tags_tag_id_get ...'
|
231
|
+
end
|
232
|
+
# verify the required parameter 'tag_id' is set
|
233
|
+
if @api_client.config.client_side_validation && tag_id.nil?
|
234
|
+
fail ArgumentError, "Missing the required parameter 'tag_id' when calling TagsApi.tags_tag_id_get"
|
235
|
+
end
|
236
|
+
# resource path
|
237
|
+
local_var_path = '/tags/{tagId}'.sub('{' + 'tagId' + '}', CGI.escape(tag_id.to_s))
|
238
|
+
|
239
|
+
# query parameters
|
240
|
+
query_params = opts[:query_params] || {}
|
241
|
+
|
242
|
+
# header parameters
|
243
|
+
header_params = opts[:header_params] || {}
|
244
|
+
# HTTP header 'Accept' (if needed)
|
245
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
246
|
+
|
247
|
+
# form parameters
|
248
|
+
form_params = opts[:form_params] || {}
|
249
|
+
|
250
|
+
# http body (model)
|
251
|
+
post_body = opts[:debug_body]
|
252
|
+
|
253
|
+
# return_type
|
254
|
+
return_type = opts[:debug_return_type] || 'Tag'
|
255
|
+
|
256
|
+
# auth_names
|
257
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
258
|
+
|
259
|
+
new_options = opts.merge(
|
260
|
+
:operation => :"TagsApi.tags_tag_id_get",
|
261
|
+
:header_params => header_params,
|
262
|
+
:query_params => query_params,
|
263
|
+
:form_params => form_params,
|
264
|
+
:body => post_body,
|
265
|
+
:auth_names => auth_names,
|
266
|
+
:return_type => return_type
|
267
|
+
)
|
268
|
+
|
269
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
270
|
+
if @api_client.config.debugging
|
271
|
+
@api_client.config.logger.debug "API called: TagsApi#tags_tag_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
272
|
+
end
|
273
|
+
return data, status_code, headers
|
274
|
+
end
|
275
|
+
|
276
|
+
# Modify a Tag.
|
277
|
+
# Updates the tag with the given ID.
|
278
|
+
# @param tag_id [String] The tag's ID.
|
279
|
+
# @param tag_update [TagUpdate] The body containing the tag changes.
|
280
|
+
# @param [Hash] opts the optional parameters
|
281
|
+
# @return [Tag]
|
282
|
+
def tags_tag_id_patch(tag_id, tag_update, opts = {})
|
283
|
+
data, _status_code, _headers = tags_tag_id_patch_with_http_info(tag_id, tag_update, opts)
|
284
|
+
data
|
285
|
+
end
|
286
|
+
|
287
|
+
# Modify a Tag.
|
288
|
+
# Updates the tag with the given ID.
|
289
|
+
# @param tag_id [String] The tag's ID.
|
290
|
+
# @param tag_update [TagUpdate] The body containing the tag changes.
|
291
|
+
# @param [Hash] opts the optional parameters
|
292
|
+
# @return [Array<(Tag, Integer, Hash)>] Tag data, response status code and response headers
|
293
|
+
def tags_tag_id_patch_with_http_info(tag_id, tag_update, opts = {})
|
294
|
+
if @api_client.config.debugging
|
295
|
+
@api_client.config.logger.debug 'Calling API: TagsApi.tags_tag_id_patch ...'
|
296
|
+
end
|
297
|
+
# verify the required parameter 'tag_id' is set
|
298
|
+
if @api_client.config.client_side_validation && tag_id.nil?
|
299
|
+
fail ArgumentError, "Missing the required parameter 'tag_id' when calling TagsApi.tags_tag_id_patch"
|
300
|
+
end
|
301
|
+
# verify the required parameter 'tag_update' is set
|
302
|
+
if @api_client.config.client_side_validation && tag_update.nil?
|
303
|
+
fail ArgumentError, "Missing the required parameter 'tag_update' when calling TagsApi.tags_tag_id_patch"
|
304
|
+
end
|
305
|
+
# resource path
|
306
|
+
local_var_path = '/tags/{tagId}'.sub('{' + 'tagId' + '}', CGI.escape(tag_id.to_s))
|
307
|
+
|
308
|
+
# query parameters
|
309
|
+
query_params = opts[:query_params] || {}
|
310
|
+
|
311
|
+
# header parameters
|
312
|
+
header_params = opts[:header_params] || {}
|
313
|
+
# HTTP header 'Accept' (if needed)
|
314
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
315
|
+
# HTTP header 'Content-Type'
|
316
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
317
|
+
if !content_type.nil?
|
318
|
+
header_params['Content-Type'] = content_type
|
319
|
+
end
|
320
|
+
|
321
|
+
# form parameters
|
322
|
+
form_params = opts[:form_params] || {}
|
323
|
+
|
324
|
+
# http body (model)
|
325
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_update)
|
326
|
+
|
327
|
+
# return_type
|
328
|
+
return_type = opts[:debug_return_type] || 'Tag'
|
329
|
+
|
330
|
+
# auth_names
|
331
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
332
|
+
|
333
|
+
new_options = opts.merge(
|
334
|
+
:operation => :"TagsApi.tags_tag_id_patch",
|
335
|
+
:header_params => header_params,
|
336
|
+
:query_params => query_params,
|
337
|
+
:form_params => form_params,
|
338
|
+
:body => post_body,
|
339
|
+
:auth_names => auth_names,
|
340
|
+
:return_type => return_type
|
341
|
+
)
|
342
|
+
|
343
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
344
|
+
if @api_client.config.debugging
|
345
|
+
@api_client.config.logger.debug "API called: TagsApi#tags_tag_id_patch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
346
|
+
end
|
347
|
+
return data, status_code, headers
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|