[e3d4e0a] | 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\Assignment;
|
---|
| 21 | use Google\Service\BigQueryReservation\BigqueryreservationEmpty;
|
---|
| 22 | use Google\Service\BigQueryReservation\ListAssignmentsResponse;
|
---|
| 23 | use Google\Service\BigQueryReservation\MoveAssignmentRequest;
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * The "assignments" collection of methods.
|
---|
| 27 | * Typical usage is:
|
---|
| 28 | * <code>
|
---|
| 29 | * $bigqueryreservationService = new Google\Service\BigQueryReservation(...);
|
---|
| 30 | * $assignments = $bigqueryreservationService->projects_locations_reservations_assignments;
|
---|
| 31 | * </code>
|
---|
| 32 | */
|
---|
| 33 | class ProjectsLocationsReservationsAssignments extends \Google\Service\Resource
|
---|
| 34 | {
|
---|
| 35 | /**
|
---|
| 36 | * Creates an assignment object which allows the given project to submit jobs of
|
---|
| 37 | * a certain type using slots from the specified reservation. Currently a
|
---|
| 38 | * resource (project, folder, organization) can only have one assignment per
|
---|
| 39 | * each (job_type, location) combination, and that reservation will be used for
|
---|
| 40 | * all jobs of the matching type. Different assignments can be created on
|
---|
| 41 | * different levels of the projects, folders or organization hierarchy. During
|
---|
| 42 | * query execution, the assignment is looked up at the project, folder and
|
---|
| 43 | * organization levels in that order. The first assignment found is applied to
|
---|
| 44 | * the query. When creating assignments, it does not matter if other assignments
|
---|
| 45 | * exist at higher levels. Example: * The organization `organizationA` contains
|
---|
| 46 | * two projects, `project1` and `project2`. * Assignments for all three entities
|
---|
| 47 | * (`organizationA`, `project1`, and `project2`) could all be created and mapped
|
---|
| 48 | * to the same or different reservations. "None" assignments represent an
|
---|
| 49 | * absence of the assignment. Projects assigned to None use on-demand pricing.
|
---|
| 50 | * To create a "None" assignment, use "none" as a reservation_id in the parent.
|
---|
| 51 | * Example parent: `projects/myproject/locations/US/reservations/none`. Returns
|
---|
| 52 | * `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin'
|
---|
| 53 | * permissions on the project using the reservation and the project that owns
|
---|
| 54 | * this reservation. Returns `google.rpc.Code.INVALID_ARGUMENT` when location of
|
---|
| 55 | * the assignment does not match location of the reservation.
|
---|
| 56 | * (assignments.create)
|
---|
| 57 | *
|
---|
| 58 | * @param string $parent Required. The parent resource name of the assignment
|
---|
| 59 | * E.g. `projects/myproject/locations/US/reservations/team1-prod`
|
---|
| 60 | * @param Assignment $postBody
|
---|
| 61 | * @param array $optParams Optional parameters.
|
---|
| 62 | *
|
---|
| 63 | * @opt_param string assignmentId The optional assignment ID. Assignment name
|
---|
| 64 | * will be generated automatically if this field is empty. This field must only
|
---|
| 65 | * contain lower case alphanumeric characters or dashes. Max length is 64
|
---|
| 66 | * characters.
|
---|
| 67 | * @return Assignment
|
---|
| 68 | * @throws \Google\Service\Exception
|
---|
| 69 | */
|
---|
| 70 | public function create($parent, Assignment $postBody, $optParams = [])
|
---|
| 71 | {
|
---|
| 72 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 73 | $params = array_merge($params, $optParams);
|
---|
| 74 | return $this->call('create', [$params], Assignment::class);
|
---|
| 75 | }
|
---|
| 76 | /**
|
---|
| 77 | * Deletes a assignment. No expansion will happen. Example: * Organization
|
---|
| 78 | * `organizationA` contains two projects, `project1` and `project2`. *
|
---|
| 79 | * Reservation `res1` exists and was created previously. * CreateAssignment was
|
---|
| 80 | * used previously to define the following associations between entities and
|
---|
| 81 | * reservations: `` and `` In this example, deletion of the `` assignment won't
|
---|
| 82 | * affect the other assignment ``. After said deletion, queries from `project1`
|
---|
| 83 | * will still use `res1` while queries from `project2` will switch to use on-
|
---|
| 84 | * demand mode. (assignments.delete)
|
---|
| 85 | *
|
---|
| 86 | * @param string $name Required. Name of the resource, e.g.
|
---|
| 87 | * `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
|
---|
| 88 | * @param array $optParams Optional parameters.
|
---|
| 89 | * @return BigqueryreservationEmpty
|
---|
| 90 | * @throws \Google\Service\Exception
|
---|
| 91 | */
|
---|
| 92 | public function delete($name, $optParams = [])
|
---|
| 93 | {
|
---|
| 94 | $params = ['name' => $name];
|
---|
| 95 | $params = array_merge($params, $optParams);
|
---|
| 96 | return $this->call('delete', [$params], BigqueryreservationEmpty::class);
|
---|
| 97 | }
|
---|
| 98 | /**
|
---|
| 99 | * Lists assignments. Only explicitly created assignments will be returned.
|
---|
| 100 | * Example: * Organization `organizationA` contains two projects, `project1` and
|
---|
| 101 | * `project2`. * Reservation `res1` exists and was created previously. *
|
---|
| 102 | * CreateAssignment was used previously to define the following associations
|
---|
| 103 | * between entities and reservations: `` and `` In this example, ListAssignments
|
---|
| 104 | * will just return the above two assignments for reservation `res1`, and no
|
---|
| 105 | * expansion/merge will happen. The wildcard "-" can be used for reservations in
|
---|
| 106 | * the request. In that case all assignments belongs to the specified project
|
---|
| 107 | * and location will be listed. **Note** "-" cannot be used for projects nor
|
---|
| 108 | * locations. (assignments.listProjectsLocationsReservationsAssignments)
|
---|
| 109 | *
|
---|
| 110 | * @param string $parent Required. The parent resource name e.g.:
|
---|
| 111 | * `projects/myproject/locations/US/reservations/team1-prod` Or:
|
---|
| 112 | * `projects/myproject/locations/US/reservations/-`
|
---|
| 113 | * @param array $optParams Optional parameters.
|
---|
| 114 | *
|
---|
| 115 | * @opt_param int pageSize The maximum number of items to return per page.
|
---|
| 116 | * @opt_param string pageToken The next_page_token value returned from a
|
---|
| 117 | * previous List request, if any.
|
---|
| 118 | * @return ListAssignmentsResponse
|
---|
| 119 | * @throws \Google\Service\Exception
|
---|
| 120 | */
|
---|
| 121 | public function listProjectsLocationsReservationsAssignments($parent, $optParams = [])
|
---|
| 122 | {
|
---|
| 123 | $params = ['parent' => $parent];
|
---|
| 124 | $params = array_merge($params, $optParams);
|
---|
| 125 | return $this->call('list', [$params], ListAssignmentsResponse::class);
|
---|
| 126 | }
|
---|
| 127 | /**
|
---|
| 128 | * Moves an assignment under a new reservation. This differs from removing an
|
---|
| 129 | * existing assignment and recreating a new one by providing a transactional
|
---|
| 130 | * change that ensures an assignee always has an associated reservation.
|
---|
| 131 | * (assignments.move)
|
---|
| 132 | *
|
---|
| 133 | * @param string $name Required. The resource name of the assignment, e.g.
|
---|
| 134 | * `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
|
---|
| 135 | * @param MoveAssignmentRequest $postBody
|
---|
| 136 | * @param array $optParams Optional parameters.
|
---|
| 137 | * @return Assignment
|
---|
| 138 | * @throws \Google\Service\Exception
|
---|
| 139 | */
|
---|
| 140 | public function move($name, MoveAssignmentRequest $postBody, $optParams = [])
|
---|
| 141 | {
|
---|
| 142 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 143 | $params = array_merge($params, $optParams);
|
---|
| 144 | return $this->call('move', [$params], Assignment::class);
|
---|
| 145 | }
|
---|
| 146 | /**
|
---|
| 147 | * Updates an existing assignment. Only the `priority` field can be updated.
|
---|
| 148 | * (assignments.patch)
|
---|
| 149 | *
|
---|
| 150 | * @param string $name Output only. Name of the resource. E.g.:
|
---|
| 151 | * `projects/myproject/locations/US/reservations/team1-prod/assignments/123`.
|
---|
| 152 | * The assignment_id must only contain lower case alphanumeric characters or
|
---|
| 153 | * dashes and the max length is 64 characters.
|
---|
| 154 | * @param Assignment $postBody
|
---|
| 155 | * @param array $optParams Optional parameters.
|
---|
| 156 | *
|
---|
| 157 | * @opt_param string updateMask Standard field mask for the set of fields to be
|
---|
| 158 | * updated.
|
---|
| 159 | * @return Assignment
|
---|
| 160 | * @throws \Google\Service\Exception
|
---|
| 161 | */
|
---|
| 162 | public function patch($name, Assignment $postBody, $optParams = [])
|
---|
| 163 | {
|
---|
| 164 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 165 | $params = array_merge($params, $optParams);
|
---|
| 166 | return $this->call('patch', [$params], Assignment::class);
|
---|
| 167 | }
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 171 | class_alias(ProjectsLocationsReservationsAssignments::class, 'Google_Service_BigQueryReservation_Resource_ProjectsLocationsReservationsAssignments');
|
---|