source: vendor/google/apiclient-services/src/CloudSupport/Resource/Cases.php@ f9c482b

Last change on this file since f9c482b was f9c482b, checked in by Vlado 222039 <vlado.popovski@…>, 12 days ago

Upload new project files

  • Property mode set to 100644
File size: 14.2 KB
Line 
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 a case. EXAMPLES: cURL: ```shell case="projects/some-
38 * project/cases/43595344" curl \ --request POST \ --header "Authorization:
39 * Bearer $(gcloud auth print-access-token)" \
40 * "https://cloudsupport.googleapis.com/v2/$case:close" ``` Python: ```python
41 * import googleapiclient.discovery api_version = "v2" supportApiService =
42 * googleapiclient.discovery.build( serviceName="cloudsupport",
43 * version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.co
44 * m/$discovery/rest?version={api_version}", ) request =
45 * supportApiService.cases().close( name="projects/some-project/cases/43595344"
46 * ) print(request.execute()) ``` (cases.close)
47 *
48 * @param string $name Required. The name of the case to close.
49 * @param CloseCaseRequest $postBody
50 * @param array $optParams Optional parameters.
51 * @return CloudsupportCase
52 * @throws \Google\Service\Exception
53 */
54 public function close($name, CloseCaseRequest $postBody, $optParams = [])
55 {
56 $params = ['name' => $name, 'postBody' => $postBody];
57 $params = array_merge($params, $optParams);
58 return $this->call('close', [$params], CloudsupportCase::class);
59 }
60 /**
61 * Create a new case and associate it with a parent. It must have the following
62 * fields set: `display_name`, `description`, `classification`, and `priority`.
63 * If you're just testing the API and don't want to route your case to an agent,
64 * set `testCase=true`. EXAMPLES: cURL: ```shell parent="projects/some-project"
65 * curl \ --request POST \ --header "Authorization: Bearer $(gcloud auth print-
66 * access-token)" \ --header 'Content-Type: application/json' \ --data '{
67 * "display_name": "Test case created by me.", "description": "a random test
68 * case, feel free to close", "classification": { "id": "100IK2AKCLHMGRJ9CDGMOCG
69 * P8DM6UTB4BT262T31BT1M2T31DHNMENPO6KS36CPJ786L2TBFEHGN6NPI64R3CDHN8880G08I1H3M
70 * URR7DHII0GRCDTQM8" }, "time_zone": "-07:00", "subscriber_email_addresses": [
71 * "foo@domain.com", "bar@domain.com" ], "testCase": true, "priority": "P3" }' \
72 * "https://cloudsupport.googleapis.com/v2/$parent/cases" ``` Python: ```python
73 * import googleapiclient.discovery api_version = "v2" supportApiService =
74 * googleapiclient.discovery.build( serviceName="cloudsupport",
75 * version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.co
76 * m/$discovery/rest?version={api_version}", ) request =
77 * supportApiService.cases().create( parent="projects/some-project", body={
78 * "displayName": "A Test Case", "description": "This is a test case.",
79 * "testCase": True, "priority": "P2", "classification": { "id": "100IK2AKCLHMGR
80 * J9CDGMOCGP8DM6UTB4BT262T31BT1M2T31DHNMENPO6KS36CPJ786L2TBFEHGN6NPI64R3CDHN888
81 * 0G08I1H3MURR7DHII0GRCDTQM8" }, }, ) print(request.execute()) ```
82 * (cases.create)
83 *
84 * @param string $parent Required. The name of the parent under which the case
85 * should be created.
86 * @param CloudsupportCase $postBody
87 * @param array $optParams Optional parameters.
88 * @return CloudsupportCase
89 * @throws \Google\Service\Exception
90 */
91 public function create($parent, CloudsupportCase $postBody, $optParams = [])
92 {
93 $params = ['parent' => $parent, 'postBody' => $postBody];
94 $params = array_merge($params, $optParams);
95 return $this->call('create', [$params], CloudsupportCase::class);
96 }
97 /**
98 * Escalate a case, starting the Google Cloud Support escalation management
99 * process. This operation is only available for some support services. Go to
100 * https://cloud.google.com/support and look for 'Technical support escalations'
101 * in the feature list to find out which ones let you do that. EXAMPLES: cURL:
102 * ```shell case="projects/some-project/cases/43595344" curl \ --request POST \
103 * --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --header
104 * "Content-Type: application/json" \ --data '{ "escalation": { "reason":
105 * "BUSINESS_IMPACT", "justification": "This is a test escalation." } }' \
106 * "https://cloudsupport.googleapis.com/v2/$case:escalate" ``` Python: ```python
107 * import googleapiclient.discovery api_version = "v2" supportApiService =
108 * googleapiclient.discovery.build( serviceName="cloudsupport",
109 * version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.co
110 * m/$discovery/rest?version={api_version}", ) request =
111 * supportApiService.cases().escalate( name="projects/some-
112 * project/cases/43595344", body={ "escalation": { "reason": "BUSINESS_IMPACT",
113 * "justification": "This is a test escalation.", }, }, )
114 * print(request.execute()) ``` (cases.escalate)
115 *
116 * @param string $name Required. The name of the case to be escalated.
117 * @param EscalateCaseRequest $postBody
118 * @param array $optParams Optional parameters.
119 * @return CloudsupportCase
120 * @throws \Google\Service\Exception
121 */
122 public function escalate($name, EscalateCaseRequest $postBody, $optParams = [])
123 {
124 $params = ['name' => $name, 'postBody' => $postBody];
125 $params = array_merge($params, $optParams);
126 return $this->call('escalate', [$params], CloudsupportCase::class);
127 }
128 /**
129 * Retrieve a case. EXAMPLES: cURL: ```shell case="projects/some-
130 * project/cases/16033687" curl \ --header "Authorization: Bearer $(gcloud auth
131 * print-access-token)" \ "https://cloudsupport.googleapis.com/v2/$case" ```
132 * Python: ```python import googleapiclient.discovery api_version = "v2"
133 * supportApiService = googleapiclient.discovery.build(
134 * serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https:
135 * //cloudsupport.googleapis.com/$discovery/rest?version={api_version}", )
136 * request = supportApiService.cases().get( name="projects/some-
137 * project/cases/43595344", ) print(request.execute()) ``` (cases.get)
138 *
139 * @param string $name Required. The full name of a case to be retrieved.
140 * @param array $optParams Optional parameters.
141 * @return CloudsupportCase
142 * @throws \Google\Service\Exception
143 */
144 public function get($name, $optParams = [])
145 {
146 $params = ['name' => $name];
147 $params = array_merge($params, $optParams);
148 return $this->call('get', [$params], CloudsupportCase::class);
149 }
150 /**
151 * Retrieve all cases under a parent, but not its children. For example, listing
152 * cases under an organization only returns the cases that are directly parented
153 * by that organization. To retrieve cases under an organization and its
154 * projects, use `cases.search`. EXAMPLES: cURL: ```shell parent="projects/some-
155 * project" curl \ --header "Authorization: Bearer $(gcloud auth print-access-
156 * token)" \ "https://cloudsupport.googleapis.com/v2/$parent/cases" ``` Python:
157 * ```python import googleapiclient.discovery api_version = "v2"
158 * supportApiService = googleapiclient.discovery.build(
159 * serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https:
160 * //cloudsupport.googleapis.com/$discovery/rest?version={api_version}", )
161 * request = supportApiService.cases().list(parent="projects/some-project")
162 * print(request.execute()) ``` (cases.listCases)
163 *
164 * @param string $parent Required. The name of a parent to list cases under.
165 * @param array $optParams Optional parameters.
166 *
167 * @opt_param string filter An expression used to filter cases. If it's an empty
168 * string, then no filtering happens. Otherwise, the endpoint returns the cases
169 * that match the filter. Expressions use the following fields separated by
170 * `AND` and specified with `=`: - `state`: Can be `OPEN` or `CLOSED`. -
171 * `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You can specify multiple
172 * values for priority using the `OR` operator. For example, `priority=P1 OR
173 * priority=P2`. - `creator.email`: The email address of the case creator.
174 * EXAMPLES: - `state=CLOSED` - `state=OPEN AND
175 * creator.email="tester@example.com"` - `state=OPEN AND (priority=P0 OR
176 * priority=P1)`
177 * @opt_param int pageSize The maximum number of cases fetched with each
178 * request. Defaults to 10.
179 * @opt_param string pageToken A token identifying the page of results to
180 * return. If unspecified, the first page is retrieved.
181 * @return ListCasesResponse
182 * @throws \Google\Service\Exception
183 */
184 public function listCases($parent, $optParams = [])
185 {
186 $params = ['parent' => $parent];
187 $params = array_merge($params, $optParams);
188 return $this->call('list', [$params], ListCasesResponse::class);
189 }
190 /**
191 * Update a case. Only some fields can be updated. EXAMPLES: cURL: ```shell
192 * case="projects/some-project/cases/43595344" curl \ --request PATCH \ --header
193 * "Authorization: Bearer $(gcloud auth print-access-token)" \ --header
194 * "Content-Type: application/json" \ --data '{ "priority": "P1" }' \
195 * "https://cloudsupport.googleapis.com/v2/$case?updateMask=priority" ```
196 * Python: ```python import googleapiclient.discovery api_version = "v2"
197 * supportApiService = googleapiclient.discovery.build(
198 * serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https:
199 * //cloudsupport.googleapis.com/$discovery/rest?version={api_version}", )
200 * request = supportApiService.cases().patch( name="projects/some-
201 * project/cases/43112854", body={ "displayName": "This is Now a New Title",
202 * "priority": "P2", }, ) print(request.execute()) ``` (cases.patch)
203 *
204 * @param string $name The resource name for the case.
205 * @param CloudsupportCase $postBody
206 * @param array $optParams Optional parameters.
207 *
208 * @opt_param string updateMask A list of attributes of the case that should be
209 * updated. Supported values are `priority`, `display_name`, and
210 * `subscriber_email_addresses`. If no fields are specified, all supported
211 * fields are updated. Be careful - if you do not provide a field mask, then you
212 * might accidentally clear some fields. For example, if you leave the field
213 * mask empty and do not provide a value for `subscriber_email_addresses`, then
214 * `subscriber_email_addresses` is updated to empty.
215 * @return CloudsupportCase
216 * @throws \Google\Service\Exception
217 */
218 public function patch($name, CloudsupportCase $postBody, $optParams = [])
219 {
220 $params = ['name' => $name, 'postBody' => $postBody];
221 $params = array_merge($params, $optParams);
222 return $this->call('patch', [$params], CloudsupportCase::class);
223 }
224 /**
225 * Search for cases using a query. EXAMPLES: cURL: ```shell
226 * parent="projects/some-project" curl \ --header "Authorization: Bearer
227 * $(gcloud auth print-access-token)" \
228 * "https://cloudsupport.googleapis.com/v2/$parent/cases:search" ``` Python:
229 * ```python import googleapiclient.discovery api_version = "v2"
230 * supportApiService = googleapiclient.discovery.build(
231 * serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https:
232 * //cloudsupport.googleapis.com/$discovery/rest?version={api_version}", )
233 * request = supportApiService.cases().search( parent="projects/some-project",
234 * query="state=OPEN" ) print(request.execute()) ``` (cases.search)
235 *
236 * @param string $parent The name of the parent resource to search for cases
237 * under.
238 * @param array $optParams Optional parameters.
239 *
240 * @opt_param int pageSize The maximum number of cases fetched with each
241 * request. The default page size is 10.
242 * @opt_param string pageToken A token identifying the page of results to
243 * return. If unspecified, the first page is retrieved.
244 * @opt_param string query An expression used to filter cases. Expressions use
245 * the following fields separated by `AND` and specified with `=`: -
246 * `organization`: An organization name in the form `organizations/`. -
247 * `project`: A project name in the form `projects/`. - `state`: Can be `OPEN`
248 * or `CLOSED`. - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You can
249 * specify multiple values for priority using the `OR` operator. For example,
250 * `priority=P1 OR priority=P2`. - `creator.email`: The email address of the
251 * case creator. You must specify either `organization` or `project`. To search
252 * across `displayName`, `description`, and comments, use a global restriction
253 * with no keyword or operator. For example, `"my search"`. To search only cases
254 * updated after a certain date, use `update_time` restricted with that
255 * particular date, time, and timezone in ISO datetime format. For example,
256 * `update_time>"2020-01-01T00:00:00-05:00"`. `update_time` only supports the
257 * greater than operator (`>`). Examples: -
258 * `organization="organizations/123456789"` - `project="projects/my-project-id"`
259 * - `project="projects/123456789"` - `organization="organizations/123456789"
260 * AND state=CLOSED` - `project="projects/my-project-id" AND
261 * creator.email="tester@example.com"` - `project="projects/my-project-id" AND
262 * (priority=P0 OR priority=P1)`
263 * @return SearchCasesResponse
264 * @throws \Google\Service\Exception
265 */
266 public function search($parent, $optParams = [])
267 {
268 $params = ['parent' => $parent];
269 $params = array_merge($params, $optParams);
270 return $this->call('search', [$params], SearchCasesResponse::class);
271 }
272}
273
274// Adding a class alias for backwards compatibility with the previous class name.
275class_alias(Cases::class, 'Google_Service_CloudSupport_Resource_Cases');
Note: See TracBrowser for help on using the repository browser.