io.swagger.annotations.Extension Java Examples

The following examples show how to use io.swagger.annotations.Extension. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccessPolicyResource.java    From nifi-registry with Apache License 2.0 6 votes vote down vote up
/**
 * Retrieves all access policies
 *
 * @return A list of access policies
 */
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get all access policies",
        response = AccessPolicy.class,
        responseContainer = "List",
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/policies") })
        }
)
@ApiResponses({
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getAccessPolicies() {
    List<AccessPolicy> accessPolicies = serviceFacade.getAccessPolicies();
    if (accessPolicies == null) {
        accessPolicies = Collections.emptyList();
    }

    return generateOkResponse(accessPolicies).build();
}
 
Example #2
Source File: BucketResource.java    From nifi-registry with Apache License 2.0 6 votes vote down vote up
@GET
@Path("{bucketId}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get bucket",
        notes = "Gets the bucket with the given id.",
        response = Bucket.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404) })
public Response getBucket(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
        final String bucketId) {

    final Bucket bucket = serviceFacade.getBucket(bucketId);
    return Response.status(Response.Status.OK).entity(bucket).build();
}
 
Example #3
Source File: BucketResource.java    From nifi-registry with Apache License 2.0 6 votes vote down vote up
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Create bucket",
        response = Bucket.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "write"),
                        @ExtensionProperty(name = "resource", value = "/buckets") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403) })
public Response createBucket(
        @ApiParam(value = "The bucket to create", required = true)
        final Bucket bucket) {

    final Bucket createdBucket = serviceFacade.createBucket(bucket);
    publish(EventFactory.bucketCreated(createdBucket));
    return Response.status(Response.Status.OK).entity(createdBucket).build();
}
 
Example #4
Source File: ConnectedCupService.java    From product-iots with Apache License 2.0 6 votes vote down vote up
@Path("device/ordercoffee")
@POST
@ApiOperation(
        consumes = MediaType.APPLICATION_JSON,
        httpMethod = "POST",
        value = "Order Coffee",
        notes = "",
        response = Response.class,
        tags = "connectedcup",
        extensions = {
                @Extension(properties = {
                        @ExtensionProperty(name = SCOPE, value = "perm:connectedcup:enroll")
                })
        }
)
Response orderCoffee(@QueryParam("deviceId") String deviceId);
 
Example #5
Source File: NotificationManagementService.java    From carbon-device-mgt with Apache License 2.0 6 votes vote down vote up
@PUT
@Path("/clear-all")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "PUT",
        value = "Clearing All Notifications",
        notes = "When a user needs to mark all the notifications as checked/read this " +
                "function can be used to clear all notifications.",
        tags = "Device Notification Management",
        extensions = {
                @Extension(properties = {
                        @ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:mark-checked")
                })
        }
)
@ApiResponses(
        value = {
                @ApiResponse(
                        code = 200,
                        message = "OK"),
                @ApiResponse(
                        code = 500,
                        message = "Error occurred while clearing notifications.")
        }
)
Response clearAllNotifications();
 
Example #6
Source File: PolicyManagementService.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
@POST
@Path("/activate-policy")
@ApiOperation(
        consumes = MediaType.APPLICATION_JSON,
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "POST",
        value = "Activating Policies",
        notes = "Publish a policy using this API to bring a policy that is in the inactive state to the active state.",
        tags = "Device Policy Management",
        extensions = {
            @Extension(properties = {
                    @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:activate")
            })
        }
)
@ApiResponses(
        value = {
                @ApiResponse(
                        code = 200,
                        message = "Successfully activated the policy."),
                @ApiResponse(
                        code = 400,
                        message = "Bad Request. \n Invalid request or validation error.",
                        response = ErrorResponse.class),
                @ApiResponse(
                        code = 404,
                        message = "Not Found. \n The specified resource/s does not exist.",
                        response = ErrorResponse.class),
                @ApiResponse(
                        code = 500,
                        message = "Sever error whilst activating the policies.",
                        response = ErrorResponse.class)
        })
Response activatePolicies(
        @ApiParam(
                name = "policyIds",
                value = "The list of the policy IDs to be activated",
                required = true,
                defaultValue = "[1]")
                List<Integer> policyIds);
 
