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\CloudSearch\Resource; 19 20use Google\Service\CloudSearch\DataSource; 21use Google\Service\CloudSearch\ListDataSourceResponse; 22use Google\Service\CloudSearch\Operation; 23use Google\Service\CloudSearch\UpdateDataSourceRequest; 24 25/** 26 * The "datasources" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $cloudsearchService = new Google\Service\CloudSearch(...); 30 * $datasources = $cloudsearchService->datasources; 31 * </code> 32 */ 33class SettingsDatasources extends \Google\Service\Resource 34{ 35 /** 36 * Creates a datasource. **Note:** This API requires an admin account to 37 * execute. (datasources.create) 38 * 39 * @param DataSource $postBody 40 * @param array $optParams Optional parameters. 41 * @return Operation 42 */ 43 public function create(DataSource $postBody, $optParams = []) 44 { 45 $params = ['postBody' => $postBody]; 46 $params = array_merge($params, $optParams); 47 return $this->call('create', [$params], Operation::class); 48 } 49 /** 50 * Deletes a datasource. **Note:** This API requires an admin account to 51 * execute. (datasources.delete) 52 * 53 * @param string $name Name of the datasource. Format: datasources/{source_id}. 54 * @param array $optParams Optional parameters. 55 * 56 * @opt_param bool debugOptions.enableDebugging If you are asked by Google to 57 * help with debugging, set this field. Otherwise, ignore this field. 58 * @return Operation 59 */ 60 public function delete($name, $optParams = []) 61 { 62 $params = ['name' => $name]; 63 $params = array_merge($params, $optParams); 64 return $this->call('delete', [$params], Operation::class); 65 } 66 /** 67 * Gets a datasource. **Note:** This API requires an admin account to execute. 68 * (datasources.get) 69 * 70 * @param string $name Name of the datasource resource. Format: 71 * datasources/{source_id}. 72 * @param array $optParams Optional parameters. 73 * 74 * @opt_param bool debugOptions.enableDebugging If you are asked by Google to 75 * help with debugging, set this field. Otherwise, ignore this field. 76 * @return DataSource 77 */ 78 public function get($name, $optParams = []) 79 { 80 $params = ['name' => $name]; 81 $params = array_merge($params, $optParams); 82 return $this->call('get', [$params], DataSource::class); 83 } 84 /** 85 * Lists datasources. **Note:** This API requires an admin account to execute. 86 * (datasources.listSettingsDatasources) 87 * 88 * @param array $optParams Optional parameters. 89 * 90 * @opt_param bool debugOptions.enableDebugging If you are asked by Google to 91 * help with debugging, set this field. Otherwise, ignore this field. 92 * @opt_param int pageSize Maximum number of datasources to fetch in a request. 93 * The max value is 1000. The default value is 1000. 94 * @opt_param string pageToken Starting index of the results. 95 * @return ListDataSourceResponse 96 */ 97 public function listSettingsDatasources($optParams = []) 98 { 99 $params = []; 100 $params = array_merge($params, $optParams); 101 return $this->call('list', [$params], ListDataSourceResponse::class); 102 } 103 /** 104 * Updates a datasource. **Note:** This API requires an admin account to 105 * execute. (datasources.update) 106 * 107 * @param string $name Name of the datasource resource. Format: 108 * datasources/{source_id}. The name is ignored when creating a datasource. 109 * @param UpdateDataSourceRequest $postBody 110 * @param array $optParams Optional parameters. 111 * @return Operation 112 */ 113 public function update($name, UpdateDataSourceRequest $postBody, $optParams = []) 114 { 115 $params = ['name' => $name, 'postBody' => $postBody]; 116 $params = array_merge($params, $optParams); 117 return $this->call('update', [$params], Operation::class); 118 } 119} 120 121// Adding a class alias for backwards compatibility with the previous class name. 122class_alias(SettingsDatasources::class, 'Google_Service_CloudSearch_Resource_SettingsDatasources'); 123