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\CloudBuild\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudBuild\ApproveBuildRequest;
|
---|
21 | use Google\Service\CloudBuild\Build;
|
---|
22 | use Google\Service\CloudBuild\CancelBuildRequest;
|
---|
23 | use Google\Service\CloudBuild\ListBuildsResponse;
|
---|
24 | use Google\Service\CloudBuild\Operation;
|
---|
25 | use Google\Service\CloudBuild\RetryBuildRequest;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The "builds" collection of methods.
|
---|
29 | * Typical usage is:
|
---|
30 | * <code>
|
---|
31 | * $cloudbuildService = new Google\Service\CloudBuild(...);
|
---|
32 | * $builds = $cloudbuildService->projects_locations_builds;
|
---|
33 | * </code>
|
---|
34 | */
|
---|
35 | class ProjectsLocationsBuilds extends \Google\Service\Resource
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * Approves or rejects a pending build. If approved, the returned LRO will be
|
---|
39 | * analogous to the LRO returned from a CreateBuild call. If rejected, the
|
---|
40 | * returned LRO will be immediately done. (builds.approve)
|
---|
41 | *
|
---|
42 | * @param string $name Required. Name of the target build. For example:
|
---|
43 | * "projects/{$project_id}/builds/{$build_id}"
|
---|
44 | * @param ApproveBuildRequest $postBody
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | * @return Operation
|
---|
47 | */
|
---|
48 | public function approve($name, ApproveBuildRequest $postBody, $optParams = [])
|
---|
49 | {
|
---|
50 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
51 | $params = array_merge($params, $optParams);
|
---|
52 | return $this->call('approve', [$params], Operation::class);
|
---|
53 | }
|
---|
54 | /**
|
---|
55 | * Cancels a build in progress. (builds.cancel)
|
---|
56 | *
|
---|
57 | * @param string $name The name of the `Build` to cancel. Format:
|
---|
58 | * `projects/{project}/locations/{location}/builds/{build}`
|
---|
59 | * @param CancelBuildRequest $postBody
|
---|
60 | * @param array $optParams Optional parameters.
|
---|
61 | * @return Build
|
---|
62 | */
|
---|
63 | public function cancel($name, CancelBuildRequest $postBody, $optParams = [])
|
---|
64 | {
|
---|
65 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
66 | $params = array_merge($params, $optParams);
|
---|
67 | return $this->call('cancel', [$params], Build::class);
|
---|
68 | }
|
---|
69 | /**
|
---|
70 | * Starts a build with the specified configuration. This method returns a long-
|
---|
71 | * running `Operation`, which includes the build ID. Pass the build ID to
|
---|
72 | * `GetBuild` to determine the build status (such as `SUCCESS` or `FAILURE`).
|
---|
73 | * (builds.create)
|
---|
74 | *
|
---|
75 | * @param string $parent The parent resource where this build will be created.
|
---|
76 | * Format: `projects/{project}/locations/{location}`
|
---|
77 | * @param Build $postBody
|
---|
78 | * @param array $optParams Optional parameters.
|
---|
79 | *
|
---|
80 | * @opt_param string projectId Required. ID of the project.
|
---|
81 | * @return Operation
|
---|
82 | */
|
---|
83 | public function create($parent, Build $postBody, $optParams = [])
|
---|
84 | {
|
---|
85 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
86 | $params = array_merge($params, $optParams);
|
---|
87 | return $this->call('create', [$params], Operation::class);
|
---|
88 | }
|
---|
89 | /**
|
---|
90 | * Returns information about a previously requested build. The `Build` that is
|
---|
91 | * returned includes its status (such as `SUCCESS`, `FAILURE`, or `WORKING`),
|
---|
92 | * and timing information. (builds.get)
|
---|
93 | *
|
---|
94 | * @param string $name The name of the `Build` to retrieve. Format:
|
---|
95 | * `projects/{project}/locations/{location}/builds/{build}`
|
---|
96 | * @param array $optParams Optional parameters.
|
---|
97 | *
|
---|
98 | * @opt_param string id Required. ID of the build.
|
---|
99 | * @opt_param string projectId Required. ID of the project.
|
---|
100 | * @return Build
|
---|
101 | */
|
---|
102 | public function get($name, $optParams = [])
|
---|
103 | {
|
---|
104 | $params = ['name' => $name];
|
---|
105 | $params = array_merge($params, $optParams);
|
---|
106 | return $this->call('get', [$params], Build::class);
|
---|
107 | }
|
---|
108 | /**
|
---|
109 | * Lists previously requested builds. Previously requested builds may still be
|
---|
110 | * in-progress, or may have finished successfully or unsuccessfully.
|
---|
111 | * (builds.listProjectsLocationsBuilds)
|
---|
112 | *
|
---|
113 | * @param string $parent The parent of the collection of `Builds`. Format:
|
---|
114 | * `projects/{project}/locations/{location}`
|
---|
115 | * @param array $optParams Optional parameters.
|
---|
116 | *
|
---|
117 | * @opt_param string filter The raw filter text to constrain the results.
|
---|
118 | * @opt_param int pageSize Number of results to return in the list.
|
---|
119 | * @opt_param string pageToken The page token for the next page of Builds. If
|
---|
120 | * unspecified, the first page of results is returned. If the token is rejected
|
---|
121 | * for any reason, INVALID_ARGUMENT will be thrown. In this case, the token
|
---|
122 | * should be discarded, and pagination should be restarted from the first page
|
---|
123 | * of results. See https://google.aip.dev/158 for more.
|
---|
124 | * @opt_param string projectId Required. ID of the project.
|
---|
125 | * @return ListBuildsResponse
|
---|
126 | */
|
---|
127 | public function listProjectsLocationsBuilds($parent, $optParams = [])
|
---|
128 | {
|
---|
129 | $params = ['parent' => $parent];
|
---|
130 | $params = array_merge($params, $optParams);
|
---|
131 | return $this->call('list', [$params], ListBuildsResponse::class);
|
---|
132 | }
|
---|
133 | /**
|
---|
134 | * Creates a new build based on the specified build. This method creates a new
|
---|
135 | * build using the original build request, which may or may not result in an
|
---|
136 | * identical build. For triggered builds: * Triggered builds resolve to a
|
---|
137 | * precise revision; therefore a retry of a triggered build will result in a
|
---|
138 | * build that uses the same revision. For non-triggered builds that specify
|
---|
139 | * `RepoSource`: * If the original build built from the tip of a branch, the
|
---|
140 | * retried build will build from the tip of that branch, which may not be the
|
---|
141 | * same revision as the original build. * If the original build specified a
|
---|
142 | * commit sha or revision ID, the retried build will use the identical source.
|
---|
143 | * For builds that specify `StorageSource`: * If the original build pulled
|
---|
144 | * source from Cloud Storage without specifying the generation of the object,
|
---|
145 | * the new build will use the current object, which may be different from the
|
---|
146 | * original build source. * If the original build pulled source from Cloud
|
---|
147 | * Storage and specified the generation of the object, the new build will
|
---|
148 | * attempt to use the same object, which may or may not be available depending
|
---|
149 | * on the bucket's lifecycle management settings. (builds.retry)
|
---|
150 | *
|
---|
151 | * @param string $name The name of the `Build` to retry. Format:
|
---|
152 | * `projects/{project}/locations/{location}/builds/{build}`
|
---|
153 | * @param RetryBuildRequest $postBody
|
---|
154 | * @param array $optParams Optional parameters.
|
---|
155 | * @return Operation
|
---|
156 | */
|
---|
157 | public function retry($name, RetryBuildRequest $postBody, $optParams = [])
|
---|
158 | {
|
---|
159 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
160 | $params = array_merge($params, $optParams);
|
---|
161 | return $this->call('retry', [$params], Operation::class);
|
---|
162 | }
|
---|
163 | }
|
---|
164 |
|
---|
165 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
166 | class_alias(ProjectsLocationsBuilds::class, 'Google_Service_CloudBuild_Resource_ProjectsLocationsBuilds');
|
---|