Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(console): get integrations list and create integrations with stu…
…b response provided
- Loading branch information
1 parent
d164b83
commit 1c1de1f
Showing
3 changed files
with
169 additions
and
0 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
67 changes: 67 additions & 0 deletions
67
...va/io/gravitee/rest/api/management/v2/rest/resource/integration/IntegrationsResource.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,67 @@ | ||
/* | ||
* 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.rest.api.management.v2.rest.resource.integration; | ||
|
||
import io.gravitee.common.http.MediaType; | ||
import io.gravitee.rest.api.management.v2.rest.model.CreateIntegration; | ||
import io.gravitee.rest.api.management.v2.rest.model.Integration; | ||
import io.gravitee.rest.api.management.v2.rest.resource.AbstractResource; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.ws.rs.*; | ||
import jakarta.ws.rs.core.Response; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
/** | ||
* @author Remi Baptiste (remi.baptiste at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
@Path("/environments/{envId}/integrations") | ||
@Slf4j | ||
public class IntegrationsResource extends AbstractResource { | ||
|
||
private static final List<Integration> integrationsMock = new ArrayList<>(); | ||
|
||
@POST | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
public Response createIntegration(@Valid @NotNull final CreateIntegration integration) { | ||
|
||
Integration mockIntegration = Integration.builder() | ||
.id(UUID.randomUUID().toString()) | ||
.name("Mock integration") | ||
.description("Sample description") | ||
.provider("AWS") | ||
.build(); | ||
integrationsMock.add(mockIntegration); | ||
|
||
return Response | ||
.created(this.getLocationHeader(mockIntegration.getId())) | ||
.entity(mockIntegration) | ||
.build(); | ||
} | ||
|
||
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public Response listIntegrations(@PathParam("envId") String environmentId) { | ||
return Response.ok().entity(integrationsMock).build(); | ||
} | ||
|
||
} |
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