1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\BigQueryReservation\Resource;
19
20use Google\Service\BigQueryReservation\BigqueryreservationEmpty;
21use Google\Service\BigQueryReservation\ListReservationsResponse;
22use Google\Service\BigQueryReservation\Reservation;
23
24/**
25 * The "reservations" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $bigqueryreservationService = new Google\Service\BigQueryReservation(...);
29 *   $reservations = $bigqueryreservationService->reservations;
30 *  </code>
31 */
32class ProjectsLocationsReservations extends \Google\Service\Resource
33{
34  /**
35   * Creates a new reservation resource. (reservations.create)
36   *
37   * @param string $parent Required. Project, location. E.g.,
38   * `projects/myproject/locations/US`
39   * @param Reservation $postBody
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param string reservationId The reservation ID. It must only contain
43   * lower case alphanumeric characters or dashes. It must start with a letter and
44   * must not end with a dash. Its maximum length is 64 characters.
45   * @return Reservation
46   */
47  public function create($parent, Reservation $postBody, $optParams = [])
48  {
49    $params = ['parent' => $parent, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('create', [$params], Reservation::class);
52  }
53  /**
54   * Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when
55   * reservation has assignments. (reservations.delete)
56   *
57   * @param string $name Required. Resource name of the reservation to retrieve.
58   * E.g., `projects/myproject/locations/US/reservations/team1-prod`
59   * @param array $optParams Optional parameters.
60   * @return BigqueryreservationEmpty
61   */
62  public function delete($name, $optParams = [])
63  {
64    $params = ['name' => $name];
65    $params = array_merge($params, $optParams);
66    return $this->call('delete', [$params], BigqueryreservationEmpty::class);
67  }
68  /**
69   * Returns information about the reservation. (reservations.get)
70   *
71   * @param string $name Required. Resource name of the reservation to retrieve.
72   * E.g., `projects/myproject/locations/US/reservations/team1-prod`
73   * @param array $optParams Optional parameters.
74   * @return Reservation
75   */
76  public function get($name, $optParams = [])
77  {
78    $params = ['name' => $name];
79    $params = array_merge($params, $optParams);
80    return $this->call('get', [$params], Reservation::class);
81  }
82  /**
83   * Lists all the reservations for the project in the specified location.
84   * (reservations.listProjectsLocationsReservations)
85   *
86   * @param string $parent Required. The parent resource name containing project
87   * and location, e.g.: `projects/myproject/locations/US`
88   * @param array $optParams Optional parameters.
89   *
90   * @opt_param int pageSize The maximum number of items to return per page.
91   * @opt_param string pageToken The next_page_token value returned from a
92   * previous List request, if any.
93   * @return ListReservationsResponse
94   */
95  public function listProjectsLocationsReservations($parent, $optParams = [])
96  {
97    $params = ['parent' => $parent];
98    $params = array_merge($params, $optParams);
99    return $this->call('list', [$params], ListReservationsResponse::class);
100  }
101  /**
102   * Updates an existing reservation resource. (reservations.patch)
103   *
104   * @param string $name The resource name of the reservation, e.g.,
105   * `projects/locations/reservations/team1-prod`. The reservation_id must only
106   * contain lower case alphanumeric characters or dashes. It must start with a
107   * letter and must not end with a dash. Its maximum length is 64 characters.
108   * @param Reservation $postBody
109   * @param array $optParams Optional parameters.
110   *
111   * @opt_param string updateMask Standard field mask for the set of fields to be
112   * updated.
113   * @return Reservation
114   */
115  public function patch($name, Reservation $postBody, $optParams = [])
116  {
117    $params = ['name' => $name, 'postBody' => $postBody];
118    $params = array_merge($params, $optParams);
119    return $this->call('patch', [$params], Reservation::class);
120  }
121}
122
123// Adding a class alias for backwards compatibility with the previous class name.
124class_alias(ProjectsLocationsReservations::class, 'Google_Service_BigQueryReservation_Resource_ProjectsLocationsReservations');
125