Class: LinodeOpenapiClient::LinodeStackScriptsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ LinodeStackScriptsApi

Returns a new instance of LinodeStackScriptsApi.



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

def api_client
  @api_client
end

Instance Method Details

#delete_stack_script(api_version, stackscript_id, opts = {}) ⇒ Object

Delete a StackScript Deletes a private StackScript you have permission to ‘read_write`. You cannot delete a public StackScript. <<LB>> — - __CLI__. “` linode-cli stackscripts delete 10079 “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` stackscripts: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.

  • stackscript_id (String)

    The ID of the StackScript to look up.

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

    the optional parameters

Returns:

  • (Object)


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

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

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

Delete a StackScript Deletes a private StackScript you have permission to &#x60;read_write&#x60;. You cannot delete a public StackScript. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli stackscripts delete 10079 &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; stackscripts: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.

  • stackscript_id (String)

    The ID of the StackScript to look up.

  • 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/linode_stack_scripts_api.rb', line 39

def delete_stack_script_with_http_info(api_version, stackscript_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LinodeStackScriptsApi.delete_stack_script ...'
  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 LinodeStackScriptsApi.delete_stack_script"
  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 'stackscript_id' is set
  if @api_client.config.client_side_validation && stackscript_id.nil?
    fail ArgumentError, "Missing the required parameter 'stackscript_id' when calling LinodeStackScriptsApi.delete_stack_script"
  end
  # resource path
  local_var_path = '/{apiVersion}/linode/stackscripts/{stackscriptId}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'stackscriptId' + '}', CGI.escape(stackscript_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']) 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 => :"LinodeStackScriptsApi.delete_stack_script",
    :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: LinodeStackScriptsApi#delete_stack_script\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_stack_script(api_version, stackscript_id, opts = {}) ⇒ GetStackScript200Response

Get a StackScript Returns all of the information about a specified StackScript, including the contents of the script. <<LB>> — - __CLI__. “‘ linode-cli stackscripts view 10079 “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` stackscripts: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.

  • stackscript_id (String)

    The ID of the StackScript to look up.

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

    the optional parameters

Returns:



102
103
104
105
# File 'lib/linode_openapi_client/api/linode_stack_scripts_api.rb', line 102

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

#get_stack_script_with_http_info(api_version, stackscript_id, opts = {}) ⇒ Array<(GetStackScript200Response, Integer, Hash)>

Get a StackScript Returns all of the information about a specified StackScript, including the contents of the script. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli stackscripts view 10079 &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; stackscripts: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.

  • stackscript_id (String)

    The ID of the StackScript to look up.

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

    the optional parameters

Returns:

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

    GetStackScript200Response data, response status code and response headers



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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/linode_openapi_client/api/linode_stack_scripts_api.rb', line 113

def get_stack_script_with_http_info(api_version, stackscript_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LinodeStackScriptsApi.get_stack_script ...'
  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 LinodeStackScriptsApi.get_stack_script"
  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 'stackscript_id' is set
  if @api_client.config.client_side_validation && stackscript_id.nil?
    fail ArgumentError, "Missing the required parameter 'stackscript_id' when calling LinodeStackScriptsApi.get_stack_script"
  end
  # resource path
  local_var_path = '/{apiVersion}/linode/stackscripts/{stackscriptId}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'stackscriptId' + '}', CGI.escape(stackscript_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']) 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] || 'GetStackScript200Response'

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

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

#get_stack_scripts(api_version, opts = {}) ⇒ GetStackScripts200Response

List StackScripts If the request is not authenticated, only public StackScripts are returned. For more information on StackScripts, please read our [StackScripts documentation](www.linode.com/docs/products/tools/stackscripts/). <<LB>> — - __CLI__. “‘ linode-cli stackscripts list “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` stackscripts: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:



177
178
179
180
# File 'lib/linode_openapi_client/api/linode_stack_scripts_api.rb', line 177

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

#get_stack_scripts_with_http_info(api_version, opts = {}) ⇒ Array<(GetStackScripts200Response, Integer, Hash)>

List StackScripts If the request is not authenticated, only public StackScripts are returned. For more information on StackScripts, please read our [StackScripts documentation](www.linode.com/docs/products/tools/stackscripts/). &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli stackscripts list &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; stackscripts: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<(GetStackScripts200Response, Integer, Hash)>)

    GetStackScripts200Response data, response status code and response headers



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
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
# File 'lib/linode_openapi_client/api/linode_stack_scripts_api.rb', line 189

def get_stack_scripts_with_http_info(api_version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LinodeStackScriptsApi.get_stack_scripts ...'
  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 LinodeStackScriptsApi.get_stack_scripts"
  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 LinodeStackScriptsApi.get_stack_scripts, 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 LinodeStackScriptsApi.get_stack_scripts, 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 LinodeStackScriptsApi.get_stack_scripts, must be greater than or equal to 25.'
  end

  # resource path
  local_var_path = '/{apiVersion}/linode/stackscripts'.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] || 'GetStackScripts200Response'

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

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

#post_add_stack_script(api_version, post_add_stack_script_request, opts = {}) ⇒ PostAddStackScript200Response

Create a StackScript Creates a StackScript in your Account. <<LB>> — - __CLI__. “‘ linode-cli stackscripts create \ –label a-stackscript \ –description "This StackScript install and configures MySQL" \ –images "linode/debian9" \ –images "linode/debian8" \ –is_public true \ –rev_note "Set up MySQL" \ –script ’#!/bin/bash’ “‘ [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` stackscripts: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.

  • post_add_stack_script_request (PostAddStackScriptRequest)

    The properties to set for the new StackScript.

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

    the optional parameters

