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\BiReservation;
21use Google\Service\BigQueryReservation\SearchAllAssignmentsResponse;
22use Google\Service\BigQueryReservation\SearchAssignmentsResponse;
23
24/**
25 * The "locations" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $bigqueryreservationService = new Google\Service\BigQueryReservation(...);
29 *   $locations = $bigqueryreservationService->locations;
30 *  </code>
31 */
32class ProjectsLocations extends \Google\Service\Resource
33{
34  /**
35   * Retrieves a BI reservation. (locations.getBiReservation)
36   *
37   * @param string $name Required. Name of the requested reservation, for example:
38   * `projects/{project_id}/locations/{location_id}/biReservation`
39   * @param array $optParams Optional parameters.
40   * @return BiReservation
41   */
42  public function getBiReservation($name, $optParams = [])
43  {
44    $params = ['name' => $name];
45    $params = array_merge($params, $optParams);
46    return $this->call('getBiReservation', [$params], BiReservation::class);
47  }
48  /**
49   * Looks up assignments for a specified resource for a particular region. If the
50   * request is about a project: 1. Assignments created on the project will be
51   * returned if they exist. 2. Otherwise assignments created on the closest
52   * ancestor will be returned. 3. Assignments for different JobTypes will all be
53   * returned. The same logic applies if the request is about a folder. If the
54   * request is about an organization, then assignments created on the
55   * organization will be returned (organization doesn't have ancestors).
56   * Comparing to ListAssignments, there are some behavior differences: 1.
57   * permission on the assignee will be verified in this API. 2. Hierarchy lookup
58   * (project->folder->organization) happens in this API. 3. Parent here is
59   * `projects/locations`, instead of `projects/locationsreservations`.
60   * (locations.searchAllAssignments)
61   *
62   * @param string $parent Required. The resource name with location (project name
63   * could be the wildcard '-'), e.g.: `projects/-/locations/US`.
64   * @param array $optParams Optional parameters.
65   *
66   * @opt_param int pageSize The maximum number of items to return per page.
67   * @opt_param string pageToken The next_page_token value returned from a
68   * previous List request, if any.
69   * @opt_param string query Please specify resource name as assignee in the
70   * query. Examples: * `assignee=projects/myproject` * `assignee=folders/123` *
71   * `assignee=organizations/456`
72   * @return SearchAllAssignmentsResponse
73   */
74  public function searchAllAssignments($parent, $optParams = [])
75  {
76    $params = ['parent' => $parent];
77    $params = array_merge($params, $optParams);
78    return $this->call('searchAllAssignments', [$params], SearchAllAssignmentsResponse::class);
79  }
80  /**
81   * Deprecated: Looks up assignments for a specified resource for a particular
82   * region. If the request is about a project: 1. Assignments created on the
83   * project will be returned if they exist. 2. Otherwise assignments created on
84   * the closest ancestor will be returned. 3. Assignments for different JobTypes
85   * will all be returned. The same logic applies if the request is about a
86   * folder. If the request is about an organization, then assignments created on
87   * the organization will be returned (organization doesn't have ancestors).
88   * Comparing to ListAssignments, there are some behavior differences: 1.
89   * permission on the assignee will be verified in this API. 2. Hierarchy lookup
90   * (project->folder->organization) happens in this API. 3. Parent here is
91   * `projects/locations`, instead of `projects/locationsreservations`. **Note**
92   * "-" cannot be used for projects nor locations. (locations.searchAssignments)
93   *
94   * @param string $parent Required. The resource name of the admin
95   * project(containing project and location), e.g.:
96   * `projects/myproject/locations/US`.
97   * @param array $optParams Optional parameters.
98   *
99   * @opt_param int pageSize The maximum number of items to return per page.
100   * @opt_param string pageToken The next_page_token value returned from a
101   * previous List request, if any.
102   * @opt_param string query Please specify resource name as assignee in the
103   * query. Examples: * `assignee=projects/myproject` * `assignee=folders/123` *
104   * `assignee=organizations/456`
105   * @return SearchAssignmentsResponse
106   */
107  public function searchAssignments($parent, $optParams = [])
108  {
109    $params = ['parent' => $parent];
110    $params = array_merge($params, $optParams);
111    return $this->call('searchAssignments', [$params], SearchAssignmentsResponse::class);
112  }
113  /**
114   * Updates a BI reservation. Only fields specified in the `field_mask` are
115   * updated. A singleton BI reservation always exists with default size 0. In
116   * order to reserve BI capacity it needs to be updated to an amount greater than
117   * 0. In order to release BI capacity reservation size must be set to 0.
118   * (locations.updateBiReservation)
119   *
120   * @param string $name The resource name of the singleton BI reservation.
121   * Reservation names have the form
122   * `projects/{project_id}/locations/{location_id}/biReservation`.
123   * @param BiReservation $postBody
124   * @param array $optParams Optional parameters.
125   *
126   * @opt_param string updateMask A list of fields to be updated in this request.
127   * @return BiReservation
128   */
129  public function updateBiReservation($name, BiReservation $postBody, $optParams = [])
130  {
131    $params = ['name' => $name, 'postBody' => $postBody];
132    $params = array_merge($params, $optParams);
133    return $this->call('updateBiReservation', [$params], BiReservation::class);
134  }
135}
136
137// Adding a class alias for backwards compatibility with the previous class name.
138class_alias(ProjectsLocations::class, 'Google_Service_BigQueryReservation_Resource_ProjectsLocations');
139