io.swagger.annotations.Extension源码实例Demo

类io.swagger.annotations.Extension源码实例Demo

下面列出了io.swagger.annotations.Extension 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: product-iots   文件: ConnectedCupService.java
@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);
 
@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();
 
源代码3 项目: nifi-registry   文件: AccessPolicyResource.java
/**
 * 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();
}
 
源代码4 项目: nifi-registry   文件: BucketResource.java
@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();
}
 
源代码5 项目: nifi-registry   文件: BucketResource.java
@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();
}
 
源代码6 项目: nifi-registry   文件: TenantResource.java
/**
 * 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();
}
 
源代码7 项目: nifi-registry   文件: TenantResource.java
/**
 * 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();
}
 
源代码8 项目: nifi-registry   文件: TenantResource.java
/**
 * 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();
}
 
源代码9 项目: nifi-registry   文件: BucketFlowResource.java
@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();
}
 
源代码10 项目: nifi-registry   文件: BucketFlowResource.java
@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();
}
 
源代码11 项目: nifi-registry   文件: BucketFlowResource.java
@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();
}
 
源代码12 项目: nifi-registry   文件: BucketFlowResource.java
@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();
}
 
源代码13 项目: nifi-registry   文件: BucketFlowResource.java
@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();
}
 
源代码14 项目: nifi-registry   文件: BucketFlowResource.java
@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();
}
 
源代码15 项目: nifi-registry   文件: ExtensionRepoResource.java
@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();
}
 
源代码16 项目: nifi-registry   文件: ExtensionRepoResource.java
@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();
}
 
源代码17 项目: carbon-device-mgt   文件: UserManagementService.java
@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();
 
源代码18 项目: nifi-registry   文件: FlowResource.java
@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();
}
 
源代码19 项目: nifi-registry   文件: FlowResource.java
@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();
}
 
源代码20 项目: nifi-registry   文件: BucketBundleResource.java
@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();
}
 
源代码21 项目: nifi-registry   文件: BundleResource.java
@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();
}
 
@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);
 
@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);
 
@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);
 
源代码25 项目: carbon-device-mgt   文件: UserManagementService.java
@GET
@Path("/search/usernames")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "GET",
        value = "Searching for a User Name",
        notes = "If you are unsure of the user name of a user and need to retrieve the details of a specific " +
                "user, you can "
                + "search for that user by giving a character or a few characters in the username. "
                + "You will be given a list of users having the user name in the exact order of the "
                + "characters you provided.",
        tags = "User Management",
        extensions = {
            @Extension(properties = {
                    @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:search")
            })
        }
)
@ApiResponses(value = {
        @ApiResponse(
                code = 200,
                message = "OK. \n Successfully fetched the list of users that matched the given filter.",
                response = String.class,
                responseContainer = "List",
                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 = 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 users that " +
                        "matched the given filter.",
                response = ErrorResponse.class)
})
Response getUserNames(
        @ApiParam(
                name = "filter",
                value = "Provide a character or a few character in the user name",
                required = true)
        @QueryParam("filter") String filter,
        @ApiParam(
                name = "domain",
                value = "The user store domain which the user names should be fetched from",
                required = false)
        @QueryParam("domain") String domain,
        @ApiParam(
                name = "If-Modified-Since",
                value = "Checks if the requested variant was modified, since the specified date-time\n." +
                        "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z\n. " +
                        "Example: Mon, 05 Jan 2014 15:10:00 +0200",
                required = false)
        @HeaderParam("If-Modified-Since") String timestamp,
        @ApiParam(
                name = "offset",
                value = "The starting pagination index for the complete list of qualified items.",
                required = false,
                defaultValue = "0")
        @QueryParam("offset") int offset,
        @ApiParam(
                name = "limit",
                value = "Provide how many user details you require from the starting pagination index/offset.",
                required = false,
                defaultValue = "5")
        @QueryParam("limit") int limit);
 
源代码26 项目: carbon-device-mgt   文件: GroupManagementService.java
@POST
@ApiOperation(
        consumes = MediaType.APPLICATION_JSON,
        httpMethod = HTTPConstants.HEADER_POST,
        value = "Add new device group to the system.",
        notes = "Add device group with current user as the owner.",
        tags = "Device Group Management",
        extensions = {
            @Extension(properties = {
                    @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:add")
            })
        }
)
@ApiResponses(
        value = {
                @ApiResponse(
                        code = 201,
                        message = "Created. \n Device group has successfully been created",
                        responseHeaders = {
                                @ResponseHeader(
                                        name = "Content-Location",
                                        description = "The URL of the added group."),
                                @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 = 303,
                        message = "See Other. \n Source can be retrieved from the URL specified at 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.",
                        response = ErrorResponse.class),
                @ApiResponse(
                        code = 401,
                        message = "Unauthorized. \n Current logged in user is not authorized to add device groups.",
                        response = ErrorResponse.class),
                @ApiResponse(
                        code = 415,
                        message = "Unsupported media type. \n The entity of the request was in a not supported format."),
                @ApiResponse(
                        code = 500,
                        message = "Internal Server Error. \n " +
                                  "Server error occurred while adding a new device group.",
                        response = ErrorResponse.class)
        })
Response createGroup(@ApiParam(
                             name = "group",
                             value = "Group object with data.",
                             required = true)
                     @Valid DeviceGroup group);
 
源代码27 项目: carbon-device-mgt   文件: UserManagementService.java
@GET
@Path("/{username}")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = "GET",
        value = "Getting Details of a User",
        notes = "Get the details of a user registered with WSO2 IoTS using the REST API.",
        response = BasicUserInfo.class,
        tags = "User Management",
        extensions = {
            @Extension(properties = {
                    @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:details")
            })
        }
)
@ApiResponses(value = {
        @ApiResponse(
                code = 200,
                message = "OK. \n Successfully fetched the details of the specified user.",
                response = BasicUserInfo.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.",
                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 ErrorResponse. \n Server error occurred while" +
                        " fetching the ruser details.",
                response = ErrorResponse.class)
})
Response getUser(
        @ApiParam(
                name = "username",
                value = "Provide 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,
        @ApiParam(
                name = "If-Modified-Since",
                value = "Checks if the requested variant was modified, since the specified date-time.\n" +
                        "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
                        "Example: Mon, 05 Jan 2014 15:10:00 +0200",
                required = false)
        @HeaderParam("If-Modified-Since") String ifModifiedSince);
 
/**
 * Retrieve Geo alerts for geo clusters
 */
