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