-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f9ca59
commit 8e63ec3
Showing
49 changed files
with
545 additions
and
85 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
72 changes: 72 additions & 0 deletions
72
...ment/handlers/management/api/resources/organizations/environments/DataPlanesResource.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,72 @@ | ||
/** | ||
* Copyright (C) 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.am.management.handlers.management.api.resources.organizations.environments; | ||
|
||
import io.gravitee.am.dataplane.api.DataPlane; | ||
import io.gravitee.am.management.handlers.management.api.resources.AbstractResource; | ||
import io.gravitee.am.model.Acl; | ||
import io.gravitee.am.model.permissions.Permission; | ||
import io.gravitee.am.plugins.dataplane.core.MultiDataPlaneLoader; | ||
import io.gravitee.common.http.MediaType; | ||
import io.reactivex.rxjava3.core.Maybe; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.ArraySchema; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.PathParam; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.container.AsyncResponse; | ||
import jakarta.ws.rs.container.Suspended; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
/** | ||
* @author David BRASSELY (david.brassely at graviteesource.com) | ||
* @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
@Tag(name = "dataPlane") | ||
public class DataPlanesResource extends AbstractResource { | ||
|
||
@Autowired | ||
private MultiDataPlaneLoader multiDataPlaneLoader; | ||
|
||
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@Operation( | ||
operationId = "listDataPlanes", | ||
summary = "List of data planes", | ||
description = "List all the data planes accessible to the current user. " + | ||
"User must have DOMAIN[CREATE] permission on the specified environment or organization") | ||
@ApiResponses({ | ||
@ApiResponse(responseCode = "200", description = "List accessible data planes for current user", | ||
content = @Content(mediaType = "application/json", | ||
array = @ArraySchema(schema = @Schema(implementation = DataPlane.class)))), | ||
@ApiResponse(responseCode = "500", description = "Internal server error")}) | ||
public void list( | ||
@PathParam("organizationId") String organizationId, | ||
@PathParam("environmentId") String environmentId, | ||
@Suspended final AsyncResponse response) { | ||
|
||
checkAnyPermission(organizationId, environmentId, Permission.DOMAIN, Acl.CREATE) | ||
.andThen(Maybe.just(multiDataPlaneLoader.getDataPlanes())) | ||
.subscribe(response::resume, response::resume); | ||
} | ||
|
||
} |
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
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
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
Oops, something went wrong.