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\Bigquery\Resource; 19 20use Google\Service\Bigquery\ListRoutinesResponse; 21use Google\Service\Bigquery\Routine; 22 23/** 24 * The "routines" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $bigqueryService = new Google\Service\Bigquery(...); 28 * $routines = $bigqueryService->routines; 29 * </code> 30 */ 31class Routines extends \Google\Service\Resource 32{ 33 /** 34 * Deletes the routine specified by routineId from the dataset. 35 * (routines.delete) 36 * 37 * @param string $projectId Required. Project ID of the routine to delete 38 * @param string $datasetId Required. Dataset ID of the routine to delete 39 * @param string $routineId Required. Routine ID of the routine to delete 40 * @param array $optParams Optional parameters. 41 */ 42 public function delete($projectId, $datasetId, $routineId, $optParams = []) 43 { 44 $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'routineId' => $routineId]; 45 $params = array_merge($params, $optParams); 46 return $this->call('delete', [$params]); 47 } 48 /** 49 * Gets the specified routine resource by routine ID. (routines.get) 50 * 51 * @param string $projectId Required. Project ID of the requested routine 52 * @param string $datasetId Required. Dataset ID of the requested routine 53 * @param string $routineId Required. Routine ID of the requested routine 54 * @param array $optParams Optional parameters. 55 * 56 * @opt_param string readMask If set, only the Routine fields in the field mask 57 * are returned in the response. If unset, all Routine fields are returned. 58 * @return Routine 59 */ 60 public function get($projectId, $datasetId, $routineId, $optParams = []) 61 { 62 $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'routineId' => $routineId]; 63 $params = array_merge($params, $optParams); 64 return $this->call('get', [$params], Routine::class); 65 } 66 /** 67 * Creates a new routine in the dataset. (routines.insert) 68 * 69 * @param string $projectId Required. Project ID of the new routine 70 * @param string $datasetId Required. Dataset ID of the new routine 71 * @param Routine $postBody 72 * @param array $optParams Optional parameters. 73 * @return Routine 74 */ 75 public function insert($projectId, $datasetId, Routine $postBody, $optParams = []) 76 { 77 $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody]; 78 $params = array_merge($params, $optParams); 79 return $this->call('insert', [$params], Routine::class); 80 } 81 /** 82 * Lists all routines in the specified dataset. Requires the READER dataset 83 * role. (routines.listRoutines) 84 * 85 * @param string $projectId Required. Project ID of the routines to list 86 * @param string $datasetId Required. Dataset ID of the routines to list 87 * @param array $optParams Optional parameters. 88 * 89 * @opt_param string filter If set, then only the Routines matching this filter 90 * are returned. The current supported form is either "routine_type:" or 91 * "routineType:", where is a RoutineType enum. Example: 92 * "routineType:SCALAR_FUNCTION". 93 * @opt_param string maxResults The maximum number of results to return in a 94 * single response page. Leverage the page tokens to iterate through the entire 95 * collection. 96 * @opt_param string pageToken Page token, returned by a previous call, to 97 * request the next page of results 98 * @opt_param string readMask If set, then only the Routine fields in the field 99 * mask, as well as project_id, dataset_id and routine_id, are returned in the 100 * response. If unset, then the following Routine fields are returned: etag, 101 * project_id, dataset_id, routine_id, routine_type, creation_time, 102 * last_modified_time, and language. 103 * @return ListRoutinesResponse 104 */ 105 public function listRoutines($projectId, $datasetId, $optParams = []) 106 { 107 $params = ['projectId' => $projectId, 'datasetId' => $datasetId]; 108 $params = array_merge($params, $optParams); 109 return $this->call('list', [$params], ListRoutinesResponse::class); 110 } 111 /** 112 * Updates information in an existing routine. The update method replaces the 113 * entire Routine resource. (routines.update) 114 * 115 * @param string $projectId Required. Project ID of the routine to update 116 * @param string $datasetId Required. Dataset ID of the routine to update 117 * @param string $routineId Required. Routine ID of the routine to update 118 * @param Routine $postBody 119 * @param array $optParams Optional parameters. 120 * @return Routine 121 */ 122 public function update($projectId, $datasetId, $routineId, Routine $postBody, $optParams = []) 123 { 124 $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'routineId' => $routineId, 'postBody' => $postBody]; 125 $params = array_merge($params, $optParams); 126 return $this->call('update', [$params], Routine::class); 127 } 128} 129 130// Adding a class alias for backwards compatibility with the previous class name. 131class_alias(Routines::class, 'Google_Service_Bigquery_Resource_Routines'); 132