Returns:



262
263
264
265
# File 'lib/linode_openapi_client/api/linode_stack_scripts_api.rb', line 262

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

#post_add_stack_script_with_http_info(api_version, post_add_stack_script_request, opts = {}) ⇒ Array<(PostAddStackScript200Response, Integer, Hash)>

Create a StackScript Creates a StackScript in your Account. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli stackscripts create \ –label a-stackscript \ –description &quot;This StackScript install and configures MySQL&quot; \ –images &quot;linode/debian9&quot; \ –images &quot;linode/debian8&quot; \ –is_public true \ –rev_note &quot;Set up MySQL&quot; \ –script &#39;#!/bin/bash&#39; &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; stackscripts: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.

  • post_add_stack_script_request (PostAddStackScriptRequest)

    The properties to set for the new StackScript.

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

    the optional parameters

Returns:



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
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
# File 'lib/linode_openapi_client/api/linode_stack_scripts_api.rb', line 273

def post_add_stack_script_with_http_info(api_version, post_add_stack_script_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LinodeStackScriptsApi.post_add_stack_script ...'
  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 LinodeStackScriptsApi.post_add_stack_script"
  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 'post_add_stack_script_request' is set
  if @api_client.config.client_side_validation && post_add_stack_script_request.nil?
    fail ArgumentError, "Missing the required parameter 'post_add_stack_script_request' when calling LinodeStackScriptsApi.post_add_stack_script"
  end
  # resource path
  local_var_path = '/{apiVersion}/linode/stackscripts'.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(post_add_stack_script_request)

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

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

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

#put_stack_script(api_version, stackscript_id, opts = {}) ⇒ PutStackScript200Response

Update a StackScript Updates a StackScript. __Once a StackScript is made public, it cannot be made private.__ <<LB>> — - __CLI__. “‘ linode-cli stackscripts update 10079 \ –label a-stackscript \ –description "This StackScript installs \ and configures MySQL" \ –images "linode/debian9" \ –images "linode/debian8" \ –is_public true \ –rev_note "Set up MySQL" \ –script ’#!/bin/bash’ “‘ [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` stackscripts: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.

  • stackscript_id (String)

    The ID of the StackScript to look up.

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

    the optional parameters

Options Hash (opts):

Returns:



342
343
344
345
# File 'lib/linode_openapi_client/api/linode_stack_scripts_api.rb', line 342

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

#put_stack_script_with_http_info(api_version, stackscript_id, opts = {}) ⇒ Array<(PutStackScript200Response, Integer, Hash)>

Update a StackScript Updates a StackScript. __Once a StackScript is made public, it cannot be made private.__ &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli stackscripts update 10079 \ –label a-stackscript \ –description &quot;This StackScript installs \ and configures MySQL&quot; \ –images &quot;linode/debian9&quot; \ –images &quot;linode/debian8&quot; \ –is_public true \ –rev_note &quot;Set up MySQL&quot; \ –script &#39;#!/bin/bash&#39; &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; stackscripts: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.

  • stackscript_id (String)

    The ID of the StackScript to look up.

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

    the optional parameters

Options Hash (opts):

Returns:

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

    PutStackScript200Response data, response status code and response headers



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/linode_openapi_client/api/linode_stack_scripts_api.rb', line 354

def put_stack_script_with_http_info(api_version, stackscript_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LinodeStackScriptsApi.put_stack_script ...'
  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 LinodeStackScriptsApi.put_stack_script"
  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 'stackscript_id' is set
  if @api_client.config.client_side_validation && stackscript_id.nil?
    fail ArgumentError, "Missing the required parameter 'stackscript_id' when calling LinodeStackScriptsApi.put_stack_script"
  end
  # resource path
  local_var_path = '/{apiVersion}/linode/stackscripts/{stackscriptId}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'stackscriptId' + '}', CGI.escape(stackscript_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']) 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[:'put_stack_script_request'])

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

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

  new_options = opts.merge(
    :operation => :"LinodeStackScriptsApi.put_stack_script",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LinodeStackScriptsApi#put_stack_script\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end