diff --git a/api/mocks/RedfishAPI.go b/api/mocks/RedfishAPI.go index cb51be0..5ac2843 100644 --- a/api/mocks/RedfishAPI.go +++ b/api/mocks/RedfishAPI.go @@ -3,10 +3,10 @@ package mocks import ( - context "context" - client "opendev.org/airship/go-redfish/client" + context "context" + http "net/http" mock "github.com/stretchr/testify/mock" diff --git a/client/.openapi-generator/VERSION b/client/.openapi-generator/VERSION index 2582ddd..078bf8b 100644 --- a/client/.openapi-generator/VERSION +++ b/client/.openapi-generator/VERSION @@ -1 +1 @@ -4.1.1 \ No newline at end of file +4.2.2 \ No newline at end of file diff --git a/client/api/openapi.yaml b/client/api/openapi.yaml index ca7e105..e07699c 100644 --- a/client/api/openapi.yaml +++ b/client/api/openapi.yaml @@ -1156,7 +1156,7 @@ components: properties: '#ComputerSystem.Reset': $ref: '#/components/schemas/ComputerSystemReset' - VirtualMedia_Actions_VirtualMedia_EjectMedia: + VirtualMedia_Actions__VirtualMedia_EjectMedia: example: target: target properties: @@ -1173,6 +1173,6 @@ components: target: target properties: '#VirtualMedia.EjectMedia': - $ref: '#/components/schemas/VirtualMedia_Actions_VirtualMedia_EjectMedia' + $ref: '#/components/schemas/VirtualMedia_Actions__VirtualMedia_EjectMedia' '#VirtualMedia.InsertMedia': - $ref: '#/components/schemas/VirtualMedia_Actions_VirtualMedia_EjectMedia' + $ref: '#/components/schemas/VirtualMedia_Actions__VirtualMedia_EjectMedia' diff --git a/client/api_default.go b/client/api_default.go index a66b3af..0f19876 100644 --- a/client/api_default.go +++ b/client/api_default.go @@ -23,10 +23,11 @@ var ( _ _context.Context ) +// DefaultApiService DefaultApi service type DefaultApiService service /* -DefaultApiService +EjectVirtualMedia Method for EjectVirtualMedia * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param managerId ID of resource * @param virtualMediaId ID of resource @@ -35,7 +36,7 @@ DefaultApiService */ func (a *DefaultApiService) EjectVirtualMedia(ctx _context.Context, managerId string, virtualMediaId string, body map[string]interface{}) (RedfishError, *_nethttp.Response, error) { var ( - localVarHttpMethod = _nethttp.MethodPost + localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -53,89 +54,86 @@ func (a *DefaultApiService) EjectVirtualMedia(ctx _context.Context, managerId st localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHttpResponse.StatusCode == 0 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +GetManager Method for GetManager * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param managerId ID of resource @return Manager */ func (a *DefaultApiService) GetManager(ctx _context.Context, managerId string) (Manager, *_nethttp.Response, error) { var ( - localVarHttpMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -152,80 +150,77 @@ func (a *DefaultApiService) GetManager(ctx _context.Context, managerId string) ( localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{} + localVarHTTPContentTypes := []string{} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v Manager - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHttpResponse.StatusCode == 0 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +GetManagerVirtualMedia Method for GetManagerVirtualMedia * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param managerId ID of resource * @param virtualMediaId ID of resource @@ -233,7 +228,7 @@ DefaultApiService */ func (a *DefaultApiService) GetManagerVirtualMedia(ctx _context.Context, managerId string, virtualMediaId string) (VirtualMedia, *_nethttp.Response, error) { var ( - localVarHttpMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -251,86 +246,83 @@ func (a *DefaultApiService) GetManagerVirtualMedia(ctx _context.Context, manager localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{} + localVarHTTPContentTypes := []string{} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v VirtualMedia - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHttpResponse.StatusCode == 0 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +GetRoot Method for GetRoot * @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 + localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -346,77 +338,76 @@ func (a *DefaultApiService) GetRoot(ctx _context.Context) (Root, *_nethttp.Respo localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{} + localVarHTTPContentTypes := []string{} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v Root - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +GetSystem Method for GetSystem * @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 + localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -433,80 +424,77 @@ func (a *DefaultApiService) GetSystem(ctx _context.Context, systemId string) (Co localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{} + localVarHTTPContentTypes := []string{} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v ComputerSystem - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHttpResponse.StatusCode == 0 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +InsertVirtualMedia Method for InsertVirtualMedia * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param managerId ID of resource * @param virtualMediaId ID of resource @@ -515,7 +503,7 @@ DefaultApiService */ func (a *DefaultApiService) InsertVirtualMedia(ctx _context.Context, managerId string, virtualMediaId string, insertMediaRequestBody InsertMediaRequestBody) (RedfishError, *_nethttp.Response, error) { var ( - localVarHttpMethod = _nethttp.MethodPost + localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -533,89 +521,86 @@ func (a *DefaultApiService) InsertVirtualMedia(ctx _context.Context, managerId s localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params localVarPostBody = &insertMediaRequestBody - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHttpResponse.StatusCode == 0 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +ListManagerVirtualMedia Method for ListManagerVirtualMedia * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param managerId ID of resource @return Collection */ func (a *DefaultApiService) ListManagerVirtualMedia(ctx _context.Context, managerId string) (Collection, *_nethttp.Response, error) { var ( - localVarHttpMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -632,86 +617,83 @@ func (a *DefaultApiService) ListManagerVirtualMedia(ctx _context.Context, manage localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{} + localVarHTTPContentTypes := []string{} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v Collection - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHttpResponse.StatusCode == 0 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +ListManagers Method for ListManagers * @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 + localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -727,76 +709,75 @@ func (a *DefaultApiService) ListManagers(ctx _context.Context) (Collection, *_ne localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{} + localVarHTTPContentTypes := []string{} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v Collection - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +ListSystems Method for ListSystems * @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 + localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -812,70 +793,69 @@ func (a *DefaultApiService) ListSystems(ctx _context.Context) (Collection, *_net localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{} + localVarHTTPContentTypes := []string{} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v Collection - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +ResetSystem Method for ResetSystem * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param computerSystemId * @param resetRequestBody @@ -883,7 +863,7 @@ DefaultApiService */ func (a *DefaultApiService) ResetSystem(ctx _context.Context, computerSystemId string, resetRequestBody ResetRequestBody) (RedfishError, *_nethttp.Response, error) { var ( - localVarHttpMethod = _nethttp.MethodPost + localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -900,82 +880,79 @@ func (a *DefaultApiService) ResetSystem(ctx _context.Context, computerSystemId s localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + 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) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHttpResponse.StatusCode == 0 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } /* -DefaultApiService +SetSystem Method for SetSystem * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param systemId ID of resource * @param computerSystem @@ -983,7 +960,7 @@ DefaultApiService */ func (a *DefaultApiService) SetSystem(ctx _context.Context, systemId string, computerSystem ComputerSystem) (ComputerSystem, *_nethttp.Response, error) { var ( - localVarHttpMethod = _nethttp.MethodPatch + localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1000,76 +977,73 @@ func (a *DefaultApiService) SetSystem(ctx _context.Context, systemId string, com localVarFormParams := _neturl.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params localVarPostBody = &computerSystem - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + 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 + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHttpResponse, err + return localVarReturnValue, localVarHTTPResponse, err } - if localVarHttpResponse.StatusCode >= 300 { + if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, - error: localVarHttpResponse.Status, + error: localVarHTTPResponse.Status, } - if localVarHttpResponse.StatusCode == 200 { + if localVarHTTPResponse.StatusCode == 200 { var v ComputerSystem - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHttpResponse.StatusCode == 0 { var v RedfishError - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + 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, newErr } - return localVarReturnValue, localVarHttpResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil } diff --git a/client/client.go b/client/client.go index 44070c0..562490d 100644 --- a/client/client.go +++ b/client/client.go @@ -17,8 +17,10 @@ import ( "errors" "fmt" "io" + "log" "mime/multipart" "net/http" + "net/http/httputil" "net/url" "os" "path/filepath" @@ -157,14 +159,41 @@ func parameterToJson(obj interface{}) (string, error) { // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - return c.cfg.HTTPClient.Do(request) + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + + return resp, err } -// Change base path to allow switching to mocks +// ChangeBasePath changes base path to allow switching to mocks func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, @@ -329,6 +358,9 @@ func (c *APIClient) prepareRequest( } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } if s, ok := v.(*string); ok { *s = string(b) return nil diff --git a/client/configuration.go b/client/configuration.go index 9ba4d4e..9b29fff 100644 --- a/client/configuration.go +++ b/client/configuration.go @@ -49,24 +49,29 @@ type APIKey struct { Prefix string } +// Configuration stores the configuration of the API client 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"` + Debug bool `json:"debug,omitempty"` HTTPClient *http.Client } +// NewConfiguration returns a new Configuration object func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "http://localhost", DefaultHeader: make(map[string]string), UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, } return cfg } +// AddDefaultHeader adds a new HTTP header to the default header in the request func (c *Configuration) AddDefaultHeader(key string, value string) { c.DefaultHeader[key] = value } diff --git a/client/docs/Collection.md b/client/docs/Collection.md index e91b778..5bc223d 100644 --- a/client/docs/Collection.md +++ b/client/docs/Collection.md @@ -8,11 +8,11 @@ Name | Type | Description | Notes **OdataEtag** | **string** | etag | [optional] **OdataId** | **string** | id | **OdataType** | **string** | type | -**Description** | Pointer to **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. | +**Description** | Pointer to **string** | description | [optional] [readonly] +**Members** | [**[]IdRef**](idRef.md) | Contains the members of this collection. | [readonly] +**MembersodataCount** | **int32** | The number of items in a collection. | [optional] [readonly] +**MembersodataNextLink** | **string** | The URI to the resource containing the next set of partial members. | [optional] [readonly] +**Name** | **string** | The name of the resource. | [readonly] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/client/docs/ComputerSystem.md b/client/docs/ComputerSystem.md index 1527c9e..c3beb4f 100644 --- a/client/docs/ComputerSystem.md +++ b/client/docs/ComputerSystem.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **string** | The name of the resource. | [optional] -**Name** | **string** | The name of the resource. | +**Id** | **string** | The name of the resource. | [optional] [readonly] +**Name** | **string** | The name of the resource. | [readonly] **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] +**OdataType** | **string** | The type of a resource. | [readonly] +**OdataId** | **string** | The unique identifier for a resource. | [readonly] +**OdataContext** | **string** | The OData description of a payload. | [optional] [readonly] **RedfishCopyright** | **string** | redfish copyright | [optional] **Bios** | [**IdRef**](idRef.md) | | [optional] **Processors** | [**IdRef**](idRef.md) | | [optional] diff --git a/client/docs/ComputerSystemReset.md b/client/docs/ComputerSystemReset.md index e6d1127..80da261 100644 --- a/client/docs/ComputerSystemReset.md +++ b/client/docs/ComputerSystemReset.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Target** | **string** | The unique identifier for a resource. | [optional] +**Target** | **string** | The unique identifier for a resource. | [optional] [readonly] **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) diff --git a/client/docs/DefaultApi.md b/client/docs/DefaultApi.md index a83b18b..6a1d3dc 100644 --- a/client/docs/DefaultApi.md +++ b/client/docs/DefaultApi.md @@ -23,6 +23,7 @@ Method | HTTP request | Description > RedfishError EjectVirtualMedia(ctx, managerId, virtualMediaId, body) + ### Required Parameters @@ -56,6 +57,7 @@ No authorization required > Manager GetManager(ctx, managerId) + ### Required Parameters @@ -87,6 +89,7 @@ No authorization required > VirtualMedia GetManagerVirtualMedia(ctx, managerId, virtualMediaId) + ### Required Parameters @@ -119,6 +122,7 @@ No authorization required > Root GetRoot(ctx, ) + ### Required Parameters This endpoint does not need any parameter. @@ -146,6 +150,7 @@ No authorization required > ComputerSystem GetSystem(ctx, systemId) + ### Required Parameters @@ -177,6 +182,7 @@ No authorization required > RedfishError InsertVirtualMedia(ctx, managerId, virtualMediaId, insertMediaRequestBody) + ### Required Parameters @@ -210,6 +216,7 @@ No authorization required > Collection ListManagerVirtualMedia(ctx, managerId) + ### Required Parameters @@ -241,6 +248,7 @@ No authorization required > Collection ListManagers(ctx, ) + ### Required Parameters This endpoint does not need any parameter. @@ -268,6 +276,7 @@ No authorization required > Collection ListSystems(ctx, ) + ### Required Parameters This endpoint does not need any parameter. @@ -295,6 +304,7 @@ No authorization required > RedfishError ResetSystem(ctx, computerSystemId, resetRequestBody) + ### Required Parameters @@ -327,6 +337,7 @@ No authorization required > ComputerSystem SetSystem(ctx, systemId, computerSystem) + ### Required Parameters diff --git a/client/docs/IdRef.md b/client/docs/IdRef.md index e980fdf..d5f6949 100644 --- a/client/docs/IdRef.md +++ b/client/docs/IdRef.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**OdataId** | **string** | The unique identifier for a resource. | [optional] +**OdataId** | **string** | The unique identifier for a resource. | [optional] [readonly] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/client/docs/Manager.md b/client/docs/Manager.md index 5fc6a35..6f9f47a 100644 --- a/client/docs/Manager.md +++ b/client/docs/Manager.md @@ -4,22 +4,22 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **string** | The name of the resource. | [optional] -**Name** | **string** | The name of the resource. | +**Id** | **string** | The name of the resource. | [optional] [readonly] +**Name** | **string** | The name of the resource. | [readonly] **UUID** | **string** | | [optional] **ServiceEntryPointUUID** | **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] +**OdataType** | **string** | The type of a resource. | [readonly] +**OdataId** | **string** | The unique identifier for a resource. | [readonly] +**OdataContext** | **string** | The OData description of a payload. | [optional] [readonly] **RedfishCopyright** | **string** | redfish copyright | [optional] -**Model** | Pointer to **string** | | [optional] +**Model** | Pointer to **string** | | [optional] [readonly] **ManagerType** | [**ManagerType**](ManagerType.md) | | [optional] **Status** | [**Status**](Status.md) | | [optional] **DateTime** | Pointer to **string** | | [optional] **DateTimeLocalOffset** | Pointer to **string** | The time offset from UTC that the DateTime property is set to in format: +06:00 . | [optional] -**Description** | Pointer to **string** | description | [optional] +**Description** | Pointer to **string** | description | [optional] [readonly] **EthernetInterfaces** | [**IdRef**](idRef.md) | | [optional] -**FirmwareVersion** | Pointer to **string** | | [optional] +**FirmwareVersion** | Pointer to **string** | | [optional] [readonly] **Links** | [**ManagerLinks**](ManagerLinks.md) | | [optional] **PowerState** | [**PowerState**](PowerState.md) | | [optional] **VirtualMedia** | [**IdRef**](idRef.md) | | [optional] diff --git a/client/docs/MemorySummary.md b/client/docs/MemorySummary.md index 58c98ce..d361f40 100644 --- a/client/docs/MemorySummary.md +++ b/client/docs/MemorySummary.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**TotalSystemMemoryGiB** | Pointer to **float32** | | [optional] -**TotalSystemPersistentMemoryGiB** | Pointer to **float32** | | [optional] +**TotalSystemMemoryGiB** | Pointer to **float32** | | [optional] [readonly] +**TotalSystemPersistentMemoryGiB** | Pointer to **float32** | | [optional] [readonly] **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) diff --git a/client/docs/Message.md b/client/docs/Message.md index ab89714..7c12b75 100644 --- a/client/docs/Message.md +++ b/client/docs/Message.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Message** | **string** | | [optional] -**MessageArgs** | **[]string** | | [optional] -**MessageId** | **string** | | -**RelatedProperties** | **[]string** | | [optional] -**Resolution** | **string** | | [optional] -**Severity** | **string** | | [optional] +**Message** | **string** | | [optional] [readonly] +**MessageArgs** | **[]string** | | [optional] [readonly] +**MessageId** | **string** | | [readonly] +**RelatedProperties** | **[]string** | | [optional] [readonly] +**Resolution** | **string** | | [optional] [readonly] +**Severity** | **string** | | [optional] [readonly] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/client/docs/ProcessorSummary.md b/client/docs/ProcessorSummary.md index 1e475de..32ad43b 100644 --- a/client/docs/ProcessorSummary.md +++ b/client/docs/ProcessorSummary.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Count** | Pointer to **int32** | | [optional] +**Count** | Pointer to **int32** | | [optional] [readonly] **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) diff --git a/client/docs/RedfishErrorError.md b/client/docs/RedfishErrorError.md index e7648cd..7f21a01 100644 --- a/client/docs/RedfishErrorError.md +++ b/client/docs/RedfishErrorError.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MessageExtendedInfo** | [**[]Message**](Message.md) | | [optional] -**Code** | **string** | | -**Message** | **string** | | +**Code** | **string** | | [readonly] +**Message** | **string** | | [readonly] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/client/docs/Root.md b/client/docs/Root.md index f2a265c..2a6ca38 100644 --- a/client/docs/Root.md +++ b/client/docs/Root.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **string** | The name of the resource. | [optional] -**Name** | **string** | The name of the resource. | +**Id** | **string** | The name of the resource. | [optional] [readonly] +**Name** | **string** | The name of the resource. | [readonly] **RedfishVersion** | **string** | redfish version | [optional] **UUID** | **string** | | [optional] -**OdataType** | **string** | The type of a resource. | -**OdataId** | **string** | The unique identifier for a resource. | +**OdataType** | **string** | The type of a resource. | [readonly] +**OdataId** | **string** | The unique identifier for a resource. | [readonly] **RedfishCopyright** | **string** | redfish copyright | [optional] **Systems** | [**IdRef**](idRef.md) | | [optional] **Managers** | [**IdRef**](idRef.md) | | [optional] diff --git a/client/docs/VirtualMedia.md b/client/docs/VirtualMedia.md index 560b23d..580b331 100644 --- a/client/docs/VirtualMedia.md +++ b/client/docs/VirtualMedia.md @@ -4,18 +4,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **string** | The name of the resource. | [optional] -**Name** | **string** | The name of the resource. | -**OdataType** | **string** | The type of a resource. | -**OdataId** | **string** | The unique identifier for a resource. | -**OdataContext** | **string** | The OData description of a payload. | [optional] +**Id** | **string** | The name of the resource. | [optional] [readonly] +**Name** | **string** | The name of the resource. | [readonly] +**OdataType** | **string** | The type of a resource. | [readonly] +**OdataId** | **string** | The unique identifier for a resource. | [readonly] +**OdataContext** | **string** | The OData description of a payload. | [optional] [readonly] **RedfishCopyright** | **string** | redfish copyright | [optional] -**Description** | Pointer to **string** | description | [optional] +**Description** | Pointer to **string** | description | [optional] [readonly] **Image** | Pointer to **string** | | [optional] -**ImageName** | Pointer to **string** | | [optional] +**ImageName** | Pointer to **string** | | [optional] [readonly] **Inserted** | Pointer to **bool** | | [optional] **ConnectedVia** | [**ConnectedVia**](ConnectedVia.md) | | [optional] -**MediaTypes** | **[]string** | | [optional] +**MediaTypes** | **[]string** | | [optional] [readonly] **WriteProtected** | Pointer to **bool** | | [optional] **UserName** | Pointer to **string** | | [optional] **Password** | Pointer to **string** | | [optional] diff --git a/client/docs/VirtualMediaActions.md b/client/docs/VirtualMediaActions.md index 566a7c7..8229eeb 100644 --- a/client/docs/VirtualMediaActions.md +++ b/client/docs/VirtualMediaActions.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**VirtualMediaEjectMedia** | [**VirtualMediaActionsVirtualMediaEjectMedia**](VirtualMedia_Actions_VirtualMedia_EjectMedia.md) | | [optional] -**VirtualMediaInsertMedia** | [**VirtualMediaActionsVirtualMediaEjectMedia**](VirtualMedia_Actions_VirtualMedia_EjectMedia.md) | | [optional] +**VirtualMediaEjectMedia** | [**VirtualMediaActionsVirtualMediaEjectMedia**](VirtualMedia_Actions__VirtualMedia_EjectMedia.md) | | [optional] +**VirtualMediaInsertMedia** | [**VirtualMediaActionsVirtualMediaEjectMedia**](VirtualMedia_Actions__VirtualMedia_EjectMedia.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) diff --git a/client/docs/VirtualMediaActionsVirtualMediaEjectMedia.md b/client/docs/VirtualMediaActionsVirtualMediaEjectMedia.md index 2e7a6c8..cb81a51 100644 --- a/client/docs/VirtualMediaActionsVirtualMediaEjectMedia.md +++ b/client/docs/VirtualMediaActionsVirtualMediaEjectMedia.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Target** | **string** | The unique identifier for a resource. | [optional] +**Target** | **string** | The unique identifier for a resource. | [optional] [readonly] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/client/git_push.sh b/client/git_push.sh index a314397..be50357 100644 --- a/client/git_push.sh +++ b/client/git_push.sh @@ -1,14 +1,20 @@ #!/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" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="opendev.org" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi if [ "$git_user_id" = "" ]; then - git_user_id="Nordix" + git_user_id="airship" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi @@ -28,7 +34,7 @@ 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. +# Commits the tracked changes and prepares them to be pushed to a remote repository. git commit -m "$release_note" # Sets the new remote @@ -37,9 +43,9 @@ 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 + git remote add origin https://${git_host}/${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 + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -47,6 +53,6 @@ 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" +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' diff --git a/client/go.mod b/client/go.mod index 25e0dc4..7462b26 100644 --- a/client/go.mod +++ b/client/go.mod @@ -1,5 +1,8 @@ module opendev.org/airship/go-redfish/client -require golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a +require ( + github.com/antihax/optional v1.0.0 + golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 +) go 1.13 diff --git a/client/go.sum b/client/go.sum index cd66254..ce55b3c 100644 --- a/client/go.sum +++ b/client/go.sum @@ -1,11 +1,13 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= 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/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= 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= diff --git a/client/model_boot.go b/client/model_boot.go index 0339321..7db170c 100644 --- a/client/model_boot.go +++ b/client/model_boot.go @@ -8,7 +8,7 @@ */ package client - +// Boot struct for Boot type Boot struct { BootSourceOverrideEnabled BootSourceOverrideEnabled `json:"BootSourceOverrideEnabled,omitempty"` BootSourceOverrideTarget BootSource `json:"BootSourceOverrideTarget,omitempty"` diff --git a/client/model_boot_source.go b/client/model_boot_source.go index e9803fa..90734bb 100644 --- a/client/model_boot_source.go +++ b/client/model_boot_source.go @@ -8,6 +8,7 @@ */ package client +// BootSource the model 'BootSource' type BootSource string // List of BootSource @@ -27,4 +28,4 @@ const ( BOOTSOURCE_UEFI_HTTP BootSource = "UefiHttp" BOOTSOURCE_REMOTE_DRIVE BootSource = "RemoteDrive" BOOTSOURCE_UEFI_BOOT_NEXT BootSource = "UefiBootNext" -) \ No newline at end of file +) diff --git a/client/model_boot_source_override_enabled.go b/client/model_boot_source_override_enabled.go index abb8ae8..043d94f 100644 --- a/client/model_boot_source_override_enabled.go +++ b/client/model_boot_source_override_enabled.go @@ -8,10 +8,11 @@ */ package client +// BootSourceOverrideEnabled the model 'BootSourceOverrideEnabled' type BootSourceOverrideEnabled string // List of BootSourceOverrideEnabled const ( BOOTSOURCEOVERRIDEENABLED_ONCE BootSourceOverrideEnabled = "Once" BOOTSOURCEOVERRIDEENABLED_CONTINUOUS BootSourceOverrideEnabled = "Continuous" -) \ No newline at end of file +) diff --git a/client/model_collection.go b/client/model_collection.go index 3cb5bc7..e8b2a4b 100644 --- a/client/model_collection.go +++ b/client/model_collection.go @@ -8,8 +8,7 @@ */ package client - -// A Collection of ComputerSystem resource instances. +// Collection A Collection of ComputerSystem resource instances. type Collection struct { // context OdataContext string `json:"@odata.context,omitempty"` diff --git a/client/model_computer_system.go b/client/model_computer_system.go index 22f7afc..2430ddb 100644 --- a/client/model_computer_system.go +++ b/client/model_computer_system.go @@ -8,8 +8,7 @@ */ package client - -// Root redfish path. +// ComputerSystem Root redfish path. type ComputerSystem struct { // The name of the resource. Id string `json:"Id,omitempty"` diff --git a/client/model_computer_system_actions.go b/client/model_computer_system_actions.go index 60bfaf9..c31a7c6 100644 --- a/client/model_computer_system_actions.go +++ b/client/model_computer_system_actions.go @@ -8,7 +8,7 @@ */ package client - +// ComputerSystemActions struct for ComputerSystemActions type ComputerSystemActions struct { ComputerSystemReset ComputerSystemReset `json:"#ComputerSystem.Reset,omitempty"` } diff --git a/client/model_computer_system_reset.go b/client/model_computer_system_reset.go index 8c2242a..42e2d2d 100644 --- a/client/model_computer_system_reset.go +++ b/client/model_computer_system_reset.go @@ -8,7 +8,7 @@ */ package client - +// ComputerSystemReset struct for ComputerSystemReset type ComputerSystemReset struct { // The unique identifier for a resource. Target string `json:"target,omitempty"` diff --git a/client/model_connected_via.go b/client/model_connected_via.go index ea29907..afa89c6 100644 --- a/client/model_connected_via.go +++ b/client/model_connected_via.go @@ -8,6 +8,7 @@ */ package client +// ConnectedVia the model 'ConnectedVia' type ConnectedVia string // List of ConnectedVia @@ -16,4 +17,4 @@ const ( CONNECTEDVIA_URI ConnectedVia = "URI" CONNECTEDVIA_APPLET ConnectedVia = "Applet" CONNECTEDVIA_OEM ConnectedVia = "Oem" -) \ No newline at end of file +) diff --git a/client/model_health.go b/client/model_health.go index cdd8ea8..c8bc768 100644 --- a/client/model_health.go +++ b/client/model_health.go @@ -8,6 +8,7 @@ */ package client +// Health the model 'Health' type Health string // List of Health @@ -15,4 +16,4 @@ const ( HEALTH_OK Health = "OK" HEALTH_WARNING Health = "Warning" HEALTH_CRITICAL Health = "Critical" -) \ No newline at end of file +) diff --git a/client/model_id_ref.go b/client/model_id_ref.go index f35c275..f0dc9e7 100644 --- a/client/model_id_ref.go +++ b/client/model_id_ref.go @@ -8,8 +8,7 @@ */ package client - -// A reference to a resource. +// IdRef A reference to a resource. type IdRef struct { // The unique identifier for a resource. OdataId string `json:"@odata.id,omitempty"` diff --git a/client/model_indicator_led.go b/client/model_indicator_led.go index 77a27c7..74522d5 100644 --- a/client/model_indicator_led.go +++ b/client/model_indicator_led.go @@ -8,6 +8,7 @@ */ package client +// IndicatorLed the model 'IndicatorLed' type IndicatorLed string // List of IndicatorLED @@ -16,4 +17,4 @@ const ( INDICATORLED_LIT IndicatorLed = "Lit" INDICATORLED_BLINKING IndicatorLed = "Blinking" INDICATORLED_OFF IndicatorLed = "Off" -) \ No newline at end of file +) diff --git a/client/model_insert_media_request_body.go b/client/model_insert_media_request_body.go index cca7461..ae7ed86 100644 --- a/client/model_insert_media_request_body.go +++ b/client/model_insert_media_request_body.go @@ -8,7 +8,7 @@ */ package client - +// InsertMediaRequestBody struct for InsertMediaRequestBody type InsertMediaRequestBody struct { Image string `json:"Image"` Inserted bool `json:"Inserted,omitempty"` diff --git a/client/model_manager.go b/client/model_manager.go index d2b5849..7deaa5f 100644 --- a/client/model_manager.go +++ b/client/model_manager.go @@ -8,8 +8,7 @@ */ package client - -// Redfish manager resource. +// Manager Redfish manager resource. type Manager struct { // The name of the resource. Id string `json:"Id,omitempty"` diff --git a/client/model_manager_links.go b/client/model_manager_links.go index b687cb8..9121962 100644 --- a/client/model_manager_links.go +++ b/client/model_manager_links.go @@ -8,7 +8,7 @@ */ package client - +// ManagerLinks struct for ManagerLinks type ManagerLinks struct { ManagerForServers []IdRef `json:"ManagerForServers,omitempty"` ManagerForChassis []IdRef `json:"ManagerForChassis,omitempty"` diff --git a/client/model_manager_type.go b/client/model_manager_type.go index 5c0c4bf..a44f446 100644 --- a/client/model_manager_type.go +++ b/client/model_manager_type.go @@ -8,6 +8,7 @@ */ package client +// ManagerType the model 'ManagerType' type ManagerType string // List of ManagerType @@ -18,4 +19,4 @@ const ( MANAGERTYPE_RACK_MANAGER ManagerType = "RackManager" MANAGERTYPE_AUXILIARY_CONTROLLER ManagerType = "AuxiliaryController" MANAGERTYPE_SERVICE ManagerType = "Service" -) \ No newline at end of file +) diff --git a/client/model_memory_summary.go b/client/model_memory_summary.go index 5bf4986..ca29822 100644 --- a/client/model_memory_summary.go +++ b/client/model_memory_summary.go @@ -8,7 +8,7 @@ */ package client - +// MemorySummary struct for MemorySummary type MemorySummary struct { TotalSystemMemoryGiB *float32 `json:"TotalSystemMemoryGiB,omitempty"` TotalSystemPersistentMemoryGiB *float32 `json:"TotalSystemPersistentMemoryGiB,omitempty"` diff --git a/client/model_message.go b/client/model_message.go index 8f1b2b5..d6e5df5 100644 --- a/client/model_message.go +++ b/client/model_message.go @@ -8,7 +8,7 @@ */ package client - +// Message struct for Message type Message struct { Message string `json:"Message,omitempty"` MessageArgs []string `json:"MessageArgs,omitempty"` diff --git a/client/model_power_state.go b/client/model_power_state.go index 7d95fc1..8f42ab1 100644 --- a/client/model_power_state.go +++ b/client/model_power_state.go @@ -8,6 +8,7 @@ */ package client +// PowerState the model 'PowerState' type PowerState string // List of PowerState @@ -16,4 +17,4 @@ const ( POWERSTATE_FALSE PowerState = "false" POWERSTATE_POWERING_ON PowerState = "PoweringOn" POWERSTATE_POWERING_OFF PowerState = "PoweringOff" -) \ No newline at end of file +) diff --git a/client/model_processor_summary.go b/client/model_processor_summary.go index 0e93327..68617d7 100644 --- a/client/model_processor_summary.go +++ b/client/model_processor_summary.go @@ -8,7 +8,7 @@ */ package client - +// ProcessorSummary struct for ProcessorSummary type ProcessorSummary struct { Count *int32 `json:"Count,omitempty"` Status Status `json:"Status,omitempty"` diff --git a/client/model_redfish_error.go b/client/model_redfish_error.go index 8999d51..b13660b 100644 --- a/client/model_redfish_error.go +++ b/client/model_redfish_error.go @@ -8,8 +8,7 @@ */ package client - -// Contains an error payload from a Redfish Service. +// RedfishError Contains an error payload from a Redfish Service. type RedfishError struct { Error RedfishErrorError `json:"error"` } diff --git a/client/model_redfish_error_error.go b/client/model_redfish_error_error.go index 4d1a6c9..cb451b9 100644 --- a/client/model_redfish_error_error.go +++ b/client/model_redfish_error_error.go @@ -8,7 +8,7 @@ */ package client - +// RedfishErrorError struct for RedfishErrorError type RedfishErrorError struct { MessageExtendedInfo []Message `json:"@Message.ExtendedInfo,omitempty"` Code string `json:"code"` diff --git a/client/model_reset_request_body.go b/client/model_reset_request_body.go index df9d791..9d8a377 100644 --- a/client/model_reset_request_body.go +++ b/client/model_reset_request_body.go @@ -8,7 +8,7 @@ */ package client - +// ResetRequestBody struct for ResetRequestBody type ResetRequestBody struct { ResetType ResetType `json:"ResetType,omitempty"` } diff --git a/client/model_reset_type.go b/client/model_reset_type.go index c0cec3b..b571bc0 100644 --- a/client/model_reset_type.go +++ b/client/model_reset_type.go @@ -8,6 +8,7 @@ */ package client +// ResetType the model 'ResetType' type ResetType string // List of ResetType @@ -21,4 +22,4 @@ const ( RESETTYPE_FORCE_ON ResetType = "ForceOn" RESETTYPE_PUSH_POWER_BUTTON ResetType = "PushPowerButton" RESETTYPE_POWER_CYCLE ResetType = "PowerCycle" -) \ No newline at end of file +) diff --git a/client/model_root.go b/client/model_root.go index 96c1044..78eea0e 100644 --- a/client/model_root.go +++ b/client/model_root.go @@ -8,8 +8,7 @@ */ package client - -// Root redfish path. +// Root Root redfish path. type Root struct { // The name of the resource. Id string `json:"Id,omitempty"` diff --git a/client/model_state.go b/client/model_state.go index 6c5b723..3bc1c8a 100644 --- a/client/model_state.go +++ b/client/model_state.go @@ -8,6 +8,7 @@ */ package client +// State the model 'State' type State string // List of State @@ -23,4 +24,4 @@ const ( STATE_DEFERRING State = "Deferring" STATE_QUIESCED State = "Quiesced" STATE_UPDATING State = "Updating" -) \ No newline at end of file +) diff --git a/client/model_status.go b/client/model_status.go index 57edb12..deec424 100644 --- a/client/model_status.go +++ b/client/model_status.go @@ -8,7 +8,7 @@ */ package client - +// Status struct for Status type Status struct { Health Health `json:"Health,omitempty"` HealthRollup Health `json:"HealthRollup,omitempty"` diff --git a/client/model_system_links.go b/client/model_system_links.go index 1bc2a1e..c5ef998 100644 --- a/client/model_system_links.go +++ b/client/model_system_links.go @@ -8,7 +8,7 @@ */ package client - +// SystemLinks struct for SystemLinks type SystemLinks struct { Chassis []IdRef `json:"Chassis,omitempty"` ManagedBy []IdRef `json:"ManagedBy,omitempty"` diff --git a/client/model_transfer_method.go b/client/model_transfer_method.go index 3a5749c..2431e2c 100644 --- a/client/model_transfer_method.go +++ b/client/model_transfer_method.go @@ -8,10 +8,11 @@ */ package client +// TransferMethod the model 'TransferMethod' type TransferMethod string // List of TransferMethod const ( TRANSFERMETHOD_STREAM TransferMethod = "Stream" TRANSFERMETHOD_UPLOAD TransferMethod = "Upload" -) \ No newline at end of file +) diff --git a/client/model_transfer_protocol_type.go b/client/model_transfer_protocol_type.go index 96f3773..00d9ec4 100644 --- a/client/model_transfer_protocol_type.go +++ b/client/model_transfer_protocol_type.go @@ -8,6 +8,7 @@ */ package client +// TransferProtocolType the model 'TransferProtocolType' type TransferProtocolType string // List of TransferProtocolType @@ -20,4 +21,4 @@ const ( TRANSFERPROTOCOLTYPE_NFS TransferProtocolType = "NFS" TRANSFERPROTOCOLTYPE_SCP TransferProtocolType = "SCP" TRANSFERPROTOCOLTYPE_TFTP TransferProtocolType = "TFTP" -) \ No newline at end of file +) diff --git a/client/model_virtual_media.go b/client/model_virtual_media.go index df80c24..06ebdf1 100644 --- a/client/model_virtual_media.go +++ b/client/model_virtual_media.go @@ -8,8 +8,7 @@ */ package client - -// Redfish virtual media resource for manager. +// VirtualMedia Redfish virtual media resource for manager. type VirtualMedia struct { // The name of the resource. Id string `json:"Id,omitempty"` diff --git a/client/model_virtual_media_actions.go b/client/model_virtual_media_actions.go index d61834a..4fa7ab7 100644 --- a/client/model_virtual_media_actions.go +++ b/client/model_virtual_media_actions.go @@ -8,7 +8,7 @@ */ package client - +// VirtualMediaActions struct for VirtualMediaActions type VirtualMediaActions struct { VirtualMediaEjectMedia VirtualMediaActionsVirtualMediaEjectMedia `json:"#VirtualMedia.EjectMedia,omitempty"` VirtualMediaInsertMedia VirtualMediaActionsVirtualMediaEjectMedia `json:"#VirtualMedia.InsertMedia,omitempty"` diff --git a/client/model_virtual_media_actions_virtual_media_eject_media.go b/client/model_virtual_media_actions__virtual_media_eject_media.go similarity index 78% rename from client/model_virtual_media_actions_virtual_media_eject_media.go rename to client/model_virtual_media_actions__virtual_media_eject_media.go index ddde006..69c1f0b 100644 --- a/client/model_virtual_media_actions_virtual_media_eject_media.go +++ b/client/model_virtual_media_actions__virtual_media_eject_media.go @@ -8,7 +8,7 @@ */ package client - +// VirtualMediaActionsVirtualMediaEjectMedia struct for VirtualMediaActionsVirtualMediaEjectMedia type VirtualMediaActionsVirtualMediaEjectMedia struct { // The unique identifier for a resource. Target string `json:"target,omitempty"` diff --git a/client/response.go b/client/response.go index 74b02a4..2e3c64d 100644 --- a/client/response.go +++ b/client/response.go @@ -13,6 +13,7 @@ import ( "net/http" ) +// APIResponse stores the API response returned by the server. type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` @@ -30,12 +31,14 @@ type APIResponse struct { Payload []byte `json:"-"` } +// NewAPIResponse returns a new APIResonse object. func NewAPIResponse(r *http.Response) *APIResponse { response := &APIResponse{Response: r} return response } +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. func NewAPIResponseWithError(errorMessage string) *APIResponse { response := &APIResponse{Message: errorMessage}