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\Operation;
21use Google\Service\CloudSearch\Schema;
22use Google\Service\CloudSearch\UpdateSchemaRequest;
23
24/**
25 * The "datasources" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $cloudsearchService = new Google\Service\CloudSearch(...);
29 *   $datasources = $cloudsearchService->datasources;
30 *  </code>
31 */
32class IndexingDatasources extends \Google\Service\Resource
33{
34  /**
35   * Deletes the schema of a data source. **Note:** This API requires an admin or
36   * service account to execute. (datasources.deleteSchema)
37   *
38   * @param string $name Name of the data source to delete Schema. Format:
39   * datasources/{source_id}
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param bool debugOptions.enableDebugging If you are asked by Google to
43   * help with debugging, set this field. Otherwise, ignore this field.
44   * @return Operation
45   */
46  public function deleteSchema($name, $optParams = [])
47  {
48    $params = ['name' => $name];
49    $params = array_merge($params, $optParams);
50    return $this->call('deleteSchema', [$params], Operation::class);
51  }
52  /**
53   * Gets the schema of a data source. **Note:** This API requires an admin or
54   * service account to execute. (datasources.getSchema)
55   *
56   * @param string $name Name of the data source to get Schema. Format:
57   * datasources/{source_id}
58   * @param array $optParams Optional parameters.
59   *
60   * @opt_param bool debugOptions.enableDebugging If you are asked by Google to
61   * help with debugging, set this field. Otherwise, ignore this field.
62   * @return Schema
63   */
64  public function getSchema($name, $optParams = [])
65  {
66    $params = ['name' => $name];
67    $params = array_merge($params, $optParams);
68    return $this->call('getSchema', [$params], Schema::class);
69  }
70  /**
71   * Updates the schema of a data source. This method does not perform incremental
72   * updates to the schema. Instead, this method updates the schema by overwriting
73   * the entire schema. **Note:** This API requires an admin or service account to
74   * execute. (datasources.updateSchema)
75   *
76   * @param string $name Name of the data source to update Schema. Format:
77   * datasources/{source_id}
78   * @param UpdateSchemaRequest $postBody
79   * @param array $optParams Optional parameters.
80   * @return Operation
81   */
82  public function updateSchema($name, UpdateSchemaRequest $postBody, $optParams = [])
83  {
84    $params = ['name' => $name, 'postBody' => $postBody];
85    $params = array_merge($params, $optParams);
86    return $this->call('updateSchema', [$params], Operation::class);
87  }
88}
89
90// Adding a class alias for backwards compatibility with the previous class name.
91class_alias(IndexingDatasources::class, 'Google_Service_CloudSearch_Resource_IndexingDatasources');
92