mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-29 17:52:28 +00:00
Initial checkins
This commit is contained in:
@@ -77,7 +77,7 @@ add_executable(owprov
|
||||
src/storage_location.cpp src/storage_location.h
|
||||
src/storage_contact.cpp src/storage_contact.h
|
||||
src/RESTAPI_entity_handler.cpp src/RESTAPI_entity_handler.h
|
||||
src/storage_inventory.cpp src/storage_inventory.h src/RESTAPI_contact_handler.cpp src/RESTAPI_contact_handler.h src/RESTAPI_location_handler.cpp src/RESTAPI_location_handler.h src/RESTAPI_venue_handler.cpp src/RESTAPI_venue_handler.h src/RESTAPI_inventory_handler.cpp src/RESTAPI_inventory_handler.h src/RESTAPI_managementPolicy_handler.cpp src/RESTAPI_managementPolicy_handler.h src/RESTAPI_inventory_list_handler.cpp src/RESTAPI_inventory_list_handler.h src/dbhelpers.h src/RESTAPI_entity_list_handler.cpp src/RESTAPI_entity_list_handler.h)
|
||||
src/storage_inventory.cpp src/storage_inventory.h src/RESTAPI_contact_handler.cpp src/RESTAPI_contact_handler.h src/RESTAPI_location_handler.cpp src/RESTAPI_location_handler.h src/RESTAPI_venue_handler.cpp src/RESTAPI_venue_handler.h src/RESTAPI_inventory_handler.cpp src/RESTAPI_inventory_handler.h src/RESTAPI_managementPolicy_handler.cpp src/RESTAPI_managementPolicy_handler.h src/RESTAPI_inventory_list_handler.cpp src/RESTAPI_inventory_list_handler.h src/dbhelpers.h src/RESTAPI_entity_list_handler.cpp src/RESTAPI_entity_list_handler.h src/storage_management_groups.cpp src/storage_management_groups.h)
|
||||
|
||||
target_link_libraries(owprov PUBLIC
|
||||
${Poco_LIBRARIES} ${MySQL_LIBRARIES}
|
||||
|
||||
@@ -217,6 +217,17 @@ components:
|
||||
design:
|
||||
type: string
|
||||
|
||||
UserInfoDigest:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
loginId:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
|
||||
# uuids: mgg:<uuid>
|
||||
ManagementRole:
|
||||
type: object
|
||||
@@ -228,8 +239,15 @@ components:
|
||||
users:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
format: uuid
|
||||
$ref: '#/Components/schemas/UserInfoDigest'
|
||||
|
||||
ManagementRoleList:
|
||||
type: object
|
||||
properties:
|
||||
roles:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/Components/schemas/ManagementRole'
|
||||
|
||||
# uuids: loc:<uuid>
|
||||
Location:
|
||||
@@ -1217,6 +1235,88 @@ paths:
|
||||
404:
|
||||
$ref: '#/components/responses/NotFound'
|
||||
|
||||
/managementRole:
|
||||
get:
|
||||
tags:
|
||||
- Management Roles
|
||||
operationId: getManagementRoles
|
||||
summary: Retrieve a list of managementRoles
|
||||
parameters:
|
||||
- in: query
|
||||
name: entity
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
required: false
|
||||
- in: query
|
||||
description: Pagination start (starts at 1. If not specified, 1 is assumed)
|
||||
name: offset
|
||||
schema:
|
||||
type: integer
|
||||
required: false
|
||||
- in: query
|
||||
description: Maximum number of entries to return (if absent, no limit is assumed)
|
||||
name: limit
|
||||
schema:
|
||||
type: integer
|
||||
required: false
|
||||
- in: query
|
||||
description: Filter the results
|
||||
name: filter
|
||||
schema:
|
||||
type: string
|
||||
required: false
|
||||
- in: query
|
||||
description: Supply a list of devices comma separated
|
||||
name: select
|
||||
schema:
|
||||
type: string
|
||||
example: serial1,serial2,serial3
|
||||
required: false
|
||||
- in: query
|
||||
description: return the number of roles
|
||||
name: countOnly
|
||||
schema:
|
||||
type: boolean
|
||||
required: false
|
||||
|
||||
responses:
|
||||
200:
|
||||
description: Return a list of elements
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ManagementRoleList'
|
||||
403:
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
404:
|
||||
$ref: '#/components/responses/NotFound'
|
||||
|
||||
/managementRole/{uuid}:
|
||||
get:
|
||||
tags:
|
||||
- Management Roles
|
||||
operationId: getManagementRole
|
||||
parameters:
|
||||
- in: query
|
||||
name: uuid
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
|
||||
responses:
|
||||
200:
|
||||
description: Return a management role
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ManagementRole'
|
||||
403:
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
404:
|
||||
$ref: '#/components/responses/NotFound'
|
||||
|
||||
|
||||
|
||||
#########################################################################################
|
||||
|
||||
@@ -123,6 +123,9 @@ namespace OpenWifi{
|
||||
}
|
||||
E.info.modified = E.info.created = std::time(nullptr);
|
||||
|
||||
for(auto &i:E.info.notes)
|
||||
i.createdBy = UserInfo_.userinfo.email;
|
||||
|
||||
// When creating an entity, it cannot have any relations other that parent, notes, name, description. Everything else
|
||||
// must be conveyed through PUT.
|
||||
E.info.id = (UUID==EntityDB::RootUUID()) ? UUID : uCentral::Daemon()->CreateUUID() ;
|
||||
@@ -150,7 +153,11 @@ namespace OpenWifi{
|
||||
Storage()->EntityDB().AddChild("id",E.parent,E.info.id);
|
||||
}
|
||||
|
||||
OK(Request, Response);
|
||||
ProvObjects::Entity AddedRecord;
|
||||
Storage()->EntityDB().GetRecord("id",E.info.id,AddedRecord);
|
||||
Poco::JSON::Object Answer;
|
||||
AddedRecord.to_json(Answer);
|
||||
ReturnObject(Request, Answer, Response);
|
||||
return;
|
||||
}
|
||||
NotFound(Request,Response);
|
||||
|
||||
5
src/storage_management_groups.cpp
Normal file
5
src/storage_management_groups.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
//
|
||||
// Created by stephane bourque on 2021-08-20.
|
||||
//
|
||||
|
||||
#include "storage_management_groups.h"
|
||||
14
src/storage_management_groups.h
Normal file
14
src/storage_management_groups.h
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Created by stephane bourque on 2021-08-20.
|
||||
//
|
||||
|
||||
#ifndef OWPROV_STORAGE_MANAGEMENT_GROUPS_H
|
||||
#define OWPROV_STORAGE_MANAGEMENT_GROUPS_H
|
||||
|
||||
|
||||
class storage_management_groups {
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //OWPROV_STORAGE_MANAGEMENT_GROUPS_H
|
||||
@@ -129,11 +129,22 @@ setroot() {
|
||||
jq < ${result_file}
|
||||
}
|
||||
|
||||
addentity() {
|
||||
payload="{ \"name\" : \"$1\", \"description\" : \"sub entity.\", \"parent\" : \"0000-0000-0000\", \"notes\" : [ {\"note\" : \"CLI added\"} ] }";
|
||||
curl ${FLAGS} -X POST "https://${OWPROV}/api/v1/entity/1" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${token}" \
|
||||
-H "accept: application/json" \
|
||||
-d "$payload" > ${result_file}
|
||||
jq < ${result_file}
|
||||
}
|
||||
|
||||
shopt -s nocasematch
|
||||
case "$1" in
|
||||
"login") login; help ; logout ;;
|
||||
"getroot") login; getroot; logout;;
|
||||
"setroot") login; setroot; logout;;
|
||||
"addentity") login; addentity "$2" ; logout;;
|
||||
*) help ;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user