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\CloudMachineLearningEngine\Resource; 19 20use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1CancelJobRequest; 21use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1Job; 22use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1ListJobsResponse; 23use Google\Service\CloudMachineLearningEngine\GoogleIamV1Policy; 24use Google\Service\CloudMachineLearningEngine\GoogleIamV1SetIamPolicyRequest; 25use Google\Service\CloudMachineLearningEngine\GoogleIamV1TestIamPermissionsRequest; 26use Google\Service\CloudMachineLearningEngine\GoogleIamV1TestIamPermissionsResponse; 27use Google\Service\CloudMachineLearningEngine\GoogleProtobufEmpty; 28 29/** 30 * The "jobs" collection of methods. 31 * Typical usage is: 32 * <code> 33 * $mlService = new Google\Service\CloudMachineLearningEngine(...); 34 * $jobs = $mlService->jobs; 35 * </code> 36 */ 37class ProjectsJobs extends \Google\Service\Resource 38{ 39 /** 40 * Cancels a running job. (jobs.cancel) 41 * 42 * @param string $name Required. The name of the job to cancel. 43 * @param GoogleCloudMlV1CancelJobRequest $postBody 44 * @param array $optParams Optional parameters. 45 * @return GoogleProtobufEmpty 46 */ 47 public function cancel($name, GoogleCloudMlV1CancelJobRequest $postBody, $optParams = []) 48 { 49 $params = ['name' => $name, 'postBody' => $postBody]; 50 $params = array_merge($params, $optParams); 51 return $this->call('cancel', [$params], GoogleProtobufEmpty::class); 52 } 53 /** 54 * Creates a training or a batch prediction job. (jobs.create) 55 * 56 * @param string $parent Required. The project name. 57 * @param GoogleCloudMlV1Job $postBody 58 * @param array $optParams Optional parameters. 59 * @return GoogleCloudMlV1Job 60 */ 61 public function create($parent, GoogleCloudMlV1Job $postBody, $optParams = []) 62 { 63 $params = ['parent' => $parent, 'postBody' => $postBody]; 64 $params = array_merge($params, $optParams); 65 return $this->call('create', [$params], GoogleCloudMlV1Job::class); 66 } 67 /** 68 * Describes a job. (jobs.get) 69 * 70 * @param string $name Required. The name of the job to get the description of. 71 * @param array $optParams Optional parameters. 72 * @return GoogleCloudMlV1Job 73 */ 74 public function get($name, $optParams = []) 75 { 76 $params = ['name' => $name]; 77 $params = array_merge($params, $optParams); 78 return $this->call('get', [$params], GoogleCloudMlV1Job::class); 79 } 80 /** 81 * Gets the access control policy for a resource. Returns an empty policy if the 82 * resource exists and does not have a policy set. (jobs.getIamPolicy) 83 * 84 * @param string $resource REQUIRED: The resource for which the policy is being 85 * requested. See the operation documentation for the appropriate value for this 86 * field. 87 * @param array $optParams Optional parameters. 88 * 89 * @opt_param int options.requestedPolicyVersion Optional. The maximum policy 90 * version that will be used to format the policy. Valid values are 0, 1, and 3. 91 * Requests specifying an invalid value will be rejected. Requests for policies 92 * with any conditional role bindings must specify version 3. Policies with no 93 * conditional role bindings may specify any valid value or leave the field 94 * unset. The policy in the response might use the policy version that you 95 * specified, or it might use a lower policy version. For example, if you 96 * specify version 3, but the policy has no conditional role bindings, the 97 * response uses version 1. To learn which resources support conditions in their 98 * IAM policies, see the [IAM 99 * documentation](https://cloud.google.com/iam/help/conditions/resource- 100 * policies). 101 * @return GoogleIamV1Policy 102 */ 103 public function getIamPolicy($resource, $optParams = []) 104 { 105 $params = ['resource' => $resource]; 106 $params = array_merge($params, $optParams); 107 return $this->call('getIamPolicy', [$params], GoogleIamV1Policy::class); 108 } 109 /** 110 * Lists the jobs in the project. If there are no jobs that match the request 111 * parameters, the list request returns an empty response body: {}. 112 * (jobs.listProjectsJobs) 113 * 114 * @param string $parent Required. The name of the project for which to list 115 * jobs. 116 * @param array $optParams Optional parameters. 117 * 118 * @opt_param string filter Optional. Specifies the subset of jobs to retrieve. 119 * You can filter on the value of one or more attributes of the job object. For 120 * example, retrieve jobs with a job identifier that starts with 'census': 121 * gcloud ai-platform jobs list --filter='jobId:census*' List all failed jobs 122 * with names that start with 'rnn': gcloud ai-platform jobs list 123 * --filter='jobId:rnn* AND state:FAILED' For more examples, see the guide to 124 * monitoring jobs. 125 * @opt_param int pageSize Optional. The number of jobs to retrieve per "page" 126 * of results. If there are more remaining results than this number, the 127 * response message will contain a valid value in the `next_page_token` field. 128 * The default value is 20, and the maximum page size is 100. 129 * @opt_param string pageToken Optional. A page token to request the next page 130 * of results. You get the token from the `next_page_token` field of the 131 * response from the previous call. 132 * @return GoogleCloudMlV1ListJobsResponse 133 */ 134 public function listProjectsJobs($parent, $optParams = []) 135 { 136 $params = ['parent' => $parent]; 137 $params = array_merge($params, $optParams); 138 return $this->call('list', [$params], GoogleCloudMlV1ListJobsResponse::class); 139 } 140 /** 141 * Updates a specific job resource. Currently the only supported fields to 142 * update are `labels`. (jobs.patch) 143 * 144 * @param string $name Required. The job name. 145 * @param GoogleCloudMlV1Job $postBody 146 * @param array $optParams Optional parameters. 147 * 148 * @opt_param string updateMask Required. Specifies the path, relative to `Job`, 149 * of the field to update. To adopt etag mechanism, include `etag` field in the 150 * mask, and include the `etag` value in your job resource. For example, to 151 * change the labels of a job, the `update_mask` parameter would be specified as 152 * `labels`, `etag`, and the `PATCH` request body would specify the new value, 153 * as follows: { "labels": { "owner": "Google", "color": "Blue" } "etag": 154 * "33a64df551425fcc55e4d42a148795d9f25f89d4" } If `etag` matches the one on the 155 * server, the labels of the job will be replaced with the given ones, and the 156 * server end `etag` will be recalculated. Currently the only supported update 157 * masks are `labels` and `etag`. 158 * @return GoogleCloudMlV1Job 159 */ 160 public function patch($name, GoogleCloudMlV1Job $postBody, $optParams = []) 161 { 162 $params = ['name' => $name, 'postBody' => $postBody]; 163 $params = array_merge($params, $optParams); 164 return $this->call('patch', [$params], GoogleCloudMlV1Job::class); 165 } 166 /** 167 * Sets the access control policy on the specified resource. Replaces any 168 * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and 169 * `PERMISSION_DENIED` errors. (jobs.setIamPolicy) 170 * 171 * @param string $resource REQUIRED: The resource for which the policy is being 172 * specified. See the operation documentation for the appropriate value for this 173 * field. 174 * @param GoogleIamV1SetIamPolicyRequest $postBody 175 * @param array $optParams Optional parameters. 176 * @return GoogleIamV1Policy 177 */ 178 public function setIamPolicy($resource, GoogleIamV1SetIamPolicyRequest $postBody, $optParams = []) 179 { 180 $params = ['resource' => $resource, 'postBody' => $postBody]; 181 $params = array_merge($params, $optParams); 182 return $this->call('setIamPolicy', [$params], GoogleIamV1Policy::class); 183 } 184 /** 185 * Returns permissions that a caller has on the specified resource. If the 186 * resource does not exist, this will return an empty set of permissions, not a 187 * `NOT_FOUND` error. Note: This operation is designed to be used for building 188 * permission-aware UIs and command-line tools, not for authorization checking. 189 * This operation may "fail open" without warning. (jobs.testIamPermissions) 190 * 191 * @param string $resource REQUIRED: The resource for which the policy detail is 192 * being requested. See the operation documentation for the appropriate value 193 * for this field. 194 * @param GoogleIamV1TestIamPermissionsRequest $postBody 195 * @param array $optParams Optional parameters. 196 * @return GoogleIamV1TestIamPermissionsResponse 197 */ 198 public function testIamPermissions($resource, GoogleIamV1TestIamPermissionsRequest $postBody, $optParams = []) 199 { 200 $params = ['resource' => $resource, 'postBody' => $postBody]; 201 $params = array_merge($params, $optParams); 202 return $this->call('testIamPermissions', [$params], GoogleIamV1TestIamPermissionsResponse::class); 203 } 204} 205 206// Adding a class alias for backwards compatibility with the previous class name. 207class_alias(ProjectsJobs::class, 'Google_Service_CloudMachineLearningEngine_Resource_ProjectsJobs'); 208