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\GoogleCloudRecommenderV1ListRecommendationsResponse;
21use Google\Service\Recommender\GoogleCloudRecommenderV1MarkRecommendationClaimedRequest;
22use Google\Service\Recommender\GoogleCloudRecommenderV1MarkRecommendationFailedRequest;
23use Google\Service\Recommender\GoogleCloudRecommenderV1MarkRecommendationSucceededRequest;
24use Google\Service\Recommender\GoogleCloudRecommenderV1Recommendation;
25
26/**
27 * The "recommendations" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $recommenderService = new Google\Service\Recommender(...);
31 *   $recommendations = $recommenderService->recommendations;
32 *  </code>
33 */
34class FoldersLocationsRecommendersRecommendations extends \Google\Service\Resource
35{
36  /**
37   * Gets the requested recommendation. Requires the recommender.*.get IAM
38   * permission for the specified recommender. (recommendations.get)
39   *
40   * @param string $name Required. Name of the recommendation.
41   * @param array $optParams Optional parameters.
42   * @return GoogleCloudRecommenderV1Recommendation
43   */
44  public function get($name, $optParams = [])
45  {
46    $params = ['name' => $name];
47    $params = array_merge($params, $optParams);
48    return $this->call('get', [$params], GoogleCloudRecommenderV1Recommendation::class);
49  }
50  /**
51   * Lists recommendations for the specified Cloud Resource. Requires the
52   * recommender.*.list IAM permission for the specified recommender.
53   * (recommendations.listFoldersLocationsRecommendersRecommendations)
54   *
55   * @param string $parent Required. The container resource on which to execute
56   * the request. Acceptable formats: * `projects/[PROJECT_NUMBER]/locations/[LOCA
57   * TION]/recommenders/[RECOMMENDER_ID]` *
58   * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` *
59   * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECO
60   * MMENDER_ID]` *
61   * `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` * `o
62   * rganizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER
63   * _ID]` LOCATION here refers to GCP Locations:
64   * https://cloud.google.com/about/locations/ RECOMMENDER_ID refers to supported
65   * recommenders: https://cloud.google.com/recommender/docs/recommenders.
66   * @param array $optParams Optional parameters.
67   *
68   * @opt_param string filter Filter expression to restrict the recommendations
69   * returned. Supported filter fields: * `state_info.state` *
70   * `recommenderSubtype` * `priority` Examples: * `stateInfo.state = ACTIVE OR
71   * stateInfo.state = DISMISSED` * `recommenderSubtype = REMOVE_ROLE OR
72   * recommenderSubtype = REPLACE_ROLE` * `priority = P1 OR priority = P2` *
73   * `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)` (These
74   * expressions are based on the filter language described at
75   * https://google.aip.dev/160)
76   * @opt_param int pageSize Optional. The maximum number of results to return
77   * from this request. Non-positive values are ignored. If not specified, the
78   * server will determine the number of results to return.
79   * @opt_param string pageToken Optional. If present, retrieves the next batch of
80   * results from the preceding call to this method. `page_token` must be the
81   * value of `next_page_token` from the previous response. The values of other
82   * method parameters must be identical to those in the previous call.
83   * @return GoogleCloudRecommenderV1ListRecommendationsResponse
84   */
85  public function listFoldersLocationsRecommendersRecommendations($parent, $optParams = [])
86  {
87    $params = ['parent' => $parent];
88    $params = array_merge($params, $optParams);
89    return $this->call('list', [$params], GoogleCloudRecommenderV1ListRecommendationsResponse::class);
90  }
91  /**
92   * Marks the Recommendation State as Claimed. Users can use this method to
93   * indicate to the Recommender API that they are starting to apply the
94   * recommendation themselves. This stops the recommendation content from being
95   * updated. Associated insights are frozen and placed in the ACCEPTED state.
96   * MarkRecommendationClaimed can be applied to recommendations in CLAIMED,
97   * SUCCEEDED, FAILED, or ACTIVE state. Requires the recommender.*.update IAM
98   * permission for the specified recommender. (recommendations.markClaimed)
99   *
100   * @param string $name Required. Name of the recommendation.
101   * @param GoogleCloudRecommenderV1MarkRecommendationClaimedRequest $postBody
102   * @param array $optParams Optional parameters.
103   * @return GoogleCloudRecommenderV1Recommendation
104   */
105  public function markClaimed($name, GoogleCloudRecommenderV1MarkRecommendationClaimedRequest $postBody, $optParams = [])
106  {
107    $params = ['name' => $name, 'postBody' => $postBody];
108    $params = array_merge($params, $optParams);
109    return $this->call('markClaimed', [$params], GoogleCloudRecommenderV1Recommendation::class);
110  }
111  /**
112   * Marks the Recommendation State as Failed. Users can use this method to
113   * indicate to the Recommender API that they have applied the recommendation
114   * themselves, and the operation failed. This stops the recommendation content
115   * from being updated. Associated insights are frozen and placed in the ACCEPTED
116   * state. MarkRecommendationFailed can be applied to recommendations in ACTIVE,
117   * CLAIMED, SUCCEEDED, or FAILED state. Requires the recommender.*.update IAM
118   * permission for the specified recommender. (recommendations.markFailed)
119   *
120   * @param string $name Required. Name of the recommendation.
121   * @param GoogleCloudRecommenderV1MarkRecommendationFailedRequest $postBody
122   * @param array $optParams Optional parameters.
123   * @return GoogleCloudRecommenderV1Recommendation
124   */
125  public function markFailed($name, GoogleCloudRecommenderV1MarkRecommendationFailedRequest $postBody, $optParams = [])
126  {
127    $params = ['name' => $name, 'postBody' => $postBody];
128    $params = array_merge($params, $optParams);
129    return $this->call('markFailed', [$params], GoogleCloudRecommenderV1Recommendation::class);
130  }
131  /**
132   * Marks the Recommendation State as Succeeded. Users can use this method to
133   * indicate to the Recommender API that they have applied the recommendation
134   * themselves, and the operation was successful. This stops the recommendation
135   * content from being updated. Associated insights are frozen and placed in the
136   * ACCEPTED state. MarkRecommendationSucceeded can be applied to recommendations
137   * in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state. Requires the
138   * recommender.*.update IAM permission for the specified recommender.
139   * (recommendations.markSucceeded)
140   *
141   * @param string $name Required. Name of the recommendation.
142   * @param GoogleCloudRecommenderV1MarkRecommendationSucceededRequest $postBody
143   * @param array $optParams Optional parameters.
144   * @return GoogleCloudRecommenderV1Recommendation
145   */
146  public function markSucceeded($name, GoogleCloudRecommenderV1MarkRecommendationSucceededRequest $postBody, $optParams = [])
147  {
148    $params = ['name' => $name, 'postBody' => $postBody];
149    $params = array_merge($params, $optParams);
150    return $this->call('markSucceeded', [$params], GoogleCloudRecommenderV1Recommendation::class);
151  }
152}
153
154// Adding a class alias for backwards compatibility with the previous class name.
155class_alias(FoldersLocationsRecommendersRecommendations::class, 'Google_Service_Recommender_Resource_FoldersLocationsRecommendersRecommendations');
156