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