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\Endpoint;
21use Google\Service\ServiceDirectory\ListEndpointsResponse;
22use Google\Service\ServiceDirectory\ServicedirectoryEmpty;
23
24/**
25 * The "endpoints" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $servicedirectoryService = new Google\Service\ServiceDirectory(...);
29 *   $endpoints = $servicedirectoryService->endpoints;
30 *  </code>
31 */
32class ProjectsLocationsNamespacesServicesEndpoints extends \Google\Service\Resource
33{
34  /**
35   * Creates an endpoint, and returns the new endpoint. (endpoints.create)
36   *
37   * @param string $parent Required. The resource name of the service that this
38   * endpoint provides.
39   * @param Endpoint $postBody
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param string endpointId Required. The Resource ID must be 1-63
43   * characters long, and comply with RFC1035. Specifically, the name must be 1-63
44   * characters long and match the regular expression
45   * `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first character must be a
46   * lowercase letter, and all following characters must be a dash, lowercase
47   * letter, or digit, except the last character, which cannot be a dash.
48   * @return Endpoint
49   */
50  public function create($parent, Endpoint $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], Endpoint::class);
55  }
56  /**
57   * Deletes an endpoint. (endpoints.delete)
58   *
59   * @param string $name Required. The name of the endpoint to delete.
60   * @param array $optParams Optional parameters.
61   * @return ServicedirectoryEmpty
62   */
63  public function delete($name, $optParams = [])
64  {
65    $params = ['name' => $name];
66    $params = array_merge($params, $optParams);
67    return $this->call('delete', [$params], ServicedirectoryEmpty::class);
68  }
69  /**
70   * Gets an endpoint. (endpoints.get)
71   *
72   * @param string $name Required. The name of the endpoint to get.
73   * @param array $optParams Optional parameters.
74   * @return Endpoint
75   */
76  public function get($name, $optParams = [])
77  {
78    $params = ['name' => $name];
79    $params = array_merge($params, $optParams);
80    return $this->call('get', [$params], Endpoint::class);
81  }
82  /**
83   * Lists all endpoints.
84   * (endpoints.listProjectsLocationsNamespacesServicesEndpoints)
85   *
86   * @param string $parent Required. The resource name of the service whose
87   * endpoints you'd like to list.
88   * @param array $optParams Optional parameters.
89   *
90   * @opt_param string filter Optional. The filter to list results by. General
91   * `filter` string syntax: ` ()` * `` can be `name`, `address`, `port`, or
92   * `annotations.` for map field * `` can be `<`, `>`, `<=`, `>=`, `!=`, `=`,
93   * `:`. Of which `:` means `HAS`, and is roughly the same as `=` * `` must be
94   * the same data type as field * `` can be `AND`, `OR`, `NOT` Examples of valid
95   * filters: * `annotations.owner` returns endpoints that have a annotation with
96   * the key `owner`, this is the same as `annotations:owner` *
97   * `annotations.protocol=gRPC` returns endpoints that have key/value
98   * `protocol=gRPC` * `address=192.108.1.105` returns endpoints that have this
99   * address * `port>8080` returns endpoints that have port number larger than
100   * 8080 * `name>projects/my-project/locations/us-east1/namespaces/my-
101   * namespace/services/my-service/endpoints/endpoint-c` returns endpoints that
102   * have name that is alphabetically later than the string, so "endpoint-e" is
103   * returned but "endpoint-a" is not * `annotations.owner!=sd AND
104   * annotations.foo=bar` returns endpoints that have `owner` in annotation key
105   * but value is not `sd` AND have key/value `foo=bar` * `doesnotexist.foo=bar`
106   * returns an empty list. Note that endpoint doesn't have a field called
107   * "doesnotexist". Since the filter does not match any endpoints, it returns no
108   * results For more information about filtering, see [API
109   * Filtering](https://aip.dev/160).
110   * @opt_param string orderBy Optional. The order to list results by. General
111   * `order_by` string syntax: ` () (,)` * `` allows values: `name`, `address`,
112   * `port` * `` ascending or descending order by ``. If this is left blank, `asc`
113   * is used Note that an empty `order_by` string results in default order, which
114   * is order by `name` in ascending order.
115   * @opt_param int pageSize Optional. The maximum number of items to return.
116   * @opt_param string pageToken Optional. The next_page_token value returned from
117   * a previous List request, if any.
118   * @return ListEndpointsResponse
119   */
120  public function listProjectsLocationsNamespacesServicesEndpoints($parent, $optParams = [])
121  {
122    $params = ['parent' => $parent];
123    $params = array_merge($params, $optParams);
124    return $this->call('list', [$params], ListEndpointsResponse::class);
125  }
126  /**
127   * Updates an endpoint. (endpoints.patch)
128   *
129   * @param string $name Immutable. The resource name for the endpoint in the
130   * format `projects/locations/namespaces/services/endpoints`.
131   * @param Endpoint $postBody
132   * @param array $optParams Optional parameters.
133   *
134   * @opt_param string updateMask Required. List of fields to be updated in this
135   * request.
136   * @return Endpoint
137   */
138  public function patch($name, Endpoint $postBody, $optParams = [])
139  {
140    $params = ['name' => $name, 'postBody' => $postBody];
141    $params = array_merge($params, $optParams);
142    return $this->call('patch', [$params], Endpoint::class);
143  }
144}
145
146// Adding a class alias for backwards compatibility with the previous class name.
147class_alias(ProjectsLocationsNamespacesServicesEndpoints::class, 'Google_Service_ServiceDirectory_Resource_ProjectsLocationsNamespacesServicesEndpoints');
148