Example #7
Source File: ExtensionRepoResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{bucketName}/{groupId}/{artifactId}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get extension repo versions",
        notes = "Gets the versions in the extension repository for the given bucket, group, and artifact. " + NON_GUARANTEED_ENDPOINT,
        response = ExtensionRepoVersionSummary.class,
        responseContainer = "List",
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getExtensionRepoVersions(
        @PathParam("bucketName")
        @ApiParam("The bucket name")
            final String bucketName,
        @PathParam("groupId")
        @ApiParam("The group identifier")
            final String groupId,
        @PathParam("artifactId")
        @ApiParam("The artifact identifier")
            final String artifactId
) {
    final SortedSet<ExtensionRepoVersionSummary> repoVersions = serviceFacade.getExtensionRepoVersions(
            getBaseUri(), bucketName, groupId, artifactId);
    return Response.status(Response.Status.OK).entity(repoVersions).build();
}
 
Example #8
Source File: ExtensionRepoResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{bucketName}/{groupId}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get extension repo artifacts",
        notes = "Gets the artifacts in the extension repository in the given bucket and group. " + NON_GUARANTEED_ENDPOINT,
        response = ExtensionRepoArtifact.class,
        responseContainer = "List",
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getExtensionRepoArtifacts(
        @PathParam("bucketName")
        @ApiParam("The bucket name")
            final String bucketName,
        @PathParam("groupId")
        @ApiParam("The group id")
            final String groupId
) {
    final SortedSet<ExtensionRepoArtifact> repoArtifacts = serviceFacade.getExtensionRepoArtifacts(getBaseUri(), bucketName, groupId);
    return Response.status(Response.Status.OK).entity(repoArtifacts).build();
}
 
Example #9
Source File: UserManagementService.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/count")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "GET",
        value = "Getting the User Count",
        notes = "Get the number of users in WSO2 IoTS via this REST API.",
        tags = "User Management",
        extensions = {
                @Extension(properties = {
                        @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:count")
                })
        }
)
@ApiResponses(value = {
        @ApiResponse(
                code = 200,
                message = "OK. \n Successfully fetched the user count.",
                response = BasicUserInfoList.class,
                responseHeaders = {
                        @ResponseHeader(
                                name = "Content-Type",
                                description = "The content type of the body")
                }),
        @ApiResponse(
                code = 406,
                message = "Not Acceptable.\n The requested media type is not supported",
                response = ErrorResponse.class),
        @ApiResponse(
                code = 500,
                message = "Internal Server Error. \n Server error occurred while fetching the total number of " +
                        "users in WSO2 IoTS.",
                response = ErrorResponse.class)
})
Response getUserCount();
 
Example #10
Source File: BucketFlowResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{flowId}/diff/{versionA: \\d+}/{versionB: \\d+}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get bucket flow diff",
        notes = "Computes the differences between two given versions of a flow.",
        response = VersionedFlowDifference.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409)})
public Response getFlowDiff(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
            final String bucketId,
        @PathParam("flowId")
        @ApiParam("The flow identifier")
            final String flowId,
        @PathParam("versionA")
        @ApiParam("The first version number")
            final Integer versionNumberA,
        @PathParam("versionB")
        @ApiParam("The second version number")
            final Integer versionNumberB) {

    final VersionedFlowDifference result = serviceFacade.getFlowDiff(bucketId, flowId, versionNumberA, versionNumberB);
    return Response.status(Response.Status.OK).entity(result).build();
}
 
Example #11
Source File: BucketFlowResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{flowId}/versions/latest/metadata")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get latest bucket flow version metadata",
        notes = "Gets the metadata for the latest version of a flow.",
        response = VersionedFlowSnapshotMetadata.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getLatestFlowVersionMetadata(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
        final String bucketId,
        @PathParam("flowId")
        @ApiParam("The flow identifier")
        final String flowId) {

    final VersionedFlowSnapshotMetadata latest = serviceFacade.getLatestFlowSnapshotMetadata(bucketId, flowId);
    return Response.status(Response.Status.OK).entity(latest).build();
}
 
Example #12
Source File: BucketFlowResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{flowId}/versions/latest")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get latest bucket flow version content",
        notes = "Gets the latest version of a flow, including the metadata and content of the flow.",
        response = VersionedFlowSnapshot.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getLatestFlowVersion(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
            final String bucketId,
        @PathParam("flowId")
        @ApiParam("The flow identifier")
            final String flowId) {

    final VersionedFlowSnapshot lastSnapshot = serviceFacade.getLatestFlowSnapshot(bucketId, flowId);
    return Response.status(Response.Status.OK).entity(lastSnapshot).build();
}
 
