source: vendor/google/apiclient-services/src/BigQueryReservation/Resource/ProjectsLocationsCapacityCommitments.php@ e3d4e0a

Last change on this file since e3d4e0a was e3d4e0a, checked in by Vlado 222039 <vlado.popovski@…>, 2 weeks ago

Upload project files

  • Property mode set to 100644
File size: 8.3 KB
Line 
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\CapacityCommitment;
22use Google\Service\BigQueryReservation\ListCapacityCommitmentsResponse;
23use Google\Service\BigQueryReservation\MergeCapacityCommitmentsRequest;
24use Google\Service\BigQueryReservation\SplitCapacityCommitmentRequest;
25use Google\Service\BigQueryReservation\SplitCapacityCommitmentResponse;
26
27/**
28 * The "capacityCommitments" collection of methods.
29 * Typical usage is:
30 * <code>
31 * $bigqueryreservationService = new Google\Service\BigQueryReservation(...);
32 * $capacityCommitments = $bigqueryreservationService->projects_locations_capacityCommitments;
33 * </code>
34 */
35class ProjectsLocationsCapacityCommitments extends \Google\Service\Resource
36{
37 /**
38 * Creates a new capacity commitment resource. (capacityCommitments.create)
39 *
40 * @param string $parent Required. Resource name of the parent reservation.
41 * E.g., `projects/myproject/locations/US`
42 * @param CapacityCommitment $postBody
43 * @param array $optParams Optional parameters.
44 *
45 * @opt_param string capacityCommitmentId The optional capacity commitment ID.
46 * Capacity commitment name will be generated automatically if this field is
47 * empty. This field must only contain lower case alphanumeric characters or
48 * dashes. The first and last character cannot be a dash. Max length is 64
49 * characters. NOTE: this ID won't be kept if the capacity commitment is split
50 * or merged.
51 * @opt_param bool enforceSingleAdminProjectPerOrg If true, fail the request if
52 * another project in the organization has a capacity commitment.
53 * @return CapacityCommitment
54 * @throws \Google\Service\Exception
55 */
56 public function create($parent, CapacityCommitment $postBody, $optParams = [])
57 {
58 $params = ['parent' => $parent, 'postBody' => $postBody];
59 $params = array_merge($params, $optParams);
60 return $this->call('create', [$params], CapacityCommitment::class);
61 }
62 /**
63 * Deletes a capacity commitment. Attempting to delete capacity commitment
64 * before its commitment_end_time will fail with the error code
65 * `google.rpc.Code.FAILED_PRECONDITION`. (capacityCommitments.delete)
66 *
67 * @param string $name Required. Resource name of the capacity commitment to
68 * delete. E.g., `projects/myproject/locations/US/capacityCommitments/123`
69 * @param array $optParams Optional parameters.
70 *
71 * @opt_param bool force Can be used to force delete commitments even if
72 * assignments exist. Deleting commitments with assignments may cause queries to
73 * fail if they no longer have access to slots.
74 * @return BigqueryreservationEmpty
75 * @throws \Google\Service\Exception
76 */
77 public function delete($name, $optParams = [])
78 {
79 $params = ['name' => $name];
80 $params = array_merge($params, $optParams);
81 return $this->call('delete', [$params], BigqueryreservationEmpty::class);
82 }
83 /**
84 * Returns information about the capacity commitment. (capacityCommitments.get)
85 *
86 * @param string $name Required. Resource name of the capacity commitment to
87 * retrieve. E.g., `projects/myproject/locations/US/capacityCommitments/123`
88 * @param array $optParams Optional parameters.
89 * @return CapacityCommitment
90 * @throws \Google\Service\Exception
91 */
92 public function get($name, $optParams = [])
93 {
94 $params = ['name' => $name];
95 $params = array_merge($params, $optParams);
96 return $this->call('get', [$params], CapacityCommitment::class);
97 }
98 /**
99 * Lists all the capacity commitments for the admin project.
100 * (capacityCommitments.listProjectsLocationsCapacityCommitments)
101 *
102 * @param string $parent Required. Resource name of the parent reservation.
103 * E.g., `projects/myproject/locations/US`
104 * @param array $optParams Optional parameters.
105 *
106 * @opt_param int pageSize The maximum number of items to return.
107 * @opt_param string pageToken The next_page_token value returned from a
108 * previous List request, if any.
109 * @return ListCapacityCommitmentsResponse
110 * @throws \Google\Service\Exception
111 */
112 public function listProjectsLocationsCapacityCommitments($parent, $optParams = [])
113 {
114 $params = ['parent' => $parent];
115 $params = array_merge($params, $optParams);
116 return $this->call('list', [$params], ListCapacityCommitmentsResponse::class);
117 }
118 /**
119 * Merges capacity commitments of the same plan into a single commitment. The
120 * resulting capacity commitment has the greater commitment_end_time out of the
121 * to-be-merged capacity commitments. Attempting to merge capacity commitments
122 * of different plan will fail with the error code
123 * `google.rpc.Code.FAILED_PRECONDITION`. (capacityCommitments.merge)
124 *
125 * @param string $parent Parent resource that identifies admin project and
126 * location e.g., `projects/myproject/locations/us`
127 * @param MergeCapacityCommitmentsRequest $postBody
128 * @param array $optParams Optional parameters.
129 * @return CapacityCommitment
130 * @throws \Google\Service\Exception
131 */
132 public function merge($parent, MergeCapacityCommitmentsRequest $postBody, $optParams = [])
133 {
134 $params = ['parent' => $parent, 'postBody' => $postBody];
135 $params = array_merge($params, $optParams);
136 return $this->call('merge', [$params], CapacityCommitment::class);
137 }
138 /**
139 * Updates an existing capacity commitment. Only `plan` and `renewal_plan`
140 * fields can be updated. Plan can only be changed to a plan of a longer
141 * commitment period. Attempting to change to a plan with shorter commitment
142 * period will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
143 * (capacityCommitments.patch)
144 *
145 * @param string $name Output only. The resource name of the capacity
146 * commitment, e.g., `projects/myproject/locations/US/capacityCommitments/123`
147 * The commitment_id must only contain lower case alphanumeric characters or
148 * dashes. It must start with a letter and must not end with a dash. Its maximum
149 * length is 64 characters.
150 * @param CapacityCommitment $postBody
151 * @param array $optParams Optional parameters.
152 *
153 * @opt_param string updateMask Standard field mask for the set of fields to be
154 * updated.
155 * @return CapacityCommitment
156 * @throws \Google\Service\Exception
157 */
158 public function patch($name, CapacityCommitment $postBody, $optParams = [])
159 {
160 $params = ['name' => $name, 'postBody' => $postBody];
161 $params = array_merge($params, $optParams);
162 return $this->call('patch', [$params], CapacityCommitment::class);
163 }
164 /**
165 * Splits capacity commitment to two commitments of the same plan and
166 * `commitment_end_time`. A common use case is to enable downgrading
167 * commitments. For example, in order to downgrade from 10000 slots to 8000, you
168 * might split a 10000 capacity commitment into commitments of 2000 and 8000.
169 * Then, you delete the first one after the commitment end time passes.
170 * (capacityCommitments.split)
171 *
172 * @param string $name Required. The resource name e.g.,:
173 * `projects/myproject/locations/US/capacityCommitments/123`
174 * @param SplitCapacityCommitmentRequest $postBody
175 * @param array $optParams Optional parameters.
176 * @return SplitCapacityCommitmentResponse
177 * @throws \Google\Service\Exception
178 */
179 public function split($name, SplitCapacityCommitmentRequest $postBody, $optParams = [])
180 {
181 $params = ['name' => $name, 'postBody' => $postBody];
182 $params = array_merge($params, $optParams);
183 return $this->call('split', [$params], SplitCapacityCommitmentResponse::class);
184 }
185}
186
187// Adding a class alias for backwards compatibility with the previous class name.
188class_alias(ProjectsLocationsCapacityCommitments::class, 'Google_Service_BigQueryReservation_Resource_ProjectsLocationsCapacityCommitments');
Note: See TracBrowser for help on using the repository browser.