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\BigQueryDataTransfer\Resource;
19
20use Google\Service\BigQueryDataTransfer\CheckValidCredsRequest;
21use Google\Service\BigQueryDataTransfer\CheckValidCredsResponse;
22use Google\Service\BigQueryDataTransfer\DataSource;
23use Google\Service\BigQueryDataTransfer\ListDataSourcesResponse;
24
25/**
26 * The "dataSources" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $bigquerydatatransferService = new Google\Service\BigQueryDataTransfer(...);
30 *   $dataSources = $bigquerydatatransferService->dataSources;
31 *  </code>
32 */
33class ProjectsLocationsDataSources extends \Google\Service\Resource
34{
35  /**
36   * Returns true if valid credentials exist for the given data source and
37   * requesting user. (dataSources.checkValidCreds)
38   *
39   * @param string $name Required. The data source in the form:
40   * `projects/{project_id}/dataSources/{data_source_id}` or
41   * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`.
42   * @param CheckValidCredsRequest $postBody
43   * @param array $optParams Optional parameters.
44   * @return CheckValidCredsResponse
45   */
46  public function checkValidCreds($name, CheckValidCredsRequest $postBody, $optParams = [])
47  {
48    $params = ['name' => $name, 'postBody' => $postBody];
49    $params = array_merge($params, $optParams);
50    return $this->call('checkValidCreds', [$params], CheckValidCredsResponse::class);
51  }
52  /**
53   * Retrieves a supported data source and returns its settings. (dataSources.get)
54   *
55   * @param string $name Required. The field will contain name of the resource
56   * requested, for example: `projects/{project_id}/dataSources/{data_source_id}`
57   * or
58   * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
59   * @param array $optParams Optional parameters.
60   * @return DataSource
61   */
62  public function get($name, $optParams = [])
63  {
64    $params = ['name' => $name];
65    $params = array_merge($params, $optParams);
66    return $this->call('get', [$params], DataSource::class);
67  }
68  /**
69   * Lists supported data sources and returns their settings.
70   * (dataSources.listProjectsLocationsDataSources)
71   *
72   * @param string $parent Required. The BigQuery project id for which data
73   * sources should be returned. Must be in the form: `projects/{project_id}` or
74   * `projects/{project_id}/locations/{location_id}`
75   * @param array $optParams Optional parameters.
76   *
77   * @opt_param int pageSize Page size. The default page size is the maximum value
78   * of 1000 results.
79   * @opt_param string pageToken Pagination token, which can be used to request a
80   * specific page of `ListDataSourcesRequest` list results. For multiple-page
81   * results, `ListDataSourcesResponse` outputs a `next_page` token, which can be
82   * used as the `page_token` value to request the next page of list results.
83   * @return ListDataSourcesResponse
84   */
85  public function listProjectsLocationsDataSources($parent, $optParams = [])
86  {
87    $params = ['parent' => $parent];
88    $params = array_merge($params, $optParams);
89    return $this->call('list', [$params], ListDataSourcesResponse::class);
90  }
91}
92
93// Adding a class alias for backwards compatibility with the previous class name.
94class_alias(ProjectsLocationsDataSources::class, 'Google_Service_BigQueryDataTransfer_Resource_ProjectsLocationsDataSources');
95