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\Testing\Resource;
19
20use Google\Service\Testing\CancelTestMatrixResponse;
21use 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->testMatrices;
29 *  </code>
30 */
31class 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   */
46  public function cancel($projectId, $testMatrixId, $optParams = [])
47  {
48    $params = ['projectId' => $projectId, 'testMatrixId' => $testMatrixId];
49    $params = array_merge($params, $optParams);
50    return $this->call('cancel', [$params], CancelTestMatrixResponse::class);
51  }
52  /**
53   * Creates and runs a matrix of tests according to the given specifications.
54   * Unsupported environments will be returned in the state UNSUPPORTED. A test
55   * matrix is limited to use at most 2000 devices in parallel. May return any of
56   * the following canonical error codes: - PERMISSION_DENIED - if the user is not
57   * authorized to write to project - INVALID_ARGUMENT - if the request is
58   * malformed or if the matrix tries to use too many simultaneous devices.
59   * (testMatrices.create)
60   *
61   * @param string $projectId The GCE project under which this job will run.
62   * @param TestMatrix $postBody
63   * @param array $optParams Optional parameters.
64   *
65   * @opt_param string requestId A string id used to detect duplicated requests.
66   * Ids are automatically scoped to a project, so users should ensure the ID is
67   * unique per-project. A UUID is recommended. Optional, but strongly
68   * recommended.
69   * @return TestMatrix
70   */
71  public function create($projectId, TestMatrix $postBody, $optParams = [])
72  {
73    $params = ['projectId' => $projectId, 'postBody' => $postBody];
74    $params = array_merge($params, $optParams);
75    return $this->call('create', [$params], TestMatrix::class);
76  }
77  /**
78   * Checks the status of a test matrix. May return any of the following canonical
79   * error codes: - PERMISSION_DENIED - if the user is not authorized to read
80   * project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the
81   * Test Matrix does not exist (testMatrices.get)
82   *
83   * @param string $projectId Cloud project that owns the test matrix.
84   * @param string $testMatrixId Unique test matrix id which was assigned by the
85   * service.
86   * @param array $optParams Optional parameters.
87   * @return TestMatrix
88   */
89  public function get($projectId, $testMatrixId, $optParams = [])
90  {
91    $params = ['projectId' => $projectId, 'testMatrixId' => $testMatrixId];
92    $params = array_merge($params, $optParams);
93    return $this->call('get', [$params], TestMatrix::class);
94  }
95}
96
97// Adding a class alias for backwards compatibility with the previous class name.
98class_alias(ProjectsTestMatrices::class, 'Google_Service_Testing_Resource_ProjectsTestMatrices');
99