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\GooglePrivacyDlpV2ActivateJobTriggerRequest;
21use Google\Service\DLP\GooglePrivacyDlpV2CreateJobTriggerRequest;
22use Google\Service\DLP\GooglePrivacyDlpV2DlpJob;
23use Google\Service\DLP\GooglePrivacyDlpV2HybridInspectJobTriggerRequest;
24use Google\Service\DLP\GooglePrivacyDlpV2HybridInspectResponse;
25use Google\Service\DLP\GooglePrivacyDlpV2JobTrigger;
26use Google\Service\DLP\GooglePrivacyDlpV2ListJobTriggersResponse;
27use Google\Service\DLP\GooglePrivacyDlpV2UpdateJobTriggerRequest;
28use Google\Service\DLP\GoogleProtobufEmpty;
29
30/**
31 * The "jobTriggers" collection of methods.
32 * Typical usage is:
33 *  <code>
34 *   $dlpService = new Google\Service\DLP(...);
35 *   $jobTriggers = $dlpService->jobTriggers;
36 *  </code>
37 */
38class ProjectsLocationsJobTriggers extends \Google\Service\Resource
39{
40  /**
41   * Activate a job trigger. Causes the immediate execute of a trigger instead of
42   * waiting on the trigger event to occur. (jobTriggers.activate)
43   *
44   * @param string $name Required. Resource name of the trigger to activate, for
45   * example `projects/dlp-test-project/jobTriggers/53234423`.
46   * @param GooglePrivacyDlpV2ActivateJobTriggerRequest $postBody
47   * @param array $optParams Optional parameters.
48   * @return GooglePrivacyDlpV2DlpJob
49   */
50  public function activate($name, GooglePrivacyDlpV2ActivateJobTriggerRequest $postBody, $optParams = [])
51  {
52    $params = ['name' => $name, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('activate', [$params], GooglePrivacyDlpV2DlpJob::class);
55  }
56  /**
57   * Creates a job trigger to run DLP actions such as scanning storage for
58   * sensitive information on a set schedule. See
59   * https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
60   * (jobTriggers.create)
61   *
62   * @param string $parent Required. Parent resource name. The format of this
63   * value varies depending on whether you have [specified a processing
64   * location](https://cloud.google.com/dlp/docs/specifying-location): + Projects
65   * scope, location specified: `projects/`PROJECT_ID`/locations/`LOCATION_ID +
66   * Projects scope, no location specified (defaults to global):
67   * `projects/`PROJECT_ID The following example `parent` string specifies a
68   * parent project with the identifier `example-project`, and specifies the
69   * `europe-west3` location for processing data: parent=projects/example-
70   * project/locations/europe-west3
71   * @param GooglePrivacyDlpV2CreateJobTriggerRequest $postBody
72   * @param array $optParams Optional parameters.
73   * @return GooglePrivacyDlpV2JobTrigger
74   */
75  public function create($parent, GooglePrivacyDlpV2CreateJobTriggerRequest $postBody, $optParams = [])
76  {
77    $params = ['parent' => $parent, 'postBody' => $postBody];
78    $params = array_merge($params, $optParams);
79    return $this->call('create', [$params], GooglePrivacyDlpV2JobTrigger::class);
80  }
81  /**
82   * Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-
83   * triggers to learn more. (jobTriggers.delete)
84   *
85   * @param string $name Required. Resource name of the project and the
86   * triggeredJob, for example `projects/dlp-test-project/jobTriggers/53234423`.
87   * @param array $optParams Optional parameters.
88   * @return GoogleProtobufEmpty
89   */
90  public function delete($name, $optParams = [])
91  {
92    $params = ['name' => $name];
93    $params = array_merge($params, $optParams);
94    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
95  }
96  /**
97   * Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-
98   * triggers to learn more. (jobTriggers.get)
99   *
100   * @param string $name Required. Resource name of the project and the
101   * triggeredJob, for example `projects/dlp-test-project/jobTriggers/53234423`.
102   * @param array $optParams Optional parameters.
103   * @return GooglePrivacyDlpV2JobTrigger
104   */
105  public function get($name, $optParams = [])
106  {
107    $params = ['name' => $name];
108    $params = array_merge($params, $optParams);
109    return $this->call('get', [$params], GooglePrivacyDlpV2JobTrigger::class);
110  }
111  /**
112   * Inspect hybrid content and store findings to a trigger. The inspection will
113   * be processed asynchronously. To review the findings monitor the jobs within
114   * the trigger. (jobTriggers.hybridInspect)
115   *
116   * @param string $name Required. Resource name of the trigger to execute a
117   * hybrid inspect on, for example `projects/dlp-test-
118   * project/jobTriggers/53234423`.
119   * @param GooglePrivacyDlpV2HybridInspectJobTriggerRequest $postBody
120   * @param array $optParams Optional parameters.
121   * @return GooglePrivacyDlpV2HybridInspectResponse
122   */
123  public function hybridInspect($name, GooglePrivacyDlpV2HybridInspectJobTriggerRequest $postBody, $optParams = [])
124  {
125    $params = ['name' => $name, 'postBody' => $postBody];
126    $params = array_merge($params, $optParams);
127    return $this->call('hybridInspect', [$params], GooglePrivacyDlpV2HybridInspectResponse::class);
128  }
129  /**
130   * Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-
131   * triggers to learn more. (jobTriggers.listProjectsLocationsJobTriggers)
132   *
133   * @param string $parent Required. Parent resource name. The format of this
134   * value varies depending on whether you have [specified a processing
135   * location](https://cloud.google.com/dlp/docs/specifying-location): + Projects
136   * scope, location specified: `projects/`PROJECT_ID`/locations/`LOCATION_ID +
137   * Projects scope, no location specified (defaults to global):
138   * `projects/`PROJECT_ID The following example `parent` string specifies a
139   * parent project with the identifier `example-project`, and specifies the
140   * `europe-west3` location for processing data: parent=projects/example-
141   * project/locations/europe-west3
142   * @param array $optParams Optional parameters.
143   *
144   * @opt_param string filter Allows filtering. Supported syntax: * Filter
145   * expressions are made up of one or more restrictions. * Restrictions can be
146   * combined by `AND` or `OR` logical operators. A sequence of restrictions
147   * implicitly uses `AND`. * A restriction has the form of `{field} {operator}
148   * {value}`. * Supported fields/values for inspect triggers: - `status` -
149   * HEALTHY|PAUSED|CANCELLED - `inspected_storage` -
150   * DATASTORE|CLOUD_STORAGE|BIGQUERY - 'last_run_time` - RFC 3339 formatted
151   * timestamp, surrounded by quotation marks. Nanoseconds are ignored. -
152   * 'error_count' - Number of errors that have occurred while running. * The
153   * operator must be `=` or `!=` for status and inspected_storage. Examples: *
154   * inspected_storage = cloud_storage AND status = HEALTHY * inspected_storage =
155   * cloud_storage OR inspected_storage = bigquery * inspected_storage =
156   * cloud_storage AND (state = PAUSED OR state = HEALTHY) * last_run_time >
157   * \"2017-12-12T00:00:00+00:00\" The length of this field should be no more than
158   * 500 characters.
159   * @opt_param string locationId Deprecated. This field has no effect.
160   * @opt_param string orderBy Comma separated list of triggeredJob fields to
161   * order by, followed by `asc` or `desc` postfix. This list is case-insensitive,
162   * default sorting order is ascending, redundant space characters are
163   * insignificant. Example: `name asc,update_time, create_time desc` Supported
164   * fields are: - `create_time`: corresponds to time the JobTrigger was created.
165   * - `update_time`: corresponds to time the JobTrigger was last updated. -
166   * `last_run_time`: corresponds to the last time the JobTrigger ran. - `name`:
167   * corresponds to JobTrigger's name. - `display_name`: corresponds to
168   * JobTrigger's display name. - `status`: corresponds to JobTrigger's status.
169   * @opt_param int pageSize Size of the page, can be limited by a server.
170   * @opt_param string pageToken Page token to continue retrieval. Comes from
171   * previous call to ListJobTriggers. `order_by` field must not change for
172   * subsequent calls.
173   * @opt_param string type The type of jobs. Will use `DlpJobType.INSPECT` if not
174   * set.
175   * @return GooglePrivacyDlpV2ListJobTriggersResponse
176   */
177  public function listProjectsLocationsJobTriggers($parent, $optParams = [])
178  {
179    $params = ['parent' => $parent];
180    $params = array_merge($params, $optParams);
181    return $this->call('list', [$params], GooglePrivacyDlpV2ListJobTriggersResponse::class);
182  }
183  /**
184   * Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-
185   * triggers to learn more. (jobTriggers.patch)
186   *
187   * @param string $name Required. Resource name of the project and the
188   * triggeredJob, for example `projects/dlp-test-project/jobTriggers/53234423`.
189   * @param GooglePrivacyDlpV2UpdateJobTriggerRequest $postBody
190   * @param array $optParams Optional parameters.
191   * @return GooglePrivacyDlpV2JobTrigger
192   */
193  public function patch($name, GooglePrivacyDlpV2UpdateJobTriggerRequest $postBody, $optParams = [])
194  {
195    $params = ['name' => $name, 'postBody' => $postBody];
196    $params = array_merge($params, $optParams);
197    return $this->call('patch', [$params], GooglePrivacyDlpV2JobTrigger::class);
198  }
199}
200
201// Adding a class alias for backwards compatibility with the previous class name.
202class_alias(ProjectsLocationsJobTriggers::class, 'Google_Service_DLP_Resource_ProjectsLocationsJobTriggers');
203