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\ServiceManagement\Resource; 19 20use Google\Service\ServiceManagement\GenerateConfigReportRequest; 21use Google\Service\ServiceManagement\GenerateConfigReportResponse; 22use Google\Service\ServiceManagement\GetIamPolicyRequest; 23use Google\Service\ServiceManagement\ListServicesResponse; 24use Google\Service\ServiceManagement\ManagedService; 25use Google\Service\ServiceManagement\Operation; 26use Google\Service\ServiceManagement\Policy; 27use Google\Service\ServiceManagement\Service; 28use Google\Service\ServiceManagement\SetIamPolicyRequest; 29use Google\Service\ServiceManagement\TestIamPermissionsRequest; 30use Google\Service\ServiceManagement\TestIamPermissionsResponse; 31 32/** 33 * The "services" collection of methods. 34 * Typical usage is: 35 * <code> 36 * $servicemanagementService = new Google\Service\ServiceManagement(...); 37 * $services = $servicemanagementService->services; 38 * </code> 39 */ 40class Services extends \Google\Service\Resource 41{ 42 /** 43 * Creates a new managed service. A managed service is immutable, and is subject 44 * to mandatory 30-day data retention. You cannot move a service or recreate it 45 * within 30 days after deletion. One producer project can own no more than 500 46 * services. For security and reliability purposes, a production service should 47 * be hosted in a dedicated producer project. Operation (services.create) 48 * 49 * @param ManagedService $postBody 50 * @param array $optParams Optional parameters. 51 * @return Operation 52 */ 53 public function create(ManagedService $postBody, $optParams = []) 54 { 55 $params = ['postBody' => $postBody]; 56 $params = array_merge($params, $optParams); 57 return $this->call('create', [$params], Operation::class); 58 } 59 /** 60 * Deletes a managed service. This method will change the service to the `Soft- 61 * Delete` state for 30 days. Within this period, service producers may call 62 * UndeleteService to restore the service. After 30 days, the service will be 63 * permanently deleted. Operation (services.delete) 64 * 65 * @param string $serviceName Required. The name of the service. See the 66 * [overview](https://cloud.google.com/service-management/overview) for naming 67 * requirements. For example: `example.googleapis.com`. 68 * @param array $optParams Optional parameters. 69 * @return Operation 70 */ 71 public function delete($serviceName, $optParams = []) 72 { 73 $params = ['serviceName' => $serviceName]; 74 $params = array_merge($params, $optParams); 75 return $this->call('delete', [$params], Operation::class); 76 } 77 /** 78 * Generates and returns a report (errors, warnings and changes from existing 79 * configurations) associated with GenerateConfigReportRequest.new_value If 80 * GenerateConfigReportRequest.old_value is specified, 81 * GenerateConfigReportRequest will contain a single ChangeReport based on the 82 * comparison between GenerateConfigReportRequest.new_value and 83 * GenerateConfigReportRequest.old_value. If 84 * GenerateConfigReportRequest.old_value is not specified, this method will 85 * compare GenerateConfigReportRequest.new_value with the last pushed service 86 * configuration. (services.generateConfigReport) 87 * 88 * @param GenerateConfigReportRequest $postBody 89 * @param array $optParams Optional parameters. 90 * @return GenerateConfigReportResponse 91 */ 92 public function generateConfigReport(GenerateConfigReportRequest $postBody, $optParams = []) 93 { 94 $params = ['postBody' => $postBody]; 95 $params = array_merge($params, $optParams); 96 return $this->call('generateConfigReport', [$params], GenerateConfigReportResponse::class); 97 } 98 /** 99 * Gets a managed service. Authentication is required unless the service is 100 * public. (services.get) 101 * 102 * @param string $serviceName Required. The name of the service. See the 103 * `ServiceManager` overview for naming requirements. For example: 104 * `example.googleapis.com`. 105 * @param array $optParams Optional parameters. 106 * @return ManagedService 107 */ 108 public function get($serviceName, $optParams = []) 109 { 110 $params = ['serviceName' => $serviceName]; 111 $params = array_merge($params, $optParams); 112 return $this->call('get', [$params], ManagedService::class); 113 } 114 /** 115 * Gets a service configuration (version) for a managed service. 116 * (services.getConfig) 117 * 118 * @param string $serviceName Required. The name of the service. See the 119 * [overview](https://cloud.google.com/service-management/overview) for naming 120 * requirements. For example: `example.googleapis.com`. 121 * @param array $optParams Optional parameters. 122 * 123 * @opt_param string configId Required. The id of the service configuration 124 * resource. This field must be specified for the server to return all fields, 125 * including `SourceInfo`. 126 * @opt_param string view Specifies which parts of the Service Config should be 127 * returned in the response. 128 * @return Service 129 */ 130 public function getConfig($serviceName, $optParams = []) 131 { 132 $params = ['serviceName' => $serviceName]; 133 $params = array_merge($params, $optParams); 134 return $this->call('getConfig', [$params], Service::class); 135 } 136 /** 137 * Gets the access control policy for a resource. Returns an empty policy if the 138 * resource exists and does not have a policy set. (services.getIamPolicy) 139 * 140 * @param string $resource REQUIRED: The resource for which the policy is being 141 * requested. See the operation documentation for the appropriate value for this 142 * field. 143 * @param GetIamPolicyRequest $postBody 144 * @param array $optParams Optional parameters. 145 * @return Policy 146 */ 147 public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = []) 148 { 149 $params = ['resource' => $resource, 'postBody' => $postBody]; 150 $params = array_merge($params, $optParams); 151 return $this->call('getIamPolicy', [$params], Policy::class); 152 } 153 /** 154 * Lists managed services. Returns all public services. For authenticated users, 155 * also returns all services the calling user has 156 * "servicemanagement.services.get" permission for. (services.listServices) 157 * 158 * @param array $optParams Optional parameters. 159 * 160 * @opt_param string consumerId Include services consumed by the specified 161 * consumer. The Google Service Management implementation accepts the following 162 * forms: - project: 163 * @opt_param int pageSize The max number of items to include in the response 164 * list. Page size is 50 if not specified. Maximum value is 100. 165 * @opt_param string pageToken Token identifying which result to start with; 166 * returned by a previous list call. 167 * @opt_param string producerProjectId Include services produced by the 168 * specified project. 169 * @return ListServicesResponse 170 */ 171 public function listServices($optParams = []) 172 { 173 $params = []; 174 $params = array_merge($params, $optParams); 175 return $this->call('list', [$params], ListServicesResponse::class); 176 } 177 /** 178 * Sets the access control policy on the specified resource. Replaces any 179 * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and 180 * `PERMISSION_DENIED` errors. (services.setIamPolicy) 181 * 182 * @param string $resource REQUIRED: The resource for which the policy is being 183 * specified. See the operation documentation for the appropriate value for this 184 * field. 185 * @param SetIamPolicyRequest $postBody 186 * @param array $optParams Optional parameters. 187 * @return Policy 188 */ 189 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = []) 190 { 191 $params = ['resource' => $resource, 'postBody' => $postBody]; 192 $params = array_merge($params, $optParams); 193 return $this->call('setIamPolicy', [$params], Policy::class); 194 } 195 /** 196 * Returns permissions that a caller has on the specified resource. If the 197 * resource does not exist, this will return an empty set of permissions, not a 198 * `NOT_FOUND` error. Note: This operation is designed to be used for building 199 * permission-aware UIs and command-line tools, not for authorization checking. 200 * This operation may "fail open" without warning. (services.testIamPermissions) 201 * 202 * @param string $resource REQUIRED: The resource for which the policy detail is 203 * being requested. See the operation documentation for the appropriate value 204 * for this field. 205 * @param TestIamPermissionsRequest $postBody 206 * @param array $optParams Optional parameters. 207 * @return TestIamPermissionsResponse 208 */ 209 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = []) 210 { 211 $params = ['resource' => $resource, 'postBody' => $postBody]; 212 $params = array_merge($params, $optParams); 213 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); 214 } 215 /** 216 * Revives a previously deleted managed service. The method restores the service 217 * using the configuration at the time the service was deleted. The target 218 * service must exist and must have been deleted within the last 30 days. 219 * Operation (services.undelete) 220 * 221 * @param string $serviceName Required. The name of the service. See the 222 * [overview](https://cloud.google.com/service-management/overview) for naming 223 * requirements. For example: `example.googleapis.com`. 224 * @param array $optParams Optional parameters. 225 * @return Operation 226 */ 227 public function undelete($serviceName, $optParams = []) 228 { 229 $params = ['serviceName' => $serviceName]; 230 $params = array_merge($params, $optParams); 231 return $this->call('undelete', [$params], Operation::class); 232 } 233} 234 235// Adding a class alias for backwards compatibility with the previous class name. 236class_alias(Services::class, 'Google_Service_ServiceManagement_Resource_Services'); 237