-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement DiscoverIntegrationAssetUseCase
Implement business rules for the Federation Discovery feature. It is currently not "callable" as we don't have any endpoint on the REST API or an actual implementation of IntegrationAgent. However, it should contain everything necessary for the creation of the new type of API https://gravitee.atlassian.net/browse/APIM-4204
- Loading branch information
1 parent
d863b6b
commit 2071783
Showing
16 changed files
with
941 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...main/java/io/gravitee/apim/core/api/domain_service/ValidateFederatedApiDomainService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.apim.core.api.domain_service; | ||
|
||
import io.gravitee.apim.core.DomainService; | ||
import io.gravitee.apim.core.api.model.Api; | ||
import io.gravitee.apim.core.exception.ValidationDomainException; | ||
import io.gravitee.definition.model.DefinitionVersion; | ||
import io.gravitee.rest.api.service.exceptions.InvalidDataException; | ||
|
||
@DomainService | ||
public class ValidateFederatedApiDomainService { | ||
|
||
public Api validateAndSanitizeForCreation(final Api api) { | ||
if (api.getDefinitionVersion() != DefinitionVersion.FEDERATED) { | ||
throw new ValidationDomainException("Definition version is unsupported, should be FEDERATED"); | ||
} | ||
|
||
// Reset lifecycle state as Federated API are not deployed on Gateway | ||
api.setLifecycleState(null); | ||
|
||
return api; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...c/main/java/io/gravitee/apim/core/integration/exception/IntegrationNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.apim.core.integration.exception; | ||
|
||
import io.gravitee.apim.core.exception.NotFoundDomainException; | ||
|
||
public class IntegrationNotFoundException extends NotFoundDomainException { | ||
|
||
public IntegrationNotFoundException(String id) { | ||
super("Integration not found.", id); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ee-apim-rest-api-service/src/main/java/io/gravitee/apim/core/integration/model/Asset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.apim.core.integration.model; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder(toBuilder = true) | ||
public record Asset(String integrationId, String id, String name, String description, String version) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...est-api-service/src/main/java/io/gravitee/apim/core/integration/spi/IntegrationAgent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.apim.core.integration.spi; | ||
|
||
import io.gravitee.apim.core.integration.model.Asset; | ||
import io.gravitee.apim.core.integration.model.Integration; | ||
import io.reactivex.rxjava3.core.Flowable; | ||
|
||
public interface IntegrationAgent { | ||
Flowable<Asset> fetchAllAssets(Integration integration); | ||
} |
Oops, something went wrong.