Skip to content

Commit

Permalink
Merge pull request wso2#12418 from RakhithaRR/devops-revamp
Browse files Browse the repository at this point in the history
Rename DevOps API parameters
  • Loading branch information
RakhithaRR authored Apr 22, 2024
2 parents a8a3d64 + 2a17116 commit d2fa205
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,41 @@ public class TenantLogsApi {


@GET
@Path("/{tenantId}/apis/{apiId}")
@Path("/{tenant}/apis/{apiId}")

@Produces({ "application/json" })
@ApiOperation(value = "GET log enabled API data ", notes = "", response = LoggingApiOutputListDTO.class, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Logs enabled API details", response = LoggingApiOutputListDTO.class),
@ApiResponse(code = 404, message = "Not Found. Request API resource or external store Ids not found. ", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal server error while retrieving API data to be logged", response = ErrorDTO.class) })
public Response tenantLogsTenantIdApisApiIdGet(@ApiParam(value = "Tenant ID ",required=true) @PathParam("tenantId") String tenantId, @ApiParam(value = "The API ID for the logging operation ",required=true) @PathParam("apiId") String apiId) throws APIManagementException{
return delegate.tenantLogsTenantIdApisApiIdGet(tenantId, apiId, securityContext);
public Response tenantLogsTenantApisApiIdGet(@ApiParam(value = "Tenant (organization) name ",required=true) @PathParam("tenant") String tenant, @ApiParam(value = "The API ID for the logging operation ",required=true) @PathParam("apiId") String apiId) throws APIManagementException{
return delegate.tenantLogsTenantApisApiIdGet(tenant, apiId, securityContext);
}

@PUT
@Path("/{tenantId}/apis/{apiId}")
@Path("/{tenant}/apis/{apiId}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Set logging levels of the API with its api ID ", notes = "This operation enables you to provide the API context template(context/version) with the log level (OFF|BASIC|STANDARD|FULL). You should either provide the api ID and the api log level. ", response = LoggingApiOutputListDTO.class, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully Enabled the logs for the API", response = LoggingApiOutputListDTO.class),
@ApiResponse(code = 404, message = "Not Found. Request API resource or external store Ids not found. ", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal server error while configuring API to be logged", response = ErrorDTO.class) })
public Response tenantLogsTenantIdApisApiIdPut(@ApiParam(value = "Tenant ID ",required=true) @PathParam("tenantId") String tenantId, @ApiParam(value = "The API ID for the logging operation ",required=true) @PathParam("apiId") String apiId, @ApiParam(value = "The logLeve is provided as a payload. " ) LoggingApiInputDTO loggingApiInputDTO) throws APIManagementException{
return delegate.tenantLogsTenantIdApisApiIdPut(tenantId, apiId, loggingApiInputDTO, securityContext);
public Response tenantLogsTenantApisApiIdPut(@ApiParam(value = "Tenant (organization) name ",required=true) @PathParam("tenant") String tenant, @ApiParam(value = "The API ID for the logging operation ",required=true) @PathParam("apiId") String apiId, @ApiParam(value = "The logLeve is provided as a payload. " ) LoggingApiInputDTO loggingApiInputDTO) throws APIManagementException{
return delegate.tenantLogsTenantApisApiIdPut(tenant, apiId, loggingApiInputDTO, securityContext);
}

@GET
@Path("/{tenantId}/apis/")
@Path("/{tenant}/apis/")

@Produces({ "application/json" })
@ApiOperation(value = "GET log level of APIs ", notes = "", response = LoggingApiOutputListDTO.class, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Log level of APIs", response = LoggingApiOutputListDTO.class),
@ApiResponse(code = 404, message = "Not Found. Request API resource or external store Ids not found. ", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal server error while retrieving API data to be logged", response = ErrorDTO.class) })
public Response tenantLogsTenantIdApisGet(@ApiParam(value = "Tenant ID ",required=true) @PathParam("tenantId") String tenantId, @ApiParam(value = "Log level of the APIs ") @QueryParam("log-level") String logLevel) throws APIManagementException{
return delegate.tenantLogsTenantIdApisGet(tenantId, logLevel, securityContext);
public Response tenantLogsTenantApisGet(@ApiParam(value = "Tenant (organization) name ",required=true) @PathParam("tenant") String tenant, @ApiParam(value = "Log level of the APIs ") @QueryParam("log-level") String logLevel) throws APIManagementException{
return delegate.tenantLogsTenantApisGet(tenant, logLevel, securityContext);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


public interface TenantLogsApiService {
public Response tenantLogsTenantIdApisApiIdGet(String tenantId, String apiId, MessageContext messageContext) throws APIManagementException;
public Response tenantLogsTenantIdApisApiIdPut(String tenantId, String apiId, LoggingApiInputDTO loggingApiInputDTO, MessageContext messageContext) throws APIManagementException;
public Response tenantLogsTenantIdApisGet(String tenantId, String logLevel, MessageContext messageContext) throws APIManagementException;
public Response tenantLogsTenantApisApiIdGet(String tenant, String apiId, MessageContext messageContext) throws APIManagementException;
public Response tenantLogsTenantApisApiIdPut(String tenant, String apiId, LoggingApiInputDTO loggingApiInputDTO, MessageContext messageContext) throws APIManagementException;
public Response tenantLogsTenantApisGet(String tenant, String logLevel, MessageContext messageContext) throws APIManagementException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@
*/
public class TenantLogsApiServiceImpl implements TenantLogsApiService {

public Response tenantLogsTenantIdApisApiIdGet(String tenantId, String apiId, MessageContext messageContext)
public Response tenantLogsTenantApisApiIdGet(String tenant, String apiId, MessageContext messageContext)
throws APIManagementException {
APILoggingImpl apiLoggingImpl = new APILoggingImpl();
List<APILogInfoDTO> apiLogInfoDTOList = apiLoggingImpl.getAPILoggerListByApiId(tenantId, apiId);
List<APILogInfoDTO> apiLogInfoDTOList = apiLoggingImpl.getAPILoggerListByApiId(tenant, apiId);
LoggingApiOutputListDTO loggingApiOutputListDT = DevopsAPIUtils.getLoggingAPIList(apiLogInfoDTOList);
return Response.ok().entity(loggingApiOutputListDT).build();
}

public Response tenantLogsTenantIdApisApiIdPut(String tenantId, String apiId, LoggingApiInputDTO loggingApiInputDTO,
public Response tenantLogsTenantApisApiIdPut(String tenant, String apiId, LoggingApiInputDTO loggingApiInputDTO,
MessageContext messageContext) throws APIManagementException {
if (apiId != null) {
if (DevopsAPIUtils.validateLogLevel(loggingApiInputDTO.getLogLevel())) {
APILoggingImpl apiLoggingImpl = new APILoggingImpl();
apiLoggingImpl.addUpdateAPILogger(tenantId, apiId, loggingApiInputDTO.getLogLevel().toUpperCase(),
apiLoggingImpl.addUpdateAPILogger(tenant, apiId, loggingApiInputDTO.getLogLevel().toUpperCase(),
loggingApiInputDTO.getResourceMethod(),loggingApiInputDTO.getResourcePath());
return Response.ok().entity(loggingApiInputDTO).build();
} else {
Expand All @@ -64,10 +64,10 @@ public Response tenantLogsTenantIdApisApiIdPut(String tenantId, String apiId, Lo
}
}

public Response tenantLogsTenantIdApisGet(String tenantId, String logLevel, MessageContext messageContext)
public Response tenantLogsTenantApisGet(String tenant, String logLevel, MessageContext messageContext)
throws APIManagementException {
APILoggingImpl apiLoggingImpl = new APILoggingImpl();
List<APILogInfoDTO> apiLogInfoDTOList = apiLoggingImpl.getAPILoggerList(tenantId, logLevel);
List<APILogInfoDTO> apiLogInfoDTOList = apiLoggingImpl.getAPILoggerList(tenant, logLevel);
LoggingApiOutputListDTO loggingApiOutputListDTO = DevopsAPIUtils.getLoggingAPIList(apiLogInfoDTOList);
return Response.ok().entity(loggingApiOutputListDTO).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ info:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
paths:
"/tenant-logs/{tenantId}/apis/":
"/tenant-logs/{tenant}/apis/":
get:
summary: |
GET log level of APIs
parameters:
- $ref: '#/components/parameters/tenantId'
- $ref: '#/components/parameters/tenant'
- $ref: '#/components/parameters/logLevel'
responses:
"200":
Expand All @@ -56,11 +56,11 @@ paths:
$ref: "#/components/schemas/Error"
x-code-samples:
- lang: Curl
source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
"https://127.0.0.1:9443/api/am/devops/v0/tenant-logs/1/apis?log-level=FULL"'
source: 'curl -k -H "Authorization: Basic YWRtaW46YWRtaW4="
"https://127.0.0.1:9443/api/am/devops/v0/tenant-logs/carbon.super/apis?log-level=FULL"'


"/tenant-logs/{tenantId}/apis/{apiId}":
"/tenant-logs/{tenant}/apis/{apiId}":
get:
summary: |
GET log enabled API data
Expand All @@ -86,12 +86,12 @@ paths:
schema:
$ref: "#/components/schemas/Error"
parameters:
- $ref: '#/components/parameters/tenantId'
- $ref: '#/components/parameters/tenant'
- $ref: '#/components/parameters/apiId'
x-code-samples:
- lang: Curl
source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
"https://127.0.0.1:9443/api/am/devops/v0/tenant-logs/1/apis/12d6e73c-778d-45ac-b57d-117c6c5092a4"'
source: 'curl -k -H "Authorization: Basic YWRtaW46YWRtaW4="
"https://127.0.0.1:9443/api/am/devops/v0/tenant-logs/carbon.super/apis/12d6e73c-778d-45ac-b57d-117c6c5092a4"'
put:
summary: |
Set logging levels of the API with its api ID
Expand All @@ -100,7 +100,7 @@ paths:
template(context/version) with the log level (OFF|BASIC|STANDARD|FULL).
You should either provide the api ID and the api log level.
parameters:
- $ref: '#/components/parameters/tenantId'
- $ref: '#/components/parameters/tenant'
- $ref: '#/components/parameters/apiId'
requestBody:
content:
Expand Down Expand Up @@ -132,8 +132,8 @@ paths:
$ref: "#/components/schemas/Error"
x-code-samples:
- lang: Curl
source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
"https://127.0.0.1:9443/api/am/devops/v0/tenant-logs/1/apis/12d6e73c-778d-45ac-b57d-117c6c5092a4"'
source: 'curl -k -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4="
"https://127.0.0.1:9443/api/am/devops/v0/tenant-logs/carbon.super/apis/12d6e73c-778d-45ac-b57d-117c6c5092a4"'

"/config/correlation/":
get:
Expand Down Expand Up @@ -163,7 +163,7 @@ paths:
$ref: "#/components/schemas/Error"
x-code-samples:
- lang: Curl
source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
source: 'curl -k -H "Authorization: Basic YWRtaW46YWRtaW4="
"https://127.0.0.1:9443/api/am/devops/v0/config/correlation"'

put:
Expand Down Expand Up @@ -204,7 +204,7 @@ paths:
$ref: "#/components/schemas/Error"
x-code-samples:
- lang: Curl
source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -d data.json
source: 'curl -k -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -d data.json
"https://127.0.0.1:9443/api/am/devops/v0/config/correlation"'

servers:
Expand Down Expand Up @@ -333,11 +333,11 @@ components:
A detail description about the error message.
parameters:
tenantId:
name: tenantId
tenant:
name: tenant
in: path
description: |
Tenant ID
Tenant (organization) name
required: true
schema:
type: string
Expand Down

0 comments on commit d2fa205

Please sign in to comment.