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\DataFusion\Resource;
19
20use Google\Service\DataFusion\Instance;
21use Google\Service\DataFusion\ListInstancesResponse;
22use Google\Service\DataFusion\Operation;
23use Google\Service\DataFusion\Policy;
24use Google\Service\DataFusion\RestartInstanceRequest;
25use Google\Service\DataFusion\SetIamPolicyRequest;
26use Google\Service\DataFusion\TestIamPermissionsRequest;
27use Google\Service\DataFusion\TestIamPermissionsResponse;
28
29/**
30 * The "instances" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $datafusionService = new Google\Service\DataFusion(...);
34 *   $instances = $datafusionService->instances;
35 *  </code>
36 */
37class ProjectsLocationsInstances extends \Google\Service\Resource
38{
39  /**
40   * Creates a new Data Fusion instance in the specified project and location.
41   * (instances.create)
42   *
43   * @param string $parent Required. The instance's project and location in the
44   * format projects/{project}/locations/{location}.
45   * @param Instance $postBody
46   * @param array $optParams Optional parameters.
47   *
48   * @opt_param string instanceId Required. The name of the instance to create.
49   * @return Operation
50   */
51  public function create($parent, Instance $postBody, $optParams = [])
52  {
53    $params = ['parent' => $parent, 'postBody' => $postBody];
54    $params = array_merge($params, $optParams);
55    return $this->call('create', [$params], Operation::class);
56  }
57  /**
58   * Deletes a single Date Fusion instance. (instances.delete)
59   *
60   * @param string $name Required. The instance resource name in the format
61   * projects/{project}/locations/{location}/instances/{instance}
62   * @param array $optParams Optional parameters.
63   * @return Operation
64   */
65  public function delete($name, $optParams = [])
66  {
67    $params = ['name' => $name];
68    $params = array_merge($params, $optParams);
69    return $this->call('delete', [$params], Operation::class);
70  }
71  /**
72   * Gets details of a single Data Fusion instance. (instances.get)
73   *
74   * @param string $name Required. The instance resource name in the format
75   * projects/{project}/locations/{location}/instances/{instance}.
76   * @param array $optParams Optional parameters.
77   * @return Instance
78   */
79  public function get($name, $optParams = [])
80  {
81    $params = ['name' => $name];
82    $params = array_merge($params, $optParams);
83    return $this->call('get', [$params], Instance::class);
84  }
85  /**
86   * Gets the access control policy for a resource. Returns an empty policy if the
87   * resource exists and does not have a policy set. (instances.getIamPolicy)
88   *
89   * @param string $resource REQUIRED: The resource for which the policy is being
90   * requested. See the operation documentation for the appropriate value for this
91   * field.
92   * @param array $optParams Optional parameters.
93   *
94   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
95   * version that will be used to format the policy. Valid values are 0, 1, and 3.
96   * Requests specifying an invalid value will be rejected. Requests for policies
97   * with any conditional role bindings must specify version 3. Policies with no
98   * conditional role bindings may specify any valid value or leave the field
99   * unset. The policy in the response might use the policy version that you
100   * specified, or it might use a lower policy version. For example, if you
101   * specify version 3, but the policy has no conditional role bindings, the
102   * response uses version 1. To learn which resources support conditions in their
103   * IAM policies, see the [IAM
104   * documentation](https://cloud.google.com/iam/help/conditions/resource-
105   * policies).
106   * @return Policy
107   */
108  public function getIamPolicy($resource, $optParams = [])
109  {
110    $params = ['resource' => $resource];
111    $params = array_merge($params, $optParams);
112    return $this->call('getIamPolicy', [$params], Policy::class);
113  }
114  /**
115   * Lists Data Fusion instances in the specified project and location.
116   * (instances.listProjectsLocationsInstances)
117   *
118   * @param string $parent Required. The project and location for which to
119   * retrieve instance information in the format
120   * projects/{project}/locations/{location}. If the location is specified as '-'
121   * (wildcard), then all regions available to the project are queried, and the
122   * results are aggregated.
123   * @param array $optParams Optional parameters.
124   *
125   * @opt_param string filter List filter.
126   * @opt_param string orderBy Sort results. Supported values are "name", "name
127   * desc", or "" (unsorted).
128   * @opt_param int pageSize The maximum number of items to return.
129   * @opt_param string pageToken The next_page_token value to use if there are
130   * additional results to retrieve for this list request.
131   * @return ListInstancesResponse
132   */
133  public function listProjectsLocationsInstances($parent, $optParams = [])
134  {
135    $params = ['parent' => $parent];
136    $params = array_merge($params, $optParams);
137    return $this->call('list', [$params], ListInstancesResponse::class);
138  }
139  /**
140   * Updates a single Data Fusion instance. (instances.patch)
141   *
142   * @param string $name Output only. The name of this instance is in the form of
143   * projects/{project}/locations/{location}/instances/{instance}.
144   * @param Instance $postBody
145   * @param array $optParams Optional parameters.
146   *
147   * @opt_param string updateMask Field mask is used to specify the fields that
148   * the update will overwrite in an instance resource. The fields specified in
149   * the update_mask are relative to the resource, not the full request. A field
150   * will be overwritten if it is in the mask. If the user does not provide a
151   * mask, the label field will be overwritten.
152   * @return Operation
153   */
154  public function patch($name, Instance $postBody, $optParams = [])
155  {
156    $params = ['name' => $name, 'postBody' => $postBody];
157    $params = array_merge($params, $optParams);
158    return $this->call('patch', [$params], Operation::class);
159  }
160  /**
161   * Restart a single Data Fusion instance. At the end of an operation instance is
162   * fully restarted. (instances.restart)
163   *
164   * @param string $name Required. Name of the Data Fusion instance which need to
165   * be restarted in the form of
166   * projects/{project}/locations/{location}/instances/{instance}
167   * @param RestartInstanceRequest $postBody
168   * @param array $optParams Optional parameters.
169   * @return Operation
170   */
171  public function restart($name, RestartInstanceRequest $postBody, $optParams = [])
172  {
173    $params = ['name' => $name, 'postBody' => $postBody];
174    $params = array_merge($params, $optParams);
175    return $this->call('restart', [$params], Operation::class);
176  }
177  /**
178   * Sets the access control policy on the specified resource. Replaces any
179   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
180   * `PERMISSION_DENIED` errors. (instances.setIamPolicy)
181   *
182   * @param string $resource REQUIRED: The resource for which the policy is being
183   * specified. See the operation documentation for the appropriate value for this
184   * field.
185   * @param SetIamPolicyRequest $postBody
186   * @param array $optParams Optional parameters.
187   * @return Policy
188   */
189  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
190  {
191    $params = ['resource' => $resource, 'postBody' => $postBody];
192    $params = array_merge($params, $optParams);
193    return $this->call('setIamPolicy', [$params], Policy::class);
194  }
195  /**
196   * Returns permissions that a caller has on the specified resource. If the
197   * resource does not exist, this will return an empty set of permissions, not a
198   * `NOT_FOUND` error. Note: This operation is designed to be used for building
199   * permission-aware UIs and command-line tools, not for authorization checking.
200   * This operation may "fail open" without warning.
201   * (instances.testIamPermissions)
202   *
203   * @param string $resource REQUIRED: The resource for which the policy detail is
204   * being requested. See the operation documentation for the appropriate value
205   * for this field.
206   * @param TestIamPermissionsRequest $postBody
207   * @param array $optParams Optional parameters.
208   * @return TestIamPermissionsResponse
209   */
210  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
211  {
212    $params = ['resource' => $resource, 'postBody' => $postBody];
213    $params = array_merge($params, $optParams);
214    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
215  }
216}
217
218// Adding a class alias for backwards compatibility with the previous class name.
219class_alias(ProjectsLocationsInstances::class, 'Google_Service_DataFusion_Resource_ProjectsLocationsInstances');
220