Example usage for org.springframework.restdocs.payload PayloadDocumentation fieldWithPath

List of usage examples for org.springframework.restdocs.payload PayloadDocumentation fieldWithPath

Introduction

In this page you can find the example usage for org.springframework.restdocs.payload PayloadDocumentation fieldWithPath.

Prototype

public static FieldDescriptor fieldWithPath(String path) 

Source Link

Document

Creates a FieldDescriptor that describes a field with the given path .

Usage

From source file:com.netflix.genie.web.controllers.Snippets.java

private static FieldDescriptor[] getCommandFieldDescriptors() {
    return ArrayUtils.addAll(getConfigFieldDescriptors(COMMAND_CONSTRAINTS), PayloadDocumentation
            .fieldWithPath("status").attributes(getConstraintsForField(COMMAND_CONSTRAINTS, "status"))
            .description("The status of the command. Options: " + Arrays.toString(CommandStatus.values())),
            PayloadDocumentation.fieldWithPath("executable")
                    .attributes(getConstraintsForField(COMMAND_CONSTRAINTS, "executable")).description(
                            "The executable to run on the Genie node when this command is used. e.g. /usr/bin/hadoop"),
            PayloadDocumentation.fieldWithPath("checkDelay")
                    .attributes(getConstraintsForField(COMMAND_CONSTRAINTS, "checkDelay")).description(
                            "The amount of time (in milliseconds) to delay between checks of the jobs using this command"),
            PayloadDocumentation.fieldWithPath("memory")
                    .attributes(getConstraintsForField(COMMAND_CONSTRAINTS, "memory"))
                    .description(//w w  w.  j av a2  s  . c  om
                            "The default amount of memory (in MB) that should be allocated for instances of this command client")
                    .optional());
}

From source file:com.netflix.genie.web.controllers.Snippets.java

private static FieldDescriptor[] getJobRequestFieldDescriptors() {
    return ArrayUtils.addAll(getSetupFieldDescriptors(JOB_REQUEST_CONSTRAINTS),
            PayloadDocumentation.fieldWithPath("commandArgs")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "commandArgs"))
                    .description("Any arguments to append to the command executable when the job is run"),
            PayloadDocumentation.fieldWithPath("clusterCriterias")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "clusterCriterias"))
                    .description(//from  w  ww .j a v a 2s. com
                            "List of cluster criteria's for which a match will be attempted with register cluster tags"),
            PayloadDocumentation.fieldWithPath("commandCriteria")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "commandCriteria")).description(
                            "List of tags which will attempt to match against the commands linked to selected cluster"),
            PayloadDocumentation.fieldWithPath("group")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "group"))
                    .description("A group that the job should be run under on the linux system").optional(),
            PayloadDocumentation.fieldWithPath("disableLogArchival")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "disableLogArchival"))
                    .description(
                            "If you want to disable backing up job output files set this to true. Default: false")
                    .optional(),
            PayloadDocumentation.fieldWithPath("email")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "email"))
                    .description("If you want e-mail notification on job completion enter address here")
                    .optional(),
            PayloadDocumentation.fieldWithPath("cpu")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "cpu"))
                    .description("For future use. Currently has no impact.").optional(),
            PayloadDocumentation.fieldWithPath("memory")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "memory"))
                    .description(
                            "The amount of memory (in MB) desired for job client. Cannot exceed configured max.")
                    .optional(),
            PayloadDocumentation.fieldWithPath("timeout")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "timeout"))
                    .description(
                            "The timeout (in seconds) after which job will be killed by system, system setting used if not set")
                    .optional(),
            PayloadDocumentation.fieldWithPath("dependencies")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "dependencies"))
                    .description(
                            "URI's of dependency files which will be downloaded into job working directory at runtime")
                    .optional(),
            PayloadDocumentation.fieldWithPath("applications")
                    .attributes(getConstraintsForField(JOB_REQUEST_CONSTRAINTS, "applications"))
                    .description(
                            "Complete list of application ids if power user wishes to override selected command defaults")
                    .optional());
}

From source file:com.netflix.genie.web.controllers.Snippets.java

private static FieldDescriptor[] getJobFieldDescriptors() {
    return ArrayUtils.addAll(getCommonFieldDescriptors(JOB_CONSTRAINTS),
            PayloadDocumentation.fieldWithPath("commandArgs")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "commandArgs"))
                    .description("Any arguments to append to the command executable when the job is run"),
            PayloadDocumentation.fieldWithPath("status")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "status"))
                    .description("The status of the job. Options: " + Arrays.toString(JobStatus.values())),
            PayloadDocumentation.fieldWithPath("statusMsg")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "statusMsg"))
                    .description("The status message of the job").optional(),
            PayloadDocumentation.fieldWithPath("started")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "started"))
                    .description("The time (UTC ISO8601 with millis) the job was started").optional(),
            PayloadDocumentation.fieldWithPath("finished")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "finished"))
                    .description("The time (UTC ISO8601 with millis) the job finished").optional(),
            PayloadDocumentation.fieldWithPath("archiveLocation")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "archiveLocation"))
                    .description("The URI where the working directory zip was stored").optional(),
            PayloadDocumentation.fieldWithPath("clusterName")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "clusterName"))
                    .description("The name of the cluster the job was run on if it's been determined")
                    .optional(),//from  w  ww  .ja  v a2 s.  c o  m
            PayloadDocumentation.fieldWithPath("commandName")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "commandName"))
                    .description("The name of the command the job was run with if it's been determined")
                    .optional(),
            PayloadDocumentation.fieldWithPath("runtime")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "runtime"))
                    .description("Runtime of the job in ISO8601 duration format").optional());
}

