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\ListServiceLevelObjectivesResponse;
21use Google\Service\Monitoring\MonitoringEmpty;
22use Google\Service\Monitoring\ServiceLevelObjective;
23
24/**
25 * The "serviceLevelObjectives" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $monitoringService = new Google\Service\Monitoring(...);
29 *   $serviceLevelObjectives = $monitoringService->serviceLevelObjectives;
30 *  </code>
31 */
32class ServicesServiceLevelObjectives extends \Google\Service\Resource
33{
34  /**
35   * Create a ServiceLevelObjective for the given Service.
36   * (serviceLevelObjectives.create)
37   *
38   * @param string $parent Required. Resource name of the parent Service. The
39   * format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
40   * @param ServiceLevelObjective $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string serviceLevelObjectiveId Optional. The ServiceLevelObjective
44   * id to use for this ServiceLevelObjective. If omitted, an id will be generated
45   * instead. Must match the pattern [a-z0-9\-]+
46   * @return ServiceLevelObjective
47   */
48  public function create($parent, ServiceLevelObjective $postBody, $optParams = [])
49  {
50    $params = ['parent' => $parent, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], ServiceLevelObjective::class);
53  }
54  /**
55   * Delete the given ServiceLevelObjective. (serviceLevelObjectives.delete)
56   *
57   * @param string $name Required. Resource name of the ServiceLevelObjective to
58   * delete. The format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/
59   * serviceLevelObjectives/[SLO_NAME]
60   * @param array $optParams Optional parameters.
61   * @return MonitoringEmpty
62   */
63  public function delete($name, $optParams = [])
64  {
65    $params = ['name' => $name];
66    $params = array_merge($params, $optParams);
67    return $this->call('delete', [$params], MonitoringEmpty::class);
68  }
69  /**
70   * Get a ServiceLevelObjective by name. (serviceLevelObjectives.get)
71   *
72   * @param string $name Required. Resource name of the ServiceLevelObjective to
73   * get. The format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/ser
74   * viceLevelObjectives/[SLO_NAME]
75   * @param array $optParams Optional parameters.
76   *
77   * @opt_param string view View of the ServiceLevelObjective to return. If
78   * DEFAULT, return the ServiceLevelObjective as originally defined. If EXPLICIT
79   * and the ServiceLevelObjective is defined in terms of a BasicSli, replace the
80   * BasicSli with a RequestBasedSli spelling out how the SLI is computed.
81   * @return ServiceLevelObjective
82   */
83  public function get($name, $optParams = [])
84  {
85    $params = ['name' => $name];
86    $params = array_merge($params, $optParams);
87    return $this->call('get', [$params], ServiceLevelObjective::class);
88  }
89  /**
90   * List the ServiceLevelObjectives for the given Service.
91   * (serviceLevelObjectives.listServicesServiceLevelObjectives)
92   *
93   * @param string $parent Required. Resource name of the parent containing the
94   * listed SLOs, either a project or a Monitoring Workspace. The formats are:
95   * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
96   * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/-
97   * @param array $optParams Optional parameters.
98   *
99   * @opt_param string filter A filter specifying what ServiceLevelObjectives to
100   * return.
101   * @opt_param int pageSize A non-negative number that is the maximum number of
102   * results to return. When 0, use default page size.
103   * @opt_param string pageToken If this field is not empty then it must contain
104   * the nextPageToken value returned by a previous call to this method. Using
105   * this field causes the method to return additional results from the previous
106   * method call.
107   * @opt_param string view View of the ServiceLevelObjectives to return. If
108   * DEFAULT, return each ServiceLevelObjective as originally defined. If EXPLICIT
109   * and the ServiceLevelObjective is defined in terms of a BasicSli, replace the
110   * BasicSli with a RequestBasedSli spelling out how the SLI is computed.
111   * @return ListServiceLevelObjectivesResponse
112   */
113  public function listServicesServiceLevelObjectives($parent, $optParams = [])
114  {
115    $params = ['parent' => $parent];
116    $params = array_merge($params, $optParams);
117    return $this->call('list', [$params], ListServiceLevelObjectivesResponse::class);
118  }
119  /**
120   * Update the given ServiceLevelObjective. (serviceLevelObjectives.patch)
121   *
122   * @param string $name Resource name for this ServiceLevelObjective. The format
123   * is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjecti
124   * ves/[SLO_NAME]
125   * @param ServiceLevelObjective $postBody
126   * @param array $optParams Optional parameters.
127   *
128   * @opt_param string updateMask A set of field paths defining which fields to
129   * use for the update.
130   * @return ServiceLevelObjective
131   */
132  public function patch($name, ServiceLevelObjective $postBody, $optParams = [])
133  {
134    $params = ['name' => $name, 'postBody' => $postBody];
135    $params = array_merge($params, $optParams);
136    return $this->call('patch', [$params], ServiceLevelObjective::class);
137  }
138}
139
140// Adding a class alias for backwards compatibility with the previous class name.
141class_alias(ServicesServiceLevelObjectives::class, 'Google_Service_Monitoring_Resource_ServicesServiceLevelObjectives');
142