Class: NutanixVmm::ImagePlacementPoliciesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/nutanix_vmm/api/image_placement_policies_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ImagePlacementPoliciesApi

Returns a new instance of ImagePlacementPoliciesApi.



19
20
21
# File 'lib/nutanix_vmm/api/image_placement_policies_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/nutanix_vmm/api/image_placement_policies_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_placement_policy(ntnx_request_id, vmm_v40_images_config_placement_policy, opts = {}) ⇒ CreatePlacementPolicy202Response

Create an image placement policy Creates an image placement policy using the provided request body. The name, placement type, cluster entity filter and image entity filter are mandatory fields for creating an image placement policy.

Parameters:

  • ntnx_request_id (String)

    A unique identifier that is associated with each request. The provided value must be opaque and preferably in Universal Unique Identifier (UUID) format. This identifier is also used as an idempotence token for safely retrying requests in case of network errors. All the supported Nutanix API clients add this auto-generated request identifier to each request.

  • vmm_v40_images_config_placement_policy (VmmV40ImagesConfigPlacementPolicy)

    Request to create an image placement policy.

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 28

def create_placement_policy(ntnx_request_id, vmm_v40_images_config_placement_policy, opts = {})
  data, _status_code, _headers = create_placement_policy_with_http_info(ntnx_request_id, vmm_v40_images_config_placement_policy, opts)
  data
end

#create_placement_policy_with_http_info(ntnx_request_id, vmm_v40_images_config_placement_policy, opts = {}) ⇒ Array<(CreatePlacementPolicy202Response, Integer, Hash)>

Create an image placement policy Creates an image placement policy using the provided request body. The name, placement type, cluster entity filter and image entity filter are mandatory fields for creating an image placement policy.

Parameters:

  • ntnx_request_id (String)

    A unique identifier that is associated with each request. The provided value must be opaque and preferably in Universal Unique Identifier (UUID) format. This identifier is also used as an idempotence token for safely retrying requests in case of network errors. All the supported Nutanix API clients add this auto-generated request identifier to each request.

  • vmm_v40_images_config_placement_policy (VmmV40ImagesConfigPlacementPolicy)

    Request to create an image placement policy.

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

    the optional parameters

Returns:



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
95
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 39

