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\ListPatchDeploymentsResponse;
21use Google\Service\OSConfig\OsconfigEmpty;
22use Google\Service\OSConfig\PatchDeployment;
23use Google\Service\OSConfig\PausePatchDeploymentRequest;
24use Google\Service\OSConfig\ResumePatchDeploymentRequest;
25
26/**
27 * The "patchDeployments" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $osconfigService = new Google\Service\OSConfig(...);
31 *   $patchDeployments = $osconfigService->patchDeployments;
32 *  </code>
33 */
34class ProjectsPatchDeployments extends \Google\Service\Resource
35{
36  /**
37   * Create an OS Config patch deployment. (patchDeployments.create)
38   *
39   * @param string $parent Required. The project to apply this patch deployment to
40   * in the form `projects`.
41   * @param PatchDeployment $postBody
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string patchDeploymentId Required. A name for the patch deployment
45   * in the project. When creating a name the following rules apply: * Must
46   * contain only lowercase letters, numbers, and hyphens. * Must start with a
47   * letter. * Must be between 1-63 characters. * Must end with a number or a
48   * letter. * Must be unique within the project.
49   * @return PatchDeployment
50   */
51  public function create($parent, PatchDeployment $postBody, $optParams = [])
52  {
53    $params = ['parent' => $parent, 'postBody' => $postBody];
54    $params = array_merge($params, $optParams);
55    return $this->call('create', [$params], PatchDeployment::class);
56  }
57  /**
58   * Delete an OS Config patch deployment. (patchDeployments.delete)
59   *
60   * @param string $name Required. The resource name of the patch deployment in
61   * the form `projects/patchDeployments`.
62   * @param array $optParams Optional parameters.
63   * @return OsconfigEmpty
64   */
65  public function delete($name, $optParams = [])
66  {
67    $params = ['name' => $name];
68    $params = array_merge($params, $optParams);
69    return $this->call('delete', [$params], OsconfigEmpty::class);
70  }
71  /**
72   * Get an OS Config patch deployment. (patchDeployments.get)
73   *
74   * @param string $name Required. The resource name of the patch deployment in
75   * the form `projects/patchDeployments`.
76   * @param array $optParams Optional parameters.
77   * @return PatchDeployment
78   */
79  public function get($name, $optParams = [])
80  {
81    $params = ['name' => $name];
82    $params = array_merge($params, $optParams);
83    return $this->call('get', [$params], PatchDeployment::class);
84  }
85  /**
86   * Get a page of OS Config patch deployments.
87   * (patchDeployments.listProjectsPatchDeployments)
88   *
89   * @param string $parent Required. The resource name of the parent in the form
90   * `projects`.
91   * @param array $optParams Optional parameters.
92   *
93   * @opt_param int pageSize Optional. The maximum number of patch deployments to
94   * return. Default is 100.
95   * @opt_param string pageToken Optional. A pagination token returned from a
96   * previous call to ListPatchDeployments that indicates where this listing
97   * should continue from.
98   * @return ListPatchDeploymentsResponse
99   */
100  public function listProjectsPatchDeployments($parent, $optParams = [])
101  {
102    $params = ['parent' => $parent];
103    $params = array_merge($params, $optParams);
104    return $this->call('list', [$params], ListPatchDeploymentsResponse::class);
105  }
106  /**
107   * Update an OS Config patch deployment. (patchDeployments.patch)
108   *
109   * @param string $name Unique name for the patch deployment resource in a
110   * project. The patch deployment name is in the form:
111   * `projects/{project_id}/patchDeployments/{patch_deployment_id}`. This field is
112   * ignored when you create a new patch deployment.
113   * @param PatchDeployment $postBody
114   * @param array $optParams Optional parameters.
115   *
116   * @opt_param string updateMask Optional. Field mask that controls which fields
117   * of the patch deployment should be updated.
118   * @return PatchDeployment
119   */
120  public function patch($name, PatchDeployment $postBody, $optParams = [])
121  {
122    $params = ['name' => $name, 'postBody' => $postBody];
123    $params = array_merge($params, $optParams);
124    return $this->call('patch', [$params], PatchDeployment::class);
125  }
126  /**
127   * Change state of patch deployment to "PAUSED". Patch deployment in paused
128   * state doesn't generate patch jobs. (patchDeployments.pause)
129   *
130   * @param string $name Required. The resource name of the patch deployment in
131   * the form `projects/patchDeployments`.
132   * @param PausePatchDeploymentRequest $postBody
133   * @param array $optParams Optional parameters.
134   * @return PatchDeployment
135   */
136  public function pause($name, PausePatchDeploymentRequest $postBody, $optParams = [])
137  {
138    $params = ['name' => $name, 'postBody' => $postBody];
139    $params = array_merge($params, $optParams);
140    return $this->call('pause', [$params], PatchDeployment::class);
141  }
142  /**
143   * Change state of patch deployment back to "ACTIVE". Patch deployment in active
144   * state continues to generate patch jobs. (patchDeployments.resume)
145   *
146   * @param string $name Required. The resource name of the patch deployment in
147   * the form `projects/patchDeployments`.
148   * @param ResumePatchDeploymentRequest $postBody
149   * @param array $optParams Optional parameters.
150   * @return PatchDeployment
151   */
152  public function resume($name, ResumePatchDeploymentRequest $postBody, $optParams = [])
153  {
154    $params = ['name' => $name, 'postBody' => $postBody];
155    $params = array_merge($params, $optParams);
156    return $this->call('resume', [$params], PatchDeployment::class);
157  }
158}
159
160// Adding a class alias for backwards compatibility with the previous class name.
161class_alias(ProjectsPatchDeployments::class, 'Google_Service_OSConfig_Resource_ProjectsPatchDeployments');
162