Example #13
Source File: FlowResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{flowId}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get flow",
        notes = "Gets a flow by id.",
        nickname = "globalGetFlow",
        response = VersionedFlow.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getFlow(
        @PathParam("flowId")
        @ApiParam("The flow identifier")
            final String flowId) {

    final VersionedFlow flow = serviceFacade.getFlow(flowId);
    return Response.status(Response.Status.OK).entity(flow).build();
}
 
Example #14
Source File: BucketFlowResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@DELETE
@Path("{flowId}")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Delete bucket flow",
        notes = "Deletes a flow, including all saved versions of that flow.",
        response = VersionedFlow.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "delete"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response deleteFlow(
        @ApiParam(value = "The version is used to verify the client is working with the latest version of the entity.", required = true)
        @QueryParam(VERSION)
            final LongParameter version,
        @ApiParam(value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.")
        @QueryParam(CLIENT_ID)
        @DefaultValue(StringUtils.EMPTY)
            final ClientIdParameter clientId,
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
            final String bucketId,
        @PathParam("flowId")
        @ApiParam("The flow identifier")
            final String flowId) {

    final RevisionInfo revisionInfo = getRevisionInfo(version, clientId);
    final VersionedFlow deletedFlow = serviceFacade.deleteFlow(bucketId, flowId, revisionInfo);
    publish(EventFactory.flowDeleted(deletedFlow));

    return Response.status(Response.Status.OK).entity(deletedFlow).build();
}
 
Example #15
Source File: BucketFlowResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get bucket flows",
        notes = "Retrieves all flows in the given bucket.",
        response = VersionedFlow.class,
        responseContainer = "List",
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getFlows(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
        final String bucketId) {

    final List<VersionedFlow> flows = serviceFacade.getFlows(bucketId);
    return Response.status(Response.Status.OK).entity(flows).build();
}
 
Example #16
Source File: BucketFlowResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Create flow",
        notes = "Creates a flow in the given bucket. The flow id is created by the server and populated in the returned entity.",
        response = VersionedFlow.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "write"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response createFlow(
        @PathParam("bucketId")
        @ApiParam("The bucket identifier")
            final String bucketId,
        @ApiParam(value = "The details of the flow to create.", required = true)
            final VersionedFlow flow) {

    verifyPathParamsMatchBody(bucketId, flow);

    final VersionedFlow createdFlow = serviceFacade.createFlow(bucketId, flow);
    publish(EventFactory.flowCreated(createdFlow));
    return Response.status(Response.Status.OK).entity(createdFlow).build();
}
 
Example #17
Source File: TenantResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
/**
 * Removes the specified user group.
 *
 * @param httpServletRequest request
 * @param identifier                 The id of the user group to remove.
 * @return The deleted user group.
 */
@DELETE
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("user-groups/{id}")
@ApiOperation(
        value = "Delete user group",
        notes = NON_GUARANTEED_ENDPOINT,
        response = UserGroup.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "delete"),
                        @ExtensionProperty(name = "resource", value = "/tenants") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response removeUserGroup(
        @Context
            final HttpServletRequest httpServletRequest,
        @ApiParam(value = "The version is used to verify the client is working with the latest version of the entity.", required = true)
        @QueryParam(VERSION)
            final LongParameter version,
        @ApiParam(value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.")
        @QueryParam(CLIENT_ID)
        @DefaultValue(StringUtils.EMPTY)
            final ClientIdParameter clientId,
        @ApiParam(value = "The user group id.", required = true)
        @PathParam("id")
            final String identifier) {

    final RevisionInfo revisionInfo = getRevisionInfo(version, clientId);
    final UserGroup userGroup = serviceFacade.deleteUserGroup(identifier, revisionInfo);
    publish(EventFactory.userGroupDeleted(userGroup));
    return generateOkResponse(userGroup).build();
}
 
Example #18
Source File: NotificationManagementService.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
@PUT
@Path("/{id}/mark-checked")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "PUT",
        value = "Updating the Device Notification Status",
        notes = "When a user has read the the device notification the device notification status must "
                + "change from NEW to CHECKED. This API is used to update device notification status.",
        tags = "Device Notification Management",
        extensions = {
            @Extension(properties = {
                    @ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:mark-checked")
            })
        }
)
@ApiResponses(
        value = {
                @ApiResponse(
                        code = 200,
                        message = "OK",
                        response = Notification.class),
                @ApiResponse(
                        code = 200,
                        message = "Notification updated successfully. But the retrial of the updated "
                                + "notification failed.",
                        response = Notification.class),
                @ApiResponse(
                        code = 500,
                        message = "Error occurred while updating notification status.")
        }
)
Response updateNotificationStatus(
        @ApiParam(
                name = "id",
                value = "The notification ID.",
                required = true,
                defaultValue = "1")
        @PathParam("id") @Max(45)
                int id);
 
Example #19
Source File: TenantResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
/**
 * Retrieves the specified user group.
 *
 * @param identifier The id of the user group to retrieve
 * @return An userGroupEntity.
 */
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("user-groups/{id}")
@ApiOperation(
        value = "Get user group",
        notes = NON_GUARANTEED_ENDPOINT,
        response = UserGroup.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/tenants") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getUserGroup(
        @ApiParam(value = "The user group id.", required = true)
        @PathParam("id") final String identifier) {
    final UserGroup userGroup = serviceFacade.getUserGroup(identifier);
    return generateOkResponse(userGroup).build();
}
 
Example #20
Source File: FlowResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{flowId}/versions/latest/metadata")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get latest flow version metadata",
        notes = "Gets the metadata for the latest version of a flow.",
        nickname = "globalGetLatestFlowVersionMetadata",
        response = VersionedFlowSnapshotMetadata.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getLatestFlowVersionMetadata(
        @PathParam("flowId")
        @ApiParam("The flow identifier")
            final String flowId) {

    final VersionedFlowSnapshotMetadata latestMetadata = serviceFacade.getLatestFlowSnapshotMetadata(flowId);
    return Response.status(Response.Status.OK).entity(latestMetadata).build();
}
 
Example #21
Source File: CertificateManagementAdminService.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
@DELETE
@Path("/{serialNumber}")
@ApiOperation(
        consumes = MediaType.APPLICATION_JSON,
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "DELETE",
        value = "Deleting an SSL Certificate",
        notes = "Delete an SSL certificate that's on the client end.",
        tags = "Certificate Management",
        extensions = {
                @Extension(properties = {
                        @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:delete")
                })
        }
)
@ApiResponses(value = {
        @ApiResponse(
                code = 200,
                message = "OK. \n Successfully removed the certificate."),
        @ApiResponse(
                code = 400,
                message = "Bad Request. \n Invalid request or validation error.",
                response = ErrorResponse.class),
        @ApiResponse(
                code = 404,
                message = "Not Found. \n The specified resource does not exist."),
        @ApiResponse(
                code = 500,
                message = "Internal Server Error. \n " +
                        "Server error occurred while removing the certificate.",
                response = ErrorResponse.class)})
Response removeCertificate(
        @ApiParam(
                name = "serialNumber",
                value = "The serial number of the certificate.\n" +
                        "NOTE: Make sure that a certificate with the serial number you provide exists in the server. If not, first add a certificate.",
                required = true,
                defaultValue = "12438035315552875930")
        @PathParam("serialNumber") String serialNumber);
 
Example #22
Source File: TenantResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
/**
 * Removes the specified user.
 *
 * @param httpServletRequest request
 * @param identifier         The id of the user to remove.
 * @return A entity containing the client id and an updated revision.
 */
@DELETE
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("users/{id}")
@ApiOperation(
        value = "Delete user",
        notes = NON_GUARANTEED_ENDPOINT,
        response = User.class,
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "delete"),
                        @ExtensionProperty(name = "resource", value = "/tenants") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response removeUser(
        @Context
            final HttpServletRequest httpServletRequest,
        @ApiParam(value = "The version is used to verify the client is working with the latest version of the entity.", required = true)
        @QueryParam(VERSION)
            final LongParameter version,
        @ApiParam(value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.")
        @QueryParam(CLIENT_ID)
        @DefaultValue(StringUtils.EMPTY)
            final ClientIdParameter clientId,
        @ApiParam(value = "The user id.", required = true)
        @PathParam("id")
            final String identifier) {

    final RevisionInfo revisionInfo = getRevisionInfo(version, clientId);
    final User user = serviceFacade.deleteUser(identifier, revisionInfo);
    publish(EventFactory.userDeleted(user));
    return generateOkResponse(user).build();
}
 
Example #23
Source File: BucketBundleResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get extension bundles by bucket",
        notes = NON_GUARANTEED_ENDPOINT,
        response = Bundle.class,
        responseContainer = "List",
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getExtensionBundles(
        @PathParam("bucketId")
        @ApiParam(value = "The bucket identifier", required = true)
            final String bucketId) {

    final List<Bundle> bundles = serviceFacade.getBundlesByBucket(bucketId);
    return Response.status(Response.Status.OK).entity(bundles).build();
}
 
Example #24
Source File: BundleResource.java    From nifi-registry with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{bundleId}/versions")
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
        value = "Get bundle versions",
        notes = "Gets the metadata for the versions of the given extension bundle. " + NON_GUARANTEED_ENDPOINT,
        nickname = "globalGetBundleVersions",
        response = BundleVersionMetadata.class,
        responseContainer = "List",
        extensions = {
                @Extension(name = "access-policy", properties = {
                        @ExtensionProperty(name = "action", value = "read"),
                        @ExtensionProperty(name = "resource", value = "/buckets/{bucketId}") })
        }
)
@ApiResponses({
        @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400),
        @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401),
        @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403),
        @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404),
        @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) })
