Class: LinodeOpenapiClient::TagsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/linode_openapi_client/api/tags_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TagsApi

Returns a new instance of TagsApi.



19
20
21
# File 'lib/linode_openapi_client/api/tags_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/linode_openapi_client/api/tags_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_ag(api_version, tag_label, opts = {}) ⇒ Object

Delete a tag Remove a Tag from all objects and delete it. __Important__. You must be an unrestricted User in order to access, add, or modify Tags information. <<LB>> — - __CLI__. “‘ linode-cli tags delete linode-cli tags rm “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` account:read_write “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)

Parameters:

  • api_version (String)

    __Enum__ Call either the &#x60;v4&#x60; URL, or &#x60;v4beta&#x60; for operations still in Beta.

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

    the optional parameters

Returns:

  • (Object)


28
29
30
31
# File 'lib/linode_openapi_client/api/tags_api.rb', line 28

def delete_ag(api_version, tag_label, opts = {})
  data, _status_code, _headers = delete_ag_with_http_info(api_version, tag_label, opts)
  data
end

#delete_ag_with_http_info(api_version, tag_label, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Delete a tag Remove a Tag from all objects and delete it. __Important__. You must be an unrestricted User in order to access, add, or modify Tags information. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli tags delete linode-cli tags rm &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; account:read_write &#x60;&#x60;&#x60; [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)

Parameters:

  • api_version (String)

    __Enum__ Call either the &#x60;v4&#x60; URL, or &#x60;v4beta&#x60; for operations still in Beta.

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

    the optional parameters

Returns:

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

    Object data, response status code and response headers



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
85
86
87
88
89
90
91
92
93
94
# File 'lib/linode_openapi_client/api/tags_api.rb', line 39

def delete_ag_with_http_info(api_version, tag_label, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TagsApi.delete_ag ...'
  end
  # verify the required parameter 'api_version' is set
  if @api_client.config.client_side_validation && api_version.nil?
    fail ArgumentError, "Missing the required parameter 'api_version' when calling TagsApi.delete_ag"
  end
  # verify enum value
  allowable_values = ["v4", "v4beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(api_version)
    fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'tag_label' is set
  if @api_client.config.client_side_validation && tag_label.nil?
    fail ArgumentError, "Missing the required parameter 'tag_label' when calling TagsApi.delete_ag"
  end
  # resource path
  local_var_path = '/{apiVersion}/tags/{tagLabel}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'tagLabel' + '}', CGI.escape(tag_label.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']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth']

  new_options = opts.merge(
    :operation => :"TagsApi.delete_ag",
    :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: TagsApi#delete_ag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_tagged_objects(api_version, tag_label, opts = {}) ⇒ GetTaggedObjects200Response

List tagged objects Returns a paginated list of all objects you’ve tagged with the requested Tag. This is a mixed collection of all object types. __Important__. You must be an unrestricted User in order to access, add, or modify Tags information. <<LB>> — - __OAuth scopes__. “‘ account:read_only “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)

Parameters:

  • api_version (String)

    __Enum__ Call either the &#x60;v4&#x60; URL, or &#x60;v4beta&#x60; for operations still in Beta.

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    The page of a collection to return. (default to 1)

  • :page_size (Integer)

    The number of items to return per page. (default to 100)

Returns:



104
105
106
107
# File 'lib/linode_openapi_client/api/tags_api.rb', line 104

def get_tagged_objects(api_version, tag_label, opts = {})
  data, _status_code, _headers = get_tagged_objects_with_http_info(api_version, tag_label, opts)
  data
end

#get_tagged_objects_with_http_info(api_version, tag_label, opts = {}) ⇒ Array<(GetTaggedObjects200Response, Integer, Hash)>

List tagged objects Returns a paginated list of all objects you&#39;ve tagged with the requested Tag. This is a mixed collection of all object types. __Important__. You must be an unrestricted User in order to access, add, or modify Tags information. &lt;&lt;LB&gt;&gt; — - __OAuth scopes__. &#x60;&#x60;&#x60; account:read_only &#x60;&#x60;&#x60; [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)

Parameters:

  • api_version (String)

    __Enum__ Call either the &#x60;v4&#x60; URL, or &#x60;v4beta&#x60; for operations still in Beta.

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    The page of a collection to return. (default to 1)

  • :page_size (Integer)

    The number of items to return per page. (default to 100)

Returns:

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

    GetTaggedObjects200Response data, response status code and response headers



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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/linode_openapi_client/api/tags_api.rb', line 117

def get_tagged_objects_with_http_info(api_version, tag_label, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TagsApi.get_tagged_objects ...'
  end
  # verify the required parameter 'api_version' is set
  if @api_client.config.client_side_validation && api_version.nil?
    fail ArgumentError, "Missing the required parameter 'api_version' when calling TagsApi.get_tagged_objects"
  end
  # verify enum value
  allowable_values = ["v4", "v4beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(api_version)
    fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'tag_label' is set
  if @api_client.config.client_side_validation && tag_label.nil?
    fail ArgumentError, "Missing the required parameter 'tag_label' when calling TagsApi.get_tagged_objects"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TagsApi.get_tagged_objects, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 500
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling TagsApi.get_tagged_objects, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 25
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling TagsApi.get_tagged_objects, must be greater than or equal to 25.'
  end

  # resource path
  local_var_path = '/{apiVersion}/tags/{tagLabel}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'tagLabel' + '}', CGI.escape(tag_label.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetTaggedObjects200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth']

  new_options = opts.merge(
    :operation => :"TagsApi.get_tagged_objects",
    :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: TagsApi#get_tagged_objects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_tags(api_version, opts = {}) ⇒ GetTags200Response

List tags Tags are User-defined labels attached to objects in your Account, such as Linodes. They are used for specifying and grouping attributes of objects that are relevant to the User. This operation returns a paginated list of Tags on your account. __Important__. You must be an unrestricted User in order to access, add, or modify Tags information. <<LB>> — - __CLI__. “‘ linode-cli tags list linode-cli tags ls “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` account:read_only “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)

