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\Monitoring\Resource;
19
20use Google\Service\Monitoring\ListServicesResponse;
21use Google\Service\Monitoring\MonitoringEmpty;
22use Google\Service\Monitoring\Service;
23
24/**
25 * The "services" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $monitoringService = new Google\Service\Monitoring(...);
29 *   $services = $monitoringService->services;
30 *  </code>
31 */
32class Services extends \Google\Service\Resource
33{
34  /**
35   * Create a Service. (services.create)
36   *
37   * @param string $parent Required. Resource name
38   * (https://cloud.google.com/monitoring/api/v3#project_name) of the parent
39   * workspace. The format is: projects/[PROJECT_ID_OR_NUMBER]
40   * @param Service $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string serviceId Optional. The Service id to use for this Service.
44   * If omitted, an id will be generated instead. Must match the pattern
45   * [a-z0-9\-]+
46   * @return Service
47   */
48  public function create($parent, Service $postBody, $optParams = [])
49  {
50    $params = ['parent' => $parent, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], Service::class);
53  }
54  /**
55   * Soft delete this Service. (services.delete)
56   *
57   * @param string $name Required. Resource name of the Service to delete. The
58   * format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
59   * @param array $optParams Optional parameters.
60   * @return MonitoringEmpty
61   */
62  public function delete($name, $optParams = [])
63  {
64    $params = ['name' => $name];
65    $params = array_merge($params, $optParams);
66    return $this->call('delete', [$params], MonitoringEmpty::class);
67  }
68  /**
69   * Get the named Service. (services.get)
70   *
71   * @param string $name Required. Resource name of the Service. The format is:
72   * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
73   * @param array $optParams Optional parameters.
74   * @return Service
75   */
76  public function get($name, $optParams = [])
77  {
78    $params = ['name' => $name];
79    $params = array_merge($params, $optParams);
80    return $this->call('get', [$params], Service::class);
81  }
82  /**
83   * List Services for this workspace. (services.listServices)
84   *
85   * @param string $parent Required. Resource name of the parent containing the
86   * listed services, either a project
87   * (https://cloud.google.com/monitoring/api/v3#project_name) or a Monitoring
88   * Workspace. The formats are: projects/[PROJECT_ID_OR_NUMBER]
89   * workspaces/[HOST_PROJECT_ID_OR_NUMBER]
90   * @param array $optParams Optional parameters.
91   *
92   * @opt_param string filter A filter specifying what Services to return. The
93   * filter currently supports the following fields: - `identifier_case` -
94   * `app_engine.module_id` - `cloud_endpoints.service` (reserved for future use)
95   * - `mesh_istio.mesh_uid` - `mesh_istio.service_namespace` -
96   * `mesh_istio.service_name` - `cluster_istio.location` (deprecated) -
97   * `cluster_istio.cluster_name` (deprecated) - `cluster_istio.service_namespace`
98   * (deprecated) - `cluster_istio.service_name` (deprecated) identifier_case
99   * refers to which option in the identifier oneof is populated. For example, the
100   * filter identifier_case = "CUSTOM" would match all services with a value for
101   * the custom field. Valid options are "CUSTOM", "APP_ENGINE", "MESH_ISTIO",
102   * plus "CLUSTER_ISTIO" (deprecated) and "CLOUD_ENDPOINTS" (reserved for future
103   * use).
104   * @opt_param int pageSize A non-negative number that is the maximum number of
105   * results to return. When 0, use default page size.
106   * @opt_param string pageToken If this field is not empty then it must contain
107   * the nextPageToken value returned by a previous call to this method. Using
108   * this field causes the method to return additional results from the previous
109   * method call.
110   * @return ListServicesResponse
111   */
112  public function listServices($parent, $optParams = [])
113  {
114    $params = ['parent' => $parent];
115    $params = array_merge($params, $optParams);
116    return $this->call('list', [$params], ListServicesResponse::class);
117  }
118  /**
119   * Update this Service. (services.patch)
120   *
121   * @param string $name Resource name for this Service. The format is:
122   * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
123   * @param Service $postBody
124   * @param array $optParams Optional parameters.
125   *
126   * @opt_param string updateMask A set of field paths defining which fields to
127   * use for the update.
128   * @return Service
129   */
130  public function patch($name, Service $postBody, $optParams = [])
131  {
132    $params = ['name' => $name, 'postBody' => $postBody];
133    $params = array_merge($params, $optParams);
134    return $this->call('patch', [$params], Service::class);
135  }
136}
137
138// Adding a class alias for backwards compatibility with the previous class name.
139class_alias(Services::class, 'Google_Service_Monitoring_Resource_Services');
140