@GET
@Path("alerts/{alertType}")
@ApiOperation(
        consumes = "application/json",
        produces = "application/json",
        httpMethod = "GET",
        value = "Retrieve Geo alerts for geo clusters",
        notes = "Retrieve all the defined alerts for a specific alert type",
        response = Response.class,
        tags = "Geo Service Management",
        extensions = {
                @Extension(properties = {
                        @ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage")
                })
        }
)
@ApiResponses(value = {
        @ApiResponse(
                code = 200,
                message = "OK.",
                response = Response.class,
                responseHeaders = {
                        @ResponseHeader(
                                name = "Content-Type",
                                description = "The content type of the body"),
                        @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 Invalid Device Identifiers found.",
                response = Response.class),
        @ApiResponse(
                code = 401,
                message = "Unauthorized. \n Unauthorized request."),
        @ApiResponse(
                code = 500,
                message = "Internal Server Error. \n Error on retrieving stats",
                response = Response.class)
})
Response getGeoAlertsForGeoClusters(
        @ApiParam(
                name = "alertType",
                value = "The alert type, such as Within, Speed, Stationary",
                required = true)
        @PathParam("alertType") String alertType);
 
源代码29 项目: carbon-device-mgt   文件: GroupManagementService.java
@Path("/device/assign")
@POST
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        httpMethod = HTTPConstants.HEADER_POST,
        value = "Adding a Device to Many Groups",
        notes = "Add an already enrolled device to many groups, using this API.",
        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 = "In the payload, define the group IDs that you need to add the device to as comma " +
                        "separated values, and the device identifier and type of the device, such as android, " +
                        "ios, and windows, that needs to be added to the groups.",
                required = true)
        @Valid DeviceToGroupsAssignment deviceToGroupsAssignment);
 
源代码30 项目: carbon-device-mgt   文件: DeviceAgentService.java
@POST
@Path("events/publish/{type}/{deviceId}")
@ApiOperation(
        produces = MediaType.APPLICATION_JSON,
        consumes = MediaType.APPLICATION_JSON,
        httpMethod = "POST",
        value = "Publishing Events",
        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
        Map<String, Object> payloadData,
        @ApiParam(
                name = "type",
                value = "The name of the device type, such as android, ios, or windows.")
        @PathParam("type") String type,
        @ApiParam(
                name = "deviceId",
                value = "The device ID.")
        @PathParam("deviceId") String deviceId);