-
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 1e0efd4
Showing
48 changed files
with
525 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* 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. | ||
*/ | ||
/* Gravitee.io - Access Management API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
import * as runtime from '../runtime'; | ||
import { | ||
DataPlane, | ||
DataPlaneFromJSON, | ||
DataPlaneToJSON, | ||
} from '../models'; | ||
|
||
export interface ListDataPlanesRequest { | ||
organizationId: string; | ||
environmentId: string; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export class DataPlaneApi extends runtime.BaseAPI { | ||
|
||
/** | ||
* List all the data planes accessible to the current user. User must have DOMAIN[CREATE] permission on the specified environment or organization | ||
* List of data planes | ||
*/ | ||
async listDataPlanesRaw(requestParameters: ListDataPlanesRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<Array<DataPlane>>> { | ||
if (requestParameters.organizationId === null || requestParameters.organizationId === undefined) { | ||
throw new runtime.RequiredError('organizationId','Required parameter requestParameters.organizationId was null or undefined when calling listDataPlanes.'); | ||
} | ||
|
||
if (requestParameters.environmentId === null || requestParameters.environmentId === undefined) { | ||
throw new runtime.RequiredError('environmentId','Required parameter requestParameters.environmentId was null or undefined when calling listDataPlanes.'); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
if (this.configuration && this.configuration.accessToken) { | ||
const token = this.configuration.accessToken; | ||
const tokenString = await token("gravitee-auth", []); | ||
|
||
if (tokenString) { | ||
headerParameters["Authorization"] = `Bearer ${tokenString}`; | ||
} | ||
} | ||
const response = await this.request({ | ||
path: `/organizations/{organizationId}/environments/{environmentId}/data-planes`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters.organizationId))).replace(`{${"environmentId"}}`, encodeURIComponent(String(requestParameters.environmentId))), | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(DataPlaneFromJSON)); | ||
} | ||
|
||
/** | ||
* List all the data planes accessible to the current user. User must have DOMAIN[CREATE] permission on the specified environment or organization | ||
* List of data planes | ||
*/ | ||
async listDataPlanes(requestParameters: ListDataPlanesRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<Array<DataPlane>> { | ||
const response = await this.listDataPlanesRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
} |
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.