From ac853c1e7186b10e34e392918af31e4ac62b45c2 Mon Sep 17 00:00:00 2001 From: Michael Hwang Date: Tue, 14 Feb 2017 15:10:16 +0000 Subject: Make first commit Transferring from original dcae project Issue-Id: DCAEGEN2-45 Change-Id: If8500f4a120ec2d27a714c8917f163beb57ee64c Signed-off-by: Michael Hwang --- src/gen/java/io/swagger/api/ApiException.java | 30 ++++ src/gen/java/io/swagger/api/ApiOriginFilter.java | 42 +++++ .../java/io/swagger/api/ApiResponseMessage.java | 89 +++++++++++ .../java/io/swagger/api/DcaeServiceTypesApi.java | 172 ++++++++++++++++++++ .../io/swagger/api/DcaeServiceTypesApiService.java | 43 +++++ src/gen/java/io/swagger/api/DcaeServicesApi.java | 178 +++++++++++++++++++++ .../io/swagger/api/DcaeServicesApiService.java | 43 +++++ .../io/swagger/api/DcaeServicesGroupbyApi.java | 59 +++++++ .../swagger/api/DcaeServicesGroupbyApiService.java | 31 ++++ .../java/io/swagger/api/JacksonJsonProvider.java | 39 +++++ src/gen/java/io/swagger/api/NotFoundException.java | 35 ++++ src/gen/java/io/swagger/api/StringUtil.java | 62 +++++++ 12 files changed, 823 insertions(+) create mode 100644 src/gen/java/io/swagger/api/ApiException.java create mode 100644 src/gen/java/io/swagger/api/ApiOriginFilter.java create mode 100644 src/gen/java/io/swagger/api/ApiResponseMessage.java create mode 100644 src/gen/java/io/swagger/api/DcaeServiceTypesApi.java create mode 100644 src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java create mode 100644 src/gen/java/io/swagger/api/DcaeServicesApi.java create mode 100644 src/gen/java/io/swagger/api/DcaeServicesApiService.java create mode 100644 src/gen/java/io/swagger/api/DcaeServicesGroupbyApi.java create mode 100644 src/gen/java/io/swagger/api/DcaeServicesGroupbyApiService.java create mode 100644 src/gen/java/io/swagger/api/JacksonJsonProvider.java create mode 100644 src/gen/java/io/swagger/api/NotFoundException.java create mode 100644 src/gen/java/io/swagger/api/StringUtil.java (limited to 'src/gen/java/io/swagger/api') diff --git a/src/gen/java/io/swagger/api/ApiException.java b/src/gen/java/io/swagger/api/ApiException.java new file mode 100644 index 0000000..cdc6162 --- /dev/null +++ b/src/gen/java/io/swagger/api/ApiException.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public class ApiException extends Exception{ + private int code; + public ApiException (int code, String msg) { + super(msg); + this.code = code; + } +} diff --git a/src/gen/java/io/swagger/api/ApiOriginFilter.java b/src/gen/java/io/swagger/api/ApiOriginFilter.java new file mode 100644 index 0000000..b6f29f2 --- /dev/null +++ b/src/gen/java/io/swagger/api/ApiOriginFilter.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +import java.io.IOException; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public class ApiOriginFilter implements javax.servlet.Filter { + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + public void destroy() {} + + public void init(FilterConfig filterConfig) throws ServletException {} +} diff --git a/src/gen/java/io/swagger/api/ApiResponseMessage.java b/src/gen/java/io/swagger/api/ApiResponseMessage.java new file mode 100644 index 0000000..bf4e13a --- /dev/null +++ b/src/gen/java/io/swagger/api/ApiResponseMessage.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +import javax.xml.bind.annotation.XmlTransient; + +@javax.xml.bind.annotation.XmlRootElement +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public class ApiResponseMessage { + public static final int ERROR = 1; + public static final int WARNING = 2; + public static final int INFO = 3; + public static final int OK = 4; + public static final int TOO_BUSY = 5; + + int code; + String type; + String message; + + public ApiResponseMessage(){} + + public ApiResponseMessage(int code, String message){ + this.code = code; + switch(code){ + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + @XmlTransient + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java b/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java new file mode 100644 index 0000000..72f1f63 --- /dev/null +++ b/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +import io.swagger.api.factories.DcaeServiceTypesApiServiceFactory; + +import io.swagger.annotations.ApiParam; + +import io.swagger.model.InlineResponse200; +import io.swagger.model.DCAEServiceType; +import io.swagger.model.DCAEServiceTypeRequest; + +import javax.validation.Valid; +import javax.ws.rs.core.*; +import javax.ws.rs.*; + +@Path("/dcae-service-types") +@Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"}) +@Produces({"application/json", "application/vnd.dcae.inventory.v1+json"}) +@io.swagger.annotations.Api(description = "the dcae-service-types API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public class DcaeServiceTypesApi { + private final DcaeServiceTypesApiService delegate = DcaeServiceTypesApiServiceFactory.getDcaeServiceTypesApi(); + + @Context + UriInfo uriInfo; + + public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeName, Boolean onlyLatest, Boolean onlyActive, + String vnfType, String serviceId, String serviceLocation, String asdcServiceId, + String asdcResourceId, Integer offset) { + UriBuilder ub = uriInfo.getBaseUriBuilder().path(DcaeServiceTypesApi.class) + .path(DcaeServiceTypesApi.class, "dcaeServiceTypesGet"); + + if (typeName != null) { + ub.queryParam("typeName", typeName); + } + if (onlyLatest != null) { + ub.queryParam("onlyLatest", onlyLatest); + } + if (onlyActive != null) { + ub.queryParam("onlyActive", onlyActive); + } + if (vnfType != null) { + ub.queryParam("vnfType", vnfType); + } + if (serviceId != null) { + ub.queryParam("serviceId", serviceId); + } + if (serviceLocation != null) { + ub.queryParam("serviceLocation", serviceLocation); + } + if (asdcServiceId != null) { + ub.queryParam("asdcServiceId", asdcServiceId); + } + if (asdcResourceId != null) { + ub.queryParam("asdcResourceId", asdcResourceId); + } + if (offset != null) { + ub.queryParam("offset", offset); + } + + Link.Builder lb = Link.fromUri(ub.build()); + lb.rel(rel); + return lb.build(); + } + + @GET + @Path("/") + @Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @Produces({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @io.swagger.annotations.ApiOperation(value = "", notes = "Get a list of `DCAEServiceType` objects.", response = InlineResponse200.class, tags = {}) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "List of `DCAEServiceType` objects", response = InlineResponse200.class)}) + public Response dcaeServiceTypesGet( + @ApiParam(value = "Filter by service type name") @QueryParam("typeName") String typeName, + @ApiParam(value = "If set to true, query returns just the latest versions of DCAE service types. If set to false, then all versions are returned. Default is true") + @DefaultValue("true") @QueryParam("onlyLatest") Boolean onlyLatest, + @ApiParam(value = "If set to true, query returns only *active* DCAE service types. If set to false, then all DCAE service types are returned. Default is true") + @DefaultValue("true") @QueryParam("onlyActive") Boolean onlyActive, + @ApiParam(value = "Filter by associated vnf type. No wildcards, matches are explicit. This field is treated case insensitive.") + @QueryParam("vnfType") String vnfType, + @ApiParam(value = "Filter by assocaited service id. Instances with service id null or empty is always returned.") + @QueryParam("serviceId") String serviceId, + @ApiParam(value = "Filter by associated service location. Instances with service location null or empty is always returned.") + @QueryParam("serviceLocation") String serviceLocation, + @ApiParam(value = "Filter by associated asdc design service id. Setting this to `NONE` will return instances that have asdc service id set to null") + @QueryParam("asdcServiceId") String asdcServiceId, + @ApiParam(value = "Filter by associated asdc design resource id. Setting this to `NONE` will return instances that have asdc resource id set to null") + @QueryParam("asdcResourceId") String asdcResourceId, + @ApiParam(value = "Query resultset offset used for pagination (zero-based)") @QueryParam("offset") Integer offset, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.dcaeServiceTypesGet(typeName, onlyLatest, onlyActive, vnfType, serviceId, serviceLocation, + asdcServiceId, asdcResourceId, offset, uriInfo, securityContext); + } + + public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeId) { + // This same method can be used for PUTs as well + + UriBuilder ub = uriInfo.getBaseUriBuilder().path(DcaeServiceTypesApi.class) + .path(DcaeServiceTypesApi.class, "dcaeServiceTypesTypeIdGet"); + Link.Builder lb = Link.fromUri(ub.build(typeId)); + lb.rel(rel); + return lb.build(); + } + + @GET + @Path("/{typeId}") + @Consumes({"application/json"}) + @Produces({"application/json"}) + @io.swagger.annotations.ApiOperation(value = "", notes = "Get a `DCAEServiceType` object.", response = DCAEServiceType.class, tags = {}) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Single `DCAEServiceType` object", response = DCAEServiceType.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "Resource not found", response = DCAEServiceType.class)}) + public Response dcaeServiceTypesTypeIdGet( + @ApiParam(value = "", required = true) @PathParam("typeId") String typeId, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.dcaeServiceTypesTypeIdGet(typeId, uriInfo, securityContext); + } + + @POST + @Path("/") + @Consumes({"application/json"}) + @Produces({"application/json"}) + @io.swagger.annotations.ApiOperation(value = "", notes = "Inserts a new `DCAEServiceType` or updates an existing instance. Updates are only allowed iff there are no running DCAE services of the requested type,", + response = DCAEServiceType.class, tags = {}) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Single `DCAEServiceType` object.", response = DCAEServiceType.class), + @io.swagger.annotations.ApiResponse(code = 400, message = "Bad request provided.", response = ApiResponseMessage.class), + @io.swagger.annotations.ApiResponse(code = 409, message = "Failed to update because there are still DCAE services of the requested type running.", response = ApiResponseMessage.class)}) + public Response dcaeServiceTypesTypeNamePut( + @ApiParam(value = "", required = true) @Valid DCAEServiceTypeRequest request, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.dcaeServiceTypesTypeIdPost(request, uriInfo, securityContext); + } + + @DELETE + @Path("/{typeId}") + @io.swagger.annotations.ApiOperation(value = "", notes = "Deactivates existing `DCAEServiceType` instances", response = DCAEServiceType.class, tags = {}) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "`DCAEServiceType` has been deactivated", response = ApiResponseMessage.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "`DCAEServiceType` not found", response = ApiResponseMessage.class), + @io.swagger.annotations.ApiResponse(code = 410, message = "`DCAEServiceType` already gone", response = ApiResponseMessage.class) + }) + public Response dcaeServiceTypesTypeIdDelete( + @ApiParam(value = "", required = true) @PathParam("typeId") String typeId, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.dcaeServiceTypesTypeIdDelete(typeId, uriInfo, securityContext); + } + +} diff --git a/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java b/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java new file mode 100644 index 0000000..afc7476 --- /dev/null +++ b/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +import io.swagger.model.DCAEServiceTypeRequest; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.core.UriInfo; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public abstract class DcaeServiceTypesApiService { + public abstract Response dcaeServiceTypesGet(String typeName, Boolean onlyLatest, Boolean onlyActive, + String vnfType, String serviceId, String serviceLocation, + String asdcServiceId, String asdcResourceId, + Integer offset, UriInfo uriInfo, SecurityContext securityContext) + throws NotFoundException; + public abstract Response dcaeServiceTypesTypeIdGet(String typeId, UriInfo uriInfo, SecurityContext securityContext) + throws NotFoundException; + public abstract Response dcaeServiceTypesTypeIdPost(DCAEServiceTypeRequest request, UriInfo uriInfo, + SecurityContext securityContext) + throws NotFoundException; + public abstract Response dcaeServiceTypesTypeIdDelete(String typeId, UriInfo uriInfo, SecurityContext securityContext) + throws NotFoundException; +} diff --git a/src/gen/java/io/swagger/api/DcaeServicesApi.java b/src/gen/java/io/swagger/api/DcaeServicesApi.java new file mode 100644 index 0000000..55d79f3 --- /dev/null +++ b/src/gen/java/io/swagger/api/DcaeServicesApi.java @@ -0,0 +1,178 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +import io.dropwizard.jersey.params.DateTimeParam; +import io.swagger.api.factories.DcaeServicesApiServiceFactory; + +import io.swagger.annotations.ApiParam; + +import io.swagger.model.InlineResponse2001; +import io.swagger.model.DCAEService; +import io.swagger.model.DCAEServiceRequest; +import org.joda.time.DateTime; + +import javax.validation.Valid; +import javax.ws.rs.core.*; +import javax.ws.rs.*; + +@Path("/dcae-services") +@Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"}) +@Produces({"application/json", "application/vnd.dcae.inventory.v1+json"}) +@io.swagger.annotations.Api(description = "the dcae-services API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public class DcaeServicesApi { + private final DcaeServicesApiService delegate = DcaeServicesApiServiceFactory.getDcaeServicesApi(); + + @Context + UriInfo uriInfo; + + public static Link buildLinkForGetByTypeId(UriInfo uriInfo, String rel, String typeId) { + return buildLinkForGet(uriInfo, rel, typeId, null, null, null, null, null, null, null); + } + + public static Link buildLinkForGetByVnfType(UriInfo uriInfo, String rel, String vnfType) { + return buildLinkForGet(uriInfo, rel, null, null, vnfType, null, null, null, null, null); + } + + public static Link buildLinkForGetByVnfLocation(UriInfo uriInfo, String rel, String vnfLocation) { + return buildLinkForGet(uriInfo, rel, null, null, null, vnfLocation, null, null, null, null); + } + + public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeId, String vnfId, String vnfType, + String vnfLocation, String componentType, Boolean shareable, DateTime created, + Integer offset) { + UriBuilder ub = uriInfo.getBaseUriBuilder().path(DcaeServicesApi.class) + .path(DcaeServicesApi.class, "dcaeServicesGet"); + + if (typeId != null) { + ub.queryParam("typeId", typeId); + } + if (vnfId != null) { + ub.queryParam("vnfId", vnfId); + } + if (vnfType != null) { + ub.queryParam("vnfType", vnfType); + } + if (vnfLocation != null) { + ub.queryParam("vnfLocation", vnfLocation); + } + if (componentType != null) { + ub.queryParam("componentType", componentType); + } + if (shareable != null) { + ub.queryParam("shareable", shareable.toString()); + } + if (created != null) { + ub.queryParam("created", created.toString()); + } + if (offset != null) { + ub.queryParam("offset", offset); + } + + Link.Builder lb = Link.fromUri(ub.build()); + lb.rel(rel); + return lb.build(); + } + + @GET + @Path("/") + @Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @Produces({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @io.swagger.annotations.ApiOperation(value = "", notes = "Get a list of `DCAEService` objects.", response = InlineResponse2001.class, tags = {}) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "List of `DCAEService` objects", response = InlineResponse2001.class), + @io.swagger.annotations.ApiResponse(code = 502, message = "Bad response from DCAE controller", response = ApiResponseMessage.class), + @io.swagger.annotations.ApiResponse(code = 504, message = "Failed to connect with DCAE controller", response = ApiResponseMessage.class)}) + public Response dcaeServicesGet( + @ApiParam(value = "DCAE service type name") @QueryParam("typeId") String typeId, + @ApiParam(value = "") @QueryParam("vnfId") String vnfId, + @ApiParam(value = "Filter by associated vnf type. This field is treated case insensitive.") + @QueryParam("vnfType") String vnfType, + @ApiParam(value = "") @QueryParam("vnfLocation") String vnfLocation, + @ApiParam(value = "Use to filter by a specific DCAE service component type") @QueryParam("componentType") String componentType, + @ApiParam(value = "Use to filter by DCAE services that have shareable components or not") @QueryParam("shareable") Boolean shareable, + @ApiParam(value = "Use to filter by created time") @QueryParam("created") DateTimeParam created, + @ApiParam(value = "Query resultset offset used for pagination (zero-based)") @QueryParam("offset") Integer offset, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.dcaeServicesGet(typeId, vnfId, vnfType, vnfLocation, componentType, shareable, + (created == null ? null : created.get()), offset, uriInfo, securityContext); + } + + public static Link buildLinkForGet(UriInfo uriInfo, String rel, String serviceId) { + // This same method can be used for PUTs as well + + UriBuilder ub = uriInfo.getBaseUriBuilder().path(DcaeServicesApi.class) + .path(DcaeServicesApi.class, "dcaeServicesServiceIdGet"); + Link.Builder lb = Link.fromUri(ub.build(serviceId)); + lb.rel(rel); + return lb.build(); + } + + @GET + @Path("/{serviceId}") + @Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @Produces({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @io.swagger.annotations.ApiOperation(value = "", notes = "Get a `DCAEService` object.", response = DCAEService.class, tags = {}) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Single `DCAEService` object", response = DCAEService.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "DCAE service not found", response = ApiResponseMessage.class), + @io.swagger.annotations.ApiResponse(code = 502, message = "Bad response from DCAE controller", response = ApiResponseMessage.class), + @io.swagger.annotations.ApiResponse(code = 504, message = "Failed to connect with DCAE controller", response = ApiResponseMessage.class)}) + public Response dcaeServicesServiceIdGet( + @ApiParam(value = "", required = true) @PathParam("serviceId") String serviceId, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.dcaeServicesServiceIdGet(serviceId, uriInfo, securityContext); + } + + @PUT + @Path("/{serviceId}") + @Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @Produces({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @io.swagger.annotations.ApiOperation(value = "", notes = "Put a new or update an existing `DCAEService` object.", response = DCAEService.class, tags = {}) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Single `DCAEService` object", response = DCAEService.class), + @io.swagger.annotations.ApiResponse(code = 422, message = "Bad request provided", response = ApiResponseMessage.class)}) + public Response dcaeServicesServiceIdPut( + @ApiParam(value = "", required = true) @PathParam("serviceId") String serviceId, + @ApiParam(value = "", required = true) @Valid DCAEServiceRequest request, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.dcaeServicesServiceIdPut(serviceId, request, uriInfo, securityContext); + } + + @DELETE + @Path("/{serviceId}") + @Produces({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @io.swagger.annotations.ApiOperation(value = "", notes = "Remove an existing `DCAEService` object.", tags = {}) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "DCAE service has been removed"), + @io.swagger.annotations.ApiResponse(code = 404, message = "Unknown DCAE service", response = ApiResponseMessage.class)}) + public Response dcaeServicesServiceIdDelete( + @ApiParam(value = "", required = true) @PathParam("serviceId") String serviceId, + @Context SecurityContext securityContext) + throws NotFoundException + { + return delegate.dcaeServicesServiceIdDelete(serviceId, securityContext); + } +} diff --git a/src/gen/java/io/swagger/api/DcaeServicesApiService.java b/src/gen/java/io/swagger/api/DcaeServicesApiService.java new file mode 100644 index 0000000..99f9f25 --- /dev/null +++ b/src/gen/java/io/swagger/api/DcaeServicesApiService.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +import io.swagger.model.DCAEServiceRequest; +import org.joda.time.DateTime; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.core.UriInfo; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public abstract class DcaeServicesApiService { + public abstract Response dcaeServicesGet(String typeId, String vnfId, String vnfType, String vnfLocation, + String componentType, Boolean shareable, DateTime created, Integer offset, + UriInfo uriInfo, SecurityContext securityContext) + throws NotFoundException; + public abstract Response dcaeServicesServiceIdGet(String serviceId, UriInfo uriInfo, SecurityContext securityContext) + throws NotFoundException; + public abstract Response dcaeServicesServiceIdPut(String serviceId, DCAEServiceRequest request, UriInfo uriInfo, + SecurityContext securityContext) + throws NotFoundException; + public abstract Response dcaeServicesServiceIdDelete(String serviceId, SecurityContext securityContext) + throws NotFoundException; +} diff --git a/src/gen/java/io/swagger/api/DcaeServicesGroupbyApi.java b/src/gen/java/io/swagger/api/DcaeServicesGroupbyApi.java new file mode 100644 index 0000000..d108e31 --- /dev/null +++ b/src/gen/java/io/swagger/api/DcaeServicesGroupbyApi.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +import io.swagger.api.factories.DcaeServicesGroupbyApiServiceFactory; + +import io.swagger.annotations.ApiParam; + +import io.swagger.model.DCAEServiceGroupByResults; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; +import javax.ws.rs.core.UriInfo; + +@Path("/dcae-services-groupby") +@Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"}) +@Produces({"application/json", "application/vnd.dcae.inventory.v1+json"}) +@io.swagger.annotations.Api(description = "the dcae-services-groupby API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public class DcaeServicesGroupbyApi { + private final DcaeServicesGroupbyApiService delegate = DcaeServicesGroupbyApiServiceFactory.getDcaeServicesGroupbyApi(); + + @Context + UriInfo uriInfo; + + @GET + @Path("/{propertyName}") + @Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @Produces({"application/json", "application/vnd.dcae.inventory.v1+json"}) + @io.swagger.annotations.ApiOperation(value = "", notes = "Get a list of unique values for the given `propertyName`", response = DCAEServiceGroupByResults.class, tags = {}) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "List of unique property values", response = DCAEServiceGroupByResults.class)}) + public Response dcaeServicesGroupbyPropertyNameGet( + @ApiParam(value = "Property to find unique values. Restricted to `type`, `vnfType`, `vnfLocation`", required = true) @PathParam("propertyName") String propertyName, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.dcaeServicesGroupbyPropertyNameGet(propertyName, uriInfo, securityContext); + } +} diff --git a/src/gen/java/io/swagger/api/DcaeServicesGroupbyApiService.java b/src/gen/java/io/swagger/api/DcaeServicesGroupbyApiService.java new file mode 100644 index 0000000..bc25d4e --- /dev/null +++ b/src/gen/java/io/swagger/api/DcaeServicesGroupbyApiService.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.core.UriInfo; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public abstract class DcaeServicesGroupbyApiService { + public abstract Response dcaeServicesGroupbyPropertyNameGet(String propertyName, UriInfo uriInfo, SecurityContext securityContext) + throws NotFoundException; +} diff --git a/src/gen/java/io/swagger/api/JacksonJsonProvider.java b/src/gen/java/io/swagger/api/JacksonJsonProvider.java new file mode 100644 index 0000000..c7a5db2 --- /dev/null +++ b/src/gen/java/io/swagger/api/JacksonJsonProvider.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; +import io.swagger.util.Json; + +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.ext.Provider; + +@Provider +@Produces({MediaType.APPLICATION_JSON}) +public class JacksonJsonProvider extends JacksonJaxbJsonProvider { + private static ObjectMapper commonMapper = Json.mapper(); + + public JacksonJsonProvider() { + super.setMapper(commonMapper); + } +} diff --git a/src/gen/java/io/swagger/api/NotFoundException.java b/src/gen/java/io/swagger/api/NotFoundException.java new file mode 100644 index 0000000..3eb483f --- /dev/null +++ b/src/gen/java/io/swagger/api/NotFoundException.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public class NotFoundException extends ApiException { + private int code; + + public int getCode() { + return this.code; + } + + public NotFoundException (int code, String msg) { + super(code, msg); + this.code = code; + } +} diff --git a/src/gen/java/io/swagger/api/StringUtil.java b/src/gen/java/io/swagger/api/StringUtil.java new file mode 100644 index 0000000..e20f46f --- /dev/null +++ b/src/gen/java/io/swagger/api/StringUtil.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * dcae-inventory + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package io.swagger.api; + +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) return true; + if (value != null && value.equalsIgnoreCase(str)) return true; + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) return ""; + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} -- cgit 1.2.3-korg