def create_placement_policy_with_http_info(ntnx_request_id, vmm_v40_images_config_placement_policy, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagePlacementPoliciesApi.create_placement_policy ...'
  end
  # verify the required parameter 'ntnx_request_id' is set
  if @api_client.config.client_side_validation && ntnx_request_id.nil?
    fail ArgumentError, "Missing the required parameter 'ntnx_request_id' when calling ImagePlacementPoliciesApi.create_placement_policy"
  end
  # verify the required parameter 'vmm_v40_images_config_placement_policy' is set
  if @api_client.config.client_side_validation && vmm_v40_images_config_placement_policy.nil?
    fail ArgumentError, "Missing the required parameter 'vmm_v40_images_config_placement_policy' when calling ImagePlacementPoliciesApi.create_placement_policy"
  end
  # resource path
  local_var_path = '/vmm/v4.0/images/config/placement-policies'

  # 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
  header_params[:'NTNX-Request-Id'] = ntnx_request_id

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKeyAuthScheme', 'basicAuthScheme']

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

#delete_placement_policy_by_id(ext_id, opts = {}) ⇒ DeletePlacementPolicyById202Response

Delete an image placement policy Deletes the image placement policy with the given external identifier.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

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

    the optional parameters

Returns:



102
103
104
105
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 102

def delete_placement_policy_by_id(ext_id, opts = {})
  data, _status_code, _headers = delete_placement_policy_by_id_with_http_info(ext_id, opts)
  data
end

#delete_placement_policy_by_id_with_http_info(ext_id, opts = {}) ⇒ Array<(DeletePlacementPolicyById202Response, Integer, Hash)>

Delete an image placement policy Deletes the image placement policy with the given external identifier.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

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

    the optional parameters

Returns:



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 112

def delete_placement_policy_by_id_with_http_info(ext_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagePlacementPoliciesApi.delete_placement_policy_by_id ...'
  end
  # verify the required parameter 'ext_id' is set
  if @api_client.config.client_side_validation && ext_id.nil?
    fail ArgumentError, "Missing the required parameter 'ext_id' when calling ImagePlacementPoliciesApi.delete_placement_policy_by_id"
  end
  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if @api_client.config.client_side_validation && ext_id !~ pattern
    fail ArgumentError, "invalid value for 'ext_id' when calling ImagePlacementPoliciesApi.delete_placement_policy_by_id, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/vmm/v4.0/images/config/placement-policies/{extId}'.sub('{' + 'extId' + '}', CGI.escape(ext_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] || 'DeletePlacementPolicyById202Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKeyAuthScheme', 'basicAuthScheme']

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

#get_placement_policy_by_id(ext_id, opts = {}) ⇒ GetPlacementPolicyById200Response

Get an image placement policy Retrieves the image placement policy details for the provided external identifier.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

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

    the optional parameters

Returns:



170
171
172
173
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 170

def get_placement_policy_by_id(ext_id, opts = {})
  data, _status_code, _headers = get_placement_policy_by_id_with_http_info(ext_id, opts)
  data
end

#get_placement_policy_by_id_with_http_info(ext_id, opts = {}) ⇒ Array<(GetPlacementPolicyById200Response, Integer, Hash)>

Get an image placement policy Retrieves the image placement policy details for the provided external identifier.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

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

    the optional parameters

Returns:



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 180

def get_placement_policy_by_id_with_http_info(ext_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagePlacementPoliciesApi.get_placement_policy_by_id ...'
  end
  # verify the required parameter 'ext_id' is set
  if @api_client.config.client_side_validation && ext_id.nil?
    fail ArgumentError, "Missing the required parameter 'ext_id' when calling ImagePlacementPoliciesApi.get_placement_policy_by_id"
  end
  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if @api_client.config.client_side_validation && ext_id !~ pattern
    fail ArgumentError, "invalid value for 'ext_id' when calling ImagePlacementPoliciesApi.get_placement_policy_by_id, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/vmm/v4.0/images/config/placement-policies/{extId}'.sub('{' + 'extId' + '}', CGI.escape(ext_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] || 'GetPlacementPolicyById200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKeyAuthScheme', 'basicAuthScheme']

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

#list_placement_policies(opts = {}) ⇒ ListPlacementPolicies200Response

List image placement policies Lists image placement policies created in Prism Central, along with details such as name, description, and so on. This API supports operations such as filtering, sorting, selection, and pagination.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    A URL query parameter that specifies the page number of the result set. It must be a positive integer between 0 and the maximum number of pages that are available for that resource. Any number out of this range might lead to no results. (default to 0)

  • :limit (Integer)

    A URL query parameter that specifies the total number of records returned in the result set. Must be a positive integer between 1 and 100. Any number out of this range will lead to a validation error. If the limit is not provided, a default value of 50 records will be returned in the result set. (default to 50)

  • :filter (String)

    A URL query parameter that allows clients to filter a collection of resources. The expression specified with $filter is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Expression specified with the $filter must conform to the [OData V4.01](docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html) URL conventions. For example, filter &#39;$filter&#x3D;name eq &#39;karbon-ntnx-1.0&#39; would filter the result on cluster name &#39;karbon-ntnx1.0&#39;, filter &#39;$filter&#x3D;startswith(name, &#39;C&#39;)&#39; would filter on cluster name starting with &#39;C&#39;. The filter can be applied to the following fields: - description - enforcementState - name

  • :orderby (String)

    A URL query parameter that allows clients to specify the sort criteria for the returned list of objects. Resources can be sorted in ascending order using asc or descending order using desc. If asc or desc are not specified, the resources will be sorted in ascending order by default. For example, &#39;$orderby&#x3D;templateName desc&#39; would get all templates sorted by templateName in descending order. The orderby can be applied to the following fields: - description - enforcementState - name

  • :select (String)

    A URL query parameter that allows clients to request a specific set of properties for each entity or complex type. Expression specified with the $select must conform to the [OData V4.01](docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html) URL conventions. If a $select expression consists of a single select item that is an asterisk (i.e., *), then all properties on the matching resource will be returned. - createTime - description - enforcementState - extId - lastUpdateTime - links - name - ownerExtId - placementType - tenantId

Returns:



242
243
244
245
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 242

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

#list_placement_policies_with_http_info(opts = {}) ⇒ Array<(ListPlacementPolicies200Response, Integer, Hash)>

List image placement policies Lists image placement policies created in Prism Central, along with details such as name, description, and so on. This API supports operations such as filtering, sorting, selection, and pagination.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    A URL query parameter that specifies the page number of the result set. It must be a positive integer between 0 and the maximum number of pages that are available for that resource. Any number out of this range might lead to no results. (default to 0)

  • :limit (Integer)

    A URL query parameter that specifies the total number of records returned in the result set. Must be a positive integer between 1 and 100. Any number out of this range will lead to a validation error. If the limit is not provided, a default value of 50 records will be returned in the result set. (default to 50)

  • :filter (String)

    A URL query parameter that allows clients to filter a collection of resources. The expression specified with $filter is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Expression specified with the $filter must conform to the [OData V4.01](docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html) URL conventions. For example, filter &#39;$filter&#x3D;name eq &#39;karbon-ntnx-1.0&#39; would filter the result on cluster name &#39;karbon-ntnx1.0&#39;, filter &#39;$filter&#x3D;startswith(name, &#39;C&#39;)&#39; would filter on cluster name starting with &#39;C&#39;. The filter can be applied to the following fields: - description - enforcementState - name

  • :orderby (String)

    A URL query parameter that allows clients to specify the sort criteria for the returned list of objects. Resources can be sorted in ascending order using asc or descending order using desc. If asc or desc are not specified, the resources will be sorted in ascending order by default. For example, &#39;$orderby&#x3D;templateName desc&#39; would get all templates sorted by templateName in descending order. The orderby can be applied to the following fields: - description - enforcementState - name

  • :select (String)

    A URL query parameter that allows clients to request a specific set of properties for each entity or complex type. Expression specified with the $select must conform to the [OData V4.01](docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html) URL conventions. If a $select expression consists of a single select item that is an asterisk (i.e., *), then all properties on the matching resource will be returned. - createTime - description - enforcementState - extId - lastUpdateTime - links - name - ownerExtId - placementType - tenantId

Returns:



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
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
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 256

def list_placement_policies_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagePlacementPoliciesApi.list_placement_policies ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ImagePlacementPoliciesApi.list_placement_policies, must be greater than or equal to 0.'
  end

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

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

  # resource path
  local_var_path = '/vmm/v4.0/images/config/placement-policies'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'$page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'$limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?
  query_params[:'$select'] = opts[:'select'] if !opts[:'select'].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] || 'ListPlacementPolicies200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKeyAuthScheme', 'basicAuthScheme']

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

#resume_placement_policy(ext_id, if_match, ntnx_request_id, opts = {}) ⇒ ResumePlacementPolicy202Response

Resume an image placement policy Resumes a suspended image placement policy. A suspended image placement policy is one that is not being considered for enforcement.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

  • if_match (String)

    The If-Match request header makes the request conditional. When not provided the server will respond with an HTTP 428 (Precondition Required) response code indicating that the server requires the request to be conditional. The server will allow successful completion of PUT and PATCH operations, if the resource matches the ETag value returned to the response of a GET operation. If the conditional does not match, then an HTTP 412 (Precondition Failed) response

  • ntnx_request_id (String)

    A unique identifier that is associated with each request. The provided value must be opaque and preferably in Universal Unique Identifier (UUID) format. This identifier is also used as an idempotence token for safely retrying requests in case of network errors. All the supported Nutanix API clients add this auto-generated request identifier to each request.

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

    the optional parameters

Returns:



324
325
326
327
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 324

def resume_placement_policy(ext_id, if_match, ntnx_request_id, opts = {})
  data, _status_code, _headers = resume_placement_policy_with_http_info(ext_id, if_match, ntnx_request_id, opts)
  data
end

#resume_placement_policy_with_http_info(ext_id, if_match, ntnx_request_id, opts = {}) ⇒ Array<(ResumePlacementPolicy202Response, Integer, Hash)>

Resume an image placement policy Resumes a suspended image placement policy. A suspended image placement policy is one that is not being considered for enforcement.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

  • if_match (String)

    The If-Match request header makes the request conditional. When not provided the server will respond with an HTTP 428 (Precondition Required) response code indicating that the server requires the request to be conditional. The server will allow successful completion of PUT and PATCH operations, if the resource matches the ETag value returned to the response of a GET operation. If the conditional does not match, then an HTTP 412 (Precondition Failed) response

  • ntnx_request_id (String)

    A unique identifier that is associated with each request. The provided value must be opaque and preferably in Universal Unique Identifier (UUID) format. This identifier is also used as an idempotence token for safely retrying requests in case of network errors. All the supported Nutanix API clients add this auto-generated request identifier to each request.

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

    the optional parameters

Returns:



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
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
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 336

def resume_placement_policy_with_http_info(ext_id, if_match, ntnx_request_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagePlacementPoliciesApi.resume_placement_policy ...'
  end
  # verify the required parameter 'ext_id' is set
  if @api_client.config.client_side_validation && ext_id.nil?
    fail ArgumentError, "Missing the required parameter 'ext_id' when calling ImagePlacementPoliciesApi.resume_placement_policy"
  end
  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if @api_client.config.client_side_validation && ext_id !~ pattern
    fail ArgumentError, "invalid value for 'ext_id' when calling ImagePlacementPoliciesApi.resume_placement_policy, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'if_match' is set
  if @api_client.config.client_side_validation && if_match.nil?
    fail ArgumentError, "Missing the required parameter 'if_match' when calling ImagePlacementPoliciesApi.resume_placement_policy"
  end
  # verify the required parameter 'ntnx_request_id' is set
  if @api_client.config.client_side_validation && ntnx_request_id.nil?
    fail ArgumentError, "Missing the required parameter 'ntnx_request_id' when calling ImagePlacementPoliciesApi.resume_placement_policy"
  end
  # resource path
  local_var_path = '/vmm/v4.0/images/config/placement-policies/{extId}/$actions/resume'.sub('{' + 'extId' + '}', CGI.escape(ext_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']
  header_params[:'If-Match'] = if_match
  header_params[:'NTNX-Request-Id'] = ntnx_request_id

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKeyAuthScheme', 'basicAuthScheme']

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

#suspend_placement_policy(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_suspend_placement_policy_config, opts = {}) ⇒ SuspendPlacementPolicy202Response

Suspend an image placement policy Suspends an active image placement policy. An active image placement policy is considered for enforcement.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

  • if_match (String)

    The If-Match request header makes the request conditional. When not provided the server will respond with an HTTP 428 (Precondition Required) response code indicating that the server requires the request to be conditional. The server will allow successful completion of PUT and PATCH operations, if the resource matches the ETag value returned to the response of a GET operation. If the conditional does not match, then an HTTP 412 (Precondition Failed) response

  • ntnx_request_id (String)

    A unique identifier that is associated with each request. The provided value must be opaque and preferably in Universal Unique Identifier (UUID) format. This identifier is also used as an idempotence token for safely retrying requests in case of network errors. All the supported Nutanix API clients add this auto-generated request identifier to each request.

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

    the optional parameters

Returns:



407
408
409
410
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 407

def suspend_placement_policy(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_suspend_placement_policy_config, opts = {})
  data, _status_code, _headers = suspend_placement_policy_with_http_info(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_suspend_placement_policy_config, opts)
  data
end

#suspend_placement_policy_with_http_info(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_suspend_placement_policy_config, opts = {}) ⇒ Array<(SuspendPlacementPolicy202Response, Integer, Hash)>

Suspend an image placement policy Suspends an active image placement policy. An active image placement policy is considered for enforcement.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

  • if_match (String)

    The If-Match request header makes the request conditional. When not provided the server will respond with an HTTP 428 (Precondition Required) response code indicating that the server requires the request to be conditional. The server will allow successful completion of PUT and PATCH operations, if the resource matches the ETag value returned to the response of a GET operation. If the conditional does not match, then an HTTP 412 (Precondition Failed) response

  • ntnx_request_id (String)

    A unique identifier that is associated with each request. The provided value must be opaque and preferably in Universal Unique Identifier (UUID) format. This identifier is also used as an idempotence token for safely retrying requests in case of network errors. All the supported Nutanix API clients add this auto-generated request identifier to each request.

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

    the optional parameters

Returns:



420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
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
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 420

def suspend_placement_policy_with_http_info(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_suspend_placement_policy_config, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagePlacementPoliciesApi.suspend_placement_policy ...'
  end
  # verify the required parameter 'ext_id' is set
  if @api_client.config.client_side_validation && ext_id.nil?
    fail ArgumentError, "Missing the required parameter 'ext_id' when calling ImagePlacementPoliciesApi.suspend_placement_policy"
  end
  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if @api_client.config.client_side_validation && ext_id !~ pattern
    fail ArgumentError, "invalid value for 'ext_id' when calling ImagePlacementPoliciesApi.suspend_placement_policy, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'if_match' is set
  if @api_client.config.client_side_validation && if_match.nil?
    fail ArgumentError, "Missing the required parameter 'if_match' when calling ImagePlacementPoliciesApi.suspend_placement_policy"
  end
  # verify the required parameter 'ntnx_request_id' is set
  if @api_client.config.client_side_validation && ntnx_request_id.nil?
    fail ArgumentError, "Missing the required parameter 'ntnx_request_id' when calling ImagePlacementPoliciesApi.suspend_placement_policy"
  end
  # verify the required parameter 'vmm_v40_images_config_suspend_placement_policy_config' is set
  if @api_client.config.client_side_validation && vmm_v40_images_config_suspend_placement_policy_config.nil?
    fail ArgumentError, "Missing the required parameter 'vmm_v40_images_config_suspend_placement_policy_config' when calling ImagePlacementPoliciesApi.suspend_placement_policy"
  end
  # resource path
  local_var_path = '/vmm/v4.0/images/config/placement-policies/{extId}/$actions/suspend'.sub('{' + 'extId' + '}', CGI.escape(ext_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
  header_params[:'If-Match'] = if_match
  header_params[:'NTNX-Request-Id'] = ntnx_request_id

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKeyAuthScheme', 'basicAuthScheme']

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

#update_placement_policy_by_id(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_placement_policy, opts = {}) ⇒ UpdatePlacementPolicyById202Response

Update an image placement policy Updates the image placement policy using the provided request body with the given external identifier. It is always recommended to perform a GET operation on a resource before performing a PUT operation to ensure the correct ETag is used.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

  • if_match (String)

    The If-Match request header makes the request conditional. When not provided, the server will respond with an HTTP-428 (Precondition Required) response code indicating that the server requires the request to be conditional. The server will allow the successful completion of PUT and PATCH operations, if the resource matches the ETag value returned to the response of a GET operation. If the conditional does not match, then an HTTP-412 (Precondition Failed) response will be returned.

  • ntnx_request_id (String)

    A unique identifier that is associated with each request. The provided value must be opaque and preferably in Universal Unique Identifier (UUID) format. This identifier is also used as an idempotence token for safely retrying requests in case of network errors. All the supported Nutanix API clients add this auto-generated request identifier to each request.

  • vmm_v40_images_config_placement_policy (VmmV40ImagesConfigPlacementPolicy)

    Updated image placement policy request.

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

    the optional parameters

Returns:



500
501
502
503
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 500

def update_placement_policy_by_id(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_placement_policy, opts = {})
  data, _status_code, _headers = update_placement_policy_by_id_with_http_info(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_placement_policy, opts)
  data
end

#update_placement_policy_by_id_with_http_info(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_placement_policy, opts = {}) ⇒ Array<(UpdatePlacementPolicyById202Response, Integer, Hash)>

Update an image placement policy Updates the image placement policy using the provided request body with the given external identifier. It is always recommended to perform a GET operation on a resource before performing a PUT operation to ensure the correct ETag is used.

Parameters:

  • ext_id (String)

    The external identifier of image placement policy.

  • if_match (String)

    The If-Match request header makes the request conditional. When not provided, the server will respond with an HTTP-428 (Precondition Required) response code indicating that the server requires the request to be conditional. The server will allow the successful completion of PUT and PATCH operations, if the resource matches the ETag value returned to the response of a GET operation. If the conditional does not match, then an HTTP-412 (Precondition Failed) response will be returned.

  • ntnx_request_id (String)

    A unique identifier that is associated with each request. The provided value must be opaque and preferably in Universal Unique Identifier (UUID) format. This identifier is also used as an idempotence token for safely retrying requests in case of network errors. All the supported Nutanix API clients add this auto-generated request identifier to each request.

  • vmm_v40_images_config_placement_policy (VmmV40ImagesConfigPlacementPolicy)

    Updated image placement policy request.

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

    the optional parameters

Returns:



513
514
515
516
517
518
519
520
521
522
523
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
# File 'lib/nutanix_vmm/api/image_placement_policies_api.rb', line 513

def update_placement_policy_by_id_with_http_info(ext_id, if_match, ntnx_request_id, vmm_v40_images_config_placement_policy, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagePlacementPoliciesApi.update_placement_policy_by_id ...'
  end
  # verify the required parameter 'ext_id' is set
  if @api_client.config.client_side_validation && ext_id.nil?
    fail ArgumentError, "Missing the required parameter 'ext_id' when calling ImagePlacementPoliciesApi.update_placement_policy_by_id"
  end
  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if @api_client.config.client_side_validation && ext_id !~ pattern
    fail ArgumentError, "invalid value for 'ext_id' when calling ImagePlacementPoliciesApi.update_placement_policy_by_id, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'if_match' is set
  if @api_client.config.client_side_validation && if_match.nil?
    fail ArgumentError, "Missing the required parameter 'if_match' when calling ImagePlacementPoliciesApi.update_placement_policy_by_id"
  end
  # verify the required parameter 'ntnx_request_id' is set
  if @api_client.config.client_side_validation && ntnx_request_id.nil?
    fail ArgumentError, "Missing the required parameter 'ntnx_request_id' when calling ImagePlacementPoliciesApi.update_placement_policy_by_id"
  end
  # verify the required parameter 'vmm_v40_images_config_placement_policy' is set
  if @api_client.config.client_side_validation && vmm_v40_images_config_placement_policy.nil?
    fail ArgumentError, "Missing the required parameter 'vmm_v40_images_config_placement_policy' when calling ImagePlacementPoliciesApi.update_placement_policy_by_id"
  end
  # resource path
  local_var_path = '/vmm/v4.0/images/config/placement-policies/{extId}'.sub('{' + 'extId' + '}', CGI.escape(ext_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
  header_params[:'If-Match'] = if_match
  header_params[:'NTNX-Request-Id'] = ntnx_request_id

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKeyAuthScheme', 'basicAuthScheme']

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