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\NetworkServices\Resource;
19
20use Google\Service\NetworkServices\ListServiceBindingsResponse;
21use Google\Service\NetworkServices\Operation;
22use Google\Service\NetworkServices\Policy;
23use Google\Service\NetworkServices\ServiceBinding;
24use Google\Service\NetworkServices\SetIamPolicyRequest;
25use Google\Service\NetworkServices\TestIamPermissionsRequest;
26use Google\Service\NetworkServices\TestIamPermissionsResponse;
27
28/**
29 * The "serviceBindings" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $networkservicesService = new Google\Service\NetworkServices(...);
33 *   $serviceBindings = $networkservicesService->serviceBindings;
34 *  </code>
35 */
36class ProjectsLocationsServiceBindings extends \Google\Service\Resource
37{
38  /**
39   * Creates a new ServiceBinding in a given project and location.
40   * (serviceBindings.create)
41   *
42   * @param string $parent Required. The parent resource of the ServiceBinding.
43   * Must be in the format `projects/locations/global`.
44   * @param ServiceBinding $postBody
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string serviceBindingId Required. Short name of the ServiceBinding
48   * resource to be created.
49   * @return Operation
50   */
51  public function create($parent, ServiceBinding $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 ServiceBinding. (serviceBindings.delete)
59   *
60   * @param string $name Required. A name of the ServiceBinding to delete. Must be
61   * in the format `projects/locations/global/serviceBindings`.
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 ServiceBinding. (serviceBindings.get)
73   *
74   * @param string $name Required. A name of the ServiceBinding to get. Must be in
75   * the format `projects/locations/global/serviceBindings`.
76   * @param array $optParams Optional parameters.
77   * @return ServiceBinding
78   */
79  public function get($name, $optParams = [])
80  {
81    $params = ['name' => $name];
82    $params = array_merge($params, $optParams);
83    return $this->call('get', [$params], ServiceBinding::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.
88   * (serviceBindings.getIamPolicy)
89   *
90   * @param string $resource REQUIRED: The resource for which the policy is being
91   * requested. See the operation documentation for the appropriate value for this
92   * field.
93   * @param array $optParams Optional parameters.
94   *
95   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
96   * version that will be used to format the policy. Valid values are 0, 1, and 3.
97   * Requests specifying an invalid value will be rejected. Requests for policies
98   * with any conditional role bindings must specify version 3. Policies with no
99   * conditional role bindings may specify any valid value or leave the field
100   * unset. The policy in the response might use the policy version that you
101   * specified, or it might use a lower policy version. For example, if you
102   * specify version 3, but the policy has no conditional role bindings, the
103   * response uses version 1. To learn which resources support conditions in their
104   * IAM policies, see the [IAM
105   * documentation](https://cloud.google.com/iam/help/conditions/resource-
106   * policies).
107   * @return Policy
108   */
109  public function getIamPolicy($resource, $optParams = [])
110  {
111    $params = ['resource' => $resource];
112    $params = array_merge($params, $optParams);
113    return $this->call('getIamPolicy', [$params], Policy::class);
114  }
115  /**
116   * Lists ServiceBinding in a given project and location.
117   * (serviceBindings.listProjectsLocationsServiceBindings)
118   *
119   * @param string $parent Required. The project and location from which the
120   * ServiceBindings should be listed, specified in the format
121   * `projects/locations/global`.
122   * @param array $optParams Optional parameters.
123   *
124   * @opt_param int pageSize Maximum number of ServiceBindings to return per call.
125   * @opt_param string pageToken The value returned by the last
126   * `ListServiceBindingsResponse` Indicates that this is a continuation of a
127   * prior `ListRouters` call, and that the system should return the next page of
128   * data.
129   * @return ListServiceBindingsResponse
130   */
131  public function listProjectsLocationsServiceBindings($parent, $optParams = [])
132  {
133    $params = ['parent' => $parent];
134    $params = array_merge($params, $optParams);
135    return $this->call('list', [$params], ListServiceBindingsResponse::class);
136  }
137  /**
138   * Sets the access control policy on the specified resource. Replaces any
139   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
140   * `PERMISSION_DENIED` errors. (serviceBindings.setIamPolicy)
141   *
142   * @param string $resource REQUIRED: The resource for which the policy is being
143   * specified. See the operation documentation for the appropriate value for this
144   * field.
145   * @param SetIamPolicyRequest $postBody
146   * @param array $optParams Optional parameters.
147   * @return Policy
148   */
149  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
150  {
151    $params = ['resource' => $resource, 'postBody' => $postBody];
152    $params = array_merge($params, $optParams);
153    return $this->call('setIamPolicy', [$params], Policy::class);
154  }
155  /**
156   * Returns permissions that a caller has on the specified resource. If the
157   * resource does not exist, this will return an empty set of permissions, not a
158   * `NOT_FOUND` error. Note: This operation is designed to be used for building
159   * permission-aware UIs and command-line tools, not for authorization checking.
160   * This operation may "fail open" without warning.
161   * (serviceBindings.testIamPermissions)
162   *
163   * @param string $resource REQUIRED: The resource for which the policy detail is
164   * being requested. See the operation documentation for the appropriate value
165   * for this field.
166   * @param TestIamPermissionsRequest $postBody
167   * @param array $optParams Optional parameters.
168   * @return TestIamPermissionsResponse
169   */
170  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
171  {
172    $params = ['resource' => $resource, 'postBody' => $postBody];
173    $params = array_merge($params, $optParams);
174    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
175  }
176}
177
178// Adding a class alias for backwards compatibility with the previous class name.
179class_alias(ProjectsLocationsServiceBindings::class, 'Google_Service_NetworkServices_Resource_ProjectsLocationsServiceBindings');
180