Class: LinodeOpenapiClient::PlacementGroupsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PlacementGroupsApi

Returns a new instance of PlacementGroupsApi.



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

def api_client
  @api_client
end

Instance Method Details

#delete_placement_group(api_version, group_id, opts = {}) ⇒ Object

Delete a placement group Deletes a placement group you have permission to ‘read_write`. - Deleting a placement group can’t be undone. - All compute instances need to be [removed](techdocs.akamai.com/linode-api/reference/post-group-unassign) before you can delete a placement group. - If your placement group is non-compliant, you can’t delete it. You need to wait for our help to bring it [compliant](www.linode.com/docs/products/compute/compute-instances/guides/placement-groups/#non-compliance-precedence). <<LB>> — - __CLI__. “‘ linode-cli placement delete 528 “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

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

    the optional parameters

Returns:

  • (Object)


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

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

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

Delete a placement group Deletes a placement group you have permission to &#x60;read_write&#x60;. - Deleting a placement group can&#39;t be undone. - All compute instances need to be [removed](techdocs.akamai.com/linode-api/reference/post-group-unassign) before you can delete a placement group. - If your placement group is non-compliant, you can&#39;t delete it. You need to wait for our help to bring it [compliant](www.linode.com/docs/products/compute/compute-instances/guides/placement-groups/#non-compliance-precedence). &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli placement delete 528 &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

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

def delete_placement_group_with_http_info(api_version, group_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlacementGroupsApi.delete_placement_group ...'
  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 PlacementGroupsApi.delete_placement_group"
  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 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling PlacementGroupsApi.delete_placement_group"
  end
  # resource path
  local_var_path = '/{apiVersion}/placement/groups/{groupId}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'groupId' + '}', CGI.escape(group_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 => :"PlacementGroupsApi.delete_placement_group",
    :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: PlacementGroupsApi#delete_placement_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_placement_group(api_version, group_id, opts = {}) ⇒ GetPlacementGroup200Response

Get a placement group View a specific placement group by ID. <<LB>> — - __CLI__. “‘ linode-cli placement view 528 “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

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

    the optional parameters

Returns:



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

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

#get_placement_group_with_http_info(api_version, group_id, opts = {}) ⇒ Array<(GetPlacementGroup200Response, Integer, Hash)>

Get a placement group View a specific placement group by ID. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli placement view 528 &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

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

    the optional parameters

Returns:



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/placement_groups_api.rb', line 113

def get_placement_group_with_http_info(api_version, group_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlacementGroupsApi.get_placement_group ...'
  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 PlacementGroupsApi.get_placement_group"
  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 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling PlacementGroupsApi.get_placement_group"
  end
  # resource path
  local_var_path = '/{apiVersion}/placement/groups/{groupId}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'groupId' + '}', CGI.escape(group_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] || 'GetPlacementGroup200Response'

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

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

#get_placement_groups(api_version, opts = {}) ⇒ GetPlacementGroups200Response

List placement groups Returns a paginated list of placement groups you have permission to view. <<LB>> — - __CLI__. “‘ linode-cli placement-list “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` placement: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/placement_groups_api.rb', line 177

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

#get_placement_groups_with_http_info(api_version, opts = {}) ⇒ Array<(GetPlacementGroups200Response, Integer, Hash)>

List placement groups Returns a paginated list of placement groups you have permission to view. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli placement-list &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; placement: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:



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/placement_groups_api.rb', line 189

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

  # resource path
  local_var_path = '/{apiVersion}/placement/groups'.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] || 'GetPlacementGroups200Response'

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

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

#post_group_add_linode(api_version, group_id, post_group_add_linode_request, opts = {}) ⇒ PostGroupAddLinode200Response

