Class: NutanixClustermgmt::BmcApi

Inherits:
Object
  • Object
show all
Defined in:
lib/nutanix_clustermgmt/api/bmc_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BmcApi

Returns a new instance of BmcApi.



19
20
21
# File 'lib/nutanix_clustermgmt/api/bmc_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_clustermgmt/api/bmc_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_bmc_info(cluster_ext_id, ext_id, opts = {}) ⇒ GetBmcInfo200Response

Get BMC details Get BMC details of a host

Parameters:

  • cluster_ext_id (String)

    Cluster UUID

  • ext_id (String)

    Host UUID

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/nutanix_clustermgmt/api/bmc_api.rb', line 28

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_info_with_http_info(cluster_ext_id, ext_id, opts = {}) ⇒ Array<(GetBmcInfo200Response, Integer, Hash)>

Get BMC details Get BMC details of a host

Parameters:

  • cluster_ext_id (String)

    Cluster UUID

  • ext_id (String)

    Host UUID

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

    the optional parameters

Returns:

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

    GetBmcInfo200Response 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
95
96
97
98
99
# File 'lib/nutanix_clustermgmt/api/bmc_api.rb', line 39

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(cluster_ext_id, ext_id, if_match, ntnx_request_id, clustermgmt_v40_config_bmc_info, opts = {}) ⇒ UpdateBmcInfo202Response

Update BMC info summary Update BMC info

Parameters:

  • cluster_ext_id (String)

    Cluster UUID

  • ext_id (String)

    Host UUID

  • 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.

  • clustermgmt_v40_config_bmc_info (ClustermgmtV40ConfigBmcInfo)

    Update BMC info body

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

    the optional parameters

Returns:



110
111
112
113
# File 'lib/nutanix_clustermgmt/api/bmc_api.rb', line 110

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_with_http_info(cluster_ext_id, ext_id, if_match, ntnx_request_id, clustermgmt_v40_config_bmc_info, opts = {}) ⇒ Array<(UpdateBmcInfo202Response, Integer, Hash)>

Update BMC info summary Update BMC info

Parameters:

  • cluster_ext_id (String)

    Cluster UUID

  • ext_id (String)

    Host UUID

  • 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.

  • clustermgmt_v40_config_bmc_info (ClustermgmtV40ConfigBmcInfo)

    Update BMC info body

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

    the optional parameters

Returns:

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

    UpdateBmcInfo202Response data, response status code and response headers



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
# File 'lib/nutanix_clustermgmt/api/bmc_api.rb', line 124

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