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 |
|
---|
18 | namespace Google\Service\SecurityCommandCenter\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\SecurityCommandCenter\GroupAssetsRequest;
|
---|
21 | use Google\Service\SecurityCommandCenter\GroupAssetsResponse;
|
---|
22 | use Google\Service\SecurityCommandCenter\ListAssetsResponse;
|
---|
23 | use Google\Service\SecurityCommandCenter\SecurityMarks;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "assets" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $securitycenterService = new Google\Service\SecurityCommandCenter(...);
|
---|
30 | * $assets = $securitycenterService->folders_assets;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class FoldersAssets extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Filters an organization's assets and groups them by their specified
|
---|
37 | * properties. (assets.group)
|
---|
38 | *
|
---|
39 | * @param string $parent Required. The name of the parent to group the assets
|
---|
40 | * by. Its format is `organizations/[organization_id]`, `folders/[folder_id]`,
|
---|
41 | * or `projects/[project_id]`.
|
---|
42 | * @param GroupAssetsRequest $postBody
|
---|
43 | * @param array $optParams Optional parameters.
|
---|
44 | * @return GroupAssetsResponse
|
---|
45 | * @throws \Google\Service\Exception
|
---|
46 | */
|
---|
47 | public function group($parent, GroupAssetsRequest $postBody, $optParams = [])
|
---|
48 | {
|
---|
49 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
50 | $params = array_merge($params, $optParams);
|
---|
51 | return $this->call('group', [$params], GroupAssetsResponse::class);
|
---|
52 | }
|
---|
53 | /**
|
---|
54 | * Lists an organization's assets. (assets.listFoldersAssets)
|
---|
55 | *
|
---|
56 | * @param string $parent Required. The name of the parent resource that contains
|
---|
57 | * the assets. The value that you can specify on parent depends on the method in
|
---|
58 | * which you specify parent. You can specify one of the following values:
|
---|
59 | * `organizations/[organization_id]`, `folders/[folder_id]`, or
|
---|
60 | * `projects/[project_id]`.
|
---|
61 | * @param array $optParams Optional parameters.
|
---|
62 | *
|
---|
63 | * @opt_param string compareDuration When compare_duration is set, the
|
---|
64 | * ListAssetsResult's "state_change" attribute is updated to indicate whether
|
---|
65 | * the asset was added, removed, or remained present during the compare_duration
|
---|
66 | * period of time that precedes the read_time. This is the time between
|
---|
67 | * (read_time - compare_duration) and read_time. The state_change value is
|
---|
68 | * derived based on the presence of the asset at the two points in time.
|
---|
69 | * Intermediate state changes between the two times don't affect the result. For
|
---|
70 | * example, the results aren't affected if the asset is removed and re-created
|
---|
71 | * again. Possible "state_change" values when compare_duration is specified: *
|
---|
72 | * "ADDED": indicates that the asset was not present at the start of
|
---|
73 | * compare_duration, but present at read_time. * "REMOVED": indicates that the
|
---|
74 | * asset was present at the start of compare_duration, but not present at
|
---|
75 | * read_time. * "ACTIVE": indicates that the asset was present at both the start
|
---|
76 | * and the end of the time period defined by compare_duration and read_time. If
|
---|
77 | * compare_duration is not specified, then the only possible state_change is
|
---|
78 | * "UNUSED", which will be the state_change set for all assets present at
|
---|
79 | * read_time.
|
---|
80 | * @opt_param string fieldMask A field mask to specify the ListAssetsResult
|
---|
81 | * fields to be listed in the response. An empty field mask will list all
|
---|
82 | * fields.
|
---|
83 | * @opt_param string filter Expression that defines the filter to apply across
|
---|
84 | * assets. The expression is a list of zero or more restrictions combined via
|
---|
85 | * logical operators `AND` and `OR`. Parentheses are supported, and `OR` has
|
---|
86 | * higher precedence than `AND`. Restrictions have the form ` ` and may have a
|
---|
87 | * `-` character in front of them to indicate negation. The fields map to those
|
---|
88 | * defined in the Asset resource. Examples include: * name *
|
---|
89 | * security_center_properties.resource_name * resource_properties.a_property *
|
---|
90 | * security_marks.marks.marka The supported operators are: * `=` for all value
|
---|
91 | * types. * `>`, `<`, `>=`, `<=` for integer values. * `:`, meaning substring
|
---|
92 | * matching, for strings. The supported value types are: * string literals in
|
---|
93 | * quotes. * integer literals without quotes. * boolean literals `true` and
|
---|
94 | * `false` without quotes. The following are the allowed field and operator
|
---|
95 | * combinations: * name: `=` * update_time: `=`, `>`, `<`, `>=`, `<=` Usage:
|
---|
96 | * This should be milliseconds since epoch or an RFC3339 string. Examples:
|
---|
97 | * `update_time = "2019-06-10T16:07:18-07:00"` `update_time = 1560208038000` *
|
---|
98 | * create_time: `=`, `>`, `<`, `>=`, `<=` Usage: This should be milliseconds
|
---|
99 | * since epoch or an RFC3339 string. Examples: `create_time =
|
---|
100 | * "2019-06-10T16:07:18-07:00"` `create_time = 1560208038000` *
|
---|
101 | * iam_policy.policy_blob: `=`, `:` * resource_properties: `=`, `:`, `>`, `<`,
|
---|
102 | * `>=`, `<=` * security_marks.marks: `=`, `:` *
|
---|
103 | * security_center_properties.resource_name: `=`, `:` *
|
---|
104 | * security_center_properties.resource_display_name: `=`, `:` *
|
---|
105 | * security_center_properties.resource_type: `=`, `:` *
|
---|
106 | * security_center_properties.resource_parent: `=`, `:` *
|
---|
107 | * security_center_properties.resource_parent_display_name: `=`, `:` *
|
---|
108 | * security_center_properties.resource_project: `=`, `:` *
|
---|
109 | * security_center_properties.resource_project_display_name: `=`, `:` *
|
---|
110 | * security_center_properties.resource_owners: `=`, `:` For example,
|
---|
111 | * `resource_properties.size = 100` is a valid filter string. Use a partial
|
---|
112 | * match on the empty string to filter based on a property existing:
|
---|
113 | * `resource_properties.my_property : ""` Use a negated partial match on the
|
---|
114 | * empty string to filter based on a property not existing:
|
---|
115 | * `-resource_properties.my_property : ""`
|
---|
116 | * @opt_param string orderBy Expression that defines what fields and order to
|
---|
117 | * use for sorting. The string value should follow SQL syntax: comma separated
|
---|
118 | * list of fields. For example: "name,resource_properties.a_property". The
|
---|
119 | * default sorting order is ascending. To specify descending order for a field,
|
---|
120 | * a suffix " desc" should be appended to the field name. For example: "name
|
---|
121 | * desc,resource_properties.a_property". Redundant space characters in the
|
---|
122 | * syntax are insignificant. "name desc,resource_properties.a_property" and "
|
---|
123 | * name desc , resource_properties.a_property " are equivalent. The following
|
---|
124 | * fields are supported: name update_time resource_properties
|
---|
125 | * security_marks.marks security_center_properties.resource_name
|
---|
126 | * security_center_properties.resource_display_name
|
---|
127 | * security_center_properties.resource_parent
|
---|
128 | * security_center_properties.resource_parent_display_name
|
---|
129 | * security_center_properties.resource_project
|
---|
130 | * security_center_properties.resource_project_display_name
|
---|
131 | * security_center_properties.resource_type
|
---|
132 | * @opt_param int pageSize The maximum number of results to return in a single
|
---|
133 | * response. Default is 10, minimum is 1, maximum is 1000.
|
---|
134 | * @opt_param string pageToken The value returned by the last
|
---|
135 | * `ListAssetsResponse`; indicates that this is a continuation of a prior
|
---|
136 | * `ListAssets` call, and that the system should return the next page of data.
|
---|
137 | * @opt_param string readTime Time used as a reference point when filtering
|
---|
138 | * assets. The filter is limited to assets existing at the supplied time and
|
---|
139 | * their values are those at that specific time. Absence of this field will
|
---|
140 | * default to the API's version of NOW.
|
---|
141 | * @return ListAssetsResponse
|
---|
142 | * @throws \Google\Service\Exception
|
---|
143 | */
|
---|
144 | public function listFoldersAssets($parent, $optParams = [])
|
---|
145 | {
|
---|
146 | $params = ['parent' => $parent];
|
---|
147 | $params = array_merge($params, $optParams);
|
---|
148 | return $this->call('list', [$params], ListAssetsResponse::class);
|
---|
149 | }
|
---|
150 | /**
|
---|
151 | * Updates security marks. (assets.updateSecurityMarks)
|
---|
152 | *
|
---|
153 | * @param string $name The relative resource name of the SecurityMarks. See:
|
---|
154 | * https://cloud.google.com/apis/design/resource_names#relative_resource_name
|
---|
155 | * Examples: "organizations/{organization_id}/assets/{asset_id}/securityMarks" "
|
---|
156 | * organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/sec
|
---|
157 | * urityMarks".
|
---|
158 | * @param SecurityMarks $postBody
|
---|
159 | * @param array $optParams Optional parameters.
|
---|
160 | *
|
---|
161 | * @opt_param string startTime The time at which the updated SecurityMarks take
|
---|
162 | * effect. If not set uses current server time. Updates will be applied to the
|
---|
163 | * SecurityMarks that are active immediately preceding this time. Must be
|
---|
164 | * earlier or equal to the server time.
|
---|
165 | * @opt_param string updateMask The FieldMask to use when updating the security
|
---|
166 | * marks resource. The field mask must not contain duplicate fields. If empty or
|
---|
167 | * set to "marks", all marks will be replaced. Individual marks can be updated
|
---|
168 | * using "marks.".
|
---|
169 | * @return SecurityMarks
|
---|
170 | * @throws \Google\Service\Exception
|
---|
171 | */
|
---|
172 | public function updateSecurityMarks($name, SecurityMarks $postBody, $optParams = [])
|
---|
173 | {
|
---|
174 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
175 | $params = array_merge($params, $optParams);
|
---|
176 | return $this->call('updateSecurityMarks', [$params], SecurityMarks::class);
|
---|
177 | }
|
---|
178 | }
|
---|
179 |
|
---|
180 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
181 | class_alias(FoldersAssets::class, 'Google_Service_SecurityCommandCenter_Resource_FoldersAssets');
|
---|