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