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\OSConfig\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\OSConfig\ListOSPolicyAssignmentRevisionsResponse;
|
---|
21 | use Google\Service\OSConfig\ListOSPolicyAssignmentsResponse;
|
---|
22 | use Google\Service\OSConfig\OSPolicyAssignment;
|
---|
23 | use Google\Service\OSConfig\Operation;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "osPolicyAssignments" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $osconfigService = new Google\Service\OSConfig(...);
|
---|
30 | * $osPolicyAssignments = $osconfigService->projects_locations_osPolicyAssignments;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class ProjectsLocationsOsPolicyAssignments extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Create an OS policy assignment. This method also creates the first revision
|
---|
37 | * of the OS policy assignment. This method returns a long running operation
|
---|
38 | * (LRO) that contains the rollout details. The rollout can be cancelled by
|
---|
39 | * cancelling the LRO. For more information, see [Method: projects.locations.osP
|
---|
40 | * olicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osc
|
---|
41 | * onfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel).
|
---|
42 | * (osPolicyAssignments.create)
|
---|
43 | *
|
---|
44 | * @param string $parent Required. The parent resource name in the form:
|
---|
45 | * projects/{project}/locations/{location}. Note: Specify the zone of your VMs
|
---|
46 | * as the location.
|
---|
47 | * @param OSPolicyAssignment $postBody
|
---|
48 | * @param array $optParams Optional parameters.
|
---|
49 | *
|
---|
50 | * @opt_param string osPolicyAssignmentId Required. The logical name of the OS
|
---|
51 | * policy assignment in the project with the following restrictions: * Must
|
---|
52 | * contain only lowercase letters, numbers, and hyphens. * Must start with a
|
---|
53 | * letter. * Must be between 1-63 characters. * Must end with a number or a
|
---|
54 | * letter. * Must be unique within the project.
|
---|
55 | * @opt_param string requestId Optional. A unique identifier for this request.
|
---|
56 | * Restricted to 36 ASCII characters. A random UUID is recommended. This request
|
---|
57 | * is only idempotent if a `request_id` is provided.
|
---|
58 | * @return Operation
|
---|
59 | * @throws \Google\Service\Exception
|
---|
60 | */
|
---|
61 | public function create($parent, OSPolicyAssignment $postBody, $optParams = [])
|
---|
62 | {
|
---|
63 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
64 | $params = array_merge($params, $optParams);
|
---|
65 | return $this->call('create', [$params], Operation::class);
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Delete the OS policy assignment. This method creates a new revision of the OS
|
---|
69 | * policy assignment. This method returns a long running operation (LRO) that
|
---|
70 | * contains the rollout details. The rollout can be cancelled by cancelling the
|
---|
71 | * LRO. If the LRO completes and is not cancelled, all revisions associated with
|
---|
72 | * the OS policy assignment are deleted. For more information, see [Method: proj
|
---|
73 | * ects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.co
|
---|
74 | * m/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operat
|
---|
75 | * ions/cancel). (osPolicyAssignments.delete)
|
---|
76 | *
|
---|
77 | * @param string $name Required. The name of the OS policy assignment to be
|
---|
78 | * deleted
|
---|
79 | * @param array $optParams Optional parameters.
|
---|
80 | *
|
---|
81 | * @opt_param string requestId Optional. A unique identifier for this request.
|
---|
82 | * Restricted to 36 ASCII characters. A random UUID is recommended. This request
|
---|
83 | * is only idempotent if a `request_id` is provided.
|
---|
84 | * @return Operation
|
---|
85 | * @throws \Google\Service\Exception
|
---|
86 | */
|
---|
87 | public function delete($name, $optParams = [])
|
---|
88 | {
|
---|
89 | $params = ['name' => $name];
|
---|
90 | $params = array_merge($params, $optParams);
|
---|
91 | return $this->call('delete', [$params], Operation::class);
|
---|
92 | }
|
---|
93 | /**
|
---|
94 | * Retrieve an existing OS policy assignment. This method always returns the
|
---|
95 | * latest revision. In order to retrieve a previous revision of the assignment,
|
---|
96 | * also provide the revision ID in the `name` parameter.
|
---|
97 | * (osPolicyAssignments.get)
|
---|
98 | *
|
---|
99 | * @param string $name Required. The resource name of OS policy assignment.
|
---|
100 | * Format: `projects/{project}/locations/{location}/osPolicyAssignments/{os_poli
|
---|
101 | * cy_assignment}@{revisionId}`
|
---|
102 | * @param array $optParams Optional parameters.
|
---|
103 | * @return OSPolicyAssignment
|
---|
104 | * @throws \Google\Service\Exception
|
---|
105 | */
|
---|
106 | public function get($name, $optParams = [])
|
---|
107 | {
|
---|
108 | $params = ['name' => $name];
|
---|
109 | $params = array_merge($params, $optParams);
|
---|
110 | return $this->call('get', [$params], OSPolicyAssignment::class);
|
---|
111 | }
|
---|
112 | /**
|
---|
113 | * List the OS policy assignments under the parent resource. For each OS policy
|
---|
114 | * assignment, the latest revision is returned.
|
---|
115 | * (osPolicyAssignments.listProjectsLocationsOsPolicyAssignments)
|
---|
116 | *
|
---|
117 | * @param string $parent Required. The parent resource name.
|
---|
118 | * @param array $optParams Optional parameters.
|
---|
119 | *
|
---|
120 | * @opt_param int pageSize The maximum number of assignments to return.
|
---|
121 | * @opt_param string pageToken A pagination token returned from a previous call
|
---|
122 | * to `ListOSPolicyAssignments` that indicates where this listing should
|
---|
123 | * continue from.
|
---|
124 | * @return ListOSPolicyAssignmentsResponse
|
---|
125 | * @throws \Google\Service\Exception
|
---|
126 | */
|
---|
127 | public function listProjectsLocationsOsPolicyAssignments($parent, $optParams = [])
|
---|
128 | {
|
---|
129 | $params = ['parent' => $parent];
|
---|
130 | $params = array_merge($params, $optParams);
|
---|
131 | return $this->call('list', [$params], ListOSPolicyAssignmentsResponse::class);
|
---|
132 | }
|
---|
133 | /**
|
---|
134 | * List the OS policy assignment revisions for a given OS policy assignment.
|
---|
135 | * (osPolicyAssignments.listRevisions)
|
---|
136 | *
|
---|
137 | * @param string $name Required. The name of the OS policy assignment to list
|
---|
138 | * revisions for.
|
---|
139 | * @param array $optParams Optional parameters.
|
---|
140 | *
|
---|
141 | * @opt_param int pageSize The maximum number of revisions to return.
|
---|
142 | * @opt_param string pageToken A pagination token returned from a previous call
|
---|
143 | * to `ListOSPolicyAssignmentRevisions` that indicates where this listing should
|
---|
144 | * continue from.
|
---|
145 | * @return ListOSPolicyAssignmentRevisionsResponse
|
---|
146 | * @throws \Google\Service\Exception
|
---|
147 | */
|
---|
148 | public function listRevisions($name, $optParams = [])
|
---|
149 | {
|
---|
150 | $params = ['name' => $name];
|
---|
151 | $params = array_merge($params, $optParams);
|
---|
152 | return $this->call('listRevisions', [$params], ListOSPolicyAssignmentRevisionsResponse::class);
|
---|
153 | }
|
---|
154 | /**
|
---|
155 | * Update an existing OS policy assignment. This method creates a new revision
|
---|
156 | * of the OS policy assignment. This method returns a long running operation
|
---|
157 | * (LRO) that contains the rollout details. The rollout can be cancelled by
|
---|
158 | * cancelling the LRO. For more information, see [Method: projects.locations.osP
|
---|
159 | * olicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osc
|
---|
160 | * onfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel).
|
---|
161 | * (osPolicyAssignments.patch)
|
---|
162 | *
|
---|
163 | * @param string $name Resource name. Format: `projects/{project_number}/locatio
|
---|
164 | * ns/{location}/osPolicyAssignments/{os_policy_assignment_id}` This field is
|
---|
165 | * ignored when you create an OS policy assignment.
|
---|
166 | * @param OSPolicyAssignment $postBody
|
---|
167 | * @param array $optParams Optional parameters.
|
---|
168 | *
|
---|
169 | * @opt_param bool allowMissing Optional. If set to true, and the OS policy
|
---|
170 | * assignment is not found, a new OS policy assignment will be created. In this
|
---|
171 | * situation, `update_mask` is ignored.
|
---|
172 | * @opt_param string requestId Optional. A unique identifier for this request.
|
---|
173 | * Restricted to 36 ASCII characters. A random UUID is recommended. This request
|
---|
174 | * is only idempotent if a `request_id` is provided.
|
---|
175 | * @opt_param string updateMask Optional. Field mask that controls which fields
|
---|
176 | * of the assignment should be updated.
|
---|
177 | * @return Operation
|
---|
178 | * @throws \Google\Service\Exception
|
---|
179 | */
|
---|
180 | public function patch($name, OSPolicyAssignment $postBody, $optParams = [])
|
---|
181 | {
|
---|
182 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
183 | $params = array_merge($params, $optParams);
|
---|
184 | return $this->call('patch', [$params], Operation::class);
|
---|
185 | }
|
---|
186 | }
|
---|
187 |
|
---|
188 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
189 | class_alias(ProjectsLocationsOsPolicyAssignments::class, 'Google_Service_OSConfig_Resource_ProjectsLocationsOsPolicyAssignments');
|
---|