Commit 08efef26 authored by yangjian's avatar yangjian

update AuthenticationStatus

parent 807452db
/**
* Nudr_DataRepository API OpenAPI file
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 2.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "AuthEventDocumentApi.h"
#include "Helpers.h"
namespace org {
namespace openapitools {
namespace server {
namespace api {
using namespace org::openapitools::server::helpers;
using namespace org::openapitools::server::model;
AuthEventDocumentApi::AuthEventDocumentApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
void AuthEventDocumentApi::init() {
setupRoutes();
}
void AuthEventDocumentApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Delete(*router, base + "/subscription-data/:ueId/authentication-data/authentication-status", Routes::bind(&AuthEventDocumentApi::delete_authentication_status_handler, this));
Routes::Get(*router, base + "/subscription-data/:ueId/authentication-data/authentication-status", Routes::bind(&AuthEventDocumentApi::query_authentication_status_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&AuthEventDocumentApi::auth_event_document_api_default_handler, this));
}
void AuthEventDocumentApi::delete_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto ueId = request.param(":ueId").as<std::string>();
try {
this->delete_authentication_status(ueId, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (Pistache::Http::HttpError &e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void AuthEventDocumentApi::query_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto ueId = request.param(":ueId").as<std::string>();
// Getting the query params
auto fieldsQuery = request.query().get("fields");
Pistache::Optional<std::vector<std::string>> fields;
if(!fieldsQuery.isEmpty()){
std::vector<std::string> valueQuery_instance;
if(fromStringValue(fieldsQuery.get(), valueQuery_instance)){
fields = Pistache::Some(valueQuery_instance);
}
}
auto supportedFeaturesQuery = request.query().get("supported-features");
Pistache::Optional<std::string> supportedFeatures;
if(!supportedFeaturesQuery.isEmpty()){
std::string valueQuery_instance;
if(fromStringValue(supportedFeaturesQuery.get(), valueQuery_instance)){
supportedFeatures = Pistache::Some(valueQuery_instance);
}
}
try {
this->query_authentication_status(ueId, fields, supportedFeatures, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (Pistache::Http::HttpError &e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void AuthEventDocumentApi::auth_event_document_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
}
}
}
}
}
/**
* Nudr_DataRepository API OpenAPI file
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 2.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* AuthEventDocumentApi.h
*
*
*/
#ifndef AuthEventDocumentApi_H_
#define AuthEventDocumentApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "AuthEvent.h"
#include <string>
namespace org {
namespace openapitools {
namespace server {
namespace api {
using namespace org::openapitools::server::model;
class AuthEventDocumentApi {
public:
AuthEventDocumentApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~AuthEventDocumentApi() {}
void init();
const std::string base = "/nudr-dr/v2";
private:
void setupRoutes();
void delete_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void query_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void auth_event_document_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// To remove the Authentication Status of a UE
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="ueId">UE id</param>
virtual void delete_authentication_status(const std::string &ueId, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Retrieves the Authentication Status of a UE
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="ueId">UE id</param>
/// <param name="fields">attributes to be retrieved (optional, default to std::vector&lt;std::string&gt;())</param>
/// <param name="supportedFeatures">Supported Features (optional, default to &quot;&quot;)</param>
virtual void query_authentication_status(const std::string &ueId, const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response) = 0;
};
}
}
}
}
#endif /* AuthEventDocumentApi_H_ */
......@@ -34,11 +34,16 @@ void AuthenticationStatusDocumentApi::setupRoutes() {
Routes::Put(*router, base + "/subscription-data/:ueId/authentication-data/authentication-status", Routes::bind(&AuthenticationStatusDocumentApi::create_authentication_status_handler, this));
Routes::Delete(*router, base + "/subscription-data/:ueId/authentication-data/authentication-status", Routes::bind(&AuthenticationStatusDocumentApi::delete_authentication_status_handler, this));
Routes::Get(*router, base + "/subscription-data/:ueId/authentication-data/authentication-status", Routes::bind(&AuthenticationStatusDocumentApi::query_authentication_status_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&AuthenticationStatusDocumentApi::authentication_status_document_api_default_handler, this));
}
void AuthenticationStatusDocumentApi::create_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
void AuthenticationStatusDocumentApi::create_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response)
{
// Getting the path params
auto ueId = request.param(":ueId").as<std::string>();
......@@ -64,6 +69,68 @@ void AuthenticationStatusDocumentApi::create_authentication_status_handler(const
}
void AuthenticationStatusDocumentApi::delete_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response)
{
// Getting the path params
auto ueId = request.param(":ueId").as<std::string>();
try {
this->delete_authentication_status(ueId, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (Pistache::Http::HttpError &e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void AuthenticationStatusDocumentApi::query_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response)
{
// Getting the path params
auto ueId = request.param(":ueId").as<std::string>();
// Getting the query params
auto fieldsQuery = request.query().get("fields");
Pistache::Optional<std::vector<std::string>> fields;
if(!fieldsQuery.isEmpty()){
std::vector<std::string> valueQuery_instance;
if(fromStringValue(fieldsQuery.get(), valueQuery_instance)){
fields = Pistache::Some(valueQuery_instance);
}
}
auto supportedFeaturesQuery = request.query().get("supported-features");
Pistache::Optional<std::string> supportedFeatures;
if(!supportedFeaturesQuery.isEmpty()){
std::string valueQuery_instance;
if(fromStringValue(supportedFeaturesQuery.get(), valueQuery_instance)){
supportedFeatures = Pistache::Some(valueQuery_instance);
}
}
try {
this->query_authentication_status(ueId, fields, supportedFeatures, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (Pistache::Http::HttpError &e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void AuthenticationStatusDocumentApi::authentication_status_document_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
}
......
......@@ -47,6 +47,10 @@ private:
void setupRoutes();
void create_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void delete_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void query_authentication_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void authentication_status_document_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
......@@ -60,6 +64,8 @@ private:
/// <param name="ueId">UE id</param>
/// <param name="authEvent"> (optional)</param>
virtual void create_authentication_status(const std::string &ueId, const AuthEvent &authEvent, Pistache::Http::ResponseWriter &response) = 0;
virtual void delete_authentication_status(const std::string &ueId, Pistache::Http::ResponseWriter &response) = 0;
virtual void query_authentication_status(const std::string &ueId, const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response) = 0;
};
......
/**
* Nudr_DataRepository API OpenAPI file
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 2.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "AuthEventDocumentApiImpl.h"
namespace org {
namespace openapitools {
namespace server {
namespace api {
using namespace org::openapitools::server::model;
AuthEventDocumentApiImpl::AuthEventDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr)
: AuthEventDocumentApi(rtr)
{ }
void AuthEventDocumentApiImpl::delete_authentication_status(const std::string &ueId, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void AuthEventDocumentApiImpl::query_authentication_status(const std::string &ueId, const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
}
}
}
}
/**
* Nudr_DataRepository API OpenAPI file
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 2.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* AuthEventDocumentApiImpl.h
*
*
*/
#ifndef AUTH_EVENT_DOCUMENT_API_IMPL_H_
#define AUTH_EVENT_DOCUMENT_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AuthEventDocumentApi.h>
#include <pistache/optional.h>
#include "AuthEvent.h"
#include <string>
namespace org {
namespace openapitools {
namespace server {
namespace api {
using namespace org::openapitools::server::model;
class AuthEventDocumentApiImpl : public org::openapitools::server::api::AuthEventDocumentApi {
public:
AuthEventDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>);
~AuthEventDocumentApiImpl() {}
void delete_authentication_status(const std::string &ueId, Pistache::Http::ResponseWriter &response);
void query_authentication_status(const std::string &ueId, const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response);
};
}
}
}
}
#endif
\ No newline at end of file
......@@ -24,9 +24,17 @@ AuthenticationStatusDocumentApiImpl::AuthenticationStatusDocumentApiImpl(std::sh
{ }
void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std::string &ueId, const AuthEvent &authEvent, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
response.send(Pistache::Http::Code::Ok, "create_authentication_status\n");
}
void AuthenticationStatusDocumentApiImpl::delete_authentication_status(const std::string &ueId, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "delete_authentication_status\n");
}
void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std::string &ueId, const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "query_authentication_status\n");
}
}
}
}
......
......@@ -45,6 +45,9 @@ public:
~AuthenticationStatusDocumentApiImpl() {}
void create_authentication_status(const std::string &ueId, const AuthEvent &authEvent, Pistache::Http::ResponseWriter &response);
void delete_authentication_status(const std::string &ueId, Pistache::Http::ResponseWriter &response);
void query_authentication_status(const std::string &ueId, const Pistache::Optional<std::vector<std::string>> &fields, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response);
};
......
......@@ -27,7 +27,6 @@
#include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h"
#include "AmfSubscriptionInfoDocumentApiImpl.h"
#include "ApplicationDataSubscriptionsCollectionApiImpl.h"
#include "AuthEventDocumentApiImpl.h"
#include "AuthenticationSoRDocumentApiImpl.h"
#include "AuthenticationStatusDocumentApiImpl.h"
#include "AuthenticationSubscriptionDocumentApiImpl.h"
......@@ -176,8 +175,6 @@ int main() {
AmfSubscriptionInfoDocumentApiserver.init();
ApplicationDataSubscriptionsCollectionApiImpl ApplicationDataSubscriptionsCollectionApiserver(router);
ApplicationDataSubscriptionsCollectionApiserver.init();
AuthEventDocumentApiImpl AuthEventDocumentApiserver(router);
AuthEventDocumentApiserver.init();
AuthenticationSoRDocumentApiImpl AuthenticationSoRDocumentApiserver(router);
AuthenticationSoRDocumentApiserver.init();
AuthenticationStatusDocumentApiImpl AuthenticationStatusDocumentApiserver(router);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment