Merge "Add new sysinv unauthenticated region_id api"

This commit is contained in:
Zuul 2024-04-17 21:55:03 +00:00 committed by Gerrit Code Review
commit 5d18fe7b75
3 changed files with 42 additions and 1 deletions

View File

@ -12592,3 +12592,35 @@ unauthorized (401), forbidden (403), badMethod (405), overLimit (413)
"success": "kube-config-kubelet applied.", "success": "kube-config-kubelet applied.",
"error": "" "error": ""
} }
***********************************
Get Region Name
***********************************
.. rest_method:: GET /v1/isystems/region_id
**Normal response codes**
200
**Error response codes**
serviceUnavailable (503), badRequest (400),
forbidden (403), badMethod (405)
**Response parameters**
.. csv-table::
:header: "Parameter", "Style", "Type", "Description"
:widths: 20, 20, 20, 60
"region_name", "plain", "xsd:string", "region name can be default RegionOne or UUID"
::
{
"region_name": "f558ce1b-de27-4132-8ca6-ac7f34ae8d21",
}
This operation does not accept a request body.

View File

@ -35,5 +35,6 @@ app = {
'/v1/upgrade/[a-zA-Z0-9\-]+/in_upgrade', '/v1/upgrade/[a-zA-Z0-9\-]+/in_upgrade',
'/v1/upgrade/[a-zA-Z0-9\-]+/upgrade_in_progress', '/v1/upgrade/[a-zA-Z0-9\-]+/upgrade_in_progress',
'/v1/ihosts/[a-zA-Z0-9\:]+/mgmt_ip', '/v1/ihosts/[a-zA-Z0-9\:]+/mgmt_ip',
'/v1/isystems/region_id',
] ]
} }

View File

@ -16,7 +16,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# #
# Copyright (c) 2013-2021 Wind River Systems, Inc. # Copyright (c) 2013-2021,2024 Wind River Systems, Inc.
# #
import jsonpatch import jsonpatch
@ -24,6 +24,7 @@ import os
import re import re
import pecan import pecan
from pecan import rest from pecan import rest
from pecan import expose
import six import six
import wsme import wsme
from wsme import types as wtypes from wsme import types as wtypes
@ -208,6 +209,7 @@ class SystemController(rest.RestController):
_custom_actions = { _custom_actions = {
'detail': ['GET'], 'detail': ['GET'],
'mgmtvlan': ['GET'], 'mgmtvlan': ['GET'],
'region_id': ['GET'],
} }
def __init__(self): def __init__(self):
@ -721,3 +723,9 @@ class SystemController(rest.RestController):
else: else:
return interface['vlan_id'] return interface['vlan_id']
return None return None
@expose('json')
def region_id(self):
system = pecan.request.dbapi.isystem_get_one()
result = {"region_name": system.region_name}
return result