Skip to content
GitLab
Explore
Sign in
Commits on Source (2)
federation controller changes
· 4c1a5a77
George Papathanail
authored
Jul 22, 2025
4c1a5a77
Merge branch 'dev-branch' into 'main'
· 89a9f0b7
Dimitrios Laskaratos
authored
Jul 22, 2025
federation controller changes See merge request
!3
89a9f0b7
Show whitespace changes
Inline
Side-by-side
edge_cloud_management_api/controllers/federation_manager_controller.py
View file @
89a9f0b7
from
flask
import
request
,
jsonify
,
Response
import
json
import
logging
from
edge_cloud_management_api.services.federation_services
import
FederationManagerClientFactory
# Factory pattern
factory
=
FederationManagerClientFactory
()
federation_client
=
factory
.
create_federation_client
()
def
handle_response
(
status_code
,
title
,
detail
):
return
Response
(
json
.
dumps
({
"
title
"
:
title
,
"
detail
"
:
detail
,
"
status
"
:
status_code
}),
status
=
status_code
,
content_type
=
"
application/problem+json
"
)
def
create_federation
():
...
...
@@ -23,44 +14,39 @@ def create_federation():
try
:
body
=
request
.
get_json
()
result
=
federation_client
.
post_partner
(
body
)
if
"
error
"
in
result
:
return
handle_response
(
502
,
"
Federation Error
"
,
result
[
"
error
"
])
return
jsonify
(
result
),
200
except
Exception
as
e
:
return
handle_response
(
400
,
"
Bad Request
"
,
str
(
e
))
logging
.
error
(
e
.
args
)
return
jsonify
(
result
),
500
def
get_federation
(
federationContextId
):
"""
GET /{federationContextId}/partner - Get federation info.
"""
try
:
result
=
federation_client
.
get_partner
(
federationContextId
)
if
"
error
"
in
result
:
return
handle_response
(
502
,
"
Federation Error
"
,
result
[
"
error
"
])
return
jsonify
(
result
),
200
except
Exception
as
e
:
return
handle_response
(
400
,
"
Bad Request
"
,
str
(
e
))
logging
.
error
(
e
.
args
)
return
jsonify
(
result
),
500
def
delete_federation
(
federationContextId
):
"""
DELETE /{federationContextId}/partner - Delete federation.
"""
try
:
result
=
federation_client
.
delete_partner
(
federationContextId
)
if
"
error
"
in
result
:
return
handle_response
(
502
,
"
Federation Error
"
,
result
[
"
error
"
])
return
jsonify
(
result
),
200
except
Exception
as
e
:
return
handle_response
(
400
,
"
Bad Request
"
,
str
(
e
)
)
logging
.
error
(
e
.
args
)
return
jsonify
(
result
),
500
def
get_federation_context_ids
():
"""
GET /fed-context-id - Fetch federationContextId(s).
"""
try
:
result
=
federation_client
.
get_federation_context_ids
()
if
"
error
"
in
result
:
return
handle_response
(
502
,
"
Federation Error
"
,
result
[
"
error
"
])
return
jsonify
(
result
),
200
except
Exception
as
e
:
return
handle_response
(
400
,
"
Bad Request
"
,
str
(
e
))
logging
.
error
(
e
.
args
)
return
jsonify
(
result
),
500
def
onboard_application_to_partner
(
federationContextId
):
...
...
@@ -68,31 +54,28 @@ def onboard_application_to_partner(federationContextId):
try
:
body
=
request
.
get_json
()
result
=
federation_client
.
onboard_application
(
federationContextId
,
body
)
if
"
error
"
in
result
:
return
handle_response
(
502
,
"
Onboarding Error
"
,
result
[
"
error
"
])
return
jsonify
(
result
),
202
except
Exception
as
e
:
return
handle_response
(
400
,
"
Bad Request
"
,
str
(
e
))
logging
.
error
(
e
.
args
)
return
jsonify
(
result
),
500
def
get_onboarded_app
(
federationContextId
,
appId
):
"""
GET /{federationContextId}/application/onboarding/app/{appId}
"""
try
:
result
=
federation_client
.
get_onboarded_app
(
federationContextId
,
appId
)
if
"
error
"
in
result
:
return
handle_response
(
result
.
get
(
"
status_code
"
,
502
),
"
Retrieval Error
"
,
result
[
"
error
"
])
return
jsonify
(
result
),
200
except
Exception
as
e
:
return
handle_response
(
500
,
"
Internal Server Error
"
,
str
(
e
))
logging
.
error
(
e
.
args
)
return
jsonify
(
result
),
500
def
delete_onboarded_app
(
federationContextId
,
appId
):
"""
DELETE /{federationContextId}/application/onboarding/app/{appId}
"""
try
:
result
=
federation_client
.
delete_onboarded_app
(
federationContextId
,
appId
)
if
"
error
"
in
result
:
return
handle_response
(
result
.
get
(
"
status_code
"
,
502
),
"
Deletion Error
"
,
result
[
"
error
"
])
return
jsonify
({
"
message
"
:
f
"
App
{
appId
}
successfully deleted from partner
"
}),
200
return
jsonify
(
result
),
200
except
Exception
as
e
:
return
handle_response
(
500
,
"
Internal Server Error
"
,
str
(
e
))
logging
.
error
(
e
.
args
)
return
jsonify
(
result
),
500
edge_cloud_management_api/specification/openapi.yaml
View file @
89a9f0b7
...
...
@@ -817,12 +817,7 @@ paths:
"
405"
:
description
:
Method not allowed
"
404"
:
<<<<<<< HEAD
description
:
Session not found
=======
description
:
Session not found
>
>>>>>>
f18e931881554973db7ae6241588db6e667dbf10
/partner
:
post
:
tags
:
...
...