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\CloudRun\Resource;
19
20use Google\Service\CloudRun\GoogleCloudRunV2ListServicesResponse;
21use Google\Service\CloudRun\GoogleCloudRunV2Service;
22use Google\Service\CloudRun\GoogleIamV1Policy;
23use Google\Service\CloudRun\GoogleIamV1SetIamPolicyRequest;
24use Google\Service\CloudRun\GoogleIamV1TestIamPermissionsRequest;
25use Google\Service\CloudRun\GoogleIamV1TestIamPermissionsResponse;
26use Google\Service\CloudRun\GoogleLongrunningOperation;
27
28/**
29 * The "services" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $runService = new Google\Service\CloudRun(...);
33 *   $services = $runService->services;
34 *  </code>
35 */
36class ProjectsLocationsServices extends \Google\Service\Resource
37{
38  /**
39   * Creates a new Service in a given project and location. (services.create)
40   *
41   * @param string $parent Required. The location and project in which this
42   * service should be created. Format:
43   * projects/{projectnumber}/locations/{location}
44   * @param GoogleCloudRunV2Service $postBody
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string serviceId Required. The unique identifier for the Service.
48   * The name of the service becomes {parent}/services/{service_id}.
49   * @opt_param bool validateOnly Indicates that the request should be validated
50   * and default values populated, without persisting the request or creating any
51   * resources.
52   * @return GoogleLongrunningOperation
53   */
54  public function create($parent, GoogleCloudRunV2Service $postBody, $optParams = [])
55  {
56    $params = ['parent' => $parent, 'postBody' => $postBody];
57    $params = array_merge($params, $optParams);
58    return $this->call('create', [$params], GoogleLongrunningOperation::class);
59  }
60  /**
61   * Deletes a Service. This will cause the Service to stop serving traffic and
62   * will delete all revisions. (services.delete)
63   *
64   * @param string $name Required. The full name of the Service. Format:
65   * projects/{projectnumber}/locations/{location}/services/{service}
66   * @param array $optParams Optional parameters.
67   *
68   * @opt_param string etag A system-generated fingerprint for this version of the
69   * resource. May be used to detect modification conflict during updates.
70   * @opt_param bool validateOnly Indicates that the request should be validated
71   * without actually deleting any resources.
72   * @return GoogleLongrunningOperation
73   */
74  public function delete($name, $optParams = [])
75  {
76    $params = ['name' => $name];
77    $params = array_merge($params, $optParams);
78    return $this->call('delete', [$params], GoogleLongrunningOperation::class);
79  }
80  /**
81   * Gets information about a Service. (services.get)
82   *
83   * @param string $name Required. The full name of the Service. Format:
84   * projects/{projectnumber}/locations/{location}/services/{service}
85   * @param array $optParams Optional parameters.
86   * @return GoogleCloudRunV2Service
87   */
88  public function get($name, $optParams = [])
89  {
90    $params = ['name' => $name];
91    $params = array_merge($params, $optParams);
92    return $this->call('get', [$params], GoogleCloudRunV2Service::class);
93  }
94  /**
95   * Get the IAM Access Control policy currently in effect for the given Cloud Run
96   * Service. This result does not include any inherited policies.
97   * (services.getIamPolicy)
98   *
99   * @param string $resource REQUIRED: The resource for which the policy is being
100   * requested. See the operation documentation for the appropriate value for this
101   * field.
102   * @param array $optParams Optional parameters.
103   *
104   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
105   * version that will be used to format the policy. Valid values are 0, 1, and 3.
106   * Requests specifying an invalid value will be rejected. Requests for policies
107   * with any conditional role bindings must specify version 3. Policies with no
108   * conditional role bindings may specify any valid value or leave the field
109   * unset. The policy in the response might use the policy version that you
110   * specified, or it might use a lower policy version. For example, if you
111   * specify version 3, but the policy has no conditional role bindings, the
112   * response uses version 1. To learn which resources support conditions in their
113   * IAM policies, see the [IAM
114   * documentation](https://cloud.google.com/iam/help/conditions/resource-
115   * policies).
116   * @return GoogleIamV1Policy
117   */
118  public function getIamPolicy($resource, $optParams = [])
119  {
120    $params = ['resource' => $resource];
121    $params = array_merge($params, $optParams);
122    return $this->call('getIamPolicy', [$params], GoogleIamV1Policy::class);
123  }
124  /**
125   * List Services. (services.listProjectsLocationsServices)
126   *
127   * @param string $parent Required. The location and project to list resources
128   * on. Location must be a valid GCP region, and may not be the "-" wildcard.
129   * Format: projects/{projectnumber}/locations/{location}
130   * @param array $optParams Optional parameters.
131   *
132   * @opt_param int pageSize Maximum number of Services to return in this call.
133   * @opt_param string pageToken A page token received from a previous call to
134   * ListServices. All other parameters must match.
135   * @opt_param bool showDeleted If true, returns deleted (but unexpired)
136   * resources along with active ones.
137   * @return GoogleCloudRunV2ListServicesResponse
138   */
139  public function listProjectsLocationsServices($parent, $optParams = [])
140  {
141    $params = ['parent' => $parent];
142    $params = array_merge($params, $optParams);
143    return $this->call('list', [$params], GoogleCloudRunV2ListServicesResponse::class);
144  }
145  /**
146   * Updates a Service. (services.patch)
147   *
148   * @param string $name The fully qualified name of this Service. In
149   * CreateServiceRequest, this field is ignored, and instead composed from
150   * CreateServiceRequest.parent and CreateServiceRequest.service_id. Format:
151   * projects/{project}/locations/{location}/services/{service_id}
152   * @param GoogleCloudRunV2Service $postBody
153   * @param array $optParams Optional parameters.
154   *
155   * @opt_param bool allowMissing If set to true, and if the Service does not
156   * exist, it will create a new one. Caller must have both create and update
157   * permissions for this call if this is set to true.
158   * @opt_param string updateMask The list of fields to be updated.
159   * @opt_param bool validateOnly Indicates that the request should be validated
160   * and default values populated, without persisting the request or updating any
161   * resources.
162   * @return GoogleLongrunningOperation
163   */
164  public function patch($name, GoogleCloudRunV2Service $postBody, $optParams = [])
165  {
166    $params = ['name' => $name, 'postBody' => $postBody];
167    $params = array_merge($params, $optParams);
168    return $this->call('patch', [$params], GoogleLongrunningOperation::class);
169  }
170  /**
171   * Sets the IAM Access control policy for the specified Service. Overwrites any
172   * existing policy. (services.setIamPolicy)
173   *
174   * @param string $resource REQUIRED: The resource for which the policy is being
175   * specified. See the operation documentation for the appropriate value for this
176   * field.
177   * @param GoogleIamV1SetIamPolicyRequest $postBody
178   * @param array $optParams Optional parameters.
179   * @return GoogleIamV1Policy
180   */
181  public function setIamPolicy($resource, GoogleIamV1SetIamPolicyRequest $postBody, $optParams = [])
182  {
183    $params = ['resource' => $resource, 'postBody' => $postBody];
184    $params = array_merge($params, $optParams);
185    return $this->call('setIamPolicy', [$params], GoogleIamV1Policy::class);
186  }
187  /**
188   * Returns permissions that a caller has on the specified Project. There are no
189   * permissions required for making this API call. (services.testIamPermissions)
190   *
191   * @param string $resource REQUIRED: The resource for which the policy detail is
192   * being requested. See the operation documentation for the appropriate value
193   * for this field.
194   * @param GoogleIamV1TestIamPermissionsRequest $postBody
195   * @param array $optParams Optional parameters.
196   * @return GoogleIamV1TestIamPermissionsResponse
197   */
198  public function testIamPermissions($resource, GoogleIamV1TestIamPermissionsRequest $postBody, $optParams = [])
199  {
200    $params = ['resource' => $resource, 'postBody' => $postBody];
201    $params = array_merge($params, $optParams);
202    return $this->call('testIamPermissions', [$params], GoogleIamV1TestIamPermissionsResponse::class);
203  }
204}
205
206// Adding a class alias for backwards compatibility with the previous class name.
207class_alias(ProjectsLocationsServices::class, 'Google_Service_CloudRun_Resource_ProjectsLocationsServices');
208