Package com.xebialabs.xlrelease.api.v1

## Interface EnvironmentReservationApi

- All Superinterfaces:
    `ApiService`

      @Path("/api/v1/environments/reservations")
      @Consumes("application/json")
      @Produces("application/json")
      public interface EnvironmentReservationApi
      extends ApiService

- - ### Field Summary

    - ### Fields inherited from interface com.xebialabs.xlrelease.api.ApiService

      `DEFAULT_RESULTS_PER_PAGE, DEFAULT_RESULTS_PER_PAGE_STRING, DEPTH, ORDER_BY, PAGE, PAGE_IS_OFFSET, RESULTS_PER_PAGE, ROLE_IDS_DATA`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addApplication​(java.lang.String environmentReservationId, java.lang.String applicationId)` | Adds an application to an environment reservation.
    `EnvironmentReservation` | `create​(EnvironmentReservation environmentReservation)` | Creates a new environment reservation.
    `EnvironmentReservationView` | `createReservation​(EnvironmentReservationForm environmentReservationForm)` |
    `void` | `delete​(java.lang.String environmentReservationId)` | Deletes an environment reservation.
    `EnvironmentReservation` | `getById​(java.lang.String environmentReservationId)` | Gets an environment reservation by id.
    `EnvironmentReservationView` | `getReservation​(java.lang.String environmentReservationId)` |
    `boolean` | `hasReservation​(java.lang.String environmentId, java.lang.String applicationId)` | Checks if given application has a reservation on a given environment at the current time.
    `java.util.Date` | `nearestComingReservation​(java.lang.String environmentId, java.lang.String applicationId)` | Checks if given application has a reservation on a given environment at the current time or in the future.
    `java.util.Map<java.lang.String,​java.util.List<EnvironmentReservation>>` | `search​(ReservationFilters filters)` | Searches environment reservations by filters.
    `java.util.List<EnvironmentReservationSearchView>` | `searchReservations​(ReservationFilters filters)` |
    `default java.lang.String` | `serviceName()` |
    `EnvironmentReservation` | `update​(EnvironmentReservation environmentReservation)` | Updates an existing environment reservation.
    `EnvironmentReservationView` | `updateReservation​(java.lang.String environmentReservationId, EnvironmentReservationForm environmentReservationForm)` |

- - ### Method Detail

    - #### serviceName

          default java.lang.String serviceName()

      Specified by:
        `serviceName` in interface `ApiService`

    - #### createReservation

          @POST
          EnvironmentReservationView createReservation​(EnvironmentReservationForm environmentReservationForm)

    - #### getReservation

          @GET
          @Path("/{environmentReservationId:.*/EnvironmentReservation[^/]*}")
          EnvironmentReservationView getReservation​(@PathParam("environmentReservationId")
                                                    java.lang.String environmentReservationId)

    - #### updateReservation

          @PUT
          @Path("/{environmentReservationId:.*/EnvironmentReservation[^/]*}")
          EnvironmentReservationView updateReservation​(@PathParam("environmentReservationId")
                                                       java.lang.String environmentReservationId,
                                                       EnvironmentReservationForm environmentReservationForm)

    - #### searchReservations

          @POST
          @Path("/search")
          java.util.List<EnvironmentReservationSearchView> searchReservations​(ReservationFilters filters)

    - #### delete

          @DELETE
          @Path("/{environmentReservationId:.*/EnvironmentReservation[^/]*}")
          void delete​(@PathParam("environmentReservationId")
                      java.lang.String environmentReservationId)

      Deletes an environment reservation.
      Parameters:
        `environmentReservationId` - the environment reservation identifier

    - #### addApplication

          @POST
          @Path("/{environmentReservationId:.*/EnvironmentReservation[^/]*}")
          void addApplication​(@PathParam("environmentReservationId")
                              java.lang.String environmentReservationId,
                              @QueryParam("applicationId")
                              java.lang.String applicationId)

      Adds an application to an environment reservation.
      Parameters:
        `environmentReservationId` - the environment reservation identifier
        `applicationId` - the application identifier

    - #### create

          EnvironmentReservation create​(EnvironmentReservation environmentReservation)

      Creates a new environment reservation.
      Parameters:
        `environmentReservation` - an `EnvironmentReservation` object describing the new environment reservation
      Returns:
        created `EnvironmentReservation` object

    - #### getById

          EnvironmentReservation getById​(java.lang.String environmentReservationId)

      Gets an environment reservation by id.
      Parameters:
        `environmentReservationId` - the environment reservation identifier
      Returns:
        found `EnvironmentReservation` object

    - #### update

          EnvironmentReservation update​(EnvironmentReservation environmentReservation)

      Updates an existing environment reservation.
      Parameters:
        `environmentReservation` - an `EnvironmentReservation` object describing the new properties of the environment reservation
      Returns:
        updated `EnvironmentReservation` object

    - #### search

          java.util.Map<java.lang.String,​java.util.List<EnvironmentReservation>> search​(ReservationFilters filters)

      Searches environment reservations by filters.
      Parameters:
        `filters` - an `EnvironmentReservationFilters` object describing the search criteria
      Returns:
        map of matching `EnvironmentReservation` lists grouped by environment IDs

    - #### hasReservation

          boolean hasReservation​(java.lang.String environmentId,
                                 java.lang.String applicationId)

      Checks if given application has a reservation on a given environment at the current time.
      Parameters:
        `environmentId` - the environment identifier
        `applicationId` - the application identifier
      Returns:
        true if a reservation exists

    - #### nearestComingReservation

          java.util.Date nearestComingReservation​(java.lang.String environmentId,
                                                  java.lang.String applicationId)

      Checks if given application has a reservation on a given environment at the current time or in the future.
      Parameters:
        `environmentId` - the environment identifier
        `applicationId` - the application identifier
      Returns:
        Date of reservation start time. If reservation exists at the current time, then returned date will be less than or equal to now. If future reservation is found, then returned date will be start date of nearest future reservation If neither current nor future reservation found, return value is null