public Response getBundleVersions(
        @PathParam("bundleId")
        @ApiParam("The extension bundle identifier")
            final String bundleId) {

    final SortedSet<BundleVersionMetadata> bundleVersions = serviceFacade.getBundleVersions(bundleId);
    return Response.status(Response.Status.OK).entity(bundleVersions).build();
}
 
Example #25
Source File: DeviceAgentService.java    From carbon-device-mgt with Apache License 2.0 4 votes vote down vote up
@POST
@Path("/events/publish/data/{type}/{deviceId}")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        consumes = MediaType.APPLICATION_JSON,
        httpMethod = "POST",
        value = "Publishing Events data only",
        notes = "Publish events received by the device client to the WSO2 Data Analytics Server (DAS) using this" +
                " API.",
        tags = "Device Agent Management",
        extensions = {
                @Extension(properties = {
                        @ExtensionProperty(name = Constants.SCOPE, value = "perm:device:publish-event")
                })
        }
)
@ApiResponses(
        value = {
                @ApiResponse(code = 200, message = "OK. \n Successfully published the event",
                             responseHeaders = {
                                     @ResponseHeader(
                                             name = "Content-Type",
                                             description = "The content type of the body"),
                                     @ResponseHeader(
                                             name = "ETag",
                                             description = "Entity Tag of the response resource.\n" +
                                                     "Used by caches, or in conditional requests."),
                                     @ResponseHeader(
                                             name = "Last-Modified",
                                             description = "Date and time the resource was last modified.\n" +
                                                     "Used by caches, or in conditional requests.")
                             }),
                @ApiResponse(
                        code = 303,
                        message = "See Other. \n The source can be retrieved from the URL specified in the " +
                                "location header.",
                        responseHeaders = {
                                @ResponseHeader(
                                        name = "Content-Location",
                                        description = "The Source URL of the document.")}),
                @ApiResponse(
                        code = 400,
                        message = "Bad Request. \n Invalid request or validation error."),
                @ApiResponse(
                        code = 415,
                        message = "Unsupported media type. \n The format of the requested entity was not " +
                                "supported."),
                @ApiResponse(
                        code = 500,
                        message = "Internal Server Error. \n " +
                                "Server error occurred while publishing events.")
        })
