Add iDrac reset api

Change-Id: Iec4e59341fd8a976b6aeda30d0671839643b04bf
This commit is contained in:
James Gu 2022-08-25 19:08:52 +00:00
parent 3c3d7c6ba0
commit 470a7752c6
10 changed files with 500 additions and 0 deletions

View File

@ -18,6 +18,8 @@ docs/CreateVirtualDiskRequestBody.md
docs/DefaultApi.md
docs/FirmwareInventory.md
docs/Health.md
docs/IDRACResetRequestBody.md
docs/IDRACResetType.md
docs/IdRef.md
docs/IndicatorLED.md
docs/InlineObject.md
@ -65,6 +67,8 @@ model_create_virtual_disk_request_body.go
model_firmware_inventory.go
model_health.go
model_id_ref.go
model_idrac_reset_request_body.go
model_idrac_reset_type.go
model_indicator_led.go
model_inline_object.go
model_insert_media_request_body.go

View File

@ -95,6 +95,7 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**ListManagerVirtualMedia**](docs/DefaultApi.md#listmanagervirtualmedia) | **Get** /redfish/v1/Managers/{managerId}/VirtualMedia |
*DefaultApi* | [**ListManagers**](docs/DefaultApi.md#listmanagers) | **Get** /redfish/v1/Managers |
*DefaultApi* | [**ListSystems**](docs/DefaultApi.md#listsystems) | **Get** /redfish/v1/Systems |
*DefaultApi* | [**ResetIdrac**](docs/DefaultApi.md#resetidrac) | **Post** /redfish/v1/Managers/iDRAC.Embedded.1/Actions/Manager.Reset |
*DefaultApi* | [**ResetSystem**](docs/DefaultApi.md#resetsystem) | **Post** /redfish/v1/Systems/{ComputerSystemId}/Actions/ComputerSystem.Reset |
*DefaultApi* | [**SetSystem**](docs/DefaultApi.md#setsystem) | **Patch** /redfish/v1/Systems/{systemId} |
*DefaultApi* | [**UpdateService**](docs/DefaultApi.md#updateservice) | **Get** /redfish/v1/UpdateService |
@ -114,6 +115,8 @@ Class | Method | HTTP request | Description
- [CreateVirtualDiskRequestBody](docs/CreateVirtualDiskRequestBody.md)
- [FirmwareInventory](docs/FirmwareInventory.md)
- [Health](docs/Health.md)
- [IDRACResetRequestBody](docs/IDRACResetRequestBody.md)
- [IDRACResetType](docs/IDRACResetType.md)
- [IdRef](docs/IdRef.md)
- [IndicatorLED](docs/IndicatorLED.md)
- [InlineObject](docs/InlineObject.md)

View File

@ -525,6 +525,24 @@ paths:
schema:
$ref: '#/components/schemas/RedfishError'
description: Error condition
/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Manager.Reset:
post:
operationId: reset_idrac
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/IDRACResetRequestBody'
required: true
responses:
"204":
description: Success, but no response data
default:
content:
application/json:
schema:
$ref: '#/components/schemas/RedfishError'
description: Error condition
components:
requestBodies:
inline_object:
@ -598,6 +616,10 @@ components:
- PushPowerButton
- PowerCycle
type: string
IDRACResetType:
enum:
- GracefulRestart
type: string
IndicatorLED:
enum:
- Unknown
@ -1007,6 +1029,13 @@ components:
ResetType:
$ref: '#/components/schemas/ResetType'
type: object
IDRACResetRequestBody:
additionalProperties: false
example: {}
properties:
ResetType:
$ref: '#/components/schemas/IDRACResetType'
type: object
ComputerSystem:
additionalProperties: false
description: Root redfish path.

View File

@ -1932,6 +1932,113 @@ func (a *DefaultApiService) ListSystemsExecute(r ApiListSystemsRequest) (Collect
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiResetIdracRequest struct {
ctx _context.Context
ApiService *DefaultApiService
iDRACResetRequestBody *IDRACResetRequestBody
}
func (r ApiResetIdracRequest) IDRACResetRequestBody(iDRACResetRequestBody IDRACResetRequestBody) ApiResetIdracRequest {
r.iDRACResetRequestBody = &iDRACResetRequestBody
return r
}
func (r ApiResetIdracRequest) Execute() (*_nethttp.Response, error) {
return r.ApiService.ResetIdracExecute(r)
}
/*
* ResetIdrac Method for ResetIdrac
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiResetIdracRequest
*/
func (a *DefaultApiService) ResetIdrac(ctx _context.Context) ApiResetIdracRequest {
return ApiResetIdracRequest{
ApiService: a,
ctx: ctx,
}
}
/*
* Execute executes the request
*/
func (a *DefaultApiService) ResetIdracExecute(r ApiResetIdracRequest) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResetIdrac")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Manager.Reset"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.iDRACResetRequestBody == nil {
return nil, reportError("iDRACResetRequestBody is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.iDRACResetRequestBody
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v RedfishError
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.model = v
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiResetSystemRequest struct {
ctx _context.Context
ApiService *DefaultApiService

View File

@ -21,6 +21,7 @@ Method | HTTP request | Description
[**ListManagerVirtualMedia**](DefaultApi.md#ListManagerVirtualMedia) | **Get** /redfish/v1/Managers/{managerId}/VirtualMedia |
[**ListManagers**](DefaultApi.md#ListManagers) | **Get** /redfish/v1/Managers |
[**ListSystems**](DefaultApi.md#ListSystems) | **Get** /redfish/v1/Systems |
[**ResetIdrac**](DefaultApi.md#ResetIdrac) | **Post** /redfish/v1/Managers/iDRAC.Embedded.1/Actions/Manager.Reset |
[**ResetSystem**](DefaultApi.md#ResetSystem) | **Post** /redfish/v1/Systems/{ComputerSystemId}/Actions/ComputerSystem.Reset |
[**SetSystem**](DefaultApi.md#SetSystem) | **Patch** /redfish/v1/Systems/{systemId} |
[**UpdateService**](DefaultApi.md#UpdateService) | **Get** /redfish/v1/UpdateService |
@ -1157,6 +1158,68 @@ No authorization required
[[Back to README]](../README.md)
## ResetIdrac
> ResetIdrac(ctx).IDRACResetRequestBody(iDRACResetRequestBody).Execute()
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
iDRACResetRequestBody := *openapiclient.NewIDRACResetRequestBody() // IDRACResetRequestBody |
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.DefaultApi.ResetIdrac(context.Background()).IDRACResetRequestBody(iDRACResetRequestBody).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.ResetIdrac``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiResetIdracRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**iDRACResetRequestBody** | [**IDRACResetRequestBody**](IDRACResetRequestBody.md) | |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## ResetSystem
> RedfishError ResetSystem(ctx, computerSystemId).ResetRequestBody(resetRequestBody).Execute()

View File

@ -0,0 +1,56 @@
# IDRACResetRequestBody
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ResetType** | Pointer to [**IDRACResetType**](IDRACResetType.md) | | [optional]
## Methods
### NewIDRACResetRequestBody
`func NewIDRACResetRequestBody() *IDRACResetRequestBody`
NewIDRACResetRequestBody instantiates a new IDRACResetRequestBody object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewIDRACResetRequestBodyWithDefaults
`func NewIDRACResetRequestBodyWithDefaults() *IDRACResetRequestBody`
NewIDRACResetRequestBodyWithDefaults instantiates a new IDRACResetRequestBody object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetResetType
`func (o *IDRACResetRequestBody) GetResetType() IDRACResetType`
GetResetType returns the ResetType field if non-nil, zero value otherwise.
### GetResetTypeOk
`func (o *IDRACResetRequestBody) GetResetTypeOk() (*IDRACResetType, bool)`
GetResetTypeOk returns a tuple with the ResetType field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetResetType
`func (o *IDRACResetRequestBody) SetResetType(v IDRACResetType)`
SetResetType sets ResetType field to given value.
### HasResetType
`func (o *IDRACResetRequestBody) HasResetType() bool`
HasResetType returns a boolean if a field has been set.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# IDRACResetType
## Enum
* `GRACEFUL_RESTART` (value: `"GracefulRestart"`)
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,115 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package client
import (
"encoding/json"
)
// IDRACResetRequestBody struct for IDRACResetRequestBody
type IDRACResetRequestBody struct {
ResetType *IDRACResetType `json:"ResetType,omitempty"`
}
// NewIDRACResetRequestBody instantiates a new IDRACResetRequestBody object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewIDRACResetRequestBody() *IDRACResetRequestBody {
this := IDRACResetRequestBody{}
return &this
}
// NewIDRACResetRequestBodyWithDefaults instantiates a new IDRACResetRequestBody object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewIDRACResetRequestBodyWithDefaults() *IDRACResetRequestBody {
this := IDRACResetRequestBody{}
return &this
}
// GetResetType returns the ResetType field value if set, zero value otherwise.
func (o *IDRACResetRequestBody) GetResetType() IDRACResetType {
if o == nil || o.ResetType == nil {
var ret IDRACResetType
return ret
}
return *o.ResetType
}
// GetResetTypeOk returns a tuple with the ResetType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IDRACResetRequestBody) GetResetTypeOk() (*IDRACResetType, bool) {
if o == nil || o.ResetType == nil {
return nil, false
}
return o.ResetType, true
}
// HasResetType returns a boolean if a field has been set.
func (o *IDRACResetRequestBody) HasResetType() bool {
if o != nil && o.ResetType != nil {
return true
}
return false
}
// SetResetType gets a reference to the given IDRACResetType and assigns it to the ResetType field.
func (o *IDRACResetRequestBody) SetResetType(v IDRACResetType) {
o.ResetType = &v
}
func (o IDRACResetRequestBody) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.ResetType != nil {
toSerialize["ResetType"] = o.ResetType
}
return json.Marshal(toSerialize)
}
type NullableIDRACResetRequestBody struct {
value *IDRACResetRequestBody
isSet bool
}
func (v NullableIDRACResetRequestBody) Get() *IDRACResetRequestBody {
return v.value
}
func (v *NullableIDRACResetRequestBody) Set(val *IDRACResetRequestBody) {
v.value = val
v.isSet = true
}
func (v NullableIDRACResetRequestBody) IsSet() bool {
return v.isSet
}
func (v *NullableIDRACResetRequestBody) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableIDRACResetRequestBody(val *IDRACResetRequestBody) *NullableIDRACResetRequestBody {
return &NullableIDRACResetRequestBody{value: val, isSet: true}
}
func (v NullableIDRACResetRequestBody) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableIDRACResetRequestBody) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,83 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package client
import (
"encoding/json"
"fmt"
)
// IDRACResetType the model 'IDRACResetType'
type IDRACResetType string
// List of IDRACResetType
const (
IDRACRESETTYPE_GRACEFUL_RESTART IDRACResetType = "GracefulRestart"
)
func (v *IDRACResetType) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := IDRACResetType(value)
for _, existing := range []IDRACResetType{ "GracefulRestart", } {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid IDRACResetType", value)
}
// Ptr returns reference to IDRACResetType value
func (v IDRACResetType) Ptr() *IDRACResetType {
return &v
}
type NullableIDRACResetType struct {
value *IDRACResetType
isSet bool
}
func (v NullableIDRACResetType) Get() *IDRACResetType {
return v.value
}
func (v *NullableIDRACResetType) Set(val *IDRACResetType) {
v.value = val
v.isSet = true
}
func (v NullableIDRACResetType) IsSet() bool {
return v.isSet
}
func (v *NullableIDRACResetType) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableIDRACResetType(val *IDRACResetType) *NullableIDRACResetType {
return &NullableIDRACResetType{value: val, isSet: true}
}
func (v NullableIDRACResetType) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableIDRACResetType) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -524,6 +524,24 @@ paths:
schema:
$ref: '#/components/schemas/RedfishError'
description: Error condition
/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Manager.Reset:
post:
operationId: reset_idrac
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/IDRACResetRequestBody'
required: true
responses:
204:
description: Success, but no response data
default:
content:
application/json:
schema:
$ref: '#/components/schemas/RedfishError'
description: Error condition
components:
schemas:
BootSource:
@ -590,6 +608,10 @@ components:
- PushPowerButton
- PowerCycle
type: string
IDRACResetType:
enum:
- GracefulRestart
type: string
IndicatorLED:
enum:
- Unknown
@ -999,6 +1021,13 @@ components:
ResetType:
$ref: '#/components/schemas/ResetType'
type: object
IDRACResetRequestBody:
additionalProperties: false
example: {}
properties:
ResetType:
$ref: '#/components/schemas/IDRACResetType'
type: object
ComputerSystem:
additionalProperties: false
description: Root redfish path.