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 |
|
---|
18 | namespace Google\Service\Testing\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Testing\CancelTestMatrixResponse;
|
---|
21 | use Google\Service\Testing\TestMatrix;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "testMatrices" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $testingService = new Google\Service\Testing(...);
|
---|
28 | * $testMatrices = $testingService->projects_testMatrices;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class ProjectsTestMatrices extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Cancels unfinished test executions in a test matrix. This call returns
|
---|
35 | * immediately and cancellation proceeds asynchronously. If the matrix is
|
---|
36 | * already final, this operation will have no effect. May return any of the
|
---|
37 | * following canonical error codes: - PERMISSION_DENIED - if the user is not
|
---|
38 | * authorized to read project - INVALID_ARGUMENT - if the request is malformed -
|
---|
39 | * NOT_FOUND - if the Test Matrix does not exist (testMatrices.cancel)
|
---|
40 | *
|
---|
41 | * @param string $projectId Cloud project that owns the test.
|
---|
42 | * @param string $testMatrixId Test matrix that will be canceled.
|
---|
43 | * @param array $optParams Optional parameters.
|
---|
44 | * @return CancelTestMatrixResponse
|
---|
45 | * @throws \Google\Service\Exception
|
---|
46 | */
|
---|
47 | public function cancel($projectId, $testMatrixId, $optParams = [])
|
---|
48 | {
|
---|
49 | $params = ['projectId' => $projectId, 'testMatrixId' => $testMatrixId];
|
---|
50 | $params = array_merge($params, $optParams);
|
---|
51 | return $this->call('cancel', [$params], CancelTestMatrixResponse::class);
|
---|
52 | }
|
---|
53 | /**
|
---|
54 | * Creates and runs a matrix of tests according to the given specifications.
|
---|
55 | * Unsupported environments will be returned in the state UNSUPPORTED. A test
|
---|
56 | * matrix is limited to use at most 2000 devices in parallel. The returned
|
---|
57 | * matrix will not yet contain the executions that will be created for this
|
---|
58 | * matrix. Execution creation happens later on and will require a call to
|
---|
59 | * GetTestMatrix. May return any of the following canonical error codes: -
|
---|
60 | * PERMISSION_DENIED - if the user is not authorized to write to project -
|
---|
61 | * INVALID_ARGUMENT - if the request is malformed or if the matrix tries to use
|
---|
62 | * too many simultaneous devices. (testMatrices.create)
|
---|
63 | *
|
---|
64 | * @param string $projectId The GCE project under which this job will run.
|
---|
65 | * @param TestMatrix $postBody
|
---|
66 | * @param array $optParams Optional parameters.
|
---|
67 | *
|
---|
68 | * @opt_param string requestId A string id used to detect duplicated requests.
|
---|
69 | * Ids are automatically scoped to a project, so users should ensure the ID is
|
---|
70 | * unique per-project. A UUID is recommended. Optional, but strongly
|
---|
71 | * recommended.
|
---|
72 | * @return TestMatrix
|
---|
73 | * @throws \Google\Service\Exception
|
---|
74 | */
|
---|
75 | public function create($projectId, TestMatrix $postBody, $optParams = [])
|
---|
76 | {
|
---|
77 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
78 | $params = array_merge($params, $optParams);
|
---|
79 | return $this->call('create', [$params], TestMatrix::class);
|
---|
80 | }
|
---|
81 | /**
|
---|
82 | * Checks the status of a test matrix and the executions once they are created.
|
---|
83 | * The test matrix will contain the list of test executions to run if and only
|
---|
84 | * if the resultStorage.toolResultsExecution fields have been populated. Note:
|
---|
85 | * Flaky test executions may be added to the matrix at a later stage. May return
|
---|
86 | * any of the following canonical error codes: - PERMISSION_DENIED - if the user
|
---|
87 | * is not authorized to read project - INVALID_ARGUMENT - if the request is
|
---|
88 | * malformed - NOT_FOUND - if the Test Matrix does not exist (testMatrices.get)
|
---|
89 | *
|
---|
90 | * @param string $projectId Cloud project that owns the test matrix.
|
---|
91 | * @param string $testMatrixId Unique test matrix id which was assigned by the
|
---|
92 | * service.
|
---|
93 | * @param array $optParams Optional parameters.
|
---|
94 | * @return TestMatrix
|
---|
95 | * @throws \Google\Service\Exception
|
---|
96 | */
|
---|
97 | public function get($projectId, $testMatrixId, $optParams = [])
|
---|
98 | {
|
---|
99 | $params = ['projectId' => $projectId, 'testMatrixId' => $testMatrixId];
|
---|
100 | $params = array_merge($params, $optParams);
|
---|
101 | return $this->call('get', [$params], TestMatrix::class);
|
---|
102 | }
|
---|
103 | }
|
---|
104 |
|
---|
105 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
106 | class_alias(ProjectsTestMatrices::class, 'Google_Service_Testing_Resource_ProjectsTestMatrices');
|
---|