Response publishEvents(
        @ApiParam(
                name = "payloadData",
                value = "Information of the agent event to be published on DAS.")
        @Valid
        List<Object> payloadData,
        @ApiParam(
                name = "type",
                value = "name of the device type")
        @PathParam("type") String type,
        @ApiParam(
                name = "deviceId",
                value = "deviceId of the device")
        @PathParam("deviceId") String deviceId);
 
Example #26
Source File: GroupManagementService.java    From carbon-device-mgt with Apache License 2.0 4 votes vote down vote up
@Path("/id/{groupId}")
@PUT
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = HTTPConstants.HEADER_PUT,
        value = "Update a group.",
        notes = "If you wish to make changes to an existing group, that can be done by updating the group using " +
                "this resource.",
        tags = "Device Group Management",
        extensions = {
            @Extension(properties = {
                    @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:update")
            })
        }
)
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "OK. \n Group has been updated successfully.",
                responseHeaders = {
                        @ResponseHeader(
                                name = "Content-Type",
                                description = "The content type of the body."),
                        @ResponseHeader(
                                name = "ETag",
                                description = "Entity Tag of the response resource.\n" +
                                              "Used by caches, or in conditional requests."),
                        @ResponseHeader(
                                name = "Last-Modified",
                                description = "Date and time the resource has been modified the last time.\n" +
                                              "Used by caches, or in conditional requests."),
                }),
        @ApiResponse(
                code = 304,
                message = "Not Modified. \n Empty body because the client has already the latest version of " +
                          "the requested resource."),
        @ApiResponse(
                code = 404,
                message = "Group not found.",
                response = ErrorResponse.class),
        @ApiResponse(
                code = 406,
                message = "Not Acceptable.\n The requested media type is not supported."),
        @ApiResponse(
                code = 500,
                message = "Internal Server Error. \n Server error occurred while updating the group.",
                response = ErrorResponse.class)
})
Response updateGroup(@ApiParam(
                             name = "groupId",
                             value = "ID of the group to be updated.",
                             required = true)
                     @PathParam("groupId") int groupId,
                     @ApiParam(
                             name = "group",
                             value = "Group object with data.",
                             required = true)
                     @Valid DeviceGroup deviceGroup);
 
