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\Compute\Resource; 19 20use Google\Service\Compute\GlobalSetPolicyRequest; 21use Google\Service\Compute\License; 22use Google\Service\Compute\LicensesListResponse; 23use Google\Service\Compute\Operation; 24use Google\Service\Compute\Policy; 25use Google\Service\Compute\TestPermissionsRequest; 26use Google\Service\Compute\TestPermissionsResponse; 27 28/** 29 * The "licenses" collection of methods. 30 * Typical usage is: 31 * <code> 32 * $computeService = new Google\Service\Compute(...); 33 * $licenses = $computeService->licenses; 34 * </code> 35 */ 36class Licenses extends \Google\Service\Resource 37{ 38 /** 39 * Deletes the specified license. *Caution* This resource is intended for use 40 * only by third-party partners who are creating Cloud Marketplace images. 41 * (licenses.delete) 42 * 43 * @param string $project Project ID for this request. 44 * @param string $license Name of the license resource to delete. 45 * @param array $optParams Optional parameters. 46 * 47 * @opt_param string requestId An optional request ID to identify requests. 48 * Specify a unique request ID so that if you must retry your request, the 49 * server will know to ignore the request if it has already been completed. For 50 * example, consider a situation where you make an initial request and the 51 * request times out. If you make the request again with the same request ID, 52 * the server can check if original operation with the same request ID was 53 * received, and if so, will ignore the second request. This prevents clients 54 * from accidentally creating duplicate commitments. The request ID must be a 55 * valid UUID with the exception that zero UUID is not supported ( 56 * 00000000-0000-0000-0000-000000000000). 57 * @return Operation 58 */ 59 public function delete($project, $license, $optParams = []) 60 { 61 $params = ['project' => $project, 'license' => $license]; 62 $params = array_merge($params, $optParams); 63 return $this->call('delete', [$params], Operation::class); 64 } 65 /** 66 * Returns the specified License resource. *Caution* This resource is intended 67 * for use only by third-party partners who are creating Cloud Marketplace 68 * images. (licenses.get) 69 * 70 * @param string $project Project ID for this request. 71 * @param string $license Name of the License resource to return. 72 * @param array $optParams Optional parameters. 73 * @return License 74 */ 75 public function get($project, $license, $optParams = []) 76 { 77 $params = ['project' => $project, 'license' => $license]; 78 $params = array_merge($params, $optParams); 79 return $this->call('get', [$params], License::class); 80 } 81 /** 82 * Gets the access control policy for a resource. May be empty if no such policy 83 * or resource exists. *Caution* This resource is intended for use only by 84 * third-party partners who are creating Cloud Marketplace images. 85 * (licenses.getIamPolicy) 86 * 87 * @param string $project Project ID for this request. 88 * @param string $resource Name or id of the resource for this request. 89 * @param array $optParams Optional parameters. 90 * 91 * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version. 92 * @return Policy 93 */ 94 public function getIamPolicy($project, $resource, $optParams = []) 95 { 96 $params = ['project' => $project, 'resource' => $resource]; 97 $params = array_merge($params, $optParams); 98 return $this->call('getIamPolicy', [$params], Policy::class); 99 } 100 /** 101 * Create a License resource in the specified project. *Caution* This resource 102 * is intended for use only by third-party partners who are creating Cloud 103 * Marketplace images. (licenses.insert) 104 * 105 * @param string $project Project ID for this request. 106 * @param License $postBody 107 * @param array $optParams Optional parameters. 108 * 109 * @opt_param string requestId An optional request ID to identify requests. 110 * Specify a unique request ID so that if you must retry your request, the 111 * server will know to ignore the request if it has already been completed. For 112 * example, consider a situation where you make an initial request and the 113 * request times out. If you make the request again with the same request ID, 114 * the server can check if original operation with the same request ID was 115 * received, and if so, will ignore the second request. This prevents clients 116 * from accidentally creating duplicate commitments. The request ID must be a 117 * valid UUID with the exception that zero UUID is not supported ( 118 * 00000000-0000-0000-0000-000000000000). 119 * @return Operation 120 */ 121 public function insert($project, License $postBody, $optParams = []) 122 { 123 $params = ['project' => $project, 'postBody' => $postBody]; 124 $params = array_merge($params, $optParams); 125 return $this->call('insert', [$params], Operation::class); 126 } 127 /** 128 * Retrieves the list of licenses available in the specified project. This 129 * method does not get any licenses that belong to other projects, including 130 * licenses attached to publicly-available images, like Debian 9. If you want to 131 * get a list of publicly-available licenses, use this method to make a request 132 * to the respective image project, such as debian-cloud or windows-cloud. 133 * *Caution* This resource is intended for use only by third-party partners who 134 * are creating Cloud Marketplace images. (licenses.listLicenses) 135 * 136 * @param string $project Project ID for this request. 137 * @param array $optParams Optional parameters. 138 * 139 * @opt_param string filter A filter expression that filters resources listed in 140 * the response. The expression must specify the field name, an operator, and 141 * the value that you want to use for filtering. The value must be a string, a 142 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 143 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 144 * can exclude instances named `example-instance` by specifying `name != 145 * example-instance`. The `:` operator can be used with string fields to match 146 * substrings. For non-string fields it is equivalent to the `=` operator. The 147 * `:*` comparison can be used to test whether a key has been defined. For 148 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 149 * You can also filter nested fields. For example, you could specify 150 * `scheduling.automaticRestart = false` to include instances only if they are 151 * not scheduled for automatic restarts. You can use filtering on nested fields 152 * to filter based on resource labels. To filter on multiple expressions, 153 * provide each separate expression within parentheses. For example: ``` 154 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 155 * default, each expression is an `AND` expression. However, you can include 156 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 157 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 158 * (scheduling.automaticRestart = true) ``` 159 * @opt_param string maxResults The maximum number of results per page that 160 * should be returned. If the number of available results is larger than 161 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 162 * get the next page of results in subsequent list requests. Acceptable values 163 * are `0` to `500`, inclusive. (Default: `500`) 164 * @opt_param string orderBy Sorts list results by a certain order. By default, 165 * results are returned in alphanumerical order based on the resource name. You 166 * can also sort results in descending order based on the creation timestamp 167 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 168 * `creationTimestamp` field in reverse chronological order (newest result 169 * first). Use this to sort resources like operations so that the newest 170 * operation is returned first. Currently, only sorting by `name` or 171 * `creationTimestamp desc` is supported. 172 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 173 * the `nextPageToken` returned by a previous list request to get the next page 174 * of results. 175 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 176 * which provides partial results in case of failure. The default value is 177 * false. 178 * @return LicensesListResponse 179 */ 180 public function listLicenses($project, $optParams = []) 181 { 182 $params = ['project' => $project]; 183 $params = array_merge($params, $optParams); 184 return $this->call('list', [$params], LicensesListResponse::class); 185 } 186 /** 187 * Sets the access control policy on the specified resource. Replaces any 188 * existing policy. *Caution* This resource is intended for use only by third- 189 * party partners who are creating Cloud Marketplace images. 190 * (licenses.setIamPolicy) 191 * 192 * @param string $project Project ID for this request. 193 * @param string $resource Name or id of the resource for this request. 194 * @param GlobalSetPolicyRequest $postBody 195 * @param array $optParams Optional parameters. 196 * @return Policy 197 */ 198 public function setIamPolicy($project, $resource, GlobalSetPolicyRequest $postBody, $optParams = []) 199 { 200 $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody]; 201 $params = array_merge($params, $optParams); 202 return $this->call('setIamPolicy', [$params], Policy::class); 203 } 204 /** 205 * Returns permissions that a caller has on the specified resource. *Caution* 206 * This resource is intended for use only by third-party partners who are 207 * creating Cloud Marketplace images. (licenses.testIamPermissions) 208 * 209 * @param string $project Project ID for this request. 210 * @param string $resource Name or id of the resource for this request. 211 * @param TestPermissionsRequest $postBody 212 * @param array $optParams Optional parameters. 213 * @return TestPermissionsResponse 214 */ 215 public function testIamPermissions($project, $resource, TestPermissionsRequest $postBody, $optParams = []) 216 { 217 $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody]; 218 $params = array_merge($params, $optParams); 219 return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class); 220 } 221} 222 223// Adding a class alias for backwards compatibility with the previous class name. 224class_alias(Licenses::class, 'Google_Service_Compute_Resource_Licenses'); 225