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\Dataproc\Resource;
19
20use Google\Service\Dataproc\AutoscalingPolicy;
21use Google\Service\Dataproc\DataprocEmpty;
22use Google\Service\Dataproc\GetIamPolicyRequest;
23use Google\Service\Dataproc\ListAutoscalingPoliciesResponse;
24use Google\Service\Dataproc\Policy;
25use Google\Service\Dataproc\SetIamPolicyRequest;
26use Google\Service\Dataproc\TestIamPermissionsRequest;
27use Google\Service\Dataproc\TestIamPermissionsResponse;
28
29/**
30 * The "autoscalingPolicies" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $dataprocService = new Google\Service\Dataproc(...);
34 *   $autoscalingPolicies = $dataprocService->autoscalingPolicies;
35 *  </code>
36 */
37class ProjectsLocationsAutoscalingPolicies extends \Google\Service\Resource
38{
39  /**
40   * Creates new autoscaling policy. (autoscalingPolicies.create)
41   *
42   * @param string $parent Required. The "resource name" of the region or
43   * location, as described in
44   * https://cloud.google.com/apis/design/resource_names. For
45   * projects.regions.autoscalingPolicies.create, the resource name of the region
46   * has the following format: projects/{project_id}/regions/{region} For
47   * projects.locations.autoscalingPolicies.create, the resource name of the
48   * location has the following format: projects/{project_id}/locations/{location}
49   * @param AutoscalingPolicy $postBody
50   * @param array $optParams Optional parameters.
51   * @return AutoscalingPolicy
52   */
53  public function create($parent, AutoscalingPolicy $postBody, $optParams = [])
54  {
55    $params = ['parent' => $parent, 'postBody' => $postBody];
56    $params = array_merge($params, $optParams);
57    return $this->call('create', [$params], AutoscalingPolicy::class);
58  }
59  /**
60   * Deletes an autoscaling policy. It is an error to delete an autoscaling policy
61   * that is in use by one or more clusters. (autoscalingPolicies.delete)
62   *
63   * @param string $name Required. The "resource name" of the autoscaling policy,
64   * as described in https://cloud.google.com/apis/design/resource_names. For
65   * projects.regions.autoscalingPolicies.delete, the resource name of the policy
66   * has the following format:
67   * projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For
68   * projects.locations.autoscalingPolicies.delete, the resource name of the
69   * policy has the following format:
70   * projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
71   * @param array $optParams Optional parameters.
72   * @return DataprocEmpty
73   */
74  public function delete($name, $optParams = [])
75  {
76    $params = ['name' => $name];
77    $params = array_merge($params, $optParams);
78    return $this->call('delete', [$params], DataprocEmpty::class);
79  }
80  /**
81   * Retrieves autoscaling policy. (autoscalingPolicies.get)
82   *
83   * @param string $name Required. The "resource name" of the autoscaling policy,
84   * as described in https://cloud.google.com/apis/design/resource_names. For
85   * projects.regions.autoscalingPolicies.get, the resource name of the policy has
86   * the following format:
87   * projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For
88   * projects.locations.autoscalingPolicies.get, the resource name of the policy
89   * has the following format:
90   * projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
91   * @param array $optParams Optional parameters.
92   * @return AutoscalingPolicy
93   */
94  public function get($name, $optParams = [])
95  {
96    $params = ['name' => $name];
97    $params = array_merge($params, $optParams);
98    return $this->call('get', [$params], AutoscalingPolicy::class);
99  }
100  /**
101   * Gets the access control policy for a resource. Returns an empty policy if the
102   * resource exists and does not have a policy set.
103   * (autoscalingPolicies.getIamPolicy)
104   *
105   * @param string $resource REQUIRED: The resource for which the policy is being
106   * requested. See the operation documentation for the appropriate value for this
107   * field.
108   * @param GetIamPolicyRequest $postBody
109   * @param array $optParams Optional parameters.
110   * @return Policy
111   */
112  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
113  {
114    $params = ['resource' => $resource, 'postBody' => $postBody];
115    $params = array_merge($params, $optParams);
116    return $this->call('getIamPolicy', [$params], Policy::class);
117  }
118  /**
119   * Lists autoscaling policies in the project.
120   * (autoscalingPolicies.listProjectsLocationsAutoscalingPolicies)
121   *
122   * @param string $parent Required. The "resource name" of the region or
123   * location, as described in
124   * https://cloud.google.com/apis/design/resource_names. For
125   * projects.regions.autoscalingPolicies.list, the resource name of the region
126   * has the following format: projects/{project_id}/regions/{region} For
127   * projects.locations.autoscalingPolicies.list, the resource name of the
128   * location has the following format: projects/{project_id}/locations/{location}
129   * @param array $optParams Optional parameters.
130   *
131   * @opt_param int pageSize Optional. The maximum number of results to return in
132   * each response. Must be less than or equal to 1000. Defaults to 100.
133   * @opt_param string pageToken Optional. The page token, returned by a previous
134   * call, to request the next page of results.
135   * @return ListAutoscalingPoliciesResponse
136   */
137  public function listProjectsLocationsAutoscalingPolicies($parent, $optParams = [])
138  {
139    $params = ['parent' => $parent];
140    $params = array_merge($params, $optParams);
141    return $this->call('list', [$params], ListAutoscalingPoliciesResponse::class);
142  }
143  /**
144   * Sets the access control policy on the specified resource. Replaces any
145   * existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
146   * errors. (autoscalingPolicies.setIamPolicy)
147   *
148   * @param string $resource REQUIRED: The resource for which the policy is being
149   * specified. See the operation documentation for the appropriate value for this
150   * field.
151   * @param SetIamPolicyRequest $postBody
152   * @param array $optParams Optional parameters.
153   * @return Policy
154   */
155  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
156  {
157    $params = ['resource' => $resource, 'postBody' => $postBody];
158    $params = array_merge($params, $optParams);
159    return $this->call('setIamPolicy', [$params], Policy::class);
160  }
161  /**
162   * Returns permissions that a caller has on the specified resource. If the
163   * resource does not exist, this will return an empty set of permissions, not a
164   * NOT_FOUND error.Note: This operation is designed to be used for building
165   * permission-aware UIs and command-line tools, not for authorization checking.
166   * This operation may "fail open" without warning.
167   * (autoscalingPolicies.testIamPermissions)
168   *
169   * @param string $resource REQUIRED: The resource for which the policy detail is
170   * being requested. See the operation documentation for the appropriate value
171   * for this field.
172   * @param TestIamPermissionsRequest $postBody
173   * @param array $optParams Optional parameters.
174   * @return TestIamPermissionsResponse
175   */
176  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
177  {
178    $params = ['resource' => $resource, 'postBody' => $postBody];
179    $params = array_merge($params, $optParams);
180    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
181  }
182  /**
183   * Updates (replaces) autoscaling policy.Disabled check for update_mask, because
184   * all updates will be full replacements. (autoscalingPolicies.update)
185   *
186   * @param string $name Output only. The "resource name" of the autoscaling
187   * policy, as described in https://cloud.google.com/apis/design/resource_names.
188   * For projects.regions.autoscalingPolicies, the resource name of the policy has
189   * the following format:
190   * projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For
191   * projects.locations.autoscalingPolicies, the resource name of the policy has
192   * the following format:
193   * projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
194   * @param AutoscalingPolicy $postBody
195   * @param array $optParams Optional parameters.
196   * @return AutoscalingPolicy
197   */
198  public function update($name, AutoscalingPolicy $postBody, $optParams = [])
199  {
200    $params = ['name' => $name, 'postBody' => $postBody];
201    $params = array_merge($params, $optParams);
202    return $this->call('update', [$params], AutoscalingPolicy::class);
203  }
204}
205
206// Adding a class alias for backwards compatibility with the previous class name.
207class_alias(ProjectsLocationsAutoscalingPolicies::class, 'Google_Service_Dataproc_Resource_ProjectsLocationsAutoscalingPolicies');
208