forked from ManageIQ/nutanix_clustermgmt-sdk-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbmc_api.rb
More file actions
205 lines (175 loc) · 10.8 KB
/
bmc_api.rb
File metadata and controls
205 lines (175 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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
=begin
#Nutanix Cluster Management APIs
#Manage Hosts, Clusters and other Infrastructure.
The version of the OpenAPI document: 4.0.2
Generated by: https://openapi-generator.tech
Generator version: 7.16.0
=end
require 'cgi'
module NutanixClustermgmt
class BmcApi
attr_accessor :api_client
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# Get BMC details
# Get BMC details of a host
# @param cluster_ext_id [String] Cluster UUID
# @param ext_id [String] Host UUID
# @param [Hash] opts the optional parameters
# @return [GetBmcInfo200Response]
def get_bmc_info(cluster_ext_id, ext_id, opts = {})
data, _status_code, _headers = get_bmc_info_with_http_info(cluster_ext_id, ext_id, opts)
data
end
# Get BMC details
# Get BMC details of a host
# @param cluster_ext_id [String] Cluster UUID
# @param ext_id [String] Host UUID
# @param [Hash] opts the optional parameters
# @return [Array<(GetBmcInfo200Response, Integer, Hash)>] GetBmcInfo200Response data, response status code and response headers
def get_bmc_info_with_http_info(cluster_ext_id, ext_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BmcApi.get_bmc_info ...'
end
# verify the required parameter 'cluster_ext_id' is set
if @api_client.config.client_side_validation && cluster_ext_id.nil?
fail ArgumentError, "Missing the required parameter 'cluster_ext_id' when calling BmcApi.get_bmc_info"
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 && cluster_ext_id !~ pattern
fail ArgumentError, "invalid value for 'cluster_ext_id' when calling BmcApi.get_bmc_info, must conform to the pattern #{pattern}."
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 BmcApi.get_bmc_info"
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 BmcApi.get_bmc_info, must conform to the pattern #{pattern}."
end
# resource path
local_var_path = '/clustermgmt/v4.0/config/clusters/{clusterExtId}/hosts/{extId}/bmc-info'.sub('{' + 'clusterExtId' + '}', CGI.escape(cluster_ext_id.to_s)).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] || 'GetBmcInfo200Response'
# auth_names
auth_names = opts[:debug_auth_names] || ['apiKeyAuthScheme', 'basicAuthScheme']
new_options = opts.merge(
:operation => :"BmcApi.get_bmc_info",
: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: BmcApi#get_bmc_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update BMC info summary
# Update BMC info
# @param cluster_ext_id [String] Cluster UUID
# @param ext_id [String] Host UUID
# @param 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.
# @param 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.
# @param clustermgmt_v40_config_bmc_info [ClustermgmtV40ConfigBmcInfo] Update BMC info body
# @param [Hash] opts the optional parameters
# @return [UpdateBmcInfo202Response]
def update_bmc_info(cluster_ext_id, ext_id, if_match, ntnx_request_id, clustermgmt_v40_config_bmc_info, opts = {})
data, _status_code, _headers = update_bmc_info_with_http_info(cluster_ext_id, ext_id, if_match, ntnx_request_id, clustermgmt_v40_config_bmc_info, opts)
data
end
# Update BMC info summary
# Update BMC info
# @param cluster_ext_id [String] Cluster UUID
# @param ext_id [String] Host UUID
# @param 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.
# @param 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.
# @param clustermgmt_v40_config_bmc_info [ClustermgmtV40ConfigBmcInfo] Update BMC info body
# @param [Hash] opts the optional parameters
# @return [Array<(UpdateBmcInfo202Response, Integer, Hash)>] UpdateBmcInfo202Response data, response status code and response headers
def update_bmc_info_with_http_info(cluster_ext_id, ext_id, if_match, ntnx_request_id, clustermgmt_v40_config_bmc_info, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BmcApi.update_bmc_info ...'
end
# verify the required parameter 'cluster_ext_id' is set
if @api_client.config.client_side_validation && cluster_ext_id.nil?
fail ArgumentError, "Missing the required parameter 'cluster_ext_id' when calling BmcApi.update_bmc_info"
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 && cluster_ext_id !~ pattern
fail ArgumentError, "invalid value for 'cluster_ext_id' when calling BmcApi.update_bmc_info, must conform to the pattern #{pattern}."
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 BmcApi.update_bmc_info"
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 BmcApi.update_bmc_info, 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 BmcApi.update_bmc_info"
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 BmcApi.update_bmc_info"
end
# verify the required parameter 'clustermgmt_v40_config_bmc_info' is set
if @api_client.config.client_side_validation && clustermgmt_v40_config_bmc_info.nil?
fail ArgumentError, "Missing the required parameter 'clustermgmt_v40_config_bmc_info' when calling BmcApi.update_bmc_info"
end
# resource path
local_var_path = '/clustermgmt/v4.0/config/clusters/{clusterExtId}/hosts/{extId}/bmc-info'.sub('{' + 'clusterExtId' + '}', CGI.escape(cluster_ext_id.to_s)).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(clustermgmt_v40_config_bmc_info)
# return_type
return_type = opts[:debug_return_type] || 'UpdateBmcInfo202Response'
# auth_names
auth_names = opts[:debug_auth_names] || ['apiKeyAuthScheme', 'basicAuthScheme']
new_options = opts.merge(
:operation => :"BmcApi.update_bmc_info",
: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: BmcApi#update_bmc_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end