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\OSConfig\Resource;
19
20use Google\Service\OSConfig\CancelPatchJobRequest;
21use Google\Service\OSConfig\ExecutePatchJobRequest;
22use Google\Service\OSConfig\ListPatchJobsResponse;
23use Google\Service\OSConfig\PatchJob;
24
25/**
26 * The "patchJobs" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $osconfigService = new Google\Service\OSConfig(...);
30 *   $patchJobs = $osconfigService->patchJobs;
31 *  </code>
32 */
33class ProjectsPatchJobs extends \Google\Service\Resource
34{
35  /**
36   * Cancel a patch job. The patch job must be active. Canceled patch jobs cannot
37   * be restarted. (patchJobs.cancel)
38   *
39   * @param string $name Required. Name of the patch in the form
40   * `projects/patchJobs`
41   * @param CancelPatchJobRequest $postBody
42   * @param array $optParams Optional parameters.
43   * @return PatchJob
44   */
45  public function cancel($name, CancelPatchJobRequest $postBody, $optParams = [])
46  {
47    $params = ['name' => $name, 'postBody' => $postBody];
48    $params = array_merge($params, $optParams);
49    return $this->call('cancel', [$params], PatchJob::class);
50  }
51  /**
52   * Patch VM instances by creating and running a patch job. (patchJobs.execute)
53   *
54   * @param string $parent Required. The project in which to run this patch in the
55   * form `projects`
56   * @param ExecutePatchJobRequest $postBody
57   * @param array $optParams Optional parameters.
58   * @return PatchJob
59   */
60  public function execute($parent, ExecutePatchJobRequest $postBody, $optParams = [])
61  {
62    $params = ['parent' => $parent, 'postBody' => $postBody];
63    $params = array_merge($params, $optParams);
64    return $this->call('execute', [$params], PatchJob::class);
65  }
66  /**
67   * Get the patch job. This can be used to track the progress of an ongoing patch
68   * job or review the details of completed jobs. (patchJobs.get)
69   *
70   * @param string $name Required. Name of the patch in the form
71   * `projects/patchJobs`
72   * @param array $optParams Optional parameters.
73   * @return PatchJob
74   */
75  public function get($name, $optParams = [])
76  {
77    $params = ['name' => $name];
78    $params = array_merge($params, $optParams);
79    return $this->call('get', [$params], PatchJob::class);
80  }
81  /**
82   * Get a list of patch jobs. (patchJobs.listProjectsPatchJobs)
83   *
84   * @param string $parent Required. In the form of `projects`
85   * @param array $optParams Optional parameters.
86   *
87   * @opt_param string filter If provided, this field specifies the criteria that
88   * must be met by patch jobs to be included in the response. Currently,
89   * filtering is only available on the patch_deployment field.
90   * @opt_param int pageSize The maximum number of instance status to return.
91   * @opt_param string pageToken A pagination token returned from a previous call
92   * that indicates where this listing should continue from.
93   * @return ListPatchJobsResponse
94   */
95  public function listProjectsPatchJobs($parent, $optParams = [])
96  {
97    $params = ['parent' => $parent];
98    $params = array_merge($params, $optParams);
99    return $this->call('list', [$params], ListPatchJobsResponse::class);
100  }
101}
102
103// Adding a class alias for backwards compatibility with the previous class name.
104class_alias(ProjectsPatchJobs::class, 'Google_Service_OSConfig_Resource_ProjectsPatchJobs');
105