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

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

- ## Method Details

  - ### serviceName

    default String serviceName()
    Specified by:
      `serviceName` in interface `ApiService`

  - ### createReservation

    @POST EnvironmentReservationView createReservation(EnvironmentReservationForm environmentReservationForm)

  - ### getReservation

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

  - ### updateReservation

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

  - ### searchReservations

    @POST @Path("/search") List<EnvironmentReservationSearchView> searchReservations(ReservationFilters filters)

  - ### delete

    @DELETE @Path("/{environmentReservationId:.*/EnvironmentReservation[^/]*}") void delete(@PathParam("environmentReservationId") String environmentReservationId)
    Deletes an environment reservation.
    Parameters:
      `environmentReservationId` - the environment reservation identifier

  - ### addApplication

    @POST @Path("/{environmentReservationId:.*/EnvironmentReservation[^/]*}") void addApplication(@PathParam("environmentReservationId") String environmentReservationId, @QueryParam("applicationId") 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(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

    Map<String,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(String environmentId, 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

    Date nearestComingReservation(String environmentId, 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