Add new sysinv unauthenticated region_id api
This update adds a new sysinv unauthenticated 'region_id' api that return region_name curl http://pxecontroller:6385/v1/isystems/region_id System inventory will return a dictionary containing the region_name { "region_name": "<system.region_name>" } Test Plan: PASS: Verify success path handling PASS: Verify multiple dictionary keys Story: 2011100 Task: 49864 Change-Id: Iaeb77fdd90e5eb06cf9fc9d7da994dd22bfbee14 Signed-off-by: rummadis <ramu.ummadishetty@windriver.com>
This commit is contained in:
parent
a1aa5b93fb
commit
d7d886c3e1
@ -12592,3 +12592,35 @@ unauthorized (401), forbidden (403), badMethod (405), overLimit (413)
|
||||
"success": "kube-config-kubelet applied.",
|
||||
"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.
|
@ -35,5 +35,6 @@ app = {
|
||||
'/v1/upgrade/[a-zA-Z0-9\-]+/in_upgrade',
|
||||
'/v1/upgrade/[a-zA-Z0-9\-]+/upgrade_in_progress',
|
||||
'/v1/ihosts/[a-zA-Z0-9\:]+/mgmt_ip',
|
||||
'/v1/isystems/region_id',
|
||||
]
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2013-2021 Wind River Systems, Inc.
|
||||
# Copyright (c) 2013-2021,2024 Wind River Systems, Inc.
|
||||
#
|
||||
|
||||
import jsonpatch
|
||||
@ -24,6 +24,7 @@ import os
|
||||
import re
|
||||
import pecan
|
||||
from pecan import rest
|
||||
from pecan import expose
|
||||
import six
|
||||
import wsme
|
||||
from wsme import types as wtypes
|
||||
@ -208,6 +209,7 @@ class SystemController(rest.RestController):
|
||||
_custom_actions = {
|
||||
'detail': ['GET'],
|
||||
'mgmtvlan': ['GET'],
|
||||
'region_id': ['GET'],
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
@ -721,3 +723,9 @@ class SystemController(rest.RestController):
|
||||
else:
|
||||
return interface['vlan_id']
|
||||
return None
|
||||
|
||||
@expose('json')
|
||||
def region_id(self):
|
||||
system = pecan.request.dbapi.isystem_get_one()
|
||||
result = {"region_name": system.region_name}
|
||||
return result
|
||||
|
Loading…
x
Reference in New Issue
Block a user