diff --git a/api-ref/source/api-ref-sysinv-v1-config.rst b/api-ref/source/api-ref-sysinv-v1-config.rst index e17b11015a..a955b090f7 100644 --- a/api-ref/source/api-ref-sysinv-v1-config.rst +++ b/api-ref/source/api-ref-sysinv-v1-config.rst @@ -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. \ No newline at end of file diff --git a/sysinv/sysinv/sysinv/sysinv/api/config.py b/sysinv/sysinv/sysinv/sysinv/api/config.py index 7259450062..fa3a7080a5 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/config.py +++ b/sysinv/sysinv/sysinv/sysinv/api/config.py @@ -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', ] } diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/system.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/system.py index a97f9b048a..33a0002d10 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/system.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/system.py @@ -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