Example #27
Source File: CertificateManagementAdminService.java    From carbon-device-mgt with Apache License 2.0 4 votes vote down vote up
/**
 * Verify Certificate for the API security filter
 *
 * @param certificate to be verified as a String
 * @return Status of the certificate verification.
 */
@POST
@Path("/verify/{type}")
@ApiOperation(
        consumes = MediaType.APPLICATION_JSON,
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "POST",
        value = "Verify SSL certificate",
        notes = "Verify Certificate for the API security filter.\n",
        tags = "Certificate Management",
        extensions = {
        @Extension(properties = {
                @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:verify")
        })
        }
)
@ApiResponses(
        value = {
                @ApiResponse(
                        code = 200,
                        message = "Return the status of the certificate verification.",
                        responseHeaders = {
                                @ResponseHeader(
                                        name = "Content-Type",
                                        description = "The content type of the body")}),
                @ApiResponse(
                        code = 400,
                        message = "Bad Request. \n Invalid request or validation error.",
                        response = ErrorResponse.class)
        })
Response verifyCertificate(
        @ApiParam(
                name = "type",
                value = "The device type, such as ios, android or windows.",
                required = true,
                allowableValues = "android, ios, windows")
        @PathParam("type")
        @Size(max = 45)
        String type,
        @ApiParam(
                name = "certificate",
                value = "The properties to verify certificate. It includes the following: \n" +
                        "serial: The unique ID of the certificate. (optional) \n" +
                        "pem: pem String of the certificate",
                required = true) EnrollmentCertificate certificate);
 
Example #28
Source File: GroupManagementService.java    From carbon-device-mgt with Apache License 2.0 4 votes vote down vote up
@Path("/device/assign")
@POST
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = HTTPConstants.HEADER_POST,
        value = "Assign devices to groups",
        notes = "Add existing device to device groups.",
        tags = "Device Group Management",
        extensions = {
                @Extension(properties = {
                        @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:assign")
                })
        }
)
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "OK. \n Successfully assign the device to groups.",
                responseHeaders = {
                        @ResponseHeader(
                                name = "Content-Type",
                                description = "The content type of the body"),
                        @ResponseHeader(
                                name = "ETag",
                                description = "Entity Tag of the response resource.\n" +
                                              "Used by caches, or in conditional requests."),
                        @ResponseHeader(
                                name = "Last-Modified",
                                description = "Date and time the resource has been modified the last time.\n" +
                                              "Used by caches, or in conditional requests."),
                }),
        @ApiResponse(
                code = 304,
                message = "Not Modified. \n Empty body because the client has already the latest version of " +
                          "the requested resource."),
        @ApiResponse(
                code = 404,
                message = "No groups found.",
                response = ErrorResponse.class),
        @ApiResponse(
                code = 406,
                message = "Not Acceptable.\n The requested media type is not supported."),
        @ApiResponse(
                code = 500,
                message = "Internal Server Error. \n Server error occurred while adding devices to the group.",
                response = ErrorResponse.class)
})
Response updateDeviceAssigningToGroups(
        @ApiParam(
                name = "deviceToGroupsAssignment",
                value = "Device to groups assignment",
                required = true)
        @Valid DeviceToGroupsAssignment deviceToGroupsAssignment);
 