Assign a placement group Add one or more compute instances to your placement group. Check out our [example API workflow](www.linode.com/docs/products/compute/compute-instances/guides/placement-groups/#create-a-placement-group) to create a placement group and add compute instances. <<LB>> — - __CLI__. “‘ linode-cli placement assignLinode 528 \ –linodes 123 456 \ –non-compliant true “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

  • post_group_add_linode_request (PostGroupAddLinodeRequest)

    The compute instances you want to add to your placement group.

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

    the optional parameters

Returns:



263
264
265
266
# File 'lib/linode_openapi_client/api/placement_groups_api.rb', line 263

def post_group_add_linode(api_version, group_id, post_group_add_linode_request, opts = {})
  data, _status_code, _headers = post_group_add_linode_with_http_info(api_version, group_id, post_group_add_linode_request, opts)
  data
end

#post_group_add_linode_with_http_info(api_version, group_id, post_group_add_linode_request, opts = {}) ⇒ Array<(PostGroupAddLinode200Response, Integer, Hash)>

Assign a placement group Add one or more compute instances to your placement group. Check out our [example API workflow](www.linode.com/docs/products/compute/compute-instances/guides/placement-groups/#create-a-placement-group) to create a placement group and add compute instances. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli placement assignLinode 528 \ –linodes 123 456 \ –non-compliant true &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

  • post_group_add_linode_request (PostGroupAddLinodeRequest)

    The compute instances you want to add to your placement group.

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

    the optional parameters

Returns:



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
334
335
336
337
338
339
# File 'lib/linode_openapi_client/api/placement_groups_api.rb', line 275

def post_group_add_linode_with_http_info(api_version, group_id, post_group_add_linode_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlacementGroupsApi.post_group_add_linode ...'
  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 PlacementGroupsApi.post_group_add_linode"
  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 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling PlacementGroupsApi.post_group_add_linode"
  end
  # verify the required parameter 'post_group_add_linode_request' is set
  if @api_client.config.client_side_validation && post_group_add_linode_request.nil?
    fail ArgumentError, "Missing the required parameter 'post_group_add_linode_request' when calling PlacementGroupsApi.post_group_add_linode"
  end
  # resource path
  local_var_path = '/{apiVersion}/placement/groups/{groupId}/assign'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'groupId' + '}', CGI.escape(group_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(post_group_add_linode_request)

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

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

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

#post_group_unassign(api_version, group_id, request_body, opts = {}) ⇒ PostGroupUnassign200Response

Unassign a placement group Remove one or more compute instances from your placement group. <<LB>> — - __CLI__. “‘ linode-cli placement unassignLinode 528 \ –linode 123 456 “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

  • request_body (Array<Integer>)

    The compute instances you want to remove from your placement group.

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

    the optional parameters

Returns:



348
349
350
351
# File 'lib/linode_openapi_client/api/placement_groups_api.rb', line 348

def post_group_unassign(api_version, group_id, request_body, opts = {})
  data, _status_code, _headers = post_group_unassign_with_http_info(api_version, group_id, request_body, opts)
  data
end

#post_group_unassign_with_http_info(api_version, group_id, request_body, opts = {}) ⇒ Array<(PostGroupUnassign200Response, Integer, Hash)>

Unassign a placement group Remove one or more compute instances from your placement group. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli placement unassignLinode 528 \ –linode 123 456 &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

  • request_body (Array<Integer>)

    The compute instances you want to remove from your placement group.

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

    the optional parameters

Returns:



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
415
416
417
418
419
420
421
422
423
424
# File 'lib/linode_openapi_client/api/placement_groups_api.rb', line 360

def post_group_unassign_with_http_info(api_version, group_id, request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlacementGroupsApi.post_group_unassign ...'
  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 PlacementGroupsApi.post_group_unassign"
  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 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling PlacementGroupsApi.post_group_unassign"
  end
  # verify the required parameter 'request_body' is set
  if @api_client.config.client_side_validation && request_body.nil?
    fail ArgumentError, "Missing the required parameter 'request_body' when calling PlacementGroupsApi.post_group_unassign"
  end
  # resource path
  local_var_path = '/{apiVersion}/placement/groups/{groupId}/unassign'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'groupId' + '}', CGI.escape(group_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(request_body)

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

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

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

#post_placement_group(api_version, post_placement_group_request, opts = {}) ⇒ PostPlacementGroup200Response

Create placement group Creates a placement group on your account. Placement groups disperse your compute instances across physical machines (hosts) in one of our compute regions. Depending on your workload requirements, you may need your compute instances to follow specific strategies: - __Grouped together__. You may want them placed close together to reduce latency between compute instances that are used for an application or workload. - __Spread apart__. You may want to disperse them across several hosts to support high availability, for example when required for failover. <<LB>> > 📘 > > - Currently, this service is only available in [select regions](www.linode.com/docs/products/compute/compute-instances/guides/placement-groups/#availability). > - For this request to complete successfully, your user needs to have the ‘add_placement` grant. > - We offer an [example API workflow](www.linode.com/docs/products/compute/compute-instances/guides/placement-groups/#create-a-placement-group) you can follow to create a placement group. <<LB>> — - __CLI__. “` linode-cli placement create \ –label PG_Miami_failover \ –region us-mia \ –placement_group_type "anti-affinity:local" \ –placement_group_policy strict “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` linodes: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_placement_group_request (PostPlacementGroupRequest)

    The requested initial state of the new placement group.

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

    the optional parameters

Returns:



432
433
434
435
# File 'lib/linode_openapi_client/api/placement_groups_api.rb', line 432

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

#post_placement_group_with_http_info(api_version, post_placement_group_request, opts = {}) ⇒ Array<(PostPlacementGroup200Response, Integer, Hash)>

Create placement group Creates a placement group on your account. Placement groups disperse your compute instances across physical machines (hosts) in one of our compute regions. Depending on your workload requirements, you may need your compute instances to follow specific strategies: - __Grouped together__. You may want them placed close together to reduce latency between compute instances that are used for an application or workload. - __Spread apart__. You may want to disperse them across several hosts to support high availability, for example when required for failover. &lt;&lt;LB&gt;&gt; &gt; 📘 &gt; &gt; - Currently, this service is only available in [select regions](www.linode.com/docs/products/compute/compute-instances/guides/placement-groups/#availability). &gt; - For this request to complete successfully, your user needs to have the &#x60;add_placement&#x60; grant. &gt; - We offer an [example API workflow](www.linode.com/docs/products/compute/compute-instances/guides/placement-groups/#create-a-placement-group) you can follow to create a placement group. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli placement create \ –label PG_Miami_failover \ –region us-mia \ –placement_group_type &quot;anti-affinity:local&quot; \ –placement_group_policy strict &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; linodes: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_placement_group_request (PostPlacementGroupRequest)

    The requested initial state of the new placement group.

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

    the optional parameters

Returns:



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/linode_openapi_client/api/placement_groups_api.rb', line 443

def post_placement_group_with_http_info(api_version, post_placement_group_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlacementGroupsApi.post_placement_group ...'
  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 PlacementGroupsApi.post_placement_group"
  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_placement_group_request' is set
  if @api_client.config.client_side_validation && post_placement_group_request.nil?
    fail ArgumentError, "Missing the required parameter 'post_placement_group_request' when calling PlacementGroupsApi.post_placement_group"
  end
  # resource path
  local_var_path = '/{apiVersion}/placement/groups'.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_placement_group_request)

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

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

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

#put_placement_group(api_version, group_id, put_placement_group_request, opts = {}) ⇒ PutPlacementGroup200Response

Update a placement group Change the ‘label` for a specific placement group. This is the only value you can update. However, you can [add](techdocs.akamai.com/linode-api/reference/post-group-add-linode) more compute instances or [remove](techdocs.akamai.com/linode-api/reference/post-group-unassign) existing ones. <<LB>> — - __CLI__. “` linode-cli placement update 528 \ –label PG_Miami_failover_update “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

  • put_placement_group_request (PutPlacementGroupRequest)

    Include the &#x60;label&#x60; parameter to update the name of your placement group.

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

    the optional parameters

Returns:



512
513
514
515
# File 'lib/linode_openapi_client/api/placement_groups_api.rb', line 512

def put_placement_group(api_version, group_id, put_placement_group_request, opts = {})
  data, _status_code, _headers = put_placement_group_with_http_info(api_version, group_id, put_placement_group_request, opts)
  data
end

#put_placement_group_with_http_info(api_version, group_id, put_placement_group_request, opts = {}) ⇒ Array<(PutPlacementGroup200Response, Integer, Hash)>

Update a placement group Change the &#x60;label&#x60; for a specific placement group. This is the only value you can update. However, you can [add](techdocs.akamai.com/linode-api/reference/post-group-add-linode) more compute instances or [remove](techdocs.akamai.com/linode-api/reference/post-group-unassign) existing ones. &lt;&lt;LB&gt;&gt; — - __CLI__. &#x60;&#x60;&#x60; linode-cli placement update 528 \ –label PG_Miami_failover_update &#x60;&#x60;&#x60; [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. &#x60;&#x60;&#x60; linodes: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.

  • group_id (Integer)

    ID of the placement group to look up. Run the [List placement groups](techdocs.akamai.com/linode-api/reference/get-placement-groups) operation and store the &#x60;id&#x60; for the applicable placement group.

  • put_placement_group_request (PutPlacementGroupRequest)

    Include the &#x60;label&#x60; parameter to update the name of your placement group.

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

    the optional parameters

Returns:



524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/linode_openapi_client/api/placement_groups_api.rb', line 524

def put_placement_group_with_http_info(api_version, group_id, put_placement_group_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlacementGroupsApi.put_placement_group ...'
  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 PlacementGroupsApi.put_placement_group"
  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 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling PlacementGroupsApi.put_placement_group"
  end
  # verify the required parameter 'put_placement_group_request' is set
  if @api_client.config.client_side_validation && put_placement_group_request.nil?
    fail ArgumentError, "Missing the required parameter 'put_placement_group_request' when calling PlacementGroupsApi.put_placement_group"
  end
  # resource path
  local_var_path = '/{apiVersion}/placement/groups/{groupId}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'groupId' + '}', CGI.escape(group_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(put_placement_group_request)

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

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

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