Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rest.service.listing.provider): Added REST Api for Service Listing #4857

Merged
merged 18 commits into from
Sep 20, 2023

Conversation

sfiorani
Copy link
Contributor

@sfiorani sfiorani commented Sep 14, 2023

This PR introduces a new REST API that can retrieve the list of kura.service.pid of services running on Kura, or the same list but filtered through the interfaces that the services must implement.

Methods added:

GET method --> serviceListing/v1/list --> get all services
POST method --> serviceListing/v1/list/byAllInterfaces --> get filtered services

"interfacesIds" body example:

{
  "interfacesIds": [
    "org.eclipse.kura.configuration.ConfigurableComponent"
  ]
}

Related Issue:

Description of the solution adopted:

Screenshots:

Manual Tests:

Any side note on the changes made:

@sfiorani sfiorani force-pushed the services-rest-listing branch from 547bcc9 to 360e044 Compare September 15, 2023 09:55
@sfiorani sfiorani marked this pull request as ready for review September 15, 2023 09:55
name="RequestHandlerRegistry"
policy="dynamic"/>

<reference interface="org.osgi.service.useradmin.UserAdmin"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the specific kura.permission.rest.serviceListing role and allow access to this rest API to any authenticated user. If this is done this reference is not required.


public class InterfacesIdsDTO {

private final List<String> interfacesIds;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try changing this to Set, in this way duplicates are removed from request automatically.

private static final String REQUEST_DEBUG_MESSAGE = "Received request from: '{}'";

private static final String APP_ID_MQTT = "SERLIST-V1";
private static final String REST_ROLE = "kura.permission.rest.serviceListing";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the specific kura.permission.rest.serviceListing role and allow access to this rest API to any authenticated user. If this is done this constant is not required.

}
}

public void bindUserAdmin(UserAdmin userAdmin) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed if we are removing the role

@nicolatimeus
Copy link
Contributor

@nicolatimeus nicolatimeus merged commit ecce7db into eclipse-kura:develop Sep 20, 2023
pierantoniomerlino pushed a commit that referenced this pull request Sep 26, 2023
…ng (#4857)

* Added temporary  bundle

Signed-off-by: SimoneFiorani <[email protected]>

* General bundle for both SSL and Keystore services

Signed-off-by: SimoneFiorani <[email protected]>

* GET works correctly, POST needs filter implementation

Signed-off-by: SimoneFiorani <[email protected]>

* Added POST api

Signed-off-by: SimoneFiorani <[email protected]>

* Turned apis into general ones: get and post working correctly

Signed-off-by: SimoneFiorani <[email protected]>

* Updated bundle name and structure. Only tests missing

Signed-off-by: SimoneFiorani <[email protected]>

* Added tests. General improvements

Signed-off-by: SimoneFiorani <[email protected]>

* Changed test response on full list test

Signed-off-by: SimoneFiorani <[email protected]>

* Updated test

Signed-off-by: SimoneFiorani <[email protected]>

* Updated tests

Signed-off-by: SimoneFiorani <[email protected]>

* Added MQTT test, fixed wrong POST body, renamed various files and bundle

Signed-off-by: SimoneFiorani <[email protected]>

* Updated provider

Signed-off-by: SimoneFiorani <[email protected]>

* Trying to resolve build failures

Signed-off-by: SimoneFiorani <[email protected]>

* Added principal check. Tests updated

Signed-off-by: SimoneFiorani <[email protected]>

* Generale clean up

Signed-off-by: SimoneFiorani <[email protected]>

* Update ServiceListingEndpointsTest.java

* Missing headers added

Signed-off-by: SimoneFiorani <[email protected]>

* Removed <sorted> word from service

---------

Signed-off-by: SimoneFiorani <[email protected]>
GregoryIvo pushed a commit to GregoryIvo/kura that referenced this pull request Sep 28, 2023
…ng (eclipse-kura#4857)

* Added temporary  bundle

Signed-off-by: SimoneFiorani <[email protected]>

* General bundle for both SSL and Keystore services

Signed-off-by: SimoneFiorani <[email protected]>

* GET works correctly, POST needs filter implementation

Signed-off-by: SimoneFiorani <[email protected]>

* Added POST api

Signed-off-by: SimoneFiorani <[email protected]>

* Turned apis into general ones: get and post working correctly

Signed-off-by: SimoneFiorani <[email protected]>

* Updated bundle name and structure. Only tests missing

Signed-off-by: SimoneFiorani <[email protected]>

* Added tests. General improvements

Signed-off-by: SimoneFiorani <[email protected]>

* Changed test response on full list test

Signed-off-by: SimoneFiorani <[email protected]>

* Updated test

Signed-off-by: SimoneFiorani <[email protected]>

* Updated tests

Signed-off-by: SimoneFiorani <[email protected]>

* Added MQTT test, fixed wrong POST body, renamed various files and bundle

Signed-off-by: SimoneFiorani <[email protected]>

* Updated provider

Signed-off-by: SimoneFiorani <[email protected]>

* Trying to resolve build failures

Signed-off-by: SimoneFiorani <[email protected]>

* Added principal check. Tests updated

Signed-off-by: SimoneFiorani <[email protected]>

* Generale clean up

Signed-off-by: SimoneFiorani <[email protected]>

* Update ServiceListingEndpointsTest.java

* Missing headers added

Signed-off-by: SimoneFiorani <[email protected]>

* Removed <sorted> word from service

---------

Signed-off-by: SimoneFiorani <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants