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\ListUptimeCheckConfigsResponse;
21use Google\Service\Monitoring\MonitoringEmpty;
22use Google\Service\Monitoring\UptimeCheckConfig;
23
24/**
25 * The "uptimeCheckConfigs" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $monitoringService = new Google\Service\Monitoring(...);
29 *   $uptimeCheckConfigs = $monitoringService->uptimeCheckConfigs;
30 *  </code>
31 */
32class ProjectsUptimeCheckConfigs extends \Google\Service\Resource
33{
34  /**
35   * Creates a new Uptime check configuration. (uptimeCheckConfigs.create)
36   *
37   * @param string $parent Required. The project
38   * (https://cloud.google.com/monitoring/api/v3#project_name) in which to create
39   * the Uptime check. The format is: projects/[PROJECT_ID_OR_NUMBER]
40   * @param UptimeCheckConfig $postBody
41   * @param array $optParams Optional parameters.
42   * @return UptimeCheckConfig
43   */
44  public function create($parent, UptimeCheckConfig $postBody, $optParams = [])
45  {
46    $params = ['parent' => $parent, 'postBody' => $postBody];
47    $params = array_merge($params, $optParams);
48    return $this->call('create', [$params], UptimeCheckConfig::class);
49  }
50  /**
51   * Deletes an Uptime check configuration. Note that this method will fail if the
52   * Uptime check configuration is referenced by an alert policy or other
53   * dependent configs that would be rendered invalid by the deletion.
54   * (uptimeCheckConfigs.delete)
55   *
56   * @param string $name Required. The Uptime check configuration to delete. The
57   * format is:
58   * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_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   * Gets a single Uptime check configuration. (uptimeCheckConfigs.get)
70   *
71   * @param string $name Required. The Uptime check configuration to retrieve. The
72   * format is:
73   * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
74   * @param array $optParams Optional parameters.
75   * @return UptimeCheckConfig
76   */
77  public function get($name, $optParams = [])
78  {
79    $params = ['name' => $name];
80    $params = array_merge($params, $optParams);
81    return $this->call('get', [$params], UptimeCheckConfig::class);
82  }
83  /**
84   * Lists the existing valid Uptime check configurations for the project (leaving
85   * out any invalid configurations).
86   * (uptimeCheckConfigs.listProjectsUptimeCheckConfigs)
87   *
88   * @param string $parent Required. The project
89   * (https://cloud.google.com/monitoring/api/v3#project_name) whose Uptime check
90   * configurations are listed. The format is: projects/[PROJECT_ID_OR_NUMBER]
91   * @param array $optParams Optional parameters.
92   *
93   * @opt_param int pageSize The maximum number of results to return in a single
94   * response. The server may further constrain the maximum number of results
95   * returned in a single page. If the page_size is <=0, the server will decide
96   * the number of results to be returned.
97   * @opt_param string pageToken If this field is not empty then it must contain
98   * the nextPageToken value returned by a previous call to this method. Using
99   * this field causes the method to return more results from the previous method
100   * call.
101   * @return ListUptimeCheckConfigsResponse
102   */
103  public function listProjectsUptimeCheckConfigs($parent, $optParams = [])
104  {
105    $params = ['parent' => $parent];
106    $params = array_merge($params, $optParams);
107    return $this->call('list', [$params], ListUptimeCheckConfigsResponse::class);
108  }
109  /**
110   * Updates an Uptime check configuration. You can either replace the entire
111   * configuration with a new one or replace only certain fields in the current
112   * configuration by specifying the fields to be updated via updateMask. Returns
113   * the updated configuration. (uptimeCheckConfigs.patch)
114   *
115   * @param string $name A unique resource name for this Uptime check
116   * configuration. The format is:
117   * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
118   * [PROJECT_ID_OR_NUMBER] is the Workspace host project associated with the
119   * Uptime check.This field should be omitted when creating the Uptime check
120   * configuration; on create, the resource name is assigned by the server and
121   * included in the response.
122   * @param UptimeCheckConfig $postBody
123   * @param array $optParams Optional parameters.
124   *
125   * @opt_param string updateMask Optional. If present, only the listed fields in
126   * the current Uptime check configuration are updated with values from the new
127   * configuration. If this field is empty, then the current configuration is
128   * completely replaced with the new configuration.
129   * @return UptimeCheckConfig
130   */
131  public function patch($name, UptimeCheckConfig $postBody, $optParams = [])
132  {
133    $params = ['name' => $name, 'postBody' => $postBody];
134    $params = array_merge($params, $optParams);
135    return $this->call('patch', [$params], UptimeCheckConfig::class);
136  }
137}
138
139// Adding a class alias for backwards compatibility with the previous class name.
140class_alias(ProjectsUptimeCheckConfigs::class, 'Google_Service_Monitoring_Resource_ProjectsUptimeCheckConfigs');
141