Skip to content

Commit

Permalink
US71619-Included new endpoint to handle service health update (#135)
Browse files Browse the repository at this point in the history
* US71619-Included new endpoint to handle service health update

* [auto generated] Checking in generated offline HTML doc

---------

Co-authored-by: dbozzato81 <[email protected]>
  • Loading branch information
dbozzato81 and dbozzato81 authored Oct 29, 2024
1 parent 406649e commit f3109d3
Show file tree
Hide file tree
Showing 10 changed files with 322 additions and 3 deletions.
5 changes: 5 additions & 0 deletions v1/api/swagger/components/responses/Forbidden.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: forbidden
content:
application/json:
schema:
$ref: ../schemas/ErrorResponse.yaml
29 changes: 29 additions & 0 deletions v1/api/swagger/paths/services@{serviceId}@updatehealth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
put:
tags:
- services
summary: Trigger a request to update an OS service image health by its ID.
description: >-
Trigger a request to update an OS service image health by its ID.
If GreenLake Platform IAM issued token is used for authentication, then it is required to pass
'X-Role' and 'X-Workspaceid' headers.
operationId: Service_updatehealth
parameters:
- name: serviceId
in: path
description: ID of OS service image.
required: true
schema:
type: string
- $ref: ../components/parameters/Role.yaml
- $ref: ../components/parameters/WorkspaceID.yaml
responses:
'202':
description: accepted
'401':
$ref: ../components/responses/Unauthorized.yaml
'403':
$ref: ../components/responses/Forbidden.yaml
'404':
$ref: ../components/responses/NotFound.yaml
'500':
$ref: ../components/responses/InternalError.yaml
2 changes: 2 additions & 0 deletions v1/api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ paths:
$ref: paths/services.yaml
/services/{serviceId}:
$ref: paths/services@{serviceId}.yaml
/services/{serviceId}/updatehealth:
$ref: paths/services@{serviceId}@updatehealth.yaml

components:
securitySchemes:
Expand Down
16 changes: 13 additions & 3 deletions v1/html/index.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions v1/pkg/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Class | Method | HTTP request | Description
*ServicesApi* | [**GetByID**](docs/ServicesApi.md#getbyid) | **Get** /services/{serviceId} | Retrieve an OS service image
*ServicesApi* | [**List**](docs/ServicesApi.md#list) | **Get** /services | List of all OS service images within an tenant
*ServicesApi* | [**Update**](docs/ServicesApi.md#update) | **Put** /services/{serviceId} | Update an OS service image by its ID
*ServicesApi* | [**Updatehealth**](docs/ServicesApi.md#updatehealth) | **Put** /services/{serviceId}/updatehealth | Trigger a request to update an OS service image health by its ID.
*SshkeysApi* | [**Add**](docs/SshkeysApi.md#add) | **Post** /sshkeys | Add a new SSH Key
*SshkeysApi* | [**Delete**](docs/SshkeysApi.md#delete) | **Delete** /sshkeys/{sshkeyId} | Delete an SSH key by ID.
*SshkeysApi* | [**GetByID**](docs/SshkeysApi.md#getbyid) | **Get** /sshkeys/{sshkeyId} | Retrieve SSH Key by ID
Expand Down
55 changes: 55 additions & 0 deletions v1/pkg/client/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3344,6 +3344,61 @@ paths:
summary: Update an OS service image by its ID
tags:
- services
/services/{serviceId}/updatehealth:
put:
description: Trigger a request to update an OS service image health by its ID.
If GreenLake Platform IAM issued token is used for authentication, then it
is required to pass 'X-Role' and 'X-Workspaceid' headers.
operationId: Service_updatehealth
parameters:
- description: ID of OS service image.
in: path
name: serviceId
required: true
schema:
type: string
- description: GreenLake Platform role name
example: metal-infra-admin
in: header
name: X-Role
schema:
type: string
- description: GreenLake Platform workspace ID
example: 1a2ba81600dd11efa47076a3447ec4eb
in: header
name: X-Workspaceid
schema:
type: string
responses:
"202":
description: accepted
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: forbidden
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: not found
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
description: internal error
summary: Trigger a request to update an OS service image health by its ID.
tags:
- services
components:
schemas:
Version:
Expand Down
145 changes: 145 additions & 0 deletions v1/pkg/client/api_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -869,3 +869,148 @@ func (a *ServicesApiService) Update(ctx _context.Context, serviceId string, file

return localVarReturnValue, localVarHTTPResponse, nil
}

// ServicesApiUpdatehealthOpts Optional parameters for the method 'Updatehealth'
type ServicesApiUpdatehealthOpts struct {
XRole optional.String
XWorkspaceid optional.String
}

/*
Updatehealth Trigger a request to update an OS service image health by its ID.
Trigger a request to update an OS service image health by its ID. If GreenLake Platform IAM issued token is used for authentication, then it is required to pass &#39;X-Role&#39; and &#39;X-Workspaceid&#39; headers.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param serviceId ID of OS service image.
* @param optional nil or *ServicesApiUpdatehealthOpts - Optional Parameters:
* @param "XRole" (optional.String) - GreenLake Platform role name
* @param "XWorkspaceid" (optional.String) - GreenLake Platform workspace ID
*/
func (a *ServicesApiService) Updatehealth(ctx _context.Context, serviceId string, localVarOptionals *ServicesApiUpdatehealthOpts) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)

// create path and map variables
localVarPath := a.client.cfg.BasePath + "/services/{serviceId}/updatehealth"
localVarPath = strings.Replace(localVarPath, "{"+"serviceId"+"}", _neturl.QueryEscape(parameterToString(serviceId, "")) , -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
}
if localVarOptionals != nil && localVarOptionals.XRole.IsSet() {
localVarHeaderParams["X-Role"] = parameterToString(localVarOptionals.XRole.Value(), "")
}
if localVarOptionals != nil && localVarOptionals.XWorkspaceid.IsSet() {
localVarHeaderParams["X-Workspaceid"] = parameterToString(localVarOptionals.XWorkspaceid.Value(), "")
}
if ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
var key string
if auth.Prefix != "" {
key = auth.Prefix + " " + auth.Key
} else {
key = auth.Key
}
localVarHeaderParams["Membership"] = key
}
}
if ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
var key string
if auth.Prefix != "" {
key = auth.Prefix + " " + auth.Key
} else {
key = auth.Key
}
localVarHeaderParams["Project"] = key
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}

localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}

localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
if err != nil {
return localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 401 {
var v ErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.model = v
return localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 403 {
var v ErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.model = v
return localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 404 {
var v ErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.model = v
return localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 500 {
var v ErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.model = v
}
return localVarHTTPResponse, newErr
}

return localVarHTTPResponse, nil
}
47 changes: 47 additions & 0 deletions v1/pkg/client/docs/ServicesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Method | HTTP request | Description
[**GetByID**](ServicesApi.md#GetByID) | **Get** /services/{serviceId} | Retrieve an OS service image
[**List**](ServicesApi.md#List) | **Get** /services | List of all OS service images within an tenant
[**Update**](ServicesApi.md#Update) | **Put** /services/{serviceId} | Update an OS service image by its ID
[**Updatehealth**](ServicesApi.md#Updatehealth) | **Put** /services/{serviceId}/updatehealth | Trigger a request to update an OS service image health by its ID.



Expand Down Expand Up @@ -245,3 +246,49 @@ Name | Type | Description | Notes
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)


## Updatehealth

> Updatehealth(ctx, serviceId, optional)
Trigger a request to update an OS service image health by its ID.

Trigger a request to update an OS service image health by its ID. If GreenLake Platform IAM issued token is used for authentication, then it is required to pass 'X-Role' and 'X-Workspaceid' headers.

### Required Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**serviceId** | **string**| ID of OS service image. |
**optional** | ***UpdatehealthOpts** | optional parameters | nil if no parameters

### Optional Parameters

Optional parameters are passed through a pointer to a UpdatehealthOpts struct


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------

**xRole** | **optional.String**| GreenLake Platform role name |
**xWorkspaceid** | **optional.String**| GreenLake Platform workspace ID |

### Return type

(empty response body)

### Authorization

[BearerAuth](../README.md#BearerAuth), [Membership](../README.md#Membership), [Project](../README.md#Project)

### 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)

10 changes: 10 additions & 0 deletions v1/pkg/client/interface_services.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions v1/pkg/mockquakeclient/mock_services.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f3109d3

Please sign in to comment.