Skip to content

Commit 009ee7f

Browse files
1 parent f3439f0 commit 009ee7f

3 files changed

Lines changed: 71 additions & 1 deletion

File tree

src/Batch.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,17 @@ public function __construct($clientOrConfig = [], $rootUrl = null)
110110
'jobs',
111111
[
112112
'methods' => [
113-
'create' => [
113+
'cancel' => [
114+
'path' => 'v1/{+name}:cancel',
115+
'httpMethod' => 'POST',
116+
'parameters' => [
117+
'name' => [
118+
'location' => 'path',
119+
'type' => 'string',
120+
'required' => true,
121+
],
122+
],
123+
],'create' => [
114124
'path' => 'v1/{+parent}/jobs',
115125
'httpMethod' => 'POST',
116126
'parameters' => [

src/Batch/CancelJobRequest.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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\Batch;
19+
20+
class CancelJobRequest extends \Google\Model
21+
{
22+
/**
23+
* @var string
24+
*/
25+
public $requestId;
26+
27+
/**
28+
* @param string
29+
*/
30+
public function setRequestId($requestId)
31+
{
32+
$this->requestId = $requestId;
33+
}
34+
/**
35+
* @return string
36+
*/
37+
public function getRequestId()
38+
{
39+
return $this->requestId;
40+
}
41+
}
42+
43+
// Adding a class alias for backwards compatibility with the previous class name.
44+
class_alias(CancelJobRequest::class, 'Google_Service_Batch_CancelJobRequest');

src/Batch/Resource/ProjectsLocationsJobs.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
namespace Google\Service\Batch\Resource;
1919

20+
use Google\Service\Batch\CancelJobRequest;
2021
use Google\Service\Batch\Job;
2122
use Google\Service\Batch\ListJobsResponse;
2223
use Google\Service\Batch\Operation;
@@ -31,6 +32,21 @@
3132
*/
3233
class ProjectsLocationsJobs extends \Google\Service\Resource
3334
{
35+
/**
36+
* Cancel a Job. (jobs.cancel)
37+
*
38+
* @param string $name Required. Job name.
39+
* @param CancelJobRequest $postBody
40+
* @param array $optParams Optional parameters.
41+
* @return Operation
42+
* @throws \Google\Service\Exception
43+
*/
44+
public function cancel($name, CancelJobRequest $postBody, $optParams = [])
45+
{
46+
$params = ['name' => $name, 'postBody' => $postBody];
47+
$params = array_merge($params, $optParams);
48+
return $this->call('cancel', [$params], Operation::class);
49+
}
3450
/**
3551
* Create a Job. (jobs.create)
3652
*

0 commit comments

Comments
 (0)