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\Recommender\Resource; 19 20use Google\Service\Recommender\GoogleCloudRecommenderV1Insight; 21use Google\Service\Recommender\GoogleCloudRecommenderV1ListInsightsResponse; 22use Google\Service\Recommender\GoogleCloudRecommenderV1MarkInsightAcceptedRequest; 23 24/** 25 * The "insights" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $recommenderService = new Google\Service\Recommender(...); 29 * $insights = $recommenderService->insights; 30 * </code> 31 */ 32class OrganizationsLocationsInsightTypesInsights extends \Google\Service\Resource 33{ 34 /** 35 * Gets the requested insight. Requires the recommender.*.get IAM permission for 36 * the specified insight type. (insights.get) 37 * 38 * @param string $name Required. Name of the insight. 39 * @param array $optParams Optional parameters. 40 * @return GoogleCloudRecommenderV1Insight 41 */ 42 public function get($name, $optParams = []) 43 { 44 $params = ['name' => $name]; 45 $params = array_merge($params, $optParams); 46 return $this->call('get', [$params], GoogleCloudRecommenderV1Insight::class); 47 } 48 /** 49 * Lists insights for the specified Cloud Resource. Requires the 50 * recommender.*.list IAM permission for the specified insight type. 51 * (insights.listOrganizationsLocationsInsightTypesInsights) 52 * 53 * @param string $parent Required. The container resource on which to execute 54 * the request. Acceptable formats: * `projects/[PROJECT_NUMBER]/locations/[LOCA 55 * TION]/insightTypes/[INSIGHT_TYPE_ID]` * 56 * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` * 57 * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSI 58 * GHT_TYPE_ID]` * 59 * `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` * ` 60 * organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TY 61 * PE_ID]` LOCATION here refers to GCP Locations: 62 * https://cloud.google.com/about/locations/ INSIGHT_TYPE_ID refers to supported 63 * insight types: https://cloud.google.com/recommender/docs/insights/insight- 64 * types. 65 * @param array $optParams Optional parameters. 66 * 67 * @opt_param string filter Optional. Filter expression to restrict the insights 68 * returned. Supported filter fields: * `stateInfo.state` * `insightSubtype` * 69 * `severity` Examples: * `stateInfo.state = ACTIVE OR stateInfo.state = 70 * DISMISSED` * `insightSubtype = PERMISSIONS_USAGE` * `severity = CRITICAL OR 71 * severity = HIGH` * `stateInfo.state = ACTIVE AND (severity = CRITICAL OR 72 * severity = HIGH)` (These expressions are based on the filter language 73 * described at https://google.aip.dev/160) 74 * @opt_param int pageSize Optional. The maximum number of results to return 75 * from this request. Non-positive values are ignored. If not specified, the 76 * server will determine the number of results to return. 77 * @opt_param string pageToken Optional. If present, retrieves the next batch of 78 * results from the preceding call to this method. `page_token` must be the 79 * value of `next_page_token` from the previous response. The values of other 80 * method parameters must be identical to those in the previous call. 81 * @return GoogleCloudRecommenderV1ListInsightsResponse 82 */ 83 public function listOrganizationsLocationsInsightTypesInsights($parent, $optParams = []) 84 { 85 $params = ['parent' => $parent]; 86 $params = array_merge($params, $optParams); 87 return $this->call('list', [$params], GoogleCloudRecommenderV1ListInsightsResponse::class); 88 } 89 /** 90 * Marks the Insight State as Accepted. Users can use this method to indicate to 91 * the Recommender API that they have applied some action based on the insight. 92 * This stops the insight content from being updated. MarkInsightAccepted can be 93 * applied to insights in ACTIVE state. Requires the recommender.*.update IAM 94 * permission for the specified insight. (insights.markAccepted) 95 * 96 * @param string $name Required. Name of the insight. 97 * @param GoogleCloudRecommenderV1MarkInsightAcceptedRequest $postBody 98 * @param array $optParams Optional parameters. 99 * @return GoogleCloudRecommenderV1Insight 100 */ 101 public function markAccepted($name, GoogleCloudRecommenderV1MarkInsightAcceptedRequest $postBody, $optParams = []) 102 { 103 $params = ['name' => $name, 'postBody' => $postBody]; 104 $params = array_merge($params, $optParams); 105 return $this->call('markAccepted', [$params], GoogleCloudRecommenderV1Insight::class); 106 } 107} 108 109// Adding a class alias for backwards compatibility with the previous class name. 110class_alias(OrganizationsLocationsInsightTypesInsights::class, 'Google_Service_Recommender_Resource_OrganizationsLocationsInsightTypesInsights'); 111