[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\CloudBuild\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\CloudBuild\BuildTrigger;
|
---|
| 21 | use Google\Service\CloudBuild\CloudbuildEmpty;
|
---|
| 22 | use Google\Service\CloudBuild\HttpBody;
|
---|
| 23 | use Google\Service\CloudBuild\ListBuildTriggersResponse;
|
---|
| 24 | use Google\Service\CloudBuild\Operation;
|
---|
| 25 | use Google\Service\CloudBuild\ReceiveTriggerWebhookResponse;
|
---|
| 26 | use Google\Service\CloudBuild\RunBuildTriggerRequest;
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * The "triggers" collection of methods.
|
---|
| 30 | * Typical usage is:
|
---|
| 31 | * <code>
|
---|
| 32 | * $cloudbuildService = new Google\Service\CloudBuild(...);
|
---|
| 33 | * $triggers = $cloudbuildService->projects_locations_triggers;
|
---|
| 34 | * </code>
|
---|
| 35 | */
|
---|
| 36 | class ProjectsLocationsTriggers extends \Google\Service\Resource
|
---|
| 37 | {
|
---|
| 38 | /**
|
---|
| 39 | * Creates a new `BuildTrigger`. This API is experimental. (triggers.create)
|
---|
| 40 | *
|
---|
| 41 | * @param string $parent The parent resource where this trigger will be created.
|
---|
| 42 | * Format: `projects/{project}/locations/{location}`
|
---|
| 43 | * @param BuildTrigger $postBody
|
---|
| 44 | * @param array $optParams Optional parameters.
|
---|
| 45 | *
|
---|
| 46 | * @opt_param string projectId Required. ID of the project for which to
|
---|
| 47 | * configure automatic builds.
|
---|
| 48 | * @return BuildTrigger
|
---|
| 49 | */
|
---|
| 50 | public function create($parent, BuildTrigger $postBody, $optParams = [])
|
---|
| 51 | {
|
---|
| 52 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 53 | $params = array_merge($params, $optParams);
|
---|
| 54 | return $this->call('create', [$params], BuildTrigger::class);
|
---|
| 55 | }
|
---|
| 56 | /**
|
---|
| 57 | * Deletes a `BuildTrigger` by its project ID and trigger ID. This API is
|
---|
| 58 | * experimental. (triggers.delete)
|
---|
| 59 | *
|
---|
| 60 | * @param string $name The name of the `Trigger` to delete. Format:
|
---|
| 61 | * `projects/{project}/locations/{location}/triggers/{trigger}`
|
---|
| 62 | * @param array $optParams Optional parameters.
|
---|
| 63 | *
|
---|
| 64 | * @opt_param string projectId Required. ID of the project that owns the
|
---|
| 65 | * trigger.
|
---|
| 66 | * @opt_param string triggerId Required. ID of the `BuildTrigger` to delete.
|
---|
| 67 | * @return CloudbuildEmpty
|
---|
| 68 | */
|
---|
| 69 | public function delete($name, $optParams = [])
|
---|
| 70 | {
|
---|
| 71 | $params = ['name' => $name];
|
---|
| 72 | $params = array_merge($params, $optParams);
|
---|
| 73 | return $this->call('delete', [$params], CloudbuildEmpty::class);
|
---|
| 74 | }
|
---|
| 75 | /**
|
---|
| 76 | * Returns information about a `BuildTrigger`. This API is experimental.
|
---|
| 77 | * (triggers.get)
|
---|
| 78 | *
|
---|
| 79 | * @param string $name The name of the `Trigger` to retrieve. Format:
|
---|
| 80 | * `projects/{project}/locations/{location}/triggers/{trigger}`
|
---|
| 81 | * @param array $optParams Optional parameters.
|
---|
| 82 | *
|
---|
| 83 | * @opt_param string projectId Required. ID of the project that owns the
|
---|
| 84 | * trigger.
|
---|
| 85 | * @opt_param string triggerId Required. Identifier (`id` or `name`) of the
|
---|
| 86 | * `BuildTrigger` to get.
|
---|
| 87 | * @return BuildTrigger
|
---|
| 88 | */
|
---|
| 89 | public function get($name, $optParams = [])
|
---|
| 90 | {
|
---|
| 91 | $params = ['name' => $name];
|
---|
| 92 | $params = array_merge($params, $optParams);
|
---|
| 93 | return $this->call('get', [$params], BuildTrigger::class);
|
---|
| 94 | }
|
---|
| 95 | /**
|
---|
| 96 | * Lists existing `BuildTrigger`s. This API is experimental.
|
---|
| 97 | * (triggers.listProjectsLocationsTriggers)
|
---|
| 98 | *
|
---|
| 99 | * @param string $parent The parent of the collection of `Triggers`. Format:
|
---|
| 100 | * `projects/{project}/locations/{location}`
|
---|
| 101 | * @param array $optParams Optional parameters.
|
---|
| 102 | *
|
---|
| 103 | * @opt_param int pageSize Number of results to return in the list.
|
---|
| 104 | * @opt_param string pageToken Token to provide to skip to a particular spot in
|
---|
| 105 | * the list.
|
---|
| 106 | * @opt_param string projectId Required. ID of the project for which to list
|
---|
| 107 | * BuildTriggers.
|
---|
| 108 | * @return ListBuildTriggersResponse
|
---|
| 109 | */
|
---|
| 110 | public function listProjectsLocationsTriggers($parent, $optParams = [])
|
---|
| 111 | {
|
---|
| 112 | $params = ['parent' => $parent];
|
---|
| 113 | $params = array_merge($params, $optParams);
|
---|
| 114 | return $this->call('list', [$params], ListBuildTriggersResponse::class);
|
---|
| 115 | }
|
---|
| 116 | /**
|
---|
| 117 | * Updates a `BuildTrigger` by its project ID and trigger ID. This API is
|
---|
| 118 | * experimental. (triggers.patch)
|
---|
| 119 | *
|
---|
| 120 | * @param string $resourceName The `Trigger` name with format:
|
---|
| 121 | * `projects/{project}/locations/{location}/triggers/{trigger}`, where {trigger}
|
---|
| 122 | * is a unique identifier generated by the service.
|
---|
| 123 | * @param BuildTrigger $postBody
|
---|
| 124 | * @param array $optParams Optional parameters.
|
---|
| 125 | *
|
---|
| 126 | * @opt_param string projectId Required. ID of the project that owns the
|
---|
| 127 | * trigger.
|
---|
| 128 | * @opt_param string triggerId Required. ID of the `BuildTrigger` to update.
|
---|
| 129 | * @opt_param string updateMask Update mask for the resource. If this is set,
|
---|
| 130 | * the server will only update the fields specified in the field mask.
|
---|
| 131 | * Otherwise, a full update of the mutable resource fields will be performed.
|
---|
| 132 | * @return BuildTrigger
|
---|
| 133 | */
|
---|
| 134 | public function patch($resourceName, BuildTrigger $postBody, $optParams = [])
|
---|
| 135 | {
|
---|
| 136 | $params = ['resourceName' => $resourceName, 'postBody' => $postBody];
|
---|
| 137 | $params = array_merge($params, $optParams);
|
---|
| 138 | return $this->call('patch', [$params], BuildTrigger::class);
|
---|
| 139 | }
|
---|
| 140 | /**
|
---|
| 141 | * Runs a `BuildTrigger` at a particular source revision. To run a regional or
|
---|
| 142 | * global trigger, use the POST request that includes the location endpoint in
|
---|
| 143 | * the path (ex.
|
---|
| 144 | * v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The
|
---|
| 145 | * POST request that does not include the location endpoint in the path can only
|
---|
| 146 | * be used when running global triggers. (triggers.run)
|
---|
| 147 | *
|
---|
| 148 | * @param string $name The name of the `Trigger` to run. Format:
|
---|
| 149 | * `projects/{project}/locations/{location}/triggers/{trigger}`
|
---|
| 150 | * @param RunBuildTriggerRequest $postBody
|
---|
| 151 | * @param array $optParams Optional parameters.
|
---|
| 152 | * @return Operation
|
---|
| 153 | */
|
---|
| 154 | public function run($name, RunBuildTriggerRequest $postBody, $optParams = [])
|
---|
| 155 | {
|
---|
| 156 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 157 | $params = array_merge($params, $optParams);
|
---|
| 158 | return $this->call('run', [$params], Operation::class);
|
---|
| 159 | }
|
---|
| 160 | /**
|
---|
| 161 | * ReceiveTriggerWebhook [Experimental] is called when the API receives a
|
---|
| 162 | * webhook request targeted at a specific trigger. (triggers.webhook)
|
---|
| 163 | *
|
---|
| 164 | * @param string $name The name of the `ReceiveTriggerWebhook` to retrieve.
|
---|
| 165 | * Format: `projects/{project}/locations/{location}/triggers/{trigger}`
|
---|
| 166 | * @param HttpBody $postBody
|
---|
| 167 | * @param array $optParams Optional parameters.
|
---|
| 168 | *
|
---|
| 169 | * @opt_param string projectId Project in which the specified trigger lives
|
---|
| 170 | * @opt_param string secret Secret token used for authorization if an OAuth
|
---|
| 171 | * token isn't provided.
|
---|
| 172 | * @opt_param string trigger Name of the trigger to run the payload against
|
---|
| 173 | * @return ReceiveTriggerWebhookResponse
|
---|
| 174 | */
|
---|
| 175 | public function webhook($name, HttpBody $postBody, $optParams = [])
|
---|
| 176 | {
|
---|
| 177 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 178 | $params = array_merge($params, $optParams);
|
---|
| 179 | return $this->call('webhook', [$params], ReceiveTriggerWebhookResponse::class);
|
---|
| 180 | }
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 184 | class_alias(ProjectsLocationsTriggers::class, 'Google_Service_CloudBuild_Resource_ProjectsLocationsTriggers');
|
---|