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\GameServices\Resource;
19
20use Google\Service\GameServices\FetchDeploymentStateRequest;
21use Google\Service\GameServices\FetchDeploymentStateResponse;
22use Google\Service\GameServices\GameServerDeployment;
23use Google\Service\GameServices\GameServerDeploymentRollout;
24use Google\Service\GameServices\ListGameServerDeploymentsResponse;
25use Google\Service\GameServices\Operation;
26use Google\Service\GameServices\Policy;
27use Google\Service\GameServices\PreviewGameServerDeploymentRolloutResponse;
28use Google\Service\GameServices\SetIamPolicyRequest;
29use Google\Service\GameServices\TestIamPermissionsRequest;
30use Google\Service\GameServices\TestIamPermissionsResponse;
31
32/**
33 * The "gameServerDeployments" collection of methods.
34 * Typical usage is:
35 *  <code>
36 *   $gameservicesService = new Google\Service\GameServices(...);
37 *   $gameServerDeployments = $gameservicesService->gameServerDeployments;
38 *  </code>
39 */
40class ProjectsLocationsGameServerDeployments extends \Google\Service\Resource
41{
42  /**
43   * Creates a new game server deployment in a given project and location.
44   * (gameServerDeployments.create)
45   *
46   * @param string $parent Required. The parent resource name, in the following
47   * form: `projects/{project}/locations/{locationId}`.
48   * @param GameServerDeployment $postBody
49   * @param array $optParams Optional parameters.
50   *
51   * @opt_param string deploymentId Required. The ID of the game server deployment
52   * resource to create.
53   * @return Operation
54   */
55  public function create($parent, GameServerDeployment $postBody, $optParams = [])
56  {
57    $params = ['parent' => $parent, 'postBody' => $postBody];
58    $params = array_merge($params, $optParams);
59    return $this->call('create', [$params], Operation::class);
60  }
61  /**
62   * Deletes a single game server deployment. (gameServerDeployments.delete)
63   *
64   * @param string $name Required. The name of the game server deployment to
65   * delete, in the following form: `projects/{project}/locations/{locationId}/gam
66   * eServerDeployments/{deploymentId}`.
67   * @param array $optParams Optional parameters.
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   * Retrieves information about the current state of the game server deployment.
78   * Gathers all the Agones fleets and Agones autoscalers, including fleets
79   * running an older version of the game server deployment.
80   * (gameServerDeployments.fetchDeploymentState)
81   *
82   * @param string $name Required. The name of the game server deployment, in the
83   * following form: `projects/{project}/locations/{locationId}/gameServerDeployme
84   * nts/{deploymentId}`.
85   * @param FetchDeploymentStateRequest $postBody
86   * @param array $optParams Optional parameters.
87   * @return FetchDeploymentStateResponse
88   */
89  public function fetchDeploymentState($name, FetchDeploymentStateRequest $postBody, $optParams = [])
90  {
91    $params = ['name' => $name, 'postBody' => $postBody];
92    $params = array_merge($params, $optParams);
93    return $this->call('fetchDeploymentState', [$params], FetchDeploymentStateResponse::class);
94  }
95  /**
96   * Gets details of a single game server deployment. (gameServerDeployments.get)
97   *
98   * @param string $name Required. The name of the game server deployment to
99   * retrieve, in the following form: `projects/{project}/locations/{locationId}/g
100   * ameServerDeployments/{deploymentId}`.
101   * @param array $optParams Optional parameters.
102   * @return GameServerDeployment
103   */
104  public function get($name, $optParams = [])
105  {
106    $params = ['name' => $name];
107    $params = array_merge($params, $optParams);
108    return $this->call('get', [$params], GameServerDeployment::class);
109  }
110  /**
111   * Gets the access control policy for a resource. Returns an empty policy if the
112   * resource exists and does not have a policy set.
113   * (gameServerDeployments.getIamPolicy)
114   *
115   * @param string $resource REQUIRED: The resource for which the policy is being
116   * requested. See the operation documentation for the appropriate value for this
117   * field.
118   * @param array $optParams Optional parameters.
119   *
120   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
121   * version that will be used to format the policy. Valid values are 0, 1, and 3.
122   * Requests specifying an invalid value will be rejected. Requests for policies
123   * with any conditional role bindings must specify version 3. Policies with no
124   * conditional role bindings may specify any valid value or leave the field
125   * unset. The policy in the response might use the policy version that you
126   * specified, or it might use a lower policy version. For example, if you
127   * specify version 3, but the policy has no conditional role bindings, the
128   * response uses version 1. To learn which resources support conditions in their
129   * IAM policies, see the [IAM
130   * documentation](https://cloud.google.com/iam/help/conditions/resource-
131   * policies).
132   * @return Policy
133   */
134  public function getIamPolicy($resource, $optParams = [])
135  {
136    $params = ['resource' => $resource];
137    $params = array_merge($params, $optParams);
138    return $this->call('getIamPolicy', [$params], Policy::class);
139  }
140  /**
141   * Gets details of a single game server deployment rollout.
142   * (gameServerDeployments.getRollout)
143   *
144   * @param string $name Required. The name of the game server deployment rollout
145   * to retrieve, in the following form: `projects/{project}/locations/{locationId
146   * }/gameServerDeployments/{deploymentId}/rollout`.
147   * @param array $optParams Optional parameters.
148   * @return GameServerDeploymentRollout
149   */
150  public function getRollout($name, $optParams = [])
151  {
152    $params = ['name' => $name];
153    $params = array_merge($params, $optParams);
154    return $this->call('getRollout', [$params], GameServerDeploymentRollout::class);
155  }
156  /**
157   * Lists game server deployments in a given project and location.
158   * (gameServerDeployments.listProjectsLocationsGameServerDeployments)
159   *
160   * @param string $parent Required. The parent resource name, in the following
161   * form: `projects/{project}/locations/{locationId}`.
162   * @param array $optParams Optional parameters.
163   *
164   * @opt_param string filter Optional. The filter to apply to list results (see
165   * [Filtering](https://google.aip.dev/160)).
166   * @opt_param string orderBy Optional. Specifies the ordering of results
167   * following [Cloud API
168   * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order).
169   * @opt_param int pageSize Optional. The maximum number of items to return. If
170   * unspecified, the server picks an appropriate default. The server may return
171   * fewer items than requested. A caller should only rely on the response's
172   * next_page_token to determine if there are more GameServerDeployments left to
173   * be queried.
174   * @opt_param string pageToken Optional. The next_page_token value returned from
175   * a previous list request, if any.
176   * @return ListGameServerDeploymentsResponse
177   */
178  public function listProjectsLocationsGameServerDeployments($parent, $optParams = [])
179  {
180    $params = ['parent' => $parent];
181    $params = array_merge($params, $optParams);
182    return $this->call('list', [$params], ListGameServerDeploymentsResponse::class);
183  }
184  /**
185   * Patches a game server deployment. (gameServerDeployments.patch)
186   *
187   * @param string $name The resource name of the game server deployment, in the
188   * following form: `projects/{project}/locations/{locationId}/gameServerDeployme
189   * nts/{deploymentId}`. For example, `projects/my-
190   * project/locations/global/gameServerDeployments/my-deployment`.
191   * @param GameServerDeployment $postBody
192   * @param array $optParams Optional parameters.
193   *
194   * @opt_param string updateMask Required. The update mask to apply to the
195   * resource. At least one path must be supplied in this field. For more
196   * information, see the [`FieldMask` definition](https://developers.google.com
197   * /protocol-buffers/docs/reference/google.protobuf#fieldmask).
198   * @return Operation
199   */
200  public function patch($name, GameServerDeployment $postBody, $optParams = [])
201  {
202    $params = ['name' => $name, 'postBody' => $postBody];
203    $params = array_merge($params, $optParams);
204    return $this->call('patch', [$params], Operation::class);
205  }
206  /**
207   * Previews the game server deployment rollout. This API does not mutate the
208   * rollout resource. (gameServerDeployments.previewRollout)
209   *
210   * @param string $name The resource name of the game server deployment rollout,
211   * in the following form: `projects/{project}/locations/{locationId}/gameServerD
212   * eployments/{deploymentId}/rollout`. For example, `projects/my-
213   * project/locations/global/gameServerDeployments/my-deployment/rollout`.
214   * @param GameServerDeploymentRollout $postBody
215   * @param array $optParams Optional parameters.
216   *
217   * @opt_param string previewTime Optional. The target timestamp to compute the
218   * preview. Defaults to the immediately after the proposed rollout completes.
219   * @opt_param string updateMask Optional. The update mask to apply to the
220   * resource. At least one path must be supplied in this field. For more
221   * information, see the [`FieldMask` definition](https://developers.google.com
222   * /protocol-buffers/docs/reference/google.protobuf#fieldmask).
223   * @return PreviewGameServerDeploymentRolloutResponse
224   */
225  public function previewRollout($name, GameServerDeploymentRollout $postBody, $optParams = [])
226  {
227    $params = ['name' => $name, 'postBody' => $postBody];
228    $params = array_merge($params, $optParams);
229    return $this->call('previewRollout', [$params], PreviewGameServerDeploymentRolloutResponse::class);
230  }
231  /**
232   * Sets the access control policy on the specified resource. Replaces any
233   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
234   * `PERMISSION_DENIED` errors. (gameServerDeployments.setIamPolicy)
235   *
236   * @param string $resource REQUIRED: The resource for which the policy is being
237   * specified. See the operation documentation for the appropriate value for this
238   * field.
239   * @param SetIamPolicyRequest $postBody
240   * @param array $optParams Optional parameters.
241   * @return Policy
242   */
243  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
244  {
245    $params = ['resource' => $resource, 'postBody' => $postBody];
246    $params = array_merge($params, $optParams);
247    return $this->call('setIamPolicy', [$params], Policy::class);
248  }
249  /**
250   * Returns permissions that a caller has on the specified resource. If the
251   * resource does not exist, this will return an empty set of permissions, not a
252   * `NOT_FOUND` error. Note: This operation is designed to be used for building
253   * permission-aware UIs and command-line tools, not for authorization checking.
254   * This operation may "fail open" without warning.
255   * (gameServerDeployments.testIamPermissions)
256   *
257   * @param string $resource REQUIRED: The resource for which the policy detail is
258   * being requested. See the operation documentation for the appropriate value
259   * for this field.
260   * @param TestIamPermissionsRequest $postBody
261   * @param array $optParams Optional parameters.
262   * @return TestIamPermissionsResponse
263   */
264  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
265  {
266    $params = ['resource' => $resource, 'postBody' => $postBody];
267    $params = array_merge($params, $optParams);
268    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
269  }
270  /**
271   * Patches a single game server deployment rollout. The method will not return
272   * an error if the update does not affect any existing realms. For example, the
273   * following cases will not return an error: * The default_game_server_config is
274   * changed but all existing realms use the override. * A non-existing realm is
275   * explicitly called out in the game_server_config_overrides field.
276   * (gameServerDeployments.updateRollout)
277   *
278   * @param string $name The resource name of the game server deployment rollout,
279   * in the following form: `projects/{project}/locations/{locationId}/gameServerD
280   * eployments/{deploymentId}/rollout`. For example, `projects/my-
281   * project/locations/global/gameServerDeployments/my-deployment/rollout`.
282   * @param GameServerDeploymentRollout $postBody
283   * @param array $optParams Optional parameters.
284   *
285   * @opt_param string updateMask Required. The update mask to apply to the
286   * resource. At least one path must be supplied in this field. For more
287   * information, see the [`FieldMask` definition](https://developers.google.com
288   * /protocol-buffers/docs/reference/google.protobuf#fieldmask).
289   * @return Operation
290   */
291  public function updateRollout($name, GameServerDeploymentRollout $postBody, $optParams = [])
292  {
293    $params = ['name' => $name, 'postBody' => $postBody];
294    $params = array_merge($params, $optParams);
295    return $this->call('updateRollout', [$params], Operation::class);
296  }
297}
298
299// Adding a class alias for backwards compatibility with the previous class name.
300class_alias(ProjectsLocationsGameServerDeployments::class, 'Google_Service_GameServices_Resource_ProjectsLocationsGameServerDeployments');
301