Skip to content

Commit

Permalink
Modify the design introducing new REST API and deprecate the existing
Browse files Browse the repository at this point in the history
  • Loading branch information
RusJaI committed Jun 30, 2024
1 parent d061910 commit 6bd318e
Show file tree
Hide file tree
Showing 4 changed files with 519 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,28 @@ public class ApisApi {
@ApiResponse(code = 200, message = "OK. The Certificate added successfully. ", response = ClientCertMetadataDTO.class),
@ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal Server Error.", response = ErrorDTO.class) })
public Response addAPIClientCertificate(@ApiParam(value = "**API ID** consisting of the **UUID** of the API. ",required=true) @PathParam("apiId") String apiId, @Multipart(value = "certificate") InputStream certificateInputStream, @Multipart(value = "certificate" ) Attachment certificateDetail, @Multipart(value = "alias") String alias, @Multipart(value = "tier") String tier, @Multipart(value = "keyType", required = false) String keyType) throws APIManagementException{
return delegate.addAPIClientCertificate(apiId, certificateInputStream, certificateDetail, alias, tier, keyType, securityContext);
public Response addAPIClientCertificate(@ApiParam(value = "**API ID** consisting of the **UUID** of the API. ",required=true) @PathParam("apiId") String apiId, @Multipart(value = "certificate") InputStream certificateInputStream, @Multipart(value = "certificate" ) Attachment certificateDetail, @Multipart(value = "alias") String alias, @Multipart(value = "tier") String tier) throws APIManagementException{
return delegate.addAPIClientCertificate(apiId, certificateInputStream, certificateDetail, alias, tier, securityContext);
}

@POST
@Path("/{apiId}/client-certificates/{keyType}")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
@ApiOperation(value = "Upload a New Certificate of the given key type", notes = "This operation can be used to upload a new certificate for an endpoint of the given type. ", response = ClientCertMetadataDTO.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:api_create", description = "Create API"),
@AuthorizationScope(scope = "apim:api_manage", description = "Manage all API related operations"),
@AuthorizationScope(scope = "apim:client_certificates_add", description = "Add client certificates"),
@AuthorizationScope(scope = "apim:client_certificates_manage", description = "View, create, update and remove client certificates")
})
}, tags={ "Client Certificates", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. The Certificate added successfully. ", response = ClientCertMetadataDTO.class),
@ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal Server Error.", response = ErrorDTO.class) })
public Response addAPIClientCertificateOfGivenKeyType(@ApiParam(value = "Key type for the certificate",required=true) @PathParam("keyType") String keyType, @ApiParam(value = "**API ID** consisting of the **UUID** of the API. ",required=true) @PathParam("apiId") String apiId, @Multipart(value = "certificate") InputStream certificateInputStream, @Multipart(value = "certificate" ) Attachment certificateDetail, @Multipart(value = "alias") String alias, @Multipart(value = "tier") String tier) throws APIManagementException{
return delegate.addAPIClientCertificateOfGivenKeyType(keyType, apiId, certificateInputStream, certificateDetail, alias, tier, securityContext);
}

@POST
Expand Down Expand Up @@ -398,6 +418,26 @@ public Response deleteAPIClientCertificateByAlias(@ApiParam(value = "The alias o
return delegate.deleteAPIClientCertificateByAlias(alias, apiId, securityContext);
}

@DELETE
@Path("/{apiId}/client-certificates/{keyType}/{alias}")

@Produces({ "application/json" })
@ApiOperation(value = "Delete a Certificate of a Given Key Type", notes = "This operation can be used to delete an uploaded certificate of a given key type. ", response = Void.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:api_create", description = "Create API"),
@AuthorizationScope(scope = "apim:api_manage", description = "Manage all API related operations"),
@AuthorizationScope(scope = "apim:client_certificates_update", description = "Update and delete client certificates")
})
}, tags={ "Client Certificates", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. The Certificate deleted successfully. ", response = Void.class),
@ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.", response = ErrorDTO.class),
@ApiResponse(code = 404, message = "Not Found. The specified resource does not exist.", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal Server Error.", response = ErrorDTO.class) })
public Response deleteAPIClientCertificateByKeyTypeAndAlias(@ApiParam(value = "Key type for the certificate",required=true) @PathParam("keyType") String keyType, @ApiParam(value = "The alias of the certificate that should be deleted. ",required=true) @PathParam("alias") String alias, @ApiParam(value = "**API ID** consisting of the **UUID** of the API. ",required=true) @PathParam("apiId") String apiId) throws APIManagementException{
return delegate.deleteAPIClientCertificateByKeyTypeAndAlias(keyType, alias, apiId, securityContext);
}

@DELETE
@Path("/{apiId}/documents/{documentId}")

Expand Down Expand Up @@ -658,6 +698,27 @@ public Response getAPIClientCertificateByAlias(@ApiParam(value = "",required=tru
return delegate.getAPIClientCertificateByAlias(alias, apiId, securityContext);
}

@GET
@Path("/{apiId}/client-certificates/{keyType}/{alias}")

@Produces({ "application/json" })
@ApiOperation(value = "Get the Certificate Information of a Given Key Type", notes = "This operation can be used to get the information about a certificate of a given key type. ", response = CertificateInfoDTO.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:api_view", description = "View API"),
@AuthorizationScope(scope = "apim:api_manage", description = "Manage all API related operations"),
@AuthorizationScope(scope = "apim:client_certificates_view", description = "View client certificates"),
@AuthorizationScope(scope = "apim:client_certificates_manage", description = "View, create, update and remove client certificates")
})
}, tags={ "Client Certificates", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. ", response = CertificateInfoDTO.class),
@ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.", response = ErrorDTO.class),
@ApiResponse(code = 404, message = "Not Found. The specified resource does not exist.", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal Server Error.", response = ErrorDTO.class) })
public Response getAPIClientCertificateByKeyTypeAndAlias(@ApiParam(value = "Key type for the certificate",required=true) @PathParam("keyType") String keyType, @ApiParam(value = "",required=true) @PathParam("alias") String alias, @ApiParam(value = "**API ID** consisting of the **UUID** of the API. ",required=true) @PathParam("apiId") String apiId) throws APIManagementException{
return delegate.getAPIClientCertificateByKeyTypeAndAlias(keyType, alias, apiId, securityContext);
}

@GET
@Path("/{apiId}/client-certificates/{alias}/content")

Expand All @@ -679,6 +740,27 @@ public Response getAPIClientCertificateContentByAlias(@ApiParam(value = "**API I
return delegate.getAPIClientCertificateContentByAlias(apiId, alias, securityContext);
}

@GET
@Path("/{apiId}/client-certificates/{keyType}/{alias}/content")

@Produces({ "application/json" })
@ApiOperation(value = "Download a Certificate of Given Key Type", notes = "This operation can be used to download a certificate which matches the given alias and key type. ", response = Void.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:api_view", description = "View API"),
@AuthorizationScope(scope = "apim:api_manage", description = "Manage all API related operations"),
@AuthorizationScope(scope = "apim:client_certificates_view", description = "View client certificates"),
@AuthorizationScope(scope = "apim:client_certificates_manage", description = "View, create, update and remove client certificates")
})
}, tags={ "Client Certificates", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. ", response = Void.class),
@ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.", response = ErrorDTO.class),
@ApiResponse(code = 404, message = "Not Found. The specified resource does not exist.", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal Server Error.", response = ErrorDTO.class) })
public Response getAPIClientCertificateContentByKeyTypeAndAlias(@ApiParam(value = "**API ID** consisting of the **UUID** of the API. ",required=true) @PathParam("apiId") String apiId, @ApiParam(value = "",required=true) @PathParam("alias") String alias, @ApiParam(value = "The key type of the certificate that should be deleted. ",required=true) @PathParam("keyType") String keyType) throws APIManagementException{
return delegate.getAPIClientCertificateContentByKeyTypeAndAlias(apiId, alias, keyType, securityContext);
}

@GET
@Path("/{apiId}/client-certificates")

Expand All @@ -699,6 +781,26 @@ public Response getAPIClientCertificates(@ApiParam(value = "**API ID** consistin
return delegate.getAPIClientCertificates(apiId, limit, offset, alias, securityContext);
}

@GET
@Path("/{apiId}/client-certificates/{keyType}")

@Produces({ "application/json" })
@ApiOperation(value = "Retrieve/ Search Uploaded Client Certificates of a given key type", notes = "This operation can be used to retrieve and search the uploaded client certificates of a given key type. ", response = ClientCertificatesDTO.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:api_view", description = "View API"),
@AuthorizationScope(scope = "apim:api_manage", description = "Manage all API related operations"),
@AuthorizationScope(scope = "apim:client_certificates_view", description = "View client certificates"),
@AuthorizationScope(scope = "apim:client_certificates_manage", description = "View, create, update and remove client certificates")
})
}, tags={ "Client Certificates", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. Successful response with the list of matching certificate information in the body. ", response = ClientCertificatesDTO.class),
@ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal Server Error.", response = ErrorDTO.class) })
public Response getAPIClientCertificatesByKeyType(@ApiParam(value = "Key type for the certificate",required=true) @PathParam("keyType") String keyType, @ApiParam(value = "**API ID** consisting of the **UUID** of the API. ",required=true) @PathParam("apiId") String apiId, @ApiParam(value = "Maximum size of resource array to return. ", defaultValue="25") @DefaultValue("25") @QueryParam("limit") Integer limit, @ApiParam(value = "Starting point within the complete list of items qualified. ", defaultValue="0") @DefaultValue("0") @QueryParam("offset") Integer offset, @ApiParam(value = "Alias for the client certificate") @QueryParam("alias") String alias) throws APIManagementException{
return delegate.getAPIClientCertificatesByKeyType(keyType, apiId, limit, offset, alias, securityContext);
}

@GET
@Path("/{apiId}/documents/{documentId}")

Expand Down Expand Up @@ -1551,6 +1653,27 @@ public Response updateAPIClientCertificateByAlias( @Size(min=1,max=30)@ApiParam(
return delegate.updateAPIClientCertificateByAlias(alias, apiId, certificateInputStream, certificateDetail, tier, keyType, securityContext);
}

@PUT
@Path("/{apiId}/client-certificates/{keyType}/{alias}")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
@ApiOperation(value = "Update a Certificate of a Given Key Type", notes = "This operation can be used to update an uploaded certificate of a given key type. ", response = ClientCertMetadataDTO.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:api_create", description = "Create API"),
@AuthorizationScope(scope = "apim:api_manage", description = "Manage all API related operations"),
@AuthorizationScope(scope = "apim:client_certificates_update", description = "Update and delete client certificates"),
@AuthorizationScope(scope = "apim:client_certificates_manage", description = "View, create, update and remove client certificates")
})
}, tags={ "Client Certificates", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. The Certificate updated successfully. ", response = ClientCertMetadataDTO.class),
@ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.", response = ErrorDTO.class),
@ApiResponse(code = 404, message = "Not Found. The specified resource does not exist.", response = ErrorDTO.class),
@ApiResponse(code = 500, message = "Internal Server Error.", response = ErrorDTO.class) })
public Response updateAPIClientCertificateByKeyTypeAndAlias(@ApiParam(value = "Key type for the certificate",required=true) @PathParam("keyType") String keyType, @Size(min=1,max=30)@ApiParam(value = "Alias for the certificate",required=true) @PathParam("alias") String alias, @ApiParam(value = "**API ID** consisting of the **UUID** of the API. ",required=true) @PathParam("apiId") String apiId, @Multipart(value = "certificate", required = false) InputStream certificateInputStream, @Multipart(value = "certificate" , required = false) Attachment certificateDetail, @Multipart(value = "tier", required = false) String tier) throws APIManagementException{
return delegate.updateAPIClientCertificateByKeyTypeAndAlias(keyType, alias, apiId, certificateInputStream, certificateDetail, tier, securityContext);
}

@PUT
@Path("/{apiId}/deployments/{deploymentId}")
@Consumes({ "application/json" })
Expand Down
Loading

0 comments on commit 6bd318e

Please sign in to comment.