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