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\ServiceDirectory\Resource;
19
20use Google\Service\ServiceDirectory\GetIamPolicyRequest;
21use Google\Service\ServiceDirectory\ListServicesResponse;
22use Google\Service\ServiceDirectory\Policy;
23use Google\Service\ServiceDirectory\ResolveServiceRequest;
24use Google\Service\ServiceDirectory\ResolveServiceResponse;
25use Google\Service\ServiceDirectory\Service;
26use Google\Service\ServiceDirectory\ServicedirectoryEmpty;
27use Google\Service\ServiceDirectory\SetIamPolicyRequest;
28use Google\Service\ServiceDirectory\TestIamPermissionsRequest;
29use Google\Service\ServiceDirectory\TestIamPermissionsResponse;
30
31/**
32 * The "services" collection of methods.
33 * Typical usage is:
34 *  <code>
35 *   $servicedirectoryService = new Google\Service\ServiceDirectory(...);
36 *   $services = $servicedirectoryService->services;
37 *  </code>
38 */
39class ProjectsLocationsNamespacesServices extends \Google\Service\Resource
40{
41  /**
42   * Creates a service, and returns the new service. (services.create)
43   *
44   * @param string $parent Required. The resource name of the namespace this
45   * service will belong to.
46   * @param Service $postBody
47   * @param array $optParams Optional parameters.
48   *
49   * @opt_param string serviceId Required. The Resource ID must be 1-63 characters
50   * long, and comply with RFC1035. Specifically, the name must be 1-63 characters
51   * long and match the regular expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?`
52   * which means the first character must be a lowercase letter, and all following
53   * characters must be a dash, lowercase letter, or digit, except the last
54   * character, which cannot be a dash.
55   * @return Service
56   */
57  public function create($parent, Service $postBody, $optParams = [])
58  {
59    $params = ['parent' => $parent, 'postBody' => $postBody];
60    $params = array_merge($params, $optParams);
61    return $this->call('create', [$params], Service::class);
62  }
63  /**
64   * Deletes a service. This also deletes all endpoints associated with the
65   * service. (services.delete)
66   *
67   * @param string $name Required. The name of the service to delete.
68   * @param array $optParams Optional parameters.
69   * @return ServicedirectoryEmpty
70   */
71  public function delete($name, $optParams = [])
72  {
73    $params = ['name' => $name];
74    $params = array_merge($params, $optParams);
75    return $this->call('delete', [$params], ServicedirectoryEmpty::class);
76  }
77  /**
78   * Gets a service. (services.get)
79   *
80   * @param string $name Required. The name of the service to get.
81   * @param array $optParams Optional parameters.
82   * @return Service
83   */
84  public function get($name, $optParams = [])
85  {
86    $params = ['name' => $name];
87    $params = array_merge($params, $optParams);
88    return $this->call('get', [$params], Service::class);
89  }
90  /**
91   * Gets the IAM Policy for a resource (namespace or service only).
92   * (services.getIamPolicy)
93   *
94   * @param string $resource REQUIRED: The resource for which the policy is being
95   * requested. See the operation documentation for the appropriate value for this
96   * field.
97   * @param GetIamPolicyRequest $postBody
98   * @param array $optParams Optional parameters.
99   * @return Policy
100   */
101  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
102  {
103    $params = ['resource' => $resource, 'postBody' => $postBody];
104    $params = array_merge($params, $optParams);
105    return $this->call('getIamPolicy', [$params], Policy::class);
106  }
107  /**
108   * Lists all services belonging to a namespace.
109   * (services.listProjectsLocationsNamespacesServices)
110   *
111   * @param string $parent Required. The resource name of the namespace whose
112   * services you'd like to list.
113   * @param array $optParams Optional parameters.
114   *
115   * @opt_param string filter Optional. The filter to list results by. General
116   * `filter` string syntax: ` ()` * `` can be `name` or `annotations.` for map
117   * field * `` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:` means
118   * `HAS`, and is roughly the same as `=` * `` must be the same data type as
119   * field * `` can be `AND`, `OR`, `NOT` Examples of valid filters: *
120   * `annotations.owner` returns services that have a annotation with the key
121   * `owner`, this is the same as `annotations:owner` *
122   * `annotations.protocol=gRPC` returns services that have key/value
123   * `protocol=gRPC` * `name>projects/my-project/locations/us-east1/namespaces/my-
124   * namespace/services/service-c` returns services that have name that is
125   * alphabetically later than the string, so "service-e" is returned but
126   * "service-a" is not * `annotations.owner!=sd AND annotations.foo=bar` returns
127   * services that have `owner` in annotation key but value is not `sd` AND have
128   * key/value `foo=bar` * `doesnotexist.foo=bar` returns an empty list. Note that
129   * service doesn't have a field called "doesnotexist". Since the filter does not
130   * match any services, it returns no results For more information about
131   * filtering, see [API Filtering](https://aip.dev/160).
132   * @opt_param string orderBy Optional. The order to list results by. General
133   * `order_by` string syntax: ` () (,)` * `` allows value: `name` * `` ascending
134   * or descending order by ``. If this is left blank, `asc` is used Note that an
135   * empty `order_by` string results in default order, which is order by `name` in
136   * ascending order.
137   * @opt_param int pageSize Optional. The maximum number of items to return.
138   * @opt_param string pageToken Optional. The next_page_token value returned from
139   * a previous List request, if any.
140   * @return ListServicesResponse
141   */
142  public function listProjectsLocationsNamespacesServices($parent, $optParams = [])
143  {
144    $params = ['parent' => $parent];
145    $params = array_merge($params, $optParams);
146    return $this->call('list', [$params], ListServicesResponse::class);
147  }
148  /**
149   * Updates a service. (services.patch)
150   *
151   * @param string $name Immutable. The resource name for the service in the
152   * format `projects/locations/namespaces/services`.
153   * @param Service $postBody
154   * @param array $optParams Optional parameters.
155   *
156   * @opt_param string updateMask Required. List of fields to be updated in this
157   * request.
158   * @return Service
159   */
160  public function patch($name, Service $postBody, $optParams = [])
161  {
162    $params = ['name' => $name, 'postBody' => $postBody];
163    $params = array_merge($params, $optParams);
164    return $this->call('patch', [$params], Service::class);
165  }
166  /**
167   * Returns a service and its associated endpoints. Resolving a service is not
168   * considered an active developer method. (services.resolve)
169   *
170   * @param string $name Required. The name of the service to resolve.
171   * @param ResolveServiceRequest $postBody
172   * @param array $optParams Optional parameters.
173   * @return ResolveServiceResponse
174   */
175  public function resolve($name, ResolveServiceRequest $postBody, $optParams = [])
176  {
177    $params = ['name' => $name, 'postBody' => $postBody];
178    $params = array_merge($params, $optParams);
179    return $this->call('resolve', [$params], ResolveServiceResponse::class);
180  }
181  /**
182   * Sets the IAM Policy for a resource (namespace or service only).
183   * (services.setIamPolicy)
184   *
185   * @param string $resource REQUIRED: The resource for which the policy is being
186   * specified. See the operation documentation for the appropriate value for this
187   * field.
188   * @param SetIamPolicyRequest $postBody
189   * @param array $optParams Optional parameters.
190   * @return Policy
191   */
192  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
193  {
194    $params = ['resource' => $resource, 'postBody' => $postBody];
195    $params = array_merge($params, $optParams);
196    return $this->call('setIamPolicy', [$params], Policy::class);
197  }
198  /**
199   * Tests IAM permissions for a resource (namespace or service only).
200   * (services.testIamPermissions)
201   *
202   * @param string $resource REQUIRED: The resource for which the policy detail is
203   * being requested. See the operation documentation for the appropriate value
204   * for this field.
205   * @param TestIamPermissionsRequest $postBody
206   * @param array $optParams Optional parameters.
207   * @return TestIamPermissionsResponse
208   */
209  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
210  {
211    $params = ['resource' => $resource, 'postBody' => $postBody];
212    $params = array_merge($params, $optParams);
213    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
214  }
215}
216
217// Adding a class alias for backwards compatibility with the previous class name.
218class_alias(ProjectsLocationsNamespacesServices::class, 'Google_Service_ServiceDirectory_Resource_ProjectsLocationsNamespacesServices');
219