Example #29
Source File: DeviceEventManagementService.java    From carbon-device-mgt with Apache License 2.0 4 votes vote down vote up
@GET
@Path("/{type}/{deviceId}")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "GET",
        value = "Getting Device Events",
        notes = "Get the events for the device.",
        tags = "Device Event Management",
        extensions = {
                @Extension(properties = {
                        @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:events:view")
                })
        }
)
@ApiResponses(
        value = {
                @ApiResponse(
                        code = 200,
                        message = "OK. \n Successfully fetched the event definition.",
                        response = EventRecords.class,
                        responseHeaders = {
                                @ResponseHeader(
                                        name = "Content-Type",
                                        description = "The content type of the body"),
                                @ResponseHeader(
                                        name = "ETag",
                                        description = "Entity Tag of the response resource.\n" +
                                                "Used by caches, or in conditional requests."),
                                @ResponseHeader(
                                        name = "Last-Modified",
                                        description =
                                                "Date and time the resource was last modified.\n" +
                                                        "Used by caches, or in conditional requests."),
                        }
                ),
                @ApiResponse(
                        code = 400,
                        message =
                                "Bad Request. \n"),
                @ApiResponse(
                        code = 406,
                        message = "Not Acceptable.\n The requested media type is not supported"),
                @ApiResponse(
                        code = 500,
                        message = "Internal Server Error. \n Server error occurred while fetching the " +
                                "list of supported device types.",
                        response = ErrorResponse.class)
        }
)
Response getData(@ApiParam(name = "deviceId", value = "id of the device ", required = false)
                 @PathParam("deviceId") String deviceId,
                 @ApiParam(name = "from", value = "unix timestamp to retrieve", required = false)
                 @QueryParam("from") long from,
                 @ApiParam(name = "to", value = "unix time to retrieve", required = false)
                 @QueryParam("to") long to,
                 @ApiParam(name = "type", value = "name of the device type", required = false)
                 @PathParam("type")  String deviceType,
                 @ApiParam(name = "offset", value = "offset of the records that needs to be picked up", required = false)
                 @QueryParam("offset") int offset,
                 @ApiParam(name = "limit", value = "limit of the records that needs to be picked up", required = false)
                 @QueryParam("limit") int limit);
 
Example #30
Source File: UserManagementService.java    From carbon-device-mgt with Apache License 2.0 4 votes vote down vote up
@GET
@Path("/{username}/roles")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "GET",
        value = "Getting the Role Details of a User",
        notes = "A user can be assigned to one or more role in IoTS. Using this REST API you can get the " +
                "role/roles a user is assigned to.",
        tags = "User Management",
        extensions = {
            @Extension(properties = {
                    @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:roles")
            })
        }
)
@ApiResponses(value = {
        @ApiResponse(
                code = 200,
                message = "OK. \n Successfully fetched the list of roles the specified user is assigned to.",
                response = RoleList.class,
                responseHeaders = {
                        @ResponseHeader(
                                name = "Content-Type",
                                description = "The content type of the body"),
                        @ResponseHeader(
                                name = "ETag",
                                description = "Entity Tag of the response resource.\n" +
                                        "Used by caches, or in conditional requests."),
                        @ResponseHeader(
                                name = "Last-Modified",
                                description = "Date and time the resource was last modified.\n" +
                                        "Used by caches, or in conditional requests."),
                }),
        @ApiResponse(
                code = 304,
                message = "Not Modified. \n Empty body because the client already has the latest version of the " +
                        "requested resource."),
        @ApiResponse(
                code = 404,
                message = "Not Found. \n The specified resource does not exist.\n",
                response = ErrorResponse.class),
        @ApiResponse(
                code = 406,
                message = "Not Acceptable.\n The requested media type is not supported",
                response = ErrorResponse.class),
        @ApiResponse(
                code = 500,
                message = "Internal Server Error. \n Server error occurred while fetching the list of roles" +
                        " assigned to the specified user.",
                response = ErrorResponse.class)
})
Response getRolesOfUser(
        @ApiParam(
                name = "username",
                value = "The username of the user.",
                required = true,
                defaultValue = "admin")
        @PathParam("username") String username,
        @ApiParam(
                name = "domain",
                value = "The domain name of the user store.",
                required = false)
        @QueryParam("domain") String domain);