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\CloudSupport\Resource;
19
20use Google\Service\CloudSupport\CloseCaseRequest;
21use Google\Service\CloudSupport\CloudsupportCase;
22use Google\Service\CloudSupport\EscalateCaseRequest;
23use Google\Service\CloudSupport\ListCasesResponse;
24use Google\Service\CloudSupport\SearchCasesResponse;
25
26/**
27 * The "cases" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $cloudsupportService = new Google\Service\CloudSupport(...);
31 *   $cases = $cloudsupportService->cases;
32 *  </code>
33 */
34class Cases extends \Google\Service\Resource
35{
36  /**
37   * Close the specified case. (cases.close)
38   *
39   * @param string $name Required. The fully qualified name of the case resource
40   * to be closed.
41   * @param CloseCaseRequest $postBody
42   * @param array $optParams Optional parameters.
43   * @return CloudsupportCase
44   */
45  public function close($name, CloseCaseRequest $postBody, $optParams = [])
46  {
47    $params = ['name' => $name, 'postBody' => $postBody];
48    $params = array_merge($params, $optParams);
49    return $this->call('close', [$params], CloudsupportCase::class);
50  }
51  /**
52   * Create a new case and associate it with the given Cloud resource.
53   * (cases.create)
54   *
55   * @param string $parent Required. The name of the Cloud resource under which
56   * the case should be created.
57   * @param CloudsupportCase $postBody
58   * @param array $optParams Optional parameters.
59   * @return CloudsupportCase
60   */
61  public function create($parent, CloudsupportCase $postBody, $optParams = [])
62  {
63    $params = ['parent' => $parent, 'postBody' => $postBody];
64    $params = array_merge($params, $optParams);
65    return $this->call('create', [$params], CloudsupportCase::class);
66  }
67  /**
68   * Escalate a case. Escalating a case will initiate the Cloud Support escalation
69   * management process. This operation is only available to certain Customer Care
70   * tiers. Go to https://cloud.google.com/support and look for 'Technical support
71   * escalations' in the feature list to find out which tiers are able to perform
72   * escalations. (cases.escalate)
73   *
74   * @param string $name Required. The fully qualified name of the Case resource
75   * to be escalated.
76   * @param EscalateCaseRequest $postBody
77   * @param array $optParams Optional parameters.
78   * @return CloudsupportCase
79   */
80  public function escalate($name, EscalateCaseRequest $postBody, $optParams = [])
81  {
82    $params = ['name' => $name, 'postBody' => $postBody];
83    $params = array_merge($params, $optParams);
84    return $this->call('escalate', [$params], CloudsupportCase::class);
85  }
86  /**
87   * Retrieve the specified case. (cases.get)
88   *
89   * @param string $name Required. The fully qualified name of a case to be
90   * retrieved.
91   * @param array $optParams Optional parameters.
92   * @return CloudsupportCase
93   */
94  public function get($name, $optParams = [])
95  {
96    $params = ['name' => $name];
97    $params = array_merge($params, $optParams);
98    return $this->call('get', [$params], CloudsupportCase::class);
99  }
100  /**
101   * Retrieve all cases under the specified parent. (cases.listCases)
102   *
103   * @param string $parent Required. The fully qualified name of parent resource
104   * to list cases under.
105   * @param array $optParams Optional parameters.
106   *
107   * @opt_param string filter An expression written in the Cloud filter language.
108   * If non-empty, then only cases whose fields match the filter are returned. If
109   * empty, then no messages are filtered out. Filter strings can use the
110   * following fields: - state (Accepted values: OPEN or CLOSED) - severity
111   * (Accepted values: S0, S1, S2, S3, or S4) - creator.email with the operators
112   * equals (=) and AND. Additionally, a global restriction (with no operator) can
113   * be used to search across displayName, description, and comments (e.g. "my
114   * search").
115   * @opt_param int pageSize The maximum number of cases fetched with each
116   * request. Defaults to 10.
117   * @opt_param string pageToken A token identifying the page of results to
118   * return. If unspecified, the first page is retrieved.
119   * @return ListCasesResponse
120   */
121  public function listCases($parent, $optParams = [])
122  {
123    $params = ['parent' => $parent];
124    $params = array_merge($params, $optParams);
125    return $this->call('list', [$params], ListCasesResponse::class);
126  }
127  /**
128   * Update the specified case. Only a subset of fields (display_name,
129   * description, time_zone, subscriber_email_addresses, related_resources,
130   * severity, priority, primary_contact, and labels) can be updated.
131   * (cases.patch)
132   *
133   * @param string $name The resource name for the case.
134   * @param CloudsupportCase $postBody
135   * @param array $optParams Optional parameters.
136   *
137   * @opt_param string updateMask A field that represents attributes of a case
138   * object that should be updated as part of this request. Supported values are
139   * severity, display_name, and subscriber_email_addresses. If no fields are
140   * specified, all supported fields will be updated. WARNING: If you do not
141   * provide a field mask then you may accidentally clear some fields. For
142   * example, if you leave field mask empty and do not provide a value for
143   * subscriber_email_addresses then subscriber_email_addresses will be updated to
144   * empty.
145   * @return CloudsupportCase
146   */
147  public function patch($name, CloudsupportCase $postBody, $optParams = [])
148  {
149    $params = ['name' => $name, 'postBody' => $postBody];
150    $params = array_merge($params, $optParams);
151    return $this->call('patch', [$params], CloudsupportCase::class);
152  }
153  /**
154   * Search cases using the specified query. (cases.search)
155   *
156   * @param array $optParams Optional parameters.
157   *
158   * @opt_param int pageSize The maximum number of cases fetched with each
159   * request. The default page size is 10.
160   * @opt_param string pageToken A token identifying the page of results to
161   * return. If unspecified, the first page is retrieved.
162   * @opt_param string query An expression written in the Cloud filter language.
163   * Filter strings can use the following fields: - organization (A name of the
164   * form organizations/) - project (A name of the form projects/) - customer (A
165   * name of the form customers/) - state (Accepted values: OPEN or CLOSED) -
166   * severity (Accepted values: S0, S1, S2, S3, or S4) - creator.email with the
167   * operators equals (=) and AND. Additionally, a global restriction (with no
168   * key/operator) can be used to search across display_name, description, and
169   * comments (e.g. "my search"). One of organization, project, or customer field
170   * must be specified.
171   * @return SearchCasesResponse
172   */
173  public function search($optParams = [])
174  {
175    $params = [];
176    $params = array_merge($params, $optParams);
177    return $this->call('search', [$params], SearchCasesResponse::class);
178  }
179}
180
181// Adding a class alias for backwards compatibility with the previous class name.
182class_alias(Cases::class, 'Google_Service_CloudSupport_Resource_Cases');
183