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 |
|
---|
18 | namespace Google\Service\BigQueryReservation\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\BigQueryReservation\BigqueryreservationEmpty;
|
---|
21 | use Google\Service\BigQueryReservation\FailoverReservationRequest;
|
---|
22 | use Google\Service\BigQueryReservation\ListReservationsResponse;
|
---|
23 | use Google\Service\BigQueryReservation\Reservation;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "reservations" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $bigqueryreservationService = new Google\Service\BigQueryReservation(...);
|
---|
30 | * $reservations = $bigqueryreservationService->projects_locations_reservations;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class ProjectsLocationsReservations extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Creates a new reservation resource. (reservations.create)
|
---|
37 | *
|
---|
38 | * @param string $parent Required. Project, location. E.g.,
|
---|
39 | * `projects/myproject/locations/US`
|
---|
40 | * @param Reservation $postBody
|
---|
41 | * @param array $optParams Optional parameters.
|
---|
42 | *
|
---|
43 | * @opt_param string reservationId The reservation ID. It must only contain
|
---|
44 | * lower case alphanumeric characters or dashes. It must start with a letter and
|
---|
45 | * must not end with a dash. Its maximum length is 64 characters.
|
---|
46 | * @return Reservation
|
---|
47 | * @throws \Google\Service\Exception
|
---|
48 | */
|
---|
49 | public function create($parent, Reservation $postBody, $optParams = [])
|
---|
50 | {
|
---|
51 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
52 | $params = array_merge($params, $optParams);
|
---|
53 | return $this->call('create', [$params], Reservation::class);
|
---|
54 | }
|
---|
55 | /**
|
---|
56 | * Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when
|
---|
57 | * reservation has assignments. (reservations.delete)
|
---|
58 | *
|
---|
59 | * @param string $name Required. Resource name of the reservation to retrieve.
|
---|
60 | * E.g., `projects/myproject/locations/US/reservations/team1-prod`
|
---|
61 | * @param array $optParams Optional parameters.
|
---|
62 | * @return BigqueryreservationEmpty
|
---|
63 | * @throws \Google\Service\Exception
|
---|
64 | */
|
---|
65 | public function delete($name, $optParams = [])
|
---|
66 | {
|
---|
67 | $params = ['name' => $name];
|
---|
68 | $params = array_merge($params, $optParams);
|
---|
69 | return $this->call('delete', [$params], BigqueryreservationEmpty::class);
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * Fail over a reservation to the secondary location. The operation should be
|
---|
73 | * done in the current secondary location, which will be promoted to the new
|
---|
74 | * primary location for the reservation. Attempting to failover a reservation in
|
---|
75 | * the current primary location will fail with the error code
|
---|
76 | * `google.rpc.Code.FAILED_PRECONDITION`. (reservations.failoverReservation)
|
---|
77 | *
|
---|
78 | * @param string $name Required. Resource name of the reservation to failover.
|
---|
79 | * E.g., `projects/myproject/locations/US/reservations/team1-prod`
|
---|
80 | * @param FailoverReservationRequest $postBody
|
---|
81 | * @param array $optParams Optional parameters.
|
---|
82 | * @return Reservation
|
---|
83 | * @throws \Google\Service\Exception
|
---|
84 | */
|
---|
85 | public function failoverReservation($name, FailoverReservationRequest $postBody, $optParams = [])
|
---|
86 | {
|
---|
87 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
88 | $params = array_merge($params, $optParams);
|
---|
89 | return $this->call('failoverReservation', [$params], Reservation::class);
|
---|
90 | }
|
---|
91 | /**
|
---|
92 | * Returns information about the reservation. (reservations.get)
|
---|
93 | *
|
---|
94 | * @param string $name Required. Resource name of the reservation to retrieve.
|
---|
95 | * E.g., `projects/myproject/locations/US/reservations/team1-prod`
|
---|
96 | * @param array $optParams Optional parameters.
|
---|
97 | * @return Reservation
|
---|
98 | * @throws \Google\Service\Exception
|
---|
99 | */
|
---|
100 | public function get($name, $optParams = [])
|
---|
101 | {
|
---|
102 | $params = ['name' => $name];
|
---|
103 | $params = array_merge($params, $optParams);
|
---|
104 | return $this->call('get', [$params], Reservation::class);
|
---|
105 | }
|
---|
106 | /**
|
---|
107 | * Lists all the reservations for the project in the specified location.
|
---|
108 | * (reservations.listProjectsLocationsReservations)
|
---|
109 | *
|
---|
110 | * @param string $parent Required. The parent resource name containing project
|
---|
111 | * and location, e.g.: `projects/myproject/locations/US`
|
---|
112 | * @param array $optParams Optional parameters.
|
---|
113 | *
|
---|
114 | * @opt_param int pageSize The maximum number of items to return per page.
|
---|
115 | * @opt_param string pageToken The next_page_token value returned from a
|
---|
116 | * previous List request, if any.
|
---|
117 | * @return ListReservationsResponse
|
---|
118 | * @throws \Google\Service\Exception
|
---|
119 | */
|
---|
120 | public function listProjectsLocationsReservations($parent, $optParams = [])
|
---|
121 | {
|
---|
122 | $params = ['parent' => $parent];
|
---|
123 | $params = array_merge($params, $optParams);
|
---|
124 | return $this->call('list', [$params], ListReservationsResponse::class);
|
---|
125 | }
|
---|
126 | /**
|
---|
127 | * Updates an existing reservation resource. (reservations.patch)
|
---|
128 | *
|
---|
129 | * @param string $name The resource name of the reservation, e.g.,
|
---|
130 | * `projects/locations/reservations/team1-prod`. The reservation_id must only
|
---|
131 | * contain lower case alphanumeric characters or dashes. It must start with a
|
---|
132 | * letter and must not end with a dash. Its maximum length is 64 characters.
|
---|
133 | * @param Reservation $postBody
|
---|
134 | * @param array $optParams Optional parameters.
|
---|
135 | *
|
---|
136 | * @opt_param string updateMask Standard field mask for the set of fields to be
|
---|
137 | * updated.
|
---|
138 | * @return Reservation
|
---|
139 | * @throws \Google\Service\Exception
|
---|
140 | */
|
---|
141 | public function patch($name, Reservation $postBody, $optParams = [])
|
---|
142 | {
|
---|
143 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
144 | $params = array_merge($params, $optParams);
|
---|
145 | return $this->call('patch', [$params], Reservation::class);
|
---|
146 | }
|
---|
147 | }
|
---|
148 |
|
---|
149 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
150 | class_alias(ProjectsLocationsReservations::class, 'Google_Service_BigQueryReservation_Resource_ProjectsLocationsReservations');
|
---|