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\DLP\Resource; 19 20use Google\Service\DLP\GooglePrivacyDlpV2CancelDlpJobRequest; 21use Google\Service\DLP\GooglePrivacyDlpV2CreateDlpJobRequest; 22use Google\Service\DLP\GooglePrivacyDlpV2DlpJob; 23use Google\Service\DLP\GooglePrivacyDlpV2ListDlpJobsResponse; 24use Google\Service\DLP\GoogleProtobufEmpty; 25 26/** 27 * The "dlpJobs" collection of methods. 28 * Typical usage is: 29 * <code> 30 * $dlpService = new Google\Service\DLP(...); 31 * $dlpJobs = $dlpService->dlpJobs; 32 * </code> 33 */ 34class ProjectsDlpJobs extends \Google\Service\Resource 35{ 36 /** 37 * Starts asynchronous cancellation on a long-running DlpJob. The server makes a 38 * best effort to cancel the DlpJob, but success is not guaranteed. See 39 * https://cloud.google.com/dlp/docs/inspecting-storage and 40 * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. 41 * (dlpJobs.cancel) 42 * 43 * @param string $name Required. The name of the DlpJob resource to be 44 * cancelled. 45 * @param GooglePrivacyDlpV2CancelDlpJobRequest $postBody 46 * @param array $optParams Optional parameters. 47 * @return GoogleProtobufEmpty 48 */ 49 public function cancel($name, GooglePrivacyDlpV2CancelDlpJobRequest $postBody, $optParams = []) 50 { 51 $params = ['name' => $name, 'postBody' => $postBody]; 52 $params = array_merge($params, $optParams); 53 return $this->call('cancel', [$params], GoogleProtobufEmpty::class); 54 } 55 /** 56 * Creates a new job to inspect storage or calculate risk metrics. See 57 * https://cloud.google.com/dlp/docs/inspecting-storage and 58 * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. When 59 * no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system 60 * will automatically choose what detectors to run. By default this may be all 61 * types, but may change over time as detectors are updated. (dlpJobs.create) 62 * 63 * @param string $parent Required. Parent resource name. The format of this 64 * value varies depending on whether you have [specified a processing 65 * location](https://cloud.google.com/dlp/docs/specifying-location): + Projects 66 * scope, location specified: `projects/`PROJECT_ID`/locations/`LOCATION_ID + 67 * Projects scope, no location specified (defaults to global): 68 * `projects/`PROJECT_ID The following example `parent` string specifies a 69 * parent project with the identifier `example-project`, and specifies the 70 * `europe-west3` location for processing data: parent=projects/example- 71 * project/locations/europe-west3 72 * @param GooglePrivacyDlpV2CreateDlpJobRequest $postBody 73 * @param array $optParams Optional parameters. 74 * @return GooglePrivacyDlpV2DlpJob 75 */ 76 public function create($parent, GooglePrivacyDlpV2CreateDlpJobRequest $postBody, $optParams = []) 77 { 78 $params = ['parent' => $parent, 'postBody' => $postBody]; 79 $params = array_merge($params, $optParams); 80 return $this->call('create', [$params], GooglePrivacyDlpV2DlpJob::class); 81 } 82 /** 83 * Deletes a long-running DlpJob. This method indicates that the client is no 84 * longer interested in the DlpJob result. The job will be cancelled if 85 * possible. See https://cloud.google.com/dlp/docs/inspecting-storage and 86 * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. 87 * (dlpJobs.delete) 88 * 89 * @param string $name Required. The name of the DlpJob resource to be deleted. 90 * @param array $optParams Optional parameters. 91 * @return GoogleProtobufEmpty 92 */ 93 public function delete($name, $optParams = []) 94 { 95 $params = ['name' => $name]; 96 $params = array_merge($params, $optParams); 97 return $this->call('delete', [$params], GoogleProtobufEmpty::class); 98 } 99 /** 100 * Gets the latest state of a long-running DlpJob. See 101 * https://cloud.google.com/dlp/docs/inspecting-storage and 102 * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. 103 * (dlpJobs.get) 104 * 105 * @param string $name Required. The name of the DlpJob resource. 106 * @param array $optParams Optional parameters. 107 * @return GooglePrivacyDlpV2DlpJob 108 */ 109 public function get($name, $optParams = []) 110 { 111 $params = ['name' => $name]; 112 $params = array_merge($params, $optParams); 113 return $this->call('get', [$params], GooglePrivacyDlpV2DlpJob::class); 114 } 115 /** 116 * Lists DlpJobs that match the specified filter in the request. See 117 * https://cloud.google.com/dlp/docs/inspecting-storage and 118 * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. 119 * (dlpJobs.listProjectsDlpJobs) 120 * 121 * @param string $parent Required. Parent resource name. The format of this 122 * value varies depending on whether you have [specified a processing 123 * location](https://cloud.google.com/dlp/docs/specifying-location): + Projects 124 * scope, location specified: `projects/`PROJECT_ID`/locations/`LOCATION_ID + 125 * Projects scope, no location specified (defaults to global): 126 * `projects/`PROJECT_ID The following example `parent` string specifies a 127 * parent project with the identifier `example-project`, and specifies the 128 * `europe-west3` location for processing data: parent=projects/example- 129 * project/locations/europe-west3 130 * @param array $optParams Optional parameters. 131 * 132 * @opt_param string filter Allows filtering. Supported syntax: * Filter 133 * expressions are made up of one or more restrictions. * Restrictions can be 134 * combined by `AND` or `OR` logical operators. A sequence of restrictions 135 * implicitly uses `AND`. * A restriction has the form of `{field} {operator} 136 * {value}`. * Supported fields/values for inspect jobs: - `state` - 137 * PENDING|RUNNING|CANCELED|FINISHED|FAILED - `inspected_storage` - 138 * DATASTORE|CLOUD_STORAGE|BIGQUERY - `trigger_name` - The resource name of the 139 * trigger that created job. - 'end_time` - Corresponds to time the job 140 * finished. - 'start_time` - Corresponds to time the job finished. * Supported 141 * fields for risk analysis jobs: - `state` - RUNNING|CANCELED|FINISHED|FAILED - 142 * 'end_time` - Corresponds to time the job finished. - 'start_time` - 143 * Corresponds to time the job finished. * The operator must be `=` or `!=`. 144 * Examples: * inspected_storage = cloud_storage AND state = done * 145 * inspected_storage = cloud_storage OR inspected_storage = bigquery * 146 * inspected_storage = cloud_storage AND (state = done OR state = canceled) * 147 * end_time > \"2017-12-12T00:00:00+00:00\" The length of this field should be 148 * no more than 500 characters. 149 * @opt_param string locationId Deprecated. This field has no effect. 150 * @opt_param string orderBy Comma separated list of fields to order by, 151 * followed by `asc` or `desc` postfix. This list is case-insensitive, default 152 * sorting order is ascending, redundant space characters are insignificant. 153 * Example: `name asc, end_time asc, create_time desc` Supported fields are: - 154 * `create_time`: corresponds to time the job was created. - `end_time`: 155 * corresponds to time the job ended. - `name`: corresponds to job's name. - 156 * `state`: corresponds to `state` 157 * @opt_param int pageSize The standard list page size. 158 * @opt_param string pageToken The standard list page token. 159 * @opt_param string type The type of job. Defaults to `DlpJobType.INSPECT` 160 * @return GooglePrivacyDlpV2ListDlpJobsResponse 161 */ 162 public function listProjectsDlpJobs($parent, $optParams = []) 163 { 164 $params = ['parent' => $parent]; 165 $params = array_merge($params, $optParams); 166 return $this->call('list', [$params], GooglePrivacyDlpV2ListDlpJobsResponse::class); 167 } 168} 169 170// Adding a class alias for backwards compatibility with the previous class name. 171class_alias(ProjectsDlpJobs::class, 'Google_Service_DLP_Resource_ProjectsDlpJobs'); 172