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\NetworkManagement\Resource;
19
20use Google\Service\NetworkManagement\ConnectivityTest;
21use Google\Service\NetworkManagement\ListConnectivityTestsResponse;
22use Google\Service\NetworkManagement\Operation;
23use Google\Service\NetworkManagement\Policy;
24use Google\Service\NetworkManagement\RerunConnectivityTestRequest;
25use Google\Service\NetworkManagement\SetIamPolicyRequest;
26use Google\Service\NetworkManagement\TestIamPermissionsRequest;
27use Google\Service\NetworkManagement\TestIamPermissionsResponse;
28
29/**
30 * The "connectivityTests" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $networkmanagementService = new Google\Service\NetworkManagement(...);
34 *   $connectivityTests = $networkmanagementService->connectivityTests;
35 *  </code>
36 */
37class ProjectsLocationsNetworkmanagementGlobalConnectivityTests extends \Google\Service\Resource
38{
39  /**
40   * Creates a new Connectivity Test. After you create a test, the reachability
41   * analysis is performed as part of the long running operation, which completes
42   * when the analysis completes. If the endpoint specifications in
43   * `ConnectivityTest` are invalid (for example, containing non-existent
44   * resources in the network, or you don't have read permissions to the network
45   * configurations of listed projects), then the reachability result returns a
46   * value of `UNKNOWN`. If the endpoint specifications in `ConnectivityTest` are
47   * incomplete, the reachability result returns a value of AMBIGUOUS. For more
48   * information, see the Connectivity Test documentation.
49   * (connectivityTests.create)
50   *
51   * @param string $parent Required. The parent resource of the Connectivity Test
52   * to create: `projects/{project_id}/locations/global`
53   * @param ConnectivityTest $postBody
54   * @param array $optParams Optional parameters.
55   *
56   * @opt_param string testId Required. The logical name of the Connectivity Test
57   * in your project with the following restrictions: * Must contain only
58   * lowercase letters, numbers, and hyphens. * Must start with a letter. * Must
59   * be between 1-40 characters. * Must end with a number or a letter. * Must be
60   * unique within the customer project
61   * @return Operation
62   */
63  public function create($parent, ConnectivityTest $postBody, $optParams = [])
64  {
65    $params = ['parent' => $parent, 'postBody' => $postBody];
66    $params = array_merge($params, $optParams);
67    return $this->call('create', [$params], Operation::class);
68  }
69  /**
70   * Deletes a specific `ConnectivityTest`. (connectivityTests.delete)
71   *
72   * @param string $name Required. Connectivity Test resource name using the form:
73   * `projects/{project_id}/locations/global/connectivityTests/{test_id}`
74   * @param array $optParams Optional parameters.
75   * @return Operation
76   */
77  public function delete($name, $optParams = [])
78  {
79    $params = ['name' => $name];
80    $params = array_merge($params, $optParams);
81    return $this->call('delete', [$params], Operation::class);
82  }
83  /**
84   * Gets the details of a specific Connectivity Test. (connectivityTests.get)
85   *
86   * @param string $name Required. `ConnectivityTest` resource name using the
87   * form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
88   * @param array $optParams Optional parameters.
89   * @return ConnectivityTest
90   */
91  public function get($name, $optParams = [])
92  {
93    $params = ['name' => $name];
94    $params = array_merge($params, $optParams);
95    return $this->call('get', [$params], ConnectivityTest::class);
96  }
97  /**
98   * Gets the access control policy for a resource. Returns an empty policy if the
99   * resource exists and does not have a policy set.
100   * (connectivityTests.getIamPolicy)
101   *
102   * @param string $resource REQUIRED: The resource for which the policy is being
103   * requested. See the operation documentation for the appropriate value for this
104   * field.
105   * @param array $optParams Optional parameters.
106   *
107   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
108   * version that will be used to format the policy. Valid values are 0, 1, and 3.
109   * Requests specifying an invalid value will be rejected. Requests for policies
110   * with any conditional role bindings must specify version 3. Policies with no
111   * conditional role bindings may specify any valid value or leave the field
112   * unset. The policy in the response might use the policy version that you
113   * specified, or it might use a lower policy version. For example, if you
114   * specify version 3, but the policy has no conditional role bindings, the
115   * response uses version 1. To learn which resources support conditions in their
116   * IAM policies, see the [IAM
117   * documentation](https://cloud.google.com/iam/help/conditions/resource-
118   * policies).
119   * @return Policy
120   */
121  public function getIamPolicy($resource, $optParams = [])
122  {
123    $params = ['resource' => $resource];
124    $params = array_merge($params, $optParams);
125    return $this->call('getIamPolicy', [$params], Policy::class);
126  }
127  /**
128   * Lists all Connectivity Tests owned by a project. (connectivityTests.listProje
129   * ctsLocationsNetworkmanagementGlobalConnectivityTests)
130   *
131   * @param string $parent Required. The parent resource of the Connectivity
132   * Tests: `projects/{project_id}/locations/global`
133   * @param array $optParams Optional parameters.
134   *
135   * @opt_param string filter Lists the `ConnectivityTests` that match the filter
136   * expression. A filter expression filters the resources listed in the response.
137   * The expression must be of the form ` ` where operators: `<`, `>`, `<=`, `>=`,
138   * `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is
139   * roughly synonymous with equality). can refer to a proto or JSON field, or a
140   * synthetic field. Field names can be camelCase or snake_case. Examples: -
141   * Filter by name: name =
142   * "projects/proj-1/locations/global/connectivityTests/test-1 - Filter by
143   * labels: - Resources that have a key called `foo` labels.foo:* - Resources
144   * that have a key called `foo` whose value is `bar` labels.foo = bar
145   * @opt_param string orderBy Field to use to sort the list.
146   * @opt_param int pageSize Number of `ConnectivityTests` to return.
147   * @opt_param string pageToken Page token from an earlier query, as returned in
148   * `next_page_token`.
149   * @return ListConnectivityTestsResponse
150   */
151  public function listProjectsLocationsNetworkmanagementGlobalConnectivityTests($parent, $optParams = [])
152  {
153    $params = ['parent' => $parent];
154    $params = array_merge($params, $optParams);
155    return $this->call('list', [$params], ListConnectivityTestsResponse::class);
156  }
157  /**
158   * Updates the configuration of an existing `ConnectivityTest`. After you update
159   * a test, the reachability analysis is performed as part of the long running
160   * operation, which completes when the analysis completes. The Reachability
161   * state in the test resource is updated with the new result. If the endpoint
162   * specifications in `ConnectivityTest` are invalid (for example, they contain
163   * non-existent resources in the network, or the user does not have read
164   * permissions to the network configurations of listed projects), then the
165   * reachability result returns a value of UNKNOWN. If the endpoint
166   * specifications in `ConnectivityTest` are incomplete, the reachability result
167   * returns a value of `AMBIGUOUS`. See the documentation in `ConnectivityTest`
168   * for for more details. (connectivityTests.patch)
169   *
170   * @param string $name Required. Unique name of the resource using the form:
171   * `projects/{project_id}/locations/global/connectivityTests/{test_id}`
172   * @param ConnectivityTest $postBody
173   * @param array $optParams Optional parameters.
174   *
175   * @opt_param string updateMask Required. Mask of fields to update. At least one
176   * path must be supplied in this field.
177   * @return Operation
178   */
179  public function patch($name, ConnectivityTest $postBody, $optParams = [])
180  {
181    $params = ['name' => $name, 'postBody' => $postBody];
182    $params = array_merge($params, $optParams);
183    return $this->call('patch', [$params], Operation::class);
184  }
185  /**
186   * Rerun an existing `ConnectivityTest`. After the user triggers the rerun, the
187   * reachability analysis is performed as part of the long running operation,
188   * which completes when the analysis completes. Even though the test
189   * configuration remains the same, the reachability result may change due to
190   * underlying network configuration changes. If the endpoint specifications in
191   * `ConnectivityTest` become invalid (for example, specified resources are
192   * deleted in the network, or you lost read permissions to the network
193   * configurations of listed projects), then the reachability result returns a
194   * value of `UNKNOWN`. (connectivityTests.rerun)
195   *
196   * @param string $name Required. Connectivity Test resource name using the form:
197   * `projects/{project_id}/locations/global/connectivityTests/{test_id}`
198   * @param RerunConnectivityTestRequest $postBody
199   * @param array $optParams Optional parameters.
200   * @return Operation
201   */
202  public function rerun($name, RerunConnectivityTestRequest $postBody, $optParams = [])
203  {
204    $params = ['name' => $name, 'postBody' => $postBody];
205    $params = array_merge($params, $optParams);
206    return $this->call('rerun', [$params], Operation::class);
207  }
208  /**
209   * Sets the access control policy on the specified resource. Replaces any
210   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
211   * `PERMISSION_DENIED` errors. (connectivityTests.setIamPolicy)
212   *
213   * @param string $resource REQUIRED: The resource for which the policy is being
214   * specified. See the operation documentation for the appropriate value for this
215   * field.
216   * @param SetIamPolicyRequest $postBody
217   * @param array $optParams Optional parameters.
218   * @return Policy
219   */
220  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
221  {
222    $params = ['resource' => $resource, 'postBody' => $postBody];
223    $params = array_merge($params, $optParams);
224    return $this->call('setIamPolicy', [$params], Policy::class);
225  }
226  /**
227   * Returns permissions that a caller has on the specified resource. If the
228   * resource does not exist, this will return an empty set of permissions, not a
229   * `NOT_FOUND` error. Note: This operation is designed to be used for building
230   * permission-aware UIs and command-line tools, not for authorization checking.
231   * This operation may "fail open" without warning.
232   * (connectivityTests.testIamPermissions)
233   *
234   * @param string $resource REQUIRED: The resource for which the policy detail is
235   * being requested. See the operation documentation for the appropriate value
236   * for this field.
237   * @param TestIamPermissionsRequest $postBody
238   * @param array $optParams Optional parameters.
239   * @return TestIamPermissionsResponse
240   */
241  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
242  {
243    $params = ['resource' => $resource, 'postBody' => $postBody];
244    $params = array_merge($params, $optParams);
245    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
246  }
247}
248
249// Adding a class alias for backwards compatibility with the previous class name.
250class_alias(ProjectsLocationsNetworkmanagementGlobalConnectivityTests::class, 'Google_Service_NetworkManagement_Resource_ProjectsLocationsNetworkmanagementGlobalConnectivityTests');
251