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\CloudBuild\Resource;
19
20use Google\Service\CloudBuild\ListWorkerPoolsResponse;
21use Google\Service\CloudBuild\Operation;
22use Google\Service\CloudBuild\WorkerPool;
23
24/**
25 * The "workerPools" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $cloudbuildService = new Google\Service\CloudBuild(...);
29 *   $workerPools = $cloudbuildService->workerPools;
30 *  </code>
31 */
32class ProjectsLocationsWorkerPools extends \Google\Service\Resource
33{
34  /**
35   * Creates a `WorkerPool`. (workerPools.create)
36   *
37   * @param string $parent Required. The parent resource where this worker pool
38   * will be created. Format: `projects/{project}/locations/{location}`.
39   * @param WorkerPool $postBody
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param bool validateOnly If set, validate the request and preview the
43   * response, but do not actually post it.
44   * @opt_param string workerPoolId Required. Immutable. The ID to use for the
45   * `WorkerPool`, which will become the final component of the resource name.
46   * This value should be 1-63 characters, and valid characters are /a-z-/.
47   * @return Operation
48   */
49  public function create($parent, WorkerPool $postBody, $optParams = [])
50  {
51    $params = ['parent' => $parent, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], Operation::class);
54  }
55  /**
56   * Deletes a `WorkerPool`. (workerPools.delete)
57   *
58   * @param string $name Required. The name of the `WorkerPool` to delete. Format:
59   * `projects/{project}/locations/{location}/workerPools/{workerPool}`.
60   * @param array $optParams Optional parameters.
61   *
62   * @opt_param bool allowMissing If set to true, and the `WorkerPool` is not
63   * found, the request will succeed but no action will be taken on the server.
64   * @opt_param string etag Optional. If provided, it must match the server's etag
65   * on the workerpool for the request to be processed.
66   * @opt_param bool validateOnly If set, validate the request and preview the
67   * response, but do not actually post it.
68   * @return Operation
69   */
70  public function delete($name, $optParams = [])
71  {
72    $params = ['name' => $name];
73    $params = array_merge($params, $optParams);
74    return $this->call('delete', [$params], Operation::class);
75  }
76  /**
77   * Returns details of a `WorkerPool`. (workerPools.get)
78   *
79   * @param string $name Required. The name of the `WorkerPool` to retrieve.
80   * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
81   * @param array $optParams Optional parameters.
82   * @return WorkerPool
83   */
84  public function get($name, $optParams = [])
85  {
86    $params = ['name' => $name];
87    $params = array_merge($params, $optParams);
88    return $this->call('get', [$params], WorkerPool::class);
89  }
90  /**
91   * Lists `WorkerPool`s. (workerPools.listProjectsLocationsWorkerPools)
92   *
93   * @param string $parent Required. The parent of the collection of
94   * `WorkerPools`. Format: `projects/{project}/locations/{location}`.
95   * @param array $optParams Optional parameters.
96   *
97   * @opt_param int pageSize The maximum number of `WorkerPool`s to return. The
98   * service may return fewer than this value. If omitted, the server will use a
99   * sensible default.
100   * @opt_param string pageToken A page token, received from a previous
101   * `ListWorkerPools` call. Provide this to retrieve the subsequent page.
102   * @return ListWorkerPoolsResponse
103   */
104  public function listProjectsLocationsWorkerPools($parent, $optParams = [])
105  {
106    $params = ['parent' => $parent];
107    $params = array_merge($params, $optParams);
108    return $this->call('list', [$params], ListWorkerPoolsResponse::class);
109  }
110  /**
111   * Updates a `WorkerPool`. (workerPools.patch)
112   *
113   * @param string $name Output only. The resource name of the `WorkerPool`, with
114   * format `projects/{project}/locations/{location}/workerPools/{worker_pool}`.
115   * The value of `{worker_pool}` is provided by `worker_pool_id` in
116   * `CreateWorkerPool` request and the value of `{location}` is determined by the
117   * endpoint accessed.
118   * @param WorkerPool $postBody
119   * @param array $optParams Optional parameters.
120   *
121   * @opt_param string updateMask A mask specifying which fields in `worker_pool`
122   * to update.
123   * @opt_param bool validateOnly If set, validate the request and preview the
124   * response, but do not actually post it.
125   * @return Operation
126   */
127  public function patch($name, WorkerPool $postBody, $optParams = [])
128  {
129    $params = ['name' => $name, 'postBody' => $postBody];
130    $params = array_merge($params, $optParams);
131    return $this->call('patch', [$params], Operation::class);
132  }
133}
134
135// Adding a class alias for backwards compatibility with the previous class name.
136class_alias(ProjectsLocationsWorkerPools::class, 'Google_Service_CloudBuild_Resource_ProjectsLocationsWorkerPools');
137