computerSystem api support

Support for redfish root, system list,
system get and system reset action.
This commit is contained in:
Kanwar Saad Bin Liaqat 2019-09-08 23:55:37 +03:00
parent 0161f2b460
commit c138ca1069
No known key found for this signature in database
GPG Key ID: F5189DC439490C63
61 changed files with 12015 additions and 0 deletions

11
Makefile Normal file
View File

@ -0,0 +1,11 @@
.PHONY: code-gen
code-gen:
rm -rf redfish_client
openapi-generator generate -i ./spec/openapi.yaml -g go -o client/
.PHONY: deps
deps:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

24
client/.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1 @@
4.1.1

8
client/.travis.yml Normal file
View File

@ -0,0 +1,8 @@
language: go
install:
- go get -d -v .
script:
- go build -v ./

76
client/README.md Normal file
View File

@ -0,0 +1,76 @@
# Go API client for openapi
Partial Redfish OAPI specification for a limited client
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
- API version: 0.0.1
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
## Installation
Install the following dependencies:
```shell
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional
```
Put the package under your project folder and add the following in import:
```golang
import "./openapi"
```
## Documentation for API Endpoints
All URIs are relative to *http://localhost*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**GetRoot**](docs/DefaultApi.md#getroot) | **Get** /redfish/v1 |
*DefaultApi* | [**GetSystem**](docs/DefaultApi.md#getsystem) | **Get** /redfish/v1/Systems/{systemId} |
*DefaultApi* | [**ListManagers**](docs/DefaultApi.md#listmanagers) | **Get** /redfish/v1/Managers |
*DefaultApi* | [**ListSystems**](docs/DefaultApi.md#listsystems) | **Get** /redfish/v1/Systems |
*DefaultApi* | [**ResetSystem**](docs/DefaultApi.md#resetsystem) | **Post** /redfish/v1/Systems/{ComputerSystemId}/Actions/ComputerSystem.Reset |
## Documentation For Models
- [Boot](docs/Boot.md)
- [BootSource](docs/BootSource.md)
- [BootSourceOverrideEnabled](docs/BootSourceOverrideEnabled.md)
- [Collection](docs/Collection.md)
- [ComputerSystem](docs/ComputerSystem.md)
- [ComputerSystemActions](docs/ComputerSystemActions.md)
- [ComputerSystemReset](docs/ComputerSystemReset.md)
- [Health](docs/Health.md)
- [IdRef](docs/IdRef.md)
- [IndicatorLed](docs/IndicatorLed.md)
- [Links](docs/Links.md)
- [MemorySummary](docs/MemorySummary.md)
- [Message](docs/Message.md)
- [PowerState](docs/PowerState.md)
- [ProcessorSummary](docs/ProcessorSummary.md)
- [RedfishError](docs/RedfishError.md)
- [RedfishErrorError](docs/RedfishErrorError.md)
- [ResetRequestBody](docs/ResetRequestBody.md)
- [ResetType](docs/ResetType.md)
- [Root](docs/Root.md)
- [State](docs/State.md)
- [Status](docs/Status.md)
## Documentation For Authorization
Endpoints do not require authorization.
## Author

652
client/api/openapi.yaml Normal file
View File

@ -0,0 +1,652 @@
openapi: 3.0.2
info:
description: Partial Redfish OAPI specification for a limited client
title: Redfish OAPI specification
version: 0.0.1
servers:
- url: /
paths:
/redfish/v1:
get:
operationId: get_root
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/Root'
description: Get redfish root
/redfish/v1/Systems:
get:
operationId: list_systems
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/Collection'
description: Computer Systems List
/redfish/v1/Systems/{systemId}:
get:
operationId: get_system
parameters:
- description: ID of resource
explode: false
in: path
name: systemId
required: true
schema:
type: string
style: simple
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/ComputerSystem'
description: Computer Systems List
/redfish/v1/Managers:
get:
operationId: list_managers
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/Collection'
description: Managers List
/redfish/v1/Systems/{ComputerSystemId}/Actions/ComputerSystem.Reset:
post:
operationId: reset_system
parameters:
- explode: false
in: path
name: ComputerSystemId
required: true
schema:
type: string
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ResetRequestBody'
required: true
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/RedfishError'
description: Success with response
204:
description: Success, but no response data
default:
content:
application/json:
schema:
$ref: '#/components/schemas/RedfishError'
description: Error condition
components:
schemas:
BootSource:
enum:
- None
- Pxe
- Floppy
- Cd
- Usb
- Hdd
- BiosSetup
- Utilities
- Diags
- UefiShell
- UefiTarget
- SDCard
- UefiHttp
- RemoteDrive
- UefiBootNext
type: string
BootSourceOverrideEnabled:
enum:
- Once
- Continuous
type: string
State:
enum:
- Enabled
- Disabled
- StandbyOffline
- StandbySpare
- InTest
- Starting
- Absent
- UnavailableOffline
- Deferring
- Quiesced
- Updating
type: string
Health:
enum:
- OK
- Warning
- Critical
type: string
PowerState:
enum:
- "true"
- "false"
- PoweringOn
- PoweringOff
type: string
ResetType:
enum:
- On
- ForceOff
- GracefulShutdown
- GracefulRestart
- ForceRestart
- Nmi
- ForceOn
- PushPowerButton
- PowerCycle
type: string
IndicatorLED:
enum:
- Unknown
- Lit
- Blinking
- Off
type: string
context:
description: The OData description of a payload.
format: uri-reference
readOnly: true
type: string
count:
description: The number of items in a collection.
readOnly: true
type: integer
name:
description: The name of the resource.
readOnly: true
type: string
etag:
description: The current ETag of the resource.
readOnly: true
type: string
id:
description: The name of the resource.
readOnly: true
type: string
odataId:
description: The unique identifier for a resource.
format: uri-reference
readOnly: true
type: string
idRef:
additionalProperties: false
description: A reference to a resource.
example:
'@odata.id': '@odata.id'
properties:
'@odata.id':
description: The unique identifier for a resource.
format: uri-reference
readOnly: true
type: string
type: object
nextLink:
description: The URI to the resource containing the next set of partial members.
format: uri-reference
readOnly: true
type: string
rtype:
description: The type of a resource.
readOnly: true
type: string
UUID:
pattern: ([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})
type: string
Message:
additionalProperties: false
example:
MessageArgs:
- MessageArgs
- MessageArgs
Message: Message
RelatedProperties:
- RelatedProperties
- RelatedProperties
Severity: Severity
MessageId: MessageId
Resolution: Resolution
properties:
Message:
readOnly: true
type: string
MessageArgs:
items:
type: string
readOnly: true
type: array
MessageId:
readOnly: true
type: string
RelatedProperties:
items:
type: string
readOnly: true
type: array
Resolution:
readOnly: true
type: string
Severity:
readOnly: true
type: string
required:
- MessageId
type: object
RedfishError:
description: Contains an error payload from a Redfish Service.
example:
error:
'@Message.ExtendedInfo':
- MessageArgs:
- MessageArgs
- MessageArgs
Message: Message
RelatedProperties:
- RelatedProperties
- RelatedProperties
Severity: Severity
MessageId: MessageId
Resolution: Resolution
- MessageArgs:
- MessageArgs
- MessageArgs
Message: Message
RelatedProperties:
- RelatedProperties
- RelatedProperties
Severity: Severity
MessageId: MessageId
Resolution: Resolution
code: code
message: message
properties:
error:
$ref: '#/components/schemas/RedfishError_error'
required:
- error
type: object
Root:
additionalProperties: false
description: Root redfish path.
example:
'@odata.id': '@odata.id'
Managers:
'@odata.id': '@odata.id'
'@odata.type': '@odata.type'
RedfishVersion: RedfishVersion
Id: Id
UUID: UUID
'@Redfish.Copyright': '@Redfish.Copyright'
Systems:
'@odata.id': '@odata.id'
Name: Name
properties:
Id:
description: The name of the resource.
readOnly: true
type: string
Name:
description: The name of the resource.
readOnly: true
type: string
RedfishVersion:
description: redfish version
type: string
UUID:
pattern: ([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})
type: string
'@odata.type':
description: The type of a resource.
readOnly: true
type: string
'@odata.id':
description: The unique identifier for a resource.
format: uri-reference
readOnly: true
type: string
'@Redfish.Copyright':
description: redfish copyright
type: string
Systems:
$ref: '#/components/schemas/idRef'
Managers:
$ref: '#/components/schemas/idRef'
required:
- '@odata.id'
- '@odata.type'
- Name
type: object
Collection:
additionalProperties: false
description: A Collection of ComputerSystem resource instances.
example:
'@odata.id': '@odata.id'
Description: Description
'@odata.type': '@odata.type'
Members@odata.count: 0
'@odata.etag': '@odata.etag'
'@odata.context': '@odata.context'
Members@odata.nextLink: Members@odata.nextLink
Members:
- '@odata.id': '@odata.id'
- '@odata.id': '@odata.id'
Name: Name
properties:
'@odata.context':
description: context
type: string
'@odata.etag':
description: etag
type: string
'@odata.id':
description: id
type: string
'@odata.type':
description: type
type: string
Description:
description: description
readOnly: true
type: string
Members:
description: Contains the members of this collection.
items:
$ref: '#/components/schemas/idRef'
readOnly: true
type: array
Members@odata.count:
description: The number of items in a collection.
readOnly: true
type: integer
Members@odata.nextLink:
description: The URI to the resource containing the next set of partial
members.
format: uri-reference
readOnly: true
type: string
Name:
description: The name of the resource.
readOnly: true
type: string
required:
- '@odata.id'
- '@odata.type'
- Members
- Name
type: object
Status:
additionalProperties: false
example: {}
properties:
Health:
$ref: '#/components/schemas/Health'
HealthRollup:
$ref: '#/components/schemas/Health'
State:
$ref: '#/components/schemas/State'
type: object
Boot:
additionalProperties: false
example:
BootSourceOverrideTarget@Redfish.AllowableValues:
- null
- null
properties:
BootSourceOverrideEnabled:
$ref: '#/components/schemas/BootSourceOverrideEnabled'
BootSourceOverrideTarget:
$ref: '#/components/schemas/BootSource'
BootSourceOverrideTarget@Redfish.AllowableValues:
items:
$ref: '#/components/schemas/BootSource'
type: array
type: object
ProcessorSummary:
additionalProperties: false
example:
Status: {}
Count: 0
properties:
Count:
minimum: 0
readOnly: true
type: integer
Status:
$ref: '#/components/schemas/Status'
type: object
MemorySummary:
additionalProperties: false
example:
Status: {}
TotalSystemPersistentMemoryGiB: 0.14658129805029452
TotalSystemMemoryGiB: 0.6027456183070403
properties:
TotalSystemMemoryGiB:
minimum: 0
readOnly: true
type: number
TotalSystemPersistentMemoryGiB:
minimum: 0
readOnly: true
type: number
Status:
$ref: '#/components/schemas/Status'
type: object
Links:
additionalProperties: false
example:
Chassis:
- '@odata.id': '@odata.id'
- '@odata.id': '@odata.id'
ManagedBy:
- '@odata.id': '@odata.id'
- '@odata.id': '@odata.id'
properties:
Chassis:
items:
$ref: '#/components/schemas/idRef'
type: array
ManagedBy:
items:
$ref: '#/components/schemas/idRef'
type: array
type: object
ComputerSystemReset:
additionalProperties: false
example:
ResetType@Redfish.AllowableValues:
- null
- null
target: target
properties:
target:
description: The unique identifier for a resource.
format: uri-reference
readOnly: true
type: string
ResetType@Redfish.AllowableValues:
items:
$ref: '#/components/schemas/ResetType'
type: array
type: object
ResetRequestBody:
additionalProperties: false
example: {}
properties:
ResetType:
$ref: '#/components/schemas/ResetType'
type: object
ComputerSystem:
additionalProperties: false
description: Root redfish path.
example:
Status: {}
Actions:
'#ComputerSystem.Reset':
ResetType@Redfish.AllowableValues:
- null
- null
target: target
'@odata.type': '@odata.type'
Memory:
'@odata.id': '@odata.id'
RedfishVersion: RedfishVersion
'@odata.context': '@odata.context'
Boot:
BootSourceOverrideTarget@Redfish.AllowableValues:
- null
- null
Name: Name
'@odata.id': '@odata.id'
Bios:
'@odata.id': '@odata.id'
ProcessorSummary:
Status: {}
Count: 0
Links:
Chassis:
- '@odata.id': '@odata.id'
- '@odata.id': '@odata.id'
ManagedBy:
- '@odata.id': '@odata.id'
- '@odata.id': '@odata.id'
Id: Id
MemorySummary:
Status: {}
TotalSystemPersistentMemoryGiB: 0.14658129805029452
TotalSystemMemoryGiB: 0.6027456183070403
UUID: UUID
'@Redfish.Copyright': '@Redfish.Copyright'
Processors:
'@odata.id': '@odata.id'
EthernetInterfaces:
'@odata.id': '@odata.id'
SimpleStorage:
'@odata.id': '@odata.id'
properties:
Id:
description: The name of the resource.
readOnly: true
type: string
Name:
description: The name of the resource.
readOnly: true
type: string
RedfishVersion:
description: redfish version
type: string
UUID:
pattern: ([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})
type: string
'@odata.type':
description: The type of a resource.
readOnly: true
type: string
'@odata.id':
description: The unique identifier for a resource.
format: uri-reference
readOnly: true
type: string
'@odata.context':
description: The OData description of a payload.
format: uri-reference
readOnly: true
type: string
'@Redfish.Copyright':
description: redfish copyright
type: string
Bios:
$ref: '#/components/schemas/idRef'
Processors:
$ref: '#/components/schemas/idRef'
Memory:
$ref: '#/components/schemas/idRef'
EthernetInterfaces:
$ref: '#/components/schemas/idRef'
SimpleStorage:
$ref: '#/components/schemas/idRef'
PowerState:
$ref: '#/components/schemas/PowerState'
Status:
$ref: '#/components/schemas/Status'
Boot:
$ref: '#/components/schemas/Boot'
ProcessorSummary:
$ref: '#/components/schemas/ProcessorSummary'
MemorySummary:
$ref: '#/components/schemas/MemorySummary'
IndicatorLED:
$ref: '#/components/schemas/IndicatorLED'
Links:
$ref: '#/components/schemas/Links'
Actions:
$ref: '#/components/schemas/ComputerSystem_Actions'
required:
- '@odata.id'
- '@odata.type'
- Name
type: object
RedfishError_error:
example:
'@Message.ExtendedInfo':
- MessageArgs:
- MessageArgs
- MessageArgs
Message: Message
RelatedProperties:
- RelatedProperties
- RelatedProperties
Severity: Severity
MessageId: MessageId
Resolution: Resolution
- MessageArgs:
- MessageArgs
- MessageArgs
Message: Message
RelatedProperties:
- RelatedProperties
- RelatedProperties
Severity: Severity
MessageId: MessageId
Resolution: Resolution
code: code
message: message
properties:
'@Message.ExtendedInfo':
items:
$ref: '#/components/schemas/Message'
type: array
code:
readOnly: true
type: string
message:
readOnly: true
type: string
required:
- code
- message
ComputerSystem_Actions:
example:
'#ComputerSystem.Reset':
ResetType@Redfish.AllowableValues:
- null
- null
target: target
properties:
'#ComputerSystem.Reset':
$ref: '#/components/schemas/ComputerSystemReset'

468
client/api_default.go Normal file
View File

@ -0,0 +1,468 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
import (
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
"fmt"
"strings"
)
// Linger please
var (
_ _context.Context
)
type DefaultApiService service
/*
DefaultApiService
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return Root
*/
func (a *DefaultApiService) GetRoot(ctx _context.Context) (Root, *_nethttp.Response, error) {
var (
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Root
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/redfish/v1"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
// 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
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v Root
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
DefaultApiService
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param systemId ID of resource
@return ComputerSystem
*/
func (a *DefaultApiService) GetSystem(ctx _context.Context, systemId string) (ComputerSystem, *_nethttp.Response, error) {
var (
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue ComputerSystem
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/redfish/v1/Systems/{systemId}"
localVarPath = strings.Replace(localVarPath, "{"+"systemId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", systemId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
// 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
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v ComputerSystem
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
DefaultApiService
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return Collection
*/
func (a *DefaultApiService) ListManagers(ctx _context.Context) (Collection, *_nethttp.Response, error) {
var (
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Collection
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/redfish/v1/Managers"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
// 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
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v Collection
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
DefaultApiService
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return Collection
*/
func (a *DefaultApiService) ListSystems(ctx _context.Context) (Collection, *_nethttp.Response, error) {
var (
localVarHttpMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Collection
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/redfish/v1/Systems"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
// 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
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v Collection
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
DefaultApiService
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param computerSystemId
* @param resetRequestBody
@return RedfishError
*/
func (a *DefaultApiService) ResetSystem(ctx _context.Context, computerSystemId string, resetRequestBody ResetRequestBody) (RedfishError, *_nethttp.Response, error) {
var (
localVarHttpMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue RedfishError
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/redfish/v1/Systems/{ComputerSystemId}/Actions/ComputerSystem.Reset"
localVarPath = strings.Replace(localVarPath, "{"+"ComputerSystemId"+"}", _neturl.QueryEscape(fmt.Sprintf("%v", computerSystemId)), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// 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 = &resetRequestBody
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v RedfishError
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
if localVarHttpResponse.StatusCode == 0 {
var v RedfishError
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}

499
client/client.go Normal file
View File

@ -0,0 +1,499 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
import (
"bytes"
"context"
"encoding/json"
"encoding/xml"
"errors"
"fmt"
"io"
"mime/multipart"
"net/http"
"net/url"
"os"
"path/filepath"
"reflect"
"regexp"
"strconv"
"strings"
"time"
"unicode/utf8"
"golang.org/x/oauth2"
)
var (
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
)
// APIClient manages communication with the Redfish OAPI specification API v0.0.1
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *Configuration
common service // Reuse a single struct instead of allocating one for each service on the heap.
// API Services
DefaultApi *DefaultApiService
}
type service struct {
client *APIClient
}
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
// optionally a custom http.Client to allow for advanced features such as caching.
func NewAPIClient(cfg *Configuration) *APIClient {
if cfg.HTTPClient == nil {
cfg.HTTPClient = http.DefaultClient
}
c := &APIClient{}
c.cfg = cfg
c.common.client = c
// API Services
c.DefaultApi = (*DefaultApiService)(&c.common)
return c
}
func atoi(in string) (int, error) {
return strconv.Atoi(in)
}
// selectHeaderContentType select a content type from the available list.
func selectHeaderContentType(contentTypes []string) string {
if len(contentTypes) == 0 {
return ""
}
if contains(contentTypes, "application/json") {
return "application/json"
}
return contentTypes[0] // use the first content type specified in 'consumes'
}
// selectHeaderAccept join all accept types and return
func selectHeaderAccept(accepts []string) string {
if len(accepts) == 0 {
return ""
}
if contains(accepts, "application/json") {
return "application/json"
}
return strings.Join(accepts, ",")
}
// contains is a case insenstive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
return true
}
}
return false
}
// Verify optional parameters are of the correct type.
func typeCheckParameter(obj interface{}, expected string, name string) error {
// Make sure there is an object.
if obj == nil {
return nil
}
// Check the type is as expected.
if reflect.TypeOf(obj).String() != expected {
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
}
return nil
}
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
func parameterToString(obj interface{}, collectionFormat string) string {
var delimiter string
switch collectionFormat {
case "pipes":
delimiter = "|"
case "ssv":
delimiter = " "
case "tsv":
delimiter = "\t"
case "csv":
delimiter = ","
}
if reflect.TypeOf(obj).Kind() == reflect.Slice {
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
} else if t, ok := obj.(time.Time); ok {
return t.Format(time.RFC3339)
}
return fmt.Sprintf("%v", obj)
}
// helper for converting interface{} parameters to json strings
func parameterToJson(obj interface{}) (string, error) {
jsonBuf, err := json.Marshal(obj)
if err != nil {
return "", err
}
return string(jsonBuf), err
}
// callAPI do the request.
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
return c.cfg.HTTPClient.Do(request)
}
// Change base path to allow switching to mocks
func (c *APIClient) ChangeBasePath(path string) {
c.cfg.BasePath = path
}
// prepareRequest build the request
func (c *APIClient) prepareRequest(
ctx context.Context,
path string, method string,
postBody interface{},
headerParams map[string]string,
queryParams url.Values,
formParams url.Values,
formFileName string,
fileName string,
fileBytes []byte) (localVarRequest *http.Request, err error) {
var body *bytes.Buffer
// Detect postBody type and post.
if postBody != nil {
contentType := headerParams["Content-Type"]
if contentType == "" {
contentType = detectContentType(postBody)
headerParams["Content-Type"] = contentType
}
body, err = setBody(postBody, contentType)
if err != nil {
return nil, err
}
}
// add form parameters and file if available.
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
if body != nil {
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
}
body = &bytes.Buffer{}
w := multipart.NewWriter(body)
for k, v := range formParams {
for _, iv := range v {
if strings.HasPrefix(k, "@") { // file
err = addFile(w, k[1:], iv)
if err != nil {
return nil, err
}
} else { // form value
w.WriteField(k, iv)
}
}
}
if len(fileBytes) > 0 && fileName != "" {
w.Boundary()
//_, fileNm := filepath.Split(fileName)
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
if err != nil {
return nil, err
}
_, err = part.Write(fileBytes)
if err != nil {
return nil, err
}
}
// Set the Boundary in the Content-Type
headerParams["Content-Type"] = w.FormDataContentType()
// Set Content-Length
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
w.Close()
}
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
if body != nil {
return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
}
body = &bytes.Buffer{}
body.WriteString(formParams.Encode())
// Set Content-Length
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
}
// Setup path and query parameters
url, err := url.Parse(path)
if err != nil {
return nil, err
}
// Override request host, if applicable
if c.cfg.Host != "" {
url.Host = c.cfg.Host
}
// Override request scheme, if applicable
if c.cfg.Scheme != "" {
url.Scheme = c.cfg.Scheme
}
// Adding Query Param
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
query.Add(k, iv)
}
}
// Encode the parameters.
url.RawQuery = query.Encode()
// Generate a new request
if body != nil {
localVarRequest, err = http.NewRequest(method, url.String(), body)
} else {
localVarRequest, err = http.NewRequest(method, url.String(), nil)
}
if err != nil {
return nil, err
}
// add header parameters, if any
if len(headerParams) > 0 {
headers := http.Header{}
for h, v := range headerParams {
headers.Set(h, v)
}
localVarRequest.Header = headers
}
// Add the user agent to the request.
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
if ctx != nil {
// add context to the request
localVarRequest = localVarRequest.WithContext(ctx)
// Walk through any authentication.
// OAuth2 authentication
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
// We were able to grab an oauth2 token from the context
var latestToken *oauth2.Token
if latestToken, err = tok.Token(); err != nil {
return nil, err
}
latestToken.SetAuthHeader(localVarRequest)
}
// Basic HTTP Authentication
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
}
// AccessToken Authentication
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
}
}
for header, value := range c.cfg.DefaultHeader {
localVarRequest.Header.Add(header, value)
}
return localVarRequest, nil
}
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
if s, ok := v.(*string); ok {
*s = string(b)
return nil
}
if xmlCheck.MatchString(contentType) {
if err = xml.Unmarshal(b, v); err != nil {
return err
}
return nil
}
if jsonCheck.MatchString(contentType) {
if err = json.Unmarshal(b, v); err != nil {
return err
}
return nil
}
return errors.New("undefined response type")
}
// Add a file to the multipart request
func addFile(w *multipart.Writer, fieldName, path string) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
if err != nil {
return err
}
_, err = io.Copy(part, file)
return err
}
// Prevent trying to import "fmt"
func reportError(format string, a ...interface{}) error {
return fmt.Errorf(format, a...)
}
// Set request body from an interface{}
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
if bodyBuf == nil {
bodyBuf = &bytes.Buffer{}
}
if reader, ok := body.(io.Reader); ok {
_, err = bodyBuf.ReadFrom(reader)
} else if b, ok := body.([]byte); ok {
_, err = bodyBuf.Write(b)
} else if s, ok := body.(string); ok {
_, err = bodyBuf.WriteString(s)
} else if s, ok := body.(*string); ok {
_, err = bodyBuf.WriteString(*s)
} else if jsonCheck.MatchString(contentType) {
err = json.NewEncoder(bodyBuf).Encode(body)
} else if xmlCheck.MatchString(contentType) {
err = xml.NewEncoder(bodyBuf).Encode(body)
}
if err != nil {
return nil, err
}
if bodyBuf.Len() == 0 {
err = fmt.Errorf("Invalid body type %s\n", contentType)
return nil, err
}
return bodyBuf, nil
}
// detectContentType method is used to figure out `Request.Body` content type for request header
func detectContentType(body interface{}) string {
contentType := "text/plain; charset=utf-8"
kind := reflect.TypeOf(body).Kind()
switch kind {
case reflect.Struct, reflect.Map, reflect.Ptr:
contentType = "application/json; charset=utf-8"
case reflect.String:
contentType = "text/plain; charset=utf-8"
default:
if b, ok := body.([]byte); ok {
contentType = http.DetectContentType(b)
} else if kind == reflect.Slice {
contentType = "application/json; charset=utf-8"
}
}
return contentType
}
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
type cacheControl map[string]string
func parseCacheControl(headers http.Header) cacheControl {
cc := cacheControl{}
ccHeader := headers.Get("Cache-Control")
for _, part := range strings.Split(ccHeader, ",") {
part = strings.Trim(part, " ")
if part == "" {
continue
}
if strings.ContainsRune(part, '=') {
keyval := strings.Split(part, "=")
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
} else {
cc[part] = ""
}
}
return cc
}
// CacheExpires helper function to determine remaining time before repeating a request.
func CacheExpires(r *http.Response) time.Time {
// Figure out when the cache expires.
var expires time.Time
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
if err != nil {
return time.Now()
}
respCacheControl := parseCacheControl(r.Header)
if maxAge, ok := respCacheControl["max-age"]; ok {
lifetime, err := time.ParseDuration(maxAge + "s")
if err != nil {
expires = now
} else {
expires = now.Add(lifetime)
}
} else {
expiresHeader := r.Header.Get("Expires")
if expiresHeader != "" {
expires, err = time.Parse(time.RFC1123, expiresHeader)
if err != nil {
expires = now
}
}
}
return expires
}
func strlen(s string) int {
return utf8.RuneCountInString(s)
}
// GenericOpenAPIError Provides access to the body, error and model on returned errors.
type GenericOpenAPIError struct {
body []byte
error string
model interface{}
}
// Error returns non-empty string if there was an error.
func (e GenericOpenAPIError) Error() string {
return e.error
}
// Body returns the raw bytes of the response
func (e GenericOpenAPIError) Body() []byte {
return e.body
}
// Model returns the unpacked model of the error
func (e GenericOpenAPIError) Model() interface{} {
return e.model
}

72
client/configuration.go Normal file
View File

@ -0,0 +1,72 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
import (
"net/http"
)
// contextKeys are used to identify the type of value in the context.
// Since these are string, it is possible to get a short description of the
// context key for logging and debugging using key.String().
type contextKey string
func (c contextKey) String() string {
return "auth " + string(c)
}
var (
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")
// ContextBasicAuth takes BasicAuth as authentication for the request.
ContextBasicAuth = contextKey("basic")
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAccessToken = contextKey("accesstoken")
// ContextAPIKey takes an APIKey as authentication for the request
ContextAPIKey = contextKey("apikey")
)
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type BasicAuth struct {
UserName string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
}
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIKey struct {
Key string
Prefix string
}
type Configuration struct {
BasePath string `json:"basePath,omitempty"`
Host string `json:"host,omitempty"`
Scheme string `json:"scheme,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
HTTPClient *http.Client
}
func NewConfiguration() *Configuration {
cfg := &Configuration{
BasePath: "http://localhost",
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
}
return cfg
}
func (c *Configuration) AddDefaultHeader(key string, value string) {
c.DefaultHeader[key] = value
}

13
client/docs/Boot.md Normal file
View File

@ -0,0 +1,13 @@
# Boot
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**BootSourceOverrideEnabled** | [**BootSourceOverrideEnabled**](BootSourceOverrideEnabled.md) | | [optional]
**BootSourceOverrideTarget** | [**BootSource**](BootSource.md) | | [optional]
**BootSourceOverrideTargetRedfishAllowableValues** | [**[]BootSource**](BootSource.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10
client/docs/BootSource.md Normal file
View File

@ -0,0 +1,10 @@
# BootSource
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[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,10 @@
# BootSourceOverrideEnabled
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

19
client/docs/Collection.md Normal file
View File

@ -0,0 +1,19 @@
# Collection
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**OdataContext** | **string** | context | [optional]
**OdataEtag** | **string** | etag | [optional]
**OdataId** | **string** | id |
**OdataType** | **string** | type |
**Description** | **string** | description | [optional]
**Members** | [**[]IdRef**](idRef.md) | Contains the members of this collection. |
**MembersodataCount** | **int32** | The number of items in a collection. | [optional]
**MembersodataNextLink** | **string** | The URI to the resource containing the next set of partial members. | [optional]
**Name** | **string** | The name of the resource. |
[[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,31 @@
# ComputerSystem
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **string** | The name of the resource. | [optional]
**Name** | **string** | The name of the resource. |
**RedfishVersion** | **string** | redfish version | [optional]
**UUID** | **string** | | [optional]
**OdataType** | **string** | The type of a resource. |
**OdataId** | **string** | The unique identifier for a resource. |
**OdataContext** | **string** | The OData description of a payload. | [optional]
**RedfishCopyright** | **string** | redfish copyright | [optional]
**Bios** | [**IdRef**](idRef.md) | | [optional]
**Processors** | [**IdRef**](idRef.md) | | [optional]
**Memory** | [**IdRef**](idRef.md) | | [optional]
**EthernetInterfaces** | [**IdRef**](idRef.md) | | [optional]
**SimpleStorage** | [**IdRef**](idRef.md) | | [optional]
**PowerState** | [**PowerState**](PowerState.md) | | [optional]
**Status** | [**Status**](Status.md) | | [optional]
**Boot** | [**Boot**](Boot.md) | | [optional]
**ProcessorSummary** | [**ProcessorSummary**](ProcessorSummary.md) | | [optional]
**MemorySummary** | [**MemorySummary**](MemorySummary.md) | | [optional]
**IndicatorLED** | [**IndicatorLed**](IndicatorLED.md) | | [optional]
**Links** | [**Links**](Links.md) | | [optional]
**Actions** | [**ComputerSystemActions**](ComputerSystem_Actions.md) | | [optional]
[[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 @@
# ComputerSystemActions
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ComputerSystemReset** | [**ComputerSystemReset**](ComputerSystemReset.md) | | [optional]
[[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,12 @@
# ComputerSystemReset
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Target** | **string** | The unique identifier for a resource. | [optional]
**ResetTypeRedfishAllowableValues** | [**[]ResetType**](ResetType.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

157
client/docs/DefaultApi.md Normal file
View File

@ -0,0 +1,157 @@
# \DefaultApi
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**GetRoot**](DefaultApi.md#GetRoot) | **Get** /redfish/v1 |
[**GetSystem**](DefaultApi.md#GetSystem) | **Get** /redfish/v1/Systems/{systemId} |
[**ListManagers**](DefaultApi.md#ListManagers) | **Get** /redfish/v1/Managers |
[**ListSystems**](DefaultApi.md#ListSystems) | **Get** /redfish/v1/Systems |
[**ResetSystem**](DefaultApi.md#ResetSystem) | **Post** /redfish/v1/Systems/{ComputerSystemId}/Actions/ComputerSystem.Reset |
## GetRoot
> Root GetRoot(ctx, )
### Required Parameters
This endpoint does not need any parameter.
### Return type
[**Root**](Root.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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)
## GetSystem
> ComputerSystem GetSystem(ctx, systemId)
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**systemId** | **string**| ID of resource |
### Return type
[**ComputerSystem**](ComputerSystem.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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)
## ListManagers
> Collection ListManagers(ctx, )
### Required Parameters
This endpoint does not need any parameter.
### Return type
[**Collection**](Collection.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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)
## ListSystems
> Collection ListSystems(ctx, )
### Required Parameters
This endpoint does not need any parameter.
### Return type
[**Collection**](Collection.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **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)
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**computerSystemId** | **string**| |
**resetRequestBody** | [**ResetRequestBody**](ResetRequestBody.md)| |
### Return type
[**RedfishError**](RedfishError.md)
### 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)

10
client/docs/Health.md Normal file
View File

@ -0,0 +1,10 @@
# Health
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

11
client/docs/IdRef.md Normal file
View File

@ -0,0 +1,11 @@
# IdRef
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**OdataId** | **string** | The unique identifier for a resource. | [optional]
[[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,10 @@
# IndicatorLed
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

12
client/docs/Links.md Normal file
View File

@ -0,0 +1,12 @@
# Links
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Chassis** | [**[]IdRef**](idRef.md) | | [optional]
**ManagedBy** | [**[]IdRef**](idRef.md) | | [optional]
[[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,13 @@
# MemorySummary
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**TotalSystemMemoryGiB** | **float32** | | [optional]
**TotalSystemPersistentMemoryGiB** | **float32** | | [optional]
**Status** | [**Status**](Status.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

16
client/docs/Message.md Normal file
View File

@ -0,0 +1,16 @@
# Message
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Message** | **string** | | [optional]
**MessageArgs** | **[]string** | | [optional]
**MessageId** | **string** | |
**RelatedProperties** | **[]string** | | [optional]
**Resolution** | **string** | | [optional]
**Severity** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10
client/docs/PowerState.md Normal file
View File

@ -0,0 +1,10 @@
# PowerState
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[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,12 @@
# ProcessorSummary
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Count** | **int32** | | [optional]
**Status** | [**Status**](Status.md) | | [optional]
[[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 @@
# RedfishError
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Error** | [**RedfishErrorError**](RedfishError_error.md) | |
[[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,13 @@
# RedfishErrorError
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MessageExtendedInfo** | [**[]Message**](Message.md) | | [optional]
**Code** | **string** | |
**Message** | **string** | |
[[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 @@
# ResetRequestBody
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ResetType** | [**ResetType**](ResetType.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10
client/docs/ResetType.md Normal file
View File

@ -0,0 +1,10 @@
# ResetType
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

19
client/docs/Root.md Normal file
View File

@ -0,0 +1,19 @@
# Root
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **string** | The name of the resource. | [optional]
**Name** | **string** | The name of the resource. |
**RedfishVersion** | **string** | redfish version | [optional]
**UUID** | **string** | | [optional]
**OdataType** | **string** | The type of a resource. |
**OdataId** | **string** | The unique identifier for a resource. |
**RedfishCopyright** | **string** | redfish copyright | [optional]
**Systems** | [**IdRef**](idRef.md) | | [optional]
**Managers** | [**IdRef**](idRef.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10
client/docs/State.md Normal file
View File

@ -0,0 +1,10 @@
# State
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

13
client/docs/Status.md Normal file
View File

@ -0,0 +1,13 @@
# Status
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Health** | [**Health**](Health.md) | | [optional]
**HealthRollup** | [**Health**](Health.md) | | [optional]
**State** | [**State**](State.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

52
client/git_push.sh Normal file
View File

@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

6
client/go.mod Normal file
View File

@ -0,0 +1,6 @@
module github.com/GIT_USER_ID/GIT_REPO_ID
require (
github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a
)

11
client/go.sum Normal file
View File

@ -0,0 +1,11 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=

16
client/model_boot.go Normal file
View File

@ -0,0 +1,16 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type Boot struct {
BootSourceOverrideEnabled BootSourceOverrideEnabled `json:"BootSourceOverrideEnabled,omitempty"`
BootSourceOverrideTarget BootSource `json:"BootSourceOverrideTarget,omitempty"`
BootSourceOverrideTargetRedfishAllowableValues []BootSource `json:"BootSourceOverrideTarget@Redfish.AllowableValues,omitempty"`
}

View File

@ -0,0 +1,30 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type BootSource string
// List of BootSource
const (
NONE BootSource = "None"
PXE BootSource = "Pxe"
FLOPPY BootSource = "Floppy"
CD BootSource = "Cd"
USB BootSource = "Usb"
HDD BootSource = "Hdd"
BIOS_SETUP BootSource = "BiosSetup"
UTILITIES BootSource = "Utilities"
DIAGS BootSource = "Diags"
UEFI_SHELL BootSource = "UefiShell"
UEFI_TARGET BootSource = "UefiTarget"
SD_CARD BootSource = "SDCard"
UEFI_HTTP BootSource = "UefiHttp"
REMOTE_DRIVE BootSource = "RemoteDrive"
UEFI_BOOT_NEXT BootSource = "UefiBootNext"
)

View File

@ -0,0 +1,17 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type BootSourceOverrideEnabled string
// List of BootSourceOverrideEnabled
const (
ONCE BootSourceOverrideEnabled = "Once"
CONTINUOUS BootSourceOverrideEnabled = "Continuous"
)

View File

@ -0,0 +1,32 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// A Collection of ComputerSystem resource instances.
type Collection struct {
// context
OdataContext string `json:"@odata.context,omitempty"`
// etag
OdataEtag string `json:"@odata.etag,omitempty"`
// id
OdataId string `json:"@odata.id"`
// type
OdataType string `json:"@odata.type"`
// description
Description string `json:"Description,omitempty"`
// Contains the members of this collection.
Members []IdRef `json:"Members"`
// The number of items in a collection.
MembersodataCount int32 `json:"Members@odata.count,omitempty"`
// The URI to the resource containing the next set of partial members.
MembersodataNextLink string `json:"Members@odata.nextLink,omitempty"`
// The name of the resource.
Name string `json:"Name"`
}

View File

@ -0,0 +1,42 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// Root redfish path.
type ComputerSystem struct {
// The name of the resource.
Id string `json:"Id,omitempty"`
// The name of the resource.
Name string `json:"Name"`
// redfish version
RedfishVersion string `json:"RedfishVersion,omitempty"`
UUID string `json:"UUID,omitempty"`
// The type of a resource.
OdataType string `json:"@odata.type"`
// The unique identifier for a resource.
OdataId string `json:"@odata.id"`
// The OData description of a payload.
OdataContext string `json:"@odata.context,omitempty"`
// redfish copyright
RedfishCopyright string `json:"@Redfish.Copyright,omitempty"`
Bios IdRef `json:"Bios,omitempty"`
Processors IdRef `json:"Processors,omitempty"`
Memory IdRef `json:"Memory,omitempty"`
EthernetInterfaces IdRef `json:"EthernetInterfaces,omitempty"`
SimpleStorage IdRef `json:"SimpleStorage,omitempty"`
PowerState PowerState `json:"PowerState,omitempty"`
Status Status `json:"Status,omitempty"`
Boot Boot `json:"Boot,omitempty"`
ProcessorSummary ProcessorSummary `json:"ProcessorSummary,omitempty"`
MemorySummary MemorySummary `json:"MemorySummary,omitempty"`
IndicatorLED IndicatorLed `json:"IndicatorLED,omitempty"`
Links Links `json:"Links,omitempty"`
Actions ComputerSystemActions `json:"Actions,omitempty"`
}

View File

@ -0,0 +1,14 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type ComputerSystemActions struct {
ComputerSystemReset ComputerSystemReset `json:"#ComputerSystem.Reset,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type ComputerSystemReset struct {
// The unique identifier for a resource.
Target string `json:"target,omitempty"`
ResetTypeRedfishAllowableValues []ResetType `json:"ResetType@Redfish.AllowableValues,omitempty"`
}

18
client/model_health.go Normal file
View File

@ -0,0 +1,18 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type Health string
// List of Health
const (
OK Health = "OK"
WARNING Health = "Warning"
CRITICAL Health = "Critical"
)

16
client/model_id_ref.go Normal file
View File

@ -0,0 +1,16 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// A reference to a resource.
type IdRef struct {
// The unique identifier for a resource.
OdataId string `json:"@odata.id,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type IndicatorLed string
// List of IndicatorLED
const (
UNKNOWN IndicatorLed = "Unknown"
LIT IndicatorLed = "Lit"
BLINKING IndicatorLed = "Blinking"
OFF IndicatorLed = "Off"
)

15
client/model_links.go Normal file
View File

@ -0,0 +1,15 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type Links struct {
Chassis []IdRef `json:"Chassis,omitempty"`
ManagedBy []IdRef `json:"ManagedBy,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type MemorySummary struct {
TotalSystemMemoryGiB float32 `json:"TotalSystemMemoryGiB,omitempty"`
TotalSystemPersistentMemoryGiB float32 `json:"TotalSystemPersistentMemoryGiB,omitempty"`
Status Status `json:"Status,omitempty"`
}

19
client/model_message.go Normal file
View File

@ -0,0 +1,19 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type Message struct {
Message string `json:"Message,omitempty"`
MessageArgs []string `json:"MessageArgs,omitempty"`
MessageId string `json:"MessageId"`
RelatedProperties []string `json:"RelatedProperties,omitempty"`
Resolution string `json:"Resolution,omitempty"`
Severity string `json:"Severity,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type PowerState string
// List of PowerState
const (
TRUE PowerState = "true"
FALSE PowerState = "false"
POWERING_ON PowerState = "PoweringOn"
POWERING_OFF PowerState = "PoweringOff"
)

View File

@ -0,0 +1,15 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type ProcessorSummary struct {
Count int32 `json:"Count,omitempty"`
Status Status `json:"Status,omitempty"`
}

View File

@ -0,0 +1,15 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// Contains an error payload from a Redfish Service.
type RedfishError struct {
Error RedfishErrorError `json:"error"`
}

View File

@ -0,0 +1,16 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type RedfishErrorError struct {
MessageExtendedInfo []Message `json:"@Message.ExtendedInfo,omitempty"`
Code string `json:"code"`
Message string `json:"message"`
}

View File

@ -0,0 +1,14 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type ResetRequestBody struct {
ResetType ResetType `json:"ResetType,omitempty"`
}

View File

@ -0,0 +1,24 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type ResetType string
// List of ResetType
const (
ON ResetType = "On"
FORCE_OFF ResetType = "ForceOff"
GRACEFUL_SHUTDOWN ResetType = "GracefulShutdown"
GRACEFUL_RESTART ResetType = "GracefulRestart"
FORCE_RESTART ResetType = "ForceRestart"
NMI ResetType = "Nmi"
FORCE_ON ResetType = "ForceOn"
PUSH_POWER_BUTTON ResetType = "PushPowerButton"
POWER_CYCLE ResetType = "PowerCycle"
)

29
client/model_root.go Normal file
View File

@ -0,0 +1,29 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// Root redfish path.
type Root struct {
// The name of the resource.
Id string `json:"Id,omitempty"`
// The name of the resource.
Name string `json:"Name"`
// redfish version
RedfishVersion string `json:"RedfishVersion,omitempty"`
UUID string `json:"UUID,omitempty"`
// The type of a resource.
OdataType string `json:"@odata.type"`
// The unique identifier for a resource.
OdataId string `json:"@odata.id"`
// redfish copyright
RedfishCopyright string `json:"@Redfish.Copyright,omitempty"`
Systems IdRef `json:"Systems,omitempty"`
Managers IdRef `json:"Managers,omitempty"`
}

26
client/model_state.go Normal file
View File

@ -0,0 +1,26 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type State string
// List of State
const (
ENABLED State = "Enabled"
DISABLED State = "Disabled"
STANDBY_OFFLINE State = "StandbyOffline"
STANDBY_SPARE State = "StandbySpare"
IN_TEST State = "InTest"
STARTING State = "Starting"
ABSENT State = "Absent"
UNAVAILABLE_OFFLINE State = "UnavailableOffline"
DEFERRING State = "Deferring"
QUIESCED State = "Quiesced"
UPDATING State = "Updating"
)

16
client/model_status.go Normal file
View File

@ -0,0 +1,16 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type Status struct {
Health Health `json:"Health,omitempty"`
HealthRollup Health `json:"HealthRollup,omitempty"`
State State `json:"State,omitempty"`
}

43
client/response.go Normal file
View File

@ -0,0 +1,43 @@
/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
import (
"net/http"
)
type APIResponse struct {
*http.Response `json:"-"`
Message string `json:"message,omitempty"`
// Operation is the name of the OpenAPI operation.
Operation string `json:"operation,omitempty"`
// RequestURL is the request URL. This value is always available, even if the
// embedded *http.Response is nil.
RequestURL string `json:"url,omitempty"`
// Method is the HTTP method used for the request. This value is always
// available, even if the embedded *http.Response is nil.
Method string `json:"method,omitempty"`
// Payload holds the contents of the response body (which may be nil or empty).
// This is provided here as the raw response.Body() reader will have already
// been drained.
Payload []byte `json:"-"`
}
func NewAPIResponse(r *http.Response) *APIResponse {
response := &APIResponse{Response: r}
return response
}
func NewAPIResponseWithError(errorMessage string) *APIResponse {
response := &APIResponse{Message: errorMessage}
return response
}

458
spec/openapi.yaml Normal file
View File

@ -0,0 +1,458 @@
openapi: 3.0.2
info:
title: Redfish OAPI specification
description: 'Partial Redfish OAPI specification for a limited client'
version: 0.0.1
components:
schemas:
BootSource:
type: string
enum:
- None
- Pxe
- Floppy
- Cd
- Usb
- Hdd
- BiosSetup
- Utilities
- Diags
- UefiShell
- UefiTarget
- SDCard
- UefiHttp
- RemoteDrive
- UefiBootNext
BootSourceOverrideEnabled:
type: string
enum:
- Once
- Continuous
State:
type: string
enum:
- Enabled
- Disabled
- StandbyOffline
- StandbySpare
- InTest
- Starting
- Absent
- UnavailableOffline
- Deferring
- Quiesced
- Updating
Health:
type: string
enum:
- OK
- Warning
- Critical
PowerState:
type: string
enum:
- On
- Off
- PoweringOn
- PoweringOff
ResetType:
type: string
enum:
- "On"
- ForceOff
- GracefulShutdown
- GracefulRestart
- ForceRestart
- Nmi
- ForceOn
- PushPowerButton
- PowerCycle
IndicatorLED:
type: string
enum:
- Unknown
- Lit
- Blinking
- "Off"
context:
description: The OData description of a payload.
format: uri-reference
readOnly: true
type: string
count:
description: The number of items in a collection.
readOnly: true
type: integer
name:
description: The name of the resource.
readOnly: true
type: string
etag:
description: The current ETag of the resource.
readOnly: true
type: string
id:
description: The name of the resource.
readOnly: true
type: string
odataId:
description: The unique identifier for a resource.
format: uri-reference
readOnly: true
type: string
idRef:
additionalProperties: false
description: A reference to a resource.
properties:
'@odata.id':
$ref: '#/components/schemas/odataId'
type: object
nextLink:
description: The URI to the resource containing the next set of partial members.
format: uri-reference
readOnly: true
type: string
rtype:
description: The type of a resource.
readOnly: true
type: string
UUID:
pattern: ([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})
type: string
Message:
additionalProperties: false
properties:
Message:
readOnly: true
type: string
MessageArgs:
items:
type: string
readOnly: true
type: array
MessageId:
readOnly: true
type: string
RelatedProperties:
items:
type: string
readOnly: true
type: array
Resolution:
readOnly: true
type: string
Severity:
readOnly: true
type: string
required:
- MessageId
type: object
RedfishError:
description: Contains an error payload from a Redfish Service.
properties:
error:
properties:
'@Message.ExtendedInfo':
items:
$ref: '#/components/schemas/Message'
type: array
code:
readOnly: true
type: string
message:
readOnly: true
type: string
required:
- code
- message
type: object
required:
- error
type: object
Root:
type: object
additionalProperties: false
description: Root redfish path.
required:
- '@odata.id'
- '@odata.type'
- 'Name'
properties:
'Id':
$ref: '#/components/schemas/id'
'Name':
$ref: '#/components/schemas/name'
'RedfishVersion':
type: string
description: redfish version
'UUID':
$ref: '#/components/schemas/UUID'
'@odata.type':
$ref: '#/components/schemas/rtype'
'@odata.id':
$ref: '#/components/schemas/odataId'
'@Redfish.Copyright':
type: string
description: redfish copyright
'Systems':
$ref: '#/components/schemas/idRef'
'Managers':
$ref: '#/components/schemas/idRef'
Collection:
type: object
additionalProperties: false
description: A Collection of ComputerSystem resource instances.
required:
- 'Members'
- '@odata.id'
- '@odata.type'
- 'Name'
properties:
'@odata.context':
type: string
description: context
'@odata.etag':
type: string
description: etag
'@odata.id':
type: string
description: id
'@odata.type':
type: string
description: type
'Description':
type: string
description: "description"
#nullable: true
readOnly: true
'Members':
description: Contains the members of this collection.
items:
$ref: '#/components/schemas/idRef'
readOnly: true
type: array
'Members@odata.count':
$ref: '#/components/schemas/count'
'Members@odata.nextLink':
$ref: '#/components/schemas/nextLink'
'Name':
$ref: '#/components/schemas/name'
readOnly: true
Status:
type: object
additionalProperties: false
properties:
Health:
$ref: '#/components/schemas/Health'
#nullable: true
readOnly: true
HealthRollup:
$ref: '#/components/schemas/Health'
#nullable: true
readOnly: true
State:
$ref: '#/components/schemas/State'
#nullable: true
readOnly: true
Boot:
type: object
additionalProperties: false
properties:
BootSourceOverrideEnabled:
$ref: '#/components/schemas/BootSourceOverrideEnabled'
BootSourceOverrideTarget:
$ref: '#/components/schemas/BootSource'
BootSourceOverrideTarget@Redfish.AllowableValues:
type: array
items:
$ref: '#/components/schemas/BootSource'
ProcessorSummary:
type: object
additionalProperties: false
properties:
Count:
minimum: 0
#nullable: true
readOnly: true
type: integer
Status:
$ref: '#/components/schemas/Status'
MemorySummary:
type: object
additionalProperties: false
properties:
TotalSystemMemoryGiB:
minimum: 0
#nullable: true
readOnly: true
type: number
TotalSystemPersistentMemoryGiB:
minimum: 0
#nullable: true
readOnly: true
type: number
Status:
$ref: '#/components/schemas/Status'
Links:
type: object
additionalProperties: false
properties:
Chassis:
type: array
items:
$ref: '#/components/schemas/idRef'
ManagedBy:
type: array
items:
$ref: '#/components/schemas/idRef'
ComputerSystemReset:
type: object
additionalProperties: false
properties:
target:
$ref: '#/components/schemas/odataId'
ResetType@Redfish.AllowableValues:
type: array
items:
$ref: '#/components/schemas/ResetType'
ResetRequestBody:
additionalProperties: false
properties:
ResetType:
$ref: '#/components/schemas/ResetType'
type: object
ComputerSystem:
type: object
additionalProperties: false
description: Root redfish path.
required:
- '@odata.id'
- '@odata.type'
- 'Name'
properties:
'Id':
$ref: '#/components/schemas/id'
'Name':
$ref: '#/components/schemas/name'
'RedfishVersion':
type: string
description: redfish version
'UUID':
$ref: '#/components/schemas/UUID'
'@odata.type':
$ref: '#/components/schemas/rtype'
'@odata.id':
$ref: '#/components/schemas/odataId'
'@odata.context':
$ref: '#/components/schemas/context'
'@Redfish.Copyright':
type: string
description: redfish copyright
'Bios':
$ref: '#/components/schemas/idRef'
'Processors':
$ref: '#/components/schemas/idRef'
'Memory':
$ref: '#/components/schemas/idRef'
'EthernetInterfaces':
$ref: '#/components/schemas/idRef'
'SimpleStorage':
$ref: '#/components/schemas/idRef'
'PowerState':
$ref: '#/components/schemas/PowerState'
'Status':
$ref: '#/components/schemas/Status'
'Boot':
$ref: '#/components/schemas/Boot'
'ProcessorSummary':
$ref: '#/components/schemas/ProcessorSummary'
'MemorySummary':
$ref: '#/components/schemas/MemorySummary'
'IndicatorLED':
$ref: '#/components/schemas/IndicatorLED'
'Links':
$ref: '#/components/schemas/Links'
'Actions':
type: object
properties:
"#ComputerSystem.Reset":
$ref: '#/components/schemas/ComputerSystemReset'
paths:
/redfish/v1:
get:
operationId: get_root
responses:
'200':
description: Get redfish root
content:
'application/json':
schema:
$ref: '#/components/schemas/Root'
/redfish/v1/Systems:
get:
operationId: list_systems
responses:
'200':
description: Computer Systems List
content:
'application/json':
schema:
$ref: '#/components/schemas/Collection'
/redfish/v1/Systems/{systemId}:
get:
operationId: get_system
responses:
'200':
description: Computer Systems List
content:
'application/json':
schema:
$ref: '#/components/schemas/ComputerSystem'
parameters:
- name: systemId
in: path
description: ID of resource
required: true
schema:
type: string
/redfish/v1/Managers:
get:
operationId: list_managers
responses:
'200':
description: Managers List
content:
'application/json':
schema:
$ref: '#/components/schemas/Collection'
/redfish/v1/Systems/{ComputerSystemId}/Actions/ComputerSystem.Reset:
parameters:
- in: path
name: ComputerSystemId
required: true
schema:
type: string
post:
operationId: reset_system
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ResetRequestBody'
required: true
responses:
'200':
description: Success with response
content:
application/json:
schema:
$ref: '#/components/schemas/RedfishError'
'204':
description: Success, but no response data
default:
content:
application/json:
schema:
$ref: '#/components/schemas/RedfishError'
description: Error condition

8723
spec/openapi.yaml.redfish Normal file

File diff suppressed because it is too large Load Diff