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\BigquerydatatransferEmpty;
21use Google\Service\BigQueryDataTransfer\ListTransferConfigsResponse;
22use Google\Service\BigQueryDataTransfer\ScheduleTransferRunsRequest;
23use Google\Service\BigQueryDataTransfer\ScheduleTransferRunsResponse;
24use Google\Service\BigQueryDataTransfer\StartManualTransferRunsRequest;
25use Google\Service\BigQueryDataTransfer\StartManualTransferRunsResponse;
26use Google\Service\BigQueryDataTransfer\TransferConfig;
27
28/**
29 * The "transferConfigs" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $bigquerydatatransferService = new Google\Service\BigQueryDataTransfer(...);
33 *   $transferConfigs = $bigquerydatatransferService->transferConfigs;
34 *  </code>
35 */
36class ProjectsTransferConfigs extends \Google\Service\Resource
37{
38  /**
39   * Creates a new data transfer configuration. (transferConfigs.create)
40   *
41   * @param string $parent Required. The BigQuery project id where the transfer
42   * configuration should be created. Must be in the format
43   * projects/{project_id}/locations/{location_id} or projects/{project_id}. If
44   * specified location and location of the destination bigquery dataset do not
45   * match - the request will fail.
46   * @param TransferConfig $postBody
47   * @param array $optParams Optional parameters.
48   *
49   * @opt_param string authorizationCode Optional OAuth2 authorization code to use
50   * with this transfer configuration. This is required only if
51   * `transferConfig.dataSourceId` is 'youtube_channel' and new credentials are
52   * needed, as indicated by `CheckValidCreds`. In order to obtain
53   * authorization_code, make a request to the following URL:
54   * https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?
55   * client_id=client_id=data_source_scopes
56   * _uri=urn:ietf:wg:oauth:2.0:oob_type=authorization_code * The client_id is the
57   * OAuth client_id of the a data source as returned by ListDataSources method. *
58   * data_source_scopes are the scopes returned by ListDataSources method. Note
59   * that this should not be set when `service_account_name` is used to create the
60   * transfer config.
61   * @opt_param string serviceAccountName Optional service account name. If this
62   * field is set, the transfer config will be created with this service account's
63   * credentials. It requires that the requesting user calling this API has
64   * permissions to act as this service account. Note that not all data sources
65   * support service account credentials when creating a transfer config. For the
66   * latest list of data sources, read about [using service
67   * accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-
68   * accounts).
69   * @opt_param string versionInfo Optional version info. This is required only if
70   * `transferConfig.dataSourceId` is not 'youtube_channel' and new credentials
71   * are needed, as indicated by `CheckValidCreds`. In order to obtain version
72   * info, make a request to the following URL:
73   * https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?
74   * client_id=client_id=data_source_scopes
75   * _uri=urn:ietf:wg:oauth:2.0:oob_type=version_info * The client_id is the OAuth
76   * client_id of the a data source as returned by ListDataSources method. *
77   * data_source_scopes are the scopes returned by ListDataSources method. Note
78   * that this should not be set when `service_account_name` is used to create the
79   * transfer config.
80   * @return TransferConfig
81   */
82  public function create($parent, TransferConfig $postBody, $optParams = [])
83  {
84    $params = ['parent' => $parent, 'postBody' => $postBody];
85    $params = array_merge($params, $optParams);
86    return $this->call('create', [$params], TransferConfig::class);
87  }
88  /**
89   * Deletes a data transfer configuration, including any associated transfer runs
90   * and logs. (transferConfigs.delete)
91   *
92   * @param string $name Required. The field will contain name of the resource
93   * requested, for example: `projects/{project_id}/transferConfigs/{config_id}`
94   * or
95   * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
96   * @param array $optParams Optional parameters.
97   * @return BigquerydatatransferEmpty
98   */
99  public function delete($name, $optParams = [])
100  {
101    $params = ['name' => $name];
102    $params = array_merge($params, $optParams);
103    return $this->call('delete', [$params], BigquerydatatransferEmpty::class);
104  }
105  /**
106   * Returns information about a data transfer config. (transferConfigs.get)
107   *
108   * @param string $name Required. The field will contain name of the resource
109   * requested, for example: `projects/{project_id}/transferConfigs/{config_id}`
110   * or
111   * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
112   * @param array $optParams Optional parameters.
113   * @return TransferConfig
114   */
115  public function get($name, $optParams = [])
116  {
117    $params = ['name' => $name];
118    $params = array_merge($params, $optParams);
119    return $this->call('get', [$params], TransferConfig::class);
120  }
121  /**
122   * Returns information about all transfer configs owned by a project in the
123   * specified location. (transferConfigs.listProjectsTransferConfigs)
124   *
125   * @param string $parent Required. The BigQuery project id for which transfer
126   * configs should be returned: `projects/{project_id}` or
127   * `projects/{project_id}/locations/{location_id}`
128   * @param array $optParams Optional parameters.
129   *
130   * @opt_param string dataSourceIds When specified, only configurations of
131   * requested data sources are returned.
132   * @opt_param int pageSize Page size. The default page size is the maximum value
133   * of 1000 results.
134   * @opt_param string pageToken Pagination token, which can be used to request a
135   * specific page of `ListTransfersRequest` list results. For multiple-page
136   * results, `ListTransfersResponse` outputs a `next_page` token, which can be
137   * used as the `page_token` value to request the next page of list results.
138   * @return ListTransferConfigsResponse
139   */
140  public function listProjectsTransferConfigs($parent, $optParams = [])
141  {
142    $params = ['parent' => $parent];
143    $params = array_merge($params, $optParams);
144    return $this->call('list', [$params], ListTransferConfigsResponse::class);
145  }
146  /**
147   * Updates a data transfer configuration. All fields must be set, even if they
148   * are not updated. (transferConfigs.patch)
149   *
150   * @param string $name The resource name of the transfer config. Transfer config
151   * names have the form
152   * `projects/{project_id}/locations/{region}/transferConfigs/{config_id}`. Where
153   * `config_id` is usually a uuid, even though it is not guaranteed or required.
154   * The name is ignored when creating a transfer config.
155   * @param TransferConfig $postBody
156   * @param array $optParams Optional parameters.
157   *
158   * @opt_param string authorizationCode Optional OAuth2 authorization code to use
159   * with this transfer configuration. This is required only if
160   * `transferConfig.dataSourceId` is 'youtube_channel' and new credentials are
161   * needed, as indicated by `CheckValidCreds`. In order to obtain
162   * authorization_code, make a request to the following URL:
163   * https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?
164   * client_id=client_id=data_source_scopes
165   * _uri=urn:ietf:wg:oauth:2.0:oob_type=authorization_code * The client_id is the
166   * OAuth client_id of the a data source as returned by ListDataSources method. *
167   * data_source_scopes are the scopes returned by ListDataSources method. Note
168   * that this should not be set when `service_account_name` is used to update the
169   * transfer config.
170   * @opt_param string serviceAccountName Optional service account name. If this
171   * field is set, the transfer config will be created with this service account's
172   * credentials. It requires that the requesting user calling this API has
173   * permissions to act as this service account. Note that not all data sources
174   * support service account credentials when creating a transfer config. For the
175   * latest list of data sources, read about [using service
176   * accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-
177   * accounts).
178   * @opt_param string updateMask Required. Required list of fields to be updated
179   * in this request.
180   * @opt_param string versionInfo Optional version info. This is required only if
181   * `transferConfig.dataSourceId` is not 'youtube_channel' and new credentials
182   * are needed, as indicated by `CheckValidCreds`. In order to obtain version
183   * info, make a request to the following URL:
184   * https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?
185   * client_id=client_id=data_source_scopes
186   * _uri=urn:ietf:wg:oauth:2.0:oob_type=version_info * The client_id is the OAuth
187   * client_id of the a data source as returned by ListDataSources method. *
188   * data_source_scopes are the scopes returned by ListDataSources method. Note
189   * that this should not be set when `service_account_name` is used to update the
190   * transfer config.
191   * @return TransferConfig
192   */
193  public function patch($name, TransferConfig $postBody, $optParams = [])
194  {
195    $params = ['name' => $name, 'postBody' => $postBody];
196    $params = array_merge($params, $optParams);
197    return $this->call('patch', [$params], TransferConfig::class);
198  }
199  /**
200   * Creates transfer runs for a time range [start_time, end_time]. For each date
201   * - or whatever granularity the data source supports - in the range, one
202   * transfer run is created. Note that runs are created per UTC time in the time
203   * range. DEPRECATED: use StartManualTransferRuns instead.
204   * (transferConfigs.scheduleRuns)
205   *
206   * @param string $parent Required. Transfer configuration name in the form:
207   * `projects/{project_id}/transferConfigs/{config_id}` or
208   * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`.
209   * @param ScheduleTransferRunsRequest $postBody
210   * @param array $optParams Optional parameters.
211   * @return ScheduleTransferRunsResponse
212   */
213  public function scheduleRuns($parent, ScheduleTransferRunsRequest $postBody, $optParams = [])
214  {
215    $params = ['parent' => $parent, 'postBody' => $postBody];
216    $params = array_merge($params, $optParams);
217    return $this->call('scheduleRuns', [$params], ScheduleTransferRunsResponse::class);
218  }
219  /**
220   * Start manual transfer runs to be executed now with schedule_time equal to
221   * current time. The transfer runs can be created for a time range where the
222   * run_time is between start_time (inclusive) and end_time (exclusive), or for a
223   * specific run_time. (transferConfigs.startManualRuns)
224   *
225   * @param string $parent Transfer configuration name in the form:
226   * `projects/{project_id}/transferConfigs/{config_id}` or
227   * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`.
228   * @param StartManualTransferRunsRequest $postBody
229   * @param array $optParams Optional parameters.
230   * @return StartManualTransferRunsResponse
231   */
232  public function startManualRuns($parent, StartManualTransferRunsRequest $postBody, $optParams = [])
233  {
234    $params = ['parent' => $parent, 'postBody' => $postBody];
235    $params = array_merge($params, $optParams);
236    return $this->call('startManualRuns', [$params], StartManualTransferRunsResponse::class);
237  }
238}
239
240// Adding a class alias for backwards compatibility with the previous class name.
241class_alias(ProjectsTransferConfigs::class, 'Google_Service_BigQueryDataTransfer_Resource_ProjectsTransferConfigs');
242