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\Networkconnectivity\Resource;
19
20use Google\Service\Networkconnectivity\GoogleLongrunningOperation;
21use Google\Service\Networkconnectivity\ListSpokesResponse;
22use Google\Service\Networkconnectivity\Policy;
23use Google\Service\Networkconnectivity\SetIamPolicyRequest;
24use Google\Service\Networkconnectivity\Spoke;
25use Google\Service\Networkconnectivity\TestIamPermissionsRequest;
26use Google\Service\Networkconnectivity\TestIamPermissionsResponse;
27
28/**
29 * The "spokes" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $networkconnectivityService = new Google\Service\Networkconnectivity(...);
33 *   $spokes = $networkconnectivityService->spokes;
34 *  </code>
35 */
36class ProjectsLocationsSpokes extends \Google\Service\Resource
37{
38  /**
39   * Creates a spoke in the specified project and location. (spokes.create)
40   *
41   * @param string $parent Required. The parent resource.
42   * @param Spoke $postBody
43   * @param array $optParams Optional parameters.
44   *
45   * @opt_param string requestId Optional. A unique request ID (optional). If you
46   * specify this ID, you can use it in cases when you need to retry your request.
47   * When you need to retry, this ID lets the server know that it can ignore the
48   * request if it has already been completed. The server guarantees that for at
49   * least 60 minutes after the first request. For example, consider a situation
50   * where you make an initial request and the request times out. If you make the
51   * request again with the same request ID, the server can check to see whether
52   * the original operation was received. If it was, the server ignores the second
53   * request. This behavior prevents clients from mistakenly creating duplicate
54   * commitments. The request ID must be a valid UUID, with the exception that
55   * zero UUID is not supported (00000000-0000-0000-0000-000000000000).
56   * @opt_param string spokeId Required. Unique id for the spoke to create.
57   * @return GoogleLongrunningOperation
58   */
59  public function create($parent, Spoke $postBody, $optParams = [])
60  {
61    $params = ['parent' => $parent, 'postBody' => $postBody];
62    $params = array_merge($params, $optParams);
63    return $this->call('create', [$params], GoogleLongrunningOperation::class);
64  }
65  /**
66   * Deletes the specified spoke. (spokes.delete)
67   *
68   * @param string $name Required. The name of the spoke to delete.
69   * @param array $optParams Optional parameters.
70   *
71   * @opt_param string requestId Optional. A unique request ID (optional). If you
72   * specify this ID, you can use it in cases when you need to retry your request.
73   * When you need to retry, this ID lets the server know that it can ignore the
74   * request if it has already been completed. The server guarantees that for at
75   * least 60 minutes after the first request. For example, consider a situation
76   * where you make an initial request and the request times out. If you make the
77   * request again with the same request ID, the server can check to see whether
78   * the original operation was received. If it was, the server ignores the second
79   * request. This behavior prevents clients from mistakenly creating duplicate
80   * commitments. The request ID must be a valid UUID, with the exception that
81   * zero UUID is not supported (00000000-0000-0000-0000-000000000000).
82   * @return GoogleLongrunningOperation
83   */
84  public function delete($name, $optParams = [])
85  {
86    $params = ['name' => $name];
87    $params = array_merge($params, $optParams);
88    return $this->call('delete', [$params], GoogleLongrunningOperation::class);
89  }
90  /**
91   * Gets details about the specified spoke. (spokes.get)
92   *
93   * @param string $name Required. The name of the spoke resource.
94   * @param array $optParams Optional parameters.
95   * @return Spoke
96   */
97  public function get($name, $optParams = [])
98  {
99    $params = ['name' => $name];
100    $params = array_merge($params, $optParams);
101    return $this->call('get', [$params], Spoke::class);
102  }
103  /**
104   * Gets the access control policy for a resource. Returns an empty policy if the
105   * resource exists and does not have a policy set. (spokes.getIamPolicy)
106   *
107   * @param string $resource REQUIRED: The resource for which the policy is being
108   * requested. See the operation documentation for the appropriate value for this
109   * field.
110   * @param array $optParams Optional parameters.
111   *
112   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
113   * version that will be used to format the policy. Valid values are 0, 1, and 3.
114   * Requests specifying an invalid value will be rejected. Requests for policies
115   * with any conditional role bindings must specify version 3. Policies with no
116   * conditional role bindings may specify any valid value or leave the field
117   * unset. The policy in the response might use the policy version that you
118   * specified, or it might use a lower policy version. For example, if you
119   * specify version 3, but the policy has no conditional role bindings, the
120   * response uses version 1. To learn which resources support conditions in their
121   * IAM policies, see the [IAM
122   * documentation](https://cloud.google.com/iam/help/conditions/resource-
123   * policies).
124   * @return Policy
125   */
126  public function getIamPolicy($resource, $optParams = [])
127  {
128    $params = ['resource' => $resource];
129    $params = array_merge($params, $optParams);
130    return $this->call('getIamPolicy', [$params], Policy::class);
131  }
132  /**
133   * Lists the spokes in the specified project and location.
134   * (spokes.listProjectsLocationsSpokes)
135   *
136   * @param string $parent Required. The parent resource.
137   * @param array $optParams Optional parameters.
138   *
139   * @opt_param string filter An expression that filters the results listed in the
140   * response.
141   * @opt_param string orderBy Sort the results by a certain order.
142   * @opt_param int pageSize The maximum number of results per page that should be
143   * returned.
144   * @opt_param string pageToken The page token.
145   * @return ListSpokesResponse
146   */
147  public function listProjectsLocationsSpokes($parent, $optParams = [])
148  {
149    $params = ['parent' => $parent];
150    $params = array_merge($params, $optParams);
151    return $this->call('list', [$params], ListSpokesResponse::class);
152  }
153  /**
154   * Updates the parameters of the specified spoke. (spokes.patch)
155   *
156   * @param string $name Immutable. The name of the spoke. Spoke names must be
157   * unique. They use the following form:
158   * `projects/{project_number}/locations/{region}/spokes/{spoke_id}`
159   * @param Spoke $postBody
160   * @param array $optParams Optional parameters.
161   *
162   * @opt_param string requestId Optional. A unique request ID (optional). If you
163   * specify this ID, you can use it in cases when you need to retry your request.
164   * When you need to retry, this ID lets the server know that it can ignore the
165   * request if it has already been completed. The server guarantees that for at
166   * least 60 minutes after the first request. For example, consider a situation
167   * where you make an initial request and the request times out. If you make the
168   * request again with the same request ID, the server can check to see whether
169   * the original operation was received. If it was, the server ignores the second
170   * request. This behavior prevents clients from mistakenly creating duplicate
171   * commitments. The request ID must be a valid UUID, with the exception that
172   * zero UUID is not supported (00000000-0000-0000-0000-000000000000).
173   * @opt_param string updateMask Optional. In the case of an update to an
174   * existing spoke, field mask is used to specify the fields to be overwritten.
175   * The fields specified in the update_mask are relative to the resource, not the
176   * full request. A field is overwritten if it is in the mask. If the user does
177   * not provide a mask, then all fields are overwritten.
178   * @return GoogleLongrunningOperation
179   */
180  public function patch($name, Spoke $postBody, $optParams = [])
181  {
182    $params = ['name' => $name, 'postBody' => $postBody];
183    $params = array_merge($params, $optParams);
184    return $this->call('patch', [$params], GoogleLongrunningOperation::class);
185  }
186  /**
187   * Sets the access control policy on the specified resource. Replaces any
188   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
189   * `PERMISSION_DENIED` errors. (spokes.setIamPolicy)
190   *
191   * @param string $resource REQUIRED: The resource for which the policy is being
192   * specified. See the operation documentation for the appropriate value for this
193   * field.
194   * @param SetIamPolicyRequest $postBody
195   * @param array $optParams Optional parameters.
196   * @return Policy
197   */
198  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
199  {
200    $params = ['resource' => $resource, 'postBody' => $postBody];
201    $params = array_merge($params, $optParams);
202    return $this->call('setIamPolicy', [$params], Policy::class);
203  }
204  /**
205   * Returns permissions that a caller has on the specified resource. If the
206   * resource does not exist, this will return an empty set of permissions, not a
207   * `NOT_FOUND` error. Note: This operation is designed to be used for building
208   * permission-aware UIs and command-line tools, not for authorization checking.
209   * This operation may "fail open" without warning. (spokes.testIamPermissions)
210   *
211   * @param string $resource REQUIRED: The resource for which the policy detail is
212   * being requested. See the operation documentation for the appropriate value
213   * for this field.
214   * @param TestIamPermissionsRequest $postBody
215   * @param array $optParams Optional parameters.
216   * @return TestIamPermissionsResponse
217   */
218  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
219  {
220    $params = ['resource' => $resource, 'postBody' => $postBody];
221    $params = array_merge($params, $optParams);
222    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
223  }
224}
225
226// Adding a class alias for backwards compatibility with the previous class name.
227class_alias(ProjectsLocationsSpokes::class, 'Google_Service_Networkconnectivity_Resource_ProjectsLocationsSpokes');
228