From source file:com.netflix.genie.web.controllers.Snippets.java

private static FieldDescriptor[] getJobExecutionFieldDescriptors() {
    return ArrayUtils.addAll(getBaseFieldDescriptors(JOB_EXECUTION_CONSTRAINTS),
            PayloadDocumentation.fieldWithPath("hostName")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "hostName"))
                    .description("The host name of the Genie node responsible for the job"),
            PayloadDocumentation.fieldWithPath("processId")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "processId"))
                    .description("The id of the job client process on the Genie node").optional(),
            PayloadDocumentation.fieldWithPath("checkDelay")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "checkDelay"))
                    .description("The amount of time in milliseconds between checks of the job status by Genie")
                    .optional(),/*from  w  w  w .  j av  a 2 s  .co m*/
            PayloadDocumentation.fieldWithPath("timeout")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "timeout"))
                    .description(
                            "The date (UTC ISO8601 with millis) when the job will be killed by Genie due to timeout")
                    .optional(),
            PayloadDocumentation.fieldWithPath("exitCode")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "exitCode"))
                    .description("The job client process exit code after the job is done").optional(),
            PayloadDocumentation.fieldWithPath("memory")
                    .attributes(getConstraintsForField(JOB_CONSTRAINTS, "memory"))
                    .description("The amount of memory (in MB) allocated to the job client").optional());
}

From source file:com.netflix.genie.web.controllers.Snippets.java

private static FieldDescriptor[] getConfigFieldDescriptors(
        final ConstraintDescriptions constraintDescriptions) {
    return ArrayUtils.addAll(getSetupFieldDescriptors(constraintDescriptions),
            PayloadDocumentation.fieldWithPath("configs")
                    .attributes(getConstraintsForField(constraintDescriptions, "configs"))
                    .description("Any configuration files needed for the resource").optional());
}

From source file:com.netflix.genie.web.controllers.Snippets.java

private static FieldDescriptor[] getSetupFieldDescriptors(final ConstraintDescriptions constraintDescriptions) {
    return ArrayUtils.addAll(getCommonFieldDescriptors(constraintDescriptions),
            PayloadDocumentation.fieldWithPath("setupFile")
                    .attributes(getConstraintsForField(constraintDescriptions, "setupFile"))
                    .description("A location for any setup that needs to be done when installing").optional());
}

From source file:com.netflix.genie.web.controllers.Snippets.java

private static FieldDescriptor[] getCommonFieldDescriptors(
        final ConstraintDescriptions constraintDescriptions) {
    return ArrayUtils.addAll(getBaseFieldDescriptors(constraintDescriptions),
            PayloadDocumentation.fieldWithPath("name")
                    .attributes(getConstraintsForField(constraintDescriptions, "name")).description("The name"),
            PayloadDocumentation.fieldWithPath("user")
                    .attributes(getConstraintsForField(constraintDescriptions, "user")).description("The user"),
            PayloadDocumentation.fieldWithPath("version")
                    .attributes(getConstraintsForField(constraintDescriptions, "version"))
                    .description("The version"),
            PayloadDocumentation.fieldWithPath("description")
                    .attributes(getConstraintsForField(constraintDescriptions, "description"))
                    .description("Any description").optional(),
            PayloadDocumentation.fieldWithPath("tags")
                    .attributes(getConstraintsForField(constraintDescriptions, "tags")).description("The tags")
                    .optional());/*from ww w.j  av  a2 s  .  c o  m*/
}

From source file:com.netflix.genie.web.controllers.Snippets.java

private static FieldDescriptor[] getBaseFieldDescriptors(final ConstraintDescriptions constraintDescriptions) {
    return new FieldDescriptor[] {
            PayloadDocumentation.fieldWithPath("id")
                    .attributes(getConstraintsForField(constraintDescriptions, "id"))
                    .description("The id. If not set the system will set one.").optional(),
            PayloadDocumentation.fieldWithPath("created")
                    .attributes(getConstraintsForField(constraintDescriptions, "created"))
                    .description(//from w  w  w  .j  ava 2s  .  c  o  m
                            "The UTC time of creation. Set by system. ISO8601 format including milliseconds.")
                    .optional(),
            PayloadDocumentation.fieldWithPath("updated")
                    .attributes(getConstraintsForField(constraintDescriptions, "updated"))
                    .description(
                            "The UTC time of last update. Set by system. ISO8601 format including milliseconds.")
                    .optional(), };
}

From source file:com.netflix.genie.web.controllers.Snippets.java

private static FieldDescriptor[] getSearchResultFields() {
    return new FieldDescriptor[] {
            PayloadDocumentation.fieldWithPath("_links").description("<<_hateoas,Links>> to other resources.")
                    .attributes(EMPTY_CONSTRAINTS),
            PayloadDocumentation.fieldWithPath("page").description("The result page information.")
                    .attributes(EMPTY_CONSTRAINTS),
            PayloadDocumentation.fieldWithPath("page.size")
                    .description("The number of elements in this page result.").attributes(EMPTY_CONSTRAINTS),
            PayloadDocumentation.fieldWithPath("page.totalElements")
                    .description("The total number of elements this search result could return.")
                    .attributes(EMPTY_CONSTRAINTS),
            PayloadDocumentation.fieldWithPath("page.totalPages")
                    .description("The total number of pages there could be at the current page size.")
                    .attributes(EMPTY_CONSTRAINTS),
            PayloadDocumentation.fieldWithPath("page.number").description("The current page number.")
                    .attributes(EMPTY_CONSTRAINTS), };
}