Parameters:

  • api_version (String)

    __Enum__ Call either the &#x60;v4&#x60; URL, or &#x60;v4beta&#x60; for operations still in Beta.

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    The page of a collection to return. (default to 1)

  • :page_size (Integer)

    The number of items to return per page. (default to 100)

Returns:



195
196
197
198
# File 'lib/linode_openapi_client/api/tags_api.rb', line 195

def get_tags(api_version, opts = {})
  data, _status_code, _headers = get_tags_with_http_info(api_version, opts)
  data
end

#get_tags_with_http_info(api_version, opts = {}) ⇒ Array<(GetTags200Response, Integer, Hash)>

List tags Tags are User-defined labels attached to objects in your Account, such as Linodes. They are used for specifying and grouping attributes of objects that are relevant to the User. This operation returns a paginated list of Tags on your account. __Important__. You must be an unrestricted User in order to access, add, or modify Tags information. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli tags list linode-cli tags ls &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; account:read_only &#x60;&#x60;&#x60; [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)

Parameters:

  • api_version (String)

    __Enum__ Call either the &#x60;v4&#x60; URL, or &#x60;v4beta&#x60; for operations still in Beta.

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    The page of a collection to return. (default to 1)

  • :page_size (Integer)

    The number of items to return per page. (default to 100)

Returns:

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

    GetTags200Response data, response status code and response headers



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
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
# File 'lib/linode_openapi_client/api/tags_api.rb', line 207

def get_tags_with_http_info(api_version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TagsApi.get_tags ...'
  end
  # verify the required parameter 'api_version' is set
  if @api_client.config.client_side_validation && api_version.nil?
    fail ArgumentError, "Missing the required parameter 'api_version' when calling TagsApi.get_tags"
  end
  # verify enum value
  allowable_values = ["v4", "v4beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(api_version)
    fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TagsApi.get_tags, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 500
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling TagsApi.get_tags, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 25
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling TagsApi.get_tags, must be greater than or equal to 25.'
  end

  # resource path
  local_var_path = '/{apiVersion}/tags'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetTags200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth']

  new_options = opts.merge(
    :operation => :"TagsApi.get_tags",
    :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: TagsApi#get_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_tag(api_version, opts = {}) ⇒ GetTags200ResponseDataInner

Create a tag Creates a new Tag and optionally tags requested objects with it immediately. __Important__. You must be an unrestricted User in order to access, add, or modify Tags information. <<LB>> — - __CLI__. “‘ linode-cli tags create \ –label ’example tag’ \ –linodes 123 \ –linodes 456 \ –volumes 9082 \ –volumes 10003 “‘ [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` account:read_write “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)

Parameters:

  • api_version (String)

    __Enum__ Call either the &#x60;v4&#x60; URL, or &#x60;v4beta&#x60; for operations still in Beta.

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

    the optional parameters

Options Hash (opts):

  • :post_tag_request (PostTagRequest)

    The tag to create, and optionally the objects to tag.

Returns:



280
281
282
283
# File 'lib/linode_openapi_client/api/tags_api.rb', line 280

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

#post_tag_with_http_info(api_version, opts = {}) ⇒ Array<(GetTags200ResponseDataInner, Integer, Hash)>

Create a tag Creates a new Tag and optionally tags requested objects with it immediately. __Important__. You must be an unrestricted User in order to access, add, or modify Tags information. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli tags create \ –label &#39;example tag&#39; \ –linodes 123 \ –linodes 456 \ –volumes 9082 \ –volumes 10003 &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; account:read_write &#x60;&#x60;&#x60; [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)

Parameters:

  • api_version (String)

    __Enum__ Call either the &#x60;v4&#x60; URL, or &#x60;v4beta&#x60; for operations still in Beta.

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

    the optional parameters

Options Hash (opts):

  • :post_tag_request (PostTagRequest)

    The tag to create, and optionally the objects to tag.

Returns:

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

    GetTags200ResponseDataInner data, response status code and response headers



291
292
293
294
295
296
297
298
299
300
301
302
303
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
# File 'lib/linode_openapi_client/api/tags_api.rb', line 291

def (api_version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TagsApi.post_tag ...'
  end
  # verify the required parameter 'api_version' is set
  if @api_client.config.client_side_validation && api_version.nil?
    fail ArgumentError, "Missing the required parameter 'api_version' when calling TagsApi.post_tag"
  end
  # verify enum value
  allowable_values = ["v4", "v4beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(api_version)
    fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/{apiVersion}/tags'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetTags200ResponseDataInner'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth']

  new_options = opts.merge(
    :operation => :"TagsApi.post_tag",
    :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: TagsApi#post_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end