diff --git a/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/Insight.php b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/Insight.php new file mode 100644 index 000000000000..96a11af63961 Binary files /dev/null and b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/Insight.php differ diff --git a/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/InsightTypeConfig.php b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/InsightTypeConfig.php new file mode 100644 index 000000000000..c295b549cb99 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/InsightTypeConfig.php @@ -0,0 +1,45 @@ +internalAddGeneratedFile( + ' +Ø +5google/cloud/recommender/v1/insight_type_config.protogoogle.cloud.recommender.v1google/api/resource.protogoogle/protobuf/struct.protogoogle/protobuf/timestamp.proto"± +InsightTypeConfig +name ( ` +insight_type_generation_config ( 28.google.cloud.recommender.v1.InsightTypeGenerationConfig +etag ( / + update_time ( 2.google.protobuf.Timestamp + revision_id ( BàAàAT + annotations ( 2?.google.cloud.recommender.v1.InsightTypeConfig.AnnotationsEntry + display_name ( 2 +AnnotationsEntry +key (  +value ( :8:¯êA« +,recommender.googleapis.com/InsightTypeConfigJprojects/{project}/locations/{location}/insightTypes/{insight_type}/configTorganizations/{organization}/locations/{location}/insightTypes/{insight_type}/configYbillingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/config"F +InsightTypeGenerationConfig\' +params ( 2.google.protobuf.StructB£ +com.google.cloud.recommender.v1BInsightTypeConfigProtoPZAcloud.google.com/go/recommender/apiv1/recommenderpb;recommenderpb¢CRECªGoogle.Cloud.Recommender.V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/Recommendation.php b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/Recommendation.php new file mode 100644 index 000000000000..f3d0e874402d Binary files /dev/null and b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/Recommendation.php differ diff --git a/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/RecommenderConfig.php b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/RecommenderConfig.php new file mode 100644 index 000000000000..ca519f51d7a8 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/RecommenderConfig.php @@ -0,0 +1,45 @@ +internalAddGeneratedFile( + ' +Ó +4google/cloud/recommender/v1/recommender_config.protogoogle.cloud.recommender.v1google/api/resource.protogoogle/protobuf/struct.protogoogle/protobuf/timestamp.proto"­ +RecommenderConfig +name ( _ +recommender_generation_config ( 28.google.cloud.recommender.v1.RecommenderGenerationConfig +etag ( / + update_time ( 2.google.protobuf.Timestamp + revision_id ( BàAàAT + annotations ( 2?.google.cloud.recommender.v1.RecommenderConfig.AnnotationsEntry + display_name ( 2 +AnnotationsEntry +key (  +value ( :8:¬êA¨ +,recommender.googleapis.com/RecommenderConfigIprojects/{project}/locations/{location}/recommenders/{recommender}/configSorganizations/{organization}/locations/{location}/recommenders/{recommender}/configXbillingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/config"F +RecommenderGenerationConfig\' +params ( 2.google.protobuf.StructB£ +com.google.cloud.recommender.v1BRecommenderConfigProtoPZAcloud.google.com/go/recommender/apiv1/recommenderpb;recommenderpb¢CRECªGoogle.Cloud.Recommender.V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/RecommenderService.php b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/RecommenderService.php new file mode 100644 index 000000000000..4ea8a97c2522 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/GPBMetadata/Google/Cloud/Recommender/V1/RecommenderService.php @@ -0,0 +1,127 @@ +internalAddGeneratedFile( + ' +óF +5google/cloud/recommender/v1/recommender_service.protogoogle.cloud.recommender.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto)google/cloud/recommender/v1/insight.proto5google/cloud/recommender/v1/insight_type_config.proto0google/cloud/recommender/v1/recommendation.proto4google/cloud/recommender/v1/recommender_config.proto google/protobuf/field_mask.proto"› +ListInsightsRequest> +parent ( B.àAúA( +&recommender.googleapis.com/InsightType + page_size (BàA + +page_token ( BàA +filter ( BàA"g +ListInsightsResponse6 +insights ( 2$.google.cloud.recommender.v1.Insight +next_page_token ( "M +GetInsightRequest8 +name ( B*àAúA$ +"recommender.googleapis.com/Insight"ˆ +MarkInsightAcceptedRequest8 +name ( B*àAúA$ +"recommender.googleapis.com/Insightg +state_metadata ( 2J.google.cloud.recommender.v1.MarkInsightAcceptedRequest.StateMetadataEntryBàA +etag ( BàA4 +StateMetadataEntry +key (  +value ( :8" +ListRecommendationsRequest> +parent ( B.àAúA( +&recommender.googleapis.com/Recommender + page_size (BàA + +page_token ( BàA +filter ( "| +ListRecommendationsResponseD +recommendations ( 2+.google.cloud.recommender.v1.Recommendation +next_page_token ( "[ +GetRecommendationRequest? +name ( B1àAúA+ +)recommender.googleapis.com/Recommendation"s +"MarkRecommendationDismissedRequest? +name ( B1àAúA+ +)recommender.googleapis.com/Recommendation +etag ( "– + MarkRecommendationClaimedRequest? +name ( B1àAúA+ +)recommender.googleapis.com/Recommendationh +state_metadata ( 2P.google.cloud.recommender.v1.MarkRecommendationClaimedRequest.StateMetadataEntry +etag ( BàA4 +StateMetadataEntry +key (  +value ( :8"š +"MarkRecommendationSucceededRequest? +name ( B1àAúA+ +)recommender.googleapis.com/Recommendationj +state_metadata ( 2R.google.cloud.recommender.v1.MarkRecommendationSucceededRequest.StateMetadataEntry +etag ( BàA4 +StateMetadataEntry +key (  +value ( :8"” +MarkRecommendationFailedRequest? +name ( B1àAúA+ +)recommender.googleapis.com/Recommendationg +state_metadata ( 2O.google.cloud.recommender.v1.MarkRecommendationFailedRequest.StateMetadataEntry +etag ( BàA4 +StateMetadataEntry +key (  +value ( :8"a +GetRecommenderConfigRequestB +name ( B4àAúA. +,recommender.googleapis.com/RecommenderConfig"¹ +UpdateRecommenderConfigRequestO +recommender_config ( 2..google.cloud.recommender.v1.RecommenderConfigBàA/ + update_mask ( 2.google.protobuf.FieldMask + validate_only ("a +GetInsightTypeConfigRequestB +name ( B4àAúA. +,recommender.googleapis.com/InsightTypeConfig"º +UpdateInsightTypeConfigRequestP +insight_type_config ( 2..google.cloud.recommender.v1.InsightTypeConfigBàA/ + update_mask ( 2.google.protobuf.FieldMask + validate_only (2Ö. + Recommender‹ + ListInsights0.google.cloud.recommender.v1.ListInsightsRequest1.google.cloud.recommender.v1.ListInsightsResponse"•‚Óä“…;/v1/{parent=projects/*/locations/*/insightTypes/*}/insightsZDB/v1/{parent=billingAccounts/*/locations/*/insightTypes/*}/insightsZ<:/v1/{parent=folders/*/locations/*/insightTypes/*}/insightsZB@/v1/{parent=organizations/*/locations/*/insightTypes/*}/insightsÚAparentø + +GetInsight..google.cloud.recommender.v1.GetInsightRequest$.google.cloud.recommender.v1.Insight"“‚Óä“…;/v1/{name=projects/*/locations/*/insightTypes/*/insights/*}ZDB/v1/{name=billingAccounts/*/locations/*/insightTypes/*/insights/*}Z<:/v1/{name=folders/*/locations/*/insightTypes/*/insights/*}ZB@/v1/{name=organizations/*/locations/*/insightTypes/*/insights/*}ÚAnameÞ +MarkInsightAccepted7.google.cloud.recommender.v1.MarkInsightAcceptedRequest$.google.cloud.recommender.v1.Insight"ç‚Óä“Å"H/v1/{name=projects/*/locations/*/insightTypes/*/insights/*}:markAccepted:*ZT"O/v1/{name=billingAccounts/*/locations/*/insightTypes/*/insights/*}:markAccepted:*ZL"G/v1/{name=folders/*/locations/*/insightTypes/*/insights/*}:markAccepted:*ZR"M/v1/{name=organizations/*/locations/*/insightTypes/*/insights/*}:markAccepted:*ÚAname,state_metadata,etagÌ +ListRecommendations7.google.cloud.recommender.v1.ListRecommendationsRequest8.google.cloud.recommender.v1.ListRecommendationsResponse"Á‚Óä“¡B/v1/{parent=projects/*/locations/*/recommenders/*}/recommendationsZKI/v1/{parent=billingAccounts/*/locations/*/recommenders/*}/recommendationsZCA/v1/{parent=folders/*/locations/*/recommenders/*}/recommendationsZIG/v1/{parent=organizations/*/locations/*/recommenders/*}/recommendationsÚAparentÚA parent,filter© +GetRecommendation5.google.cloud.recommender.v1.GetRecommendationRequest+.google.cloud.recommender.v1.Recommendation"¯‚Óä“¡B/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}ZKI/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}ZCA/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}ZIG/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}ÚAnameú +MarkRecommendationDismissed?.google.cloud.recommender.v1.MarkRecommendationDismissedRequest+.google.cloud.recommender.v1.Recommendation"ì‚Óä“å"P/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markDismissed:*Z\\"W/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markDismissed:*ZT"O/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markDismissed:*ZZ"U/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markDismissed:*‰ +MarkRecommendationClaimed=.google.cloud.recommender.v1.MarkRecommendationClaimedRequest+.google.cloud.recommender.v1.Recommendation"ÿ‚Óä“Ý"N/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed:*ZZ"U/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markClaimed:*ZR"M/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markClaimed:*ZX"S/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markClaimed:*ÚAname,state_metadata,etag• +MarkRecommendationSucceeded?.google.cloud.recommender.v1.MarkRecommendationSucceededRequest+.google.cloud.recommender.v1.Recommendation"‡‚Óä“å"P/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:*Z\\"W/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:*ZT"O/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:*ZZ"U/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:*ÚAname,state_metadata,etagƒ +MarkRecommendationFailed<.google.cloud.recommender.v1.MarkRecommendationFailedRequest+.google.cloud.recommender.v1.Recommendation"û‚Óä“Ù"M/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed:*ZY"T/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markFailed:*ZQ"L/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markFailed:*ZW"R/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markFailed:*ÚAname,state_metadata,etagÌ +GetRecommenderConfig8.google.cloud.recommender.v1.GetRecommenderConfigRequest..google.cloud.recommender.v1.RecommenderConfig"É‚Óä“»7/v1/{name=projects/*/locations/*/recommenders/*/config}Z>/v1/{name=billingAccounts/*/locations/*/recommenders/*/config}ÚAnameá +UpdateRecommenderConfig;.google.cloud.recommender.v1.UpdateRecommenderConfigRequest..google.cloud.recommender.v1.RecommenderConfig"Ø‚Óä“°2J/v1/{recommender_config.name=projects/*/locations/*/recommenders/*/config}:recommender_configZe2O/v1/{recommender_config.name=organizations/*/locations/*/recommenders/*/config}:recommender_configZg2Q/v1/{recommender_config.name=billingAccounts/*/locations/*/recommenders/*/config}:recommender_configÚArecommender_config,update_maskÌ +GetInsightTypeConfig8.google.cloud.recommender.v1.GetInsightTypeConfigRequest..google.cloud.recommender.v1.InsightTypeConfig"É‚Óä“»7/v1/{name=projects/*/locations/*/insightTypes/*/config}Z>/v1/{name=billingAccounts/*/locations/*/insightTypes/*/config}ÚAnameè +UpdateInsightTypeConfig;.google.cloud.recommender.v1.UpdateInsightTypeConfigRequest..google.cloud.recommender.v1.InsightTypeConfig"ß‚Ó䓶2K/v1/{insight_type_config.name=projects/*/locations/*/insightTypes/*/config}:insight_type_configZg2P/v1/{insight_type_config.name=organizations/*/locations/*/insightTypes/*/config}:insight_type_configZi2R/v1/{insight_type_config.name=billingAccounts/*/locations/*/insightTypes/*/config}:insight_type_configÚAinsight_type_config,update_maskNÊArecommender.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB +com.google.cloud.recommender.v1BRecommenderProtoPZAcloud.google.com/go/recommender/apiv1/recommenderpb;recommenderpb¢CRECªGoogle.Cloud.Recommender.V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/CostProjection.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/CostProjection.php new file mode 100644 index 000000000000..e981e6aba9ee --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/CostProjection.php @@ -0,0 +1,181 @@ +google.cloud.recommender.v1.CostProjection + */ +class CostProjection extends \Google\Protobuf\Internal\Message +{ + /** + * An approximate projection on amount saved or amount incurred. Negative cost + * units indicate cost savings and positive cost units indicate increase. + * See google.type.Money documentation for positive/negative units. + * A user's permissions may affect whether the cost is computed using list + * prices or custom contract prices. + * + * Generated from protobuf field .google.type.Money cost = 1; + */ + protected $cost = null; + /** + * Duration for which this cost applies. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + */ + protected $duration = null; + /** + * The approximate cost savings in the billing account's local currency. + * + * Generated from protobuf field .google.type.Money cost_in_local_currency = 3; + */ + protected $cost_in_local_currency = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\Money $cost + * An approximate projection on amount saved or amount incurred. Negative cost + * units indicate cost savings and positive cost units indicate increase. + * See google.type.Money documentation for positive/negative units. + * A user's permissions may affect whether the cost is computed using list + * prices or custom contract prices. + * @type \Google\Protobuf\Duration $duration + * Duration for which this cost applies. + * @type \Google\Type\Money $cost_in_local_currency + * The approximate cost savings in the billing account's local currency. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * An approximate projection on amount saved or amount incurred. Negative cost + * units indicate cost savings and positive cost units indicate increase. + * See google.type.Money documentation for positive/negative units. + * A user's permissions may affect whether the cost is computed using list + * prices or custom contract prices. + * + * Generated from protobuf field .google.type.Money cost = 1; + * @return \Google\Type\Money|null + */ + public function getCost() + { + return $this->cost; + } + + public function hasCost() + { + return isset($this->cost); + } + + public function clearCost() + { + unset($this->cost); + } + + /** + * An approximate projection on amount saved or amount incurred. Negative cost + * units indicate cost savings and positive cost units indicate increase. + * See google.type.Money documentation for positive/negative units. + * A user's permissions may affect whether the cost is computed using list + * prices or custom contract prices. + * + * Generated from protobuf field .google.type.Money cost = 1; + * @param \Google\Type\Money $var + * @return $this + */ + public function setCost($var) + { + GPBUtil::checkMessage($var, \Google\Type\Money::class); + $this->cost = $var; + + return $this; + } + + /** + * Duration for which this cost applies. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration for which this cost applies. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * The approximate cost savings in the billing account's local currency. + * + * Generated from protobuf field .google.type.Money cost_in_local_currency = 3; + * @return \Google\Type\Money|null + */ + public function getCostInLocalCurrency() + { + return $this->cost_in_local_currency; + } + + public function hasCostInLocalCurrency() + { + return isset($this->cost_in_local_currency); + } + + public function clearCostInLocalCurrency() + { + unset($this->cost_in_local_currency); + } + + /** + * The approximate cost savings in the billing account's local currency. + * + * Generated from protobuf field .google.type.Money cost_in_local_currency = 3; + * @param \Google\Type\Money $var + * @return $this + */ + public function setCostInLocalCurrency($var) + { + GPBUtil::checkMessage($var, \Google\Type\Money::class); + $this->cost_in_local_currency = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetInsightRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetInsightRequest.php new file mode 100644 index 000000000000..4eefd045c8d4 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetInsightRequest.php @@ -0,0 +1,81 @@ +google.cloud.recommender.v1.GetInsightRequest + */ +class GetInsightRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the insight. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the insight. Please see + * {@see RecommenderClient::insightName()} for help formatting this field. + * + * @return \Google\Cloud\Recommender\V1\GetInsightRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the insight. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the insight. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the insight. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetInsightTypeConfigRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetInsightTypeConfigRequest.php new file mode 100644 index 000000000000..cf71aa698a60 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetInsightTypeConfigRequest.php @@ -0,0 +1,111 @@ +google.cloud.recommender.v1.GetInsightTypeConfigRequest + */ +class GetInsightTypeConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the InsightTypeConfig to get. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the InsightTypeConfig to get. + * + * Acceptable formats: + * + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * Please see {@see RecommenderClient::insightTypeConfigName()} for help formatting this field. + * + * @return \Google\Cloud\Recommender\V1\GetInsightTypeConfigRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the InsightTypeConfig to get. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the InsightTypeConfig to get. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the InsightTypeConfig to get. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetRecommendationRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetRecommendationRequest.php new file mode 100644 index 000000000000..b15ce7896af4 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetRecommendationRequest.php @@ -0,0 +1,81 @@ +google.cloud.recommender.v1.GetRecommendationRequest + */ +class GetRecommendationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the recommendation. Please see + * {@see RecommenderClient::recommendationName()} for help formatting this field. + * + * @return \Google\Cloud\Recommender\V1\GetRecommendationRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the recommendation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetRecommenderConfigRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetRecommenderConfigRequest.php new file mode 100644 index 000000000000..ff82145c37d0 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/GetRecommenderConfigRequest.php @@ -0,0 +1,111 @@ +google.cloud.recommender.v1.GetRecommenderConfigRequest + */ +class GetRecommenderConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the Recommendation Config to get. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the Recommendation Config to get. + * + * Acceptable formats: + * + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * Please see {@see RecommenderClient::recommenderConfigName()} for help formatting this field. + * + * @return \Google\Cloud\Recommender\V1\GetRecommenderConfigRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the Recommendation Config to get. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the Recommendation Config to get. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the Recommendation Config to get. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Impact.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Impact.php new file mode 100644 index 000000000000..1ae4e1147913 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Impact.php @@ -0,0 +1,208 @@ +google.cloud.recommender.v1.Impact + */ +class Impact extends \Google\Protobuf\Internal\Message +{ + /** + * Category that is being targeted. + * + * Generated from protobuf field .google.cloud.recommender.v1.Impact.Category category = 1; + */ + protected $category = 0; + protected $projection; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $category + * Category that is being targeted. + * @type \Google\Cloud\Recommender\V1\CostProjection $cost_projection + * Use with CategoryType.COST + * @type \Google\Cloud\Recommender\V1\SecurityProjection $security_projection + * Use with CategoryType.SECURITY + * @type \Google\Cloud\Recommender\V1\SustainabilityProjection $sustainability_projection + * Use with CategoryType.SUSTAINABILITY + * @type \Google\Cloud\Recommender\V1\ReliabilityProjection $reliability_projection + * Use with CategoryType.RELIABILITY + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * Category that is being targeted. + * + * Generated from protobuf field .google.cloud.recommender.v1.Impact.Category category = 1; + * @return int + */ + public function getCategory() + { + return $this->category; + } + + /** + * Category that is being targeted. + * + * Generated from protobuf field .google.cloud.recommender.v1.Impact.Category category = 1; + * @param int $var + * @return $this + */ + public function setCategory($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Recommender\V1\Impact\Category::class); + $this->category = $var; + + return $this; + } + + /** + * Use with CategoryType.COST + * + * Generated from protobuf field .google.cloud.recommender.v1.CostProjection cost_projection = 100; + * @return \Google\Cloud\Recommender\V1\CostProjection|null + */ + public function getCostProjection() + { + return $this->readOneof(100); + } + + public function hasCostProjection() + { + return $this->hasOneof(100); + } + + /** + * Use with CategoryType.COST + * + * Generated from protobuf field .google.cloud.recommender.v1.CostProjection cost_projection = 100; + * @param \Google\Cloud\Recommender\V1\CostProjection $var + * @return $this + */ + public function setCostProjection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\CostProjection::class); + $this->writeOneof(100, $var); + + return $this; + } + + /** + * Use with CategoryType.SECURITY + * + * Generated from protobuf field .google.cloud.recommender.v1.SecurityProjection security_projection = 101; + * @return \Google\Cloud\Recommender\V1\SecurityProjection|null + */ + public function getSecurityProjection() + { + return $this->readOneof(101); + } + + public function hasSecurityProjection() + { + return $this->hasOneof(101); + } + + /** + * Use with CategoryType.SECURITY + * + * Generated from protobuf field .google.cloud.recommender.v1.SecurityProjection security_projection = 101; + * @param \Google\Cloud\Recommender\V1\SecurityProjection $var + * @return $this + */ + public function setSecurityProjection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\SecurityProjection::class); + $this->writeOneof(101, $var); + + return $this; + } + + /** + * Use with CategoryType.SUSTAINABILITY + * + * Generated from protobuf field .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * @return \Google\Cloud\Recommender\V1\SustainabilityProjection|null + */ + public function getSustainabilityProjection() + { + return $this->readOneof(102); + } + + public function hasSustainabilityProjection() + { + return $this->hasOneof(102); + } + + /** + * Use with CategoryType.SUSTAINABILITY + * + * Generated from protobuf field .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * @param \Google\Cloud\Recommender\V1\SustainabilityProjection $var + * @return $this + */ + public function setSustainabilityProjection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\SustainabilityProjection::class); + $this->writeOneof(102, $var); + + return $this; + } + + /** + * Use with CategoryType.RELIABILITY + * + * Generated from protobuf field .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + * @return \Google\Cloud\Recommender\V1\ReliabilityProjection|null + */ + public function getReliabilityProjection() + { + return $this->readOneof(103); + } + + public function hasReliabilityProjection() + { + return $this->hasOneof(103); + } + + /** + * Use with CategoryType.RELIABILITY + * + * Generated from protobuf field .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + * @param \Google\Cloud\Recommender\V1\ReliabilityProjection $var + * @return $this + */ + public function setReliabilityProjection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\ReliabilityProjection::class); + $this->writeOneof(103, $var); + + return $this; + } + + /** + * @return string + */ + public function getProjection() + { + return $this->whichOneof("projection"); + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Impact/Category.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Impact/Category.php new file mode 100644 index 000000000000..3edc36ada2dc --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Impact/Category.php @@ -0,0 +1,92 @@ +google.cloud.recommender.v1.Impact.Category + */ +class Category +{ + /** + * Default unspecified category. Don't use directly. + * + * Generated from protobuf enum CATEGORY_UNSPECIFIED = 0; + */ + const CATEGORY_UNSPECIFIED = 0; + /** + * Indicates a potential increase or decrease in cost. + * + * Generated from protobuf enum COST = 1; + */ + const COST = 1; + /** + * Indicates a potential increase or decrease in security. + * + * Generated from protobuf enum SECURITY = 2; + */ + const SECURITY = 2; + /** + * Indicates a potential increase or decrease in performance. + * + * Generated from protobuf enum PERFORMANCE = 3; + */ + const PERFORMANCE = 3; + /** + * Indicates a potential increase or decrease in manageability. + * + * Generated from protobuf enum MANAGEABILITY = 4; + */ + const MANAGEABILITY = 4; + /** + * Indicates a potential increase or decrease in sustainability. + * + * Generated from protobuf enum SUSTAINABILITY = 5; + */ + const SUSTAINABILITY = 5; + /** + * Indicates a potential increase or decrease in reliability. + * + * Generated from protobuf enum RELIABILITY = 6; + */ + const RELIABILITY = 6; + + private static $valueToName = [ + self::CATEGORY_UNSPECIFIED => 'CATEGORY_UNSPECIFIED', + self::COST => 'COST', + self::SECURITY => 'SECURITY', + self::PERFORMANCE => 'PERFORMANCE', + self::MANAGEABILITY => 'MANAGEABILITY', + self::SUSTAINABILITY => 'SUSTAINABILITY', + self::RELIABILITY => 'RELIABILITY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Category::class, \Google\Cloud\Recommender\V1\Impact_Category::class); + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight.php new file mode 100644 index 000000000000..544481b24ea5 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight.php @@ -0,0 +1,502 @@ +google.cloud.recommender.v1.Insight + */ +class Insight extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the insight. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Free-form human readable summary in English. The maximum length is 500 + * characters. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Fully qualified resource names that this insight is targeting. + * + * Generated from protobuf field repeated string target_resources = 9; + */ + private $target_resources; + /** + * Insight subtype. Insight content schema will be stable for a given subtype. + * + * Generated from protobuf field string insight_subtype = 10; + */ + protected $insight_subtype = ''; + /** + * A struct of custom fields to explain the insight. + * Example: "grantedPermissionsCount": "1000" + * + * Generated from protobuf field .google.protobuf.Struct content = 3; + */ + protected $content = null; + /** + * Timestamp of the latest data used to generate the insight. + * + * Generated from protobuf field .google.protobuf.Timestamp last_refresh_time = 4; + */ + protected $last_refresh_time = null; + /** + * Observation period that led to the insight. The source data used to + * generate the insight ends at last_refresh_time and begins at + * (last_refresh_time - observation_period). + * + * Generated from protobuf field .google.protobuf.Duration observation_period = 5; + */ + protected $observation_period = null; + /** + * Information state and metadata. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightStateInfo state_info = 6; + */ + protected $state_info = null; + /** + * Category being targeted by the insight. + * + * Generated from protobuf field .google.cloud.recommender.v1.Insight.Category category = 7; + */ + protected $category = 0; + /** + * Insight's severity. + * + * Generated from protobuf field .google.cloud.recommender.v1.Insight.Severity severity = 15; + */ + protected $severity = 0; + /** + * Fingerprint of the Insight. Provides optimistic locking when updating + * states. + * + * Generated from protobuf field string etag = 11; + */ + protected $etag = ''; + /** + * Recommendations derived from this insight. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Insight.RecommendationReference associated_recommendations = 8; + */ + private $associated_recommendations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the insight. + * @type string $description + * Free-form human readable summary in English. The maximum length is 500 + * characters. + * @type array|\Google\Protobuf\Internal\RepeatedField $target_resources + * Fully qualified resource names that this insight is targeting. + * @type string $insight_subtype + * Insight subtype. Insight content schema will be stable for a given subtype. + * @type \Google\Protobuf\Struct $content + * A struct of custom fields to explain the insight. + * Example: "grantedPermissionsCount": "1000" + * @type \Google\Protobuf\Timestamp $last_refresh_time + * Timestamp of the latest data used to generate the insight. + * @type \Google\Protobuf\Duration $observation_period + * Observation period that led to the insight. The source data used to + * generate the insight ends at last_refresh_time and begins at + * (last_refresh_time - observation_period). + * @type \Google\Cloud\Recommender\V1\InsightStateInfo $state_info + * Information state and metadata. + * @type int $category + * Category being targeted by the insight. + * @type int $severity + * Insight's severity. + * @type string $etag + * Fingerprint of the Insight. Provides optimistic locking when updating + * states. + * @type array<\Google\Cloud\Recommender\V1\Insight\RecommendationReference>|\Google\Protobuf\Internal\RepeatedField $associated_recommendations + * Recommendations derived from this insight. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Insight::initOnce(); + parent::__construct($data); + } + + /** + * Name of the insight. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the insight. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Free-form human readable summary in English. The maximum length is 500 + * characters. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Free-form human readable summary in English. The maximum length is 500 + * characters. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Fully qualified resource names that this insight is targeting. + * + * Generated from protobuf field repeated string target_resources = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetResources() + { + return $this->target_resources; + } + + /** + * Fully qualified resource names that this insight is targeting. + * + * Generated from protobuf field repeated string target_resources = 9; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetResources($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->target_resources = $arr; + + return $this; + } + + /** + * Insight subtype. Insight content schema will be stable for a given subtype. + * + * Generated from protobuf field string insight_subtype = 10; + * @return string + */ + public function getInsightSubtype() + { + return $this->insight_subtype; + } + + /** + * Insight subtype. Insight content schema will be stable for a given subtype. + * + * Generated from protobuf field string insight_subtype = 10; + * @param string $var + * @return $this + */ + public function setInsightSubtype($var) + { + GPBUtil::checkString($var, True); + $this->insight_subtype = $var; + + return $this; + } + + /** + * A struct of custom fields to explain the insight. + * Example: "grantedPermissionsCount": "1000" + * + * Generated from protobuf field .google.protobuf.Struct content = 3; + * @return \Google\Protobuf\Struct|null + */ + public function getContent() + { + return $this->content; + } + + public function hasContent() + { + return isset($this->content); + } + + public function clearContent() + { + unset($this->content); + } + + /** + * A struct of custom fields to explain the insight. + * Example: "grantedPermissionsCount": "1000" + * + * Generated from protobuf field .google.protobuf.Struct content = 3; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->content = $var; + + return $this; + } + + /** + * Timestamp of the latest data used to generate the insight. + * + * Generated from protobuf field .google.protobuf.Timestamp last_refresh_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastRefreshTime() + { + return $this->last_refresh_time; + } + + public function hasLastRefreshTime() + { + return isset($this->last_refresh_time); + } + + public function clearLastRefreshTime() + { + unset($this->last_refresh_time); + } + + /** + * Timestamp of the latest data used to generate the insight. + * + * Generated from protobuf field .google.protobuf.Timestamp last_refresh_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastRefreshTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_refresh_time = $var; + + return $this; + } + + /** + * Observation period that led to the insight. The source data used to + * generate the insight ends at last_refresh_time and begins at + * (last_refresh_time - observation_period). + * + * Generated from protobuf field .google.protobuf.Duration observation_period = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getObservationPeriod() + { + return $this->observation_period; + } + + public function hasObservationPeriod() + { + return isset($this->observation_period); + } + + public function clearObservationPeriod() + { + unset($this->observation_period); + } + + /** + * Observation period that led to the insight. The source data used to + * generate the insight ends at last_refresh_time and begins at + * (last_refresh_time - observation_period). + * + * Generated from protobuf field .google.protobuf.Duration observation_period = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setObservationPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->observation_period = $var; + + return $this; + } + + /** + * Information state and metadata. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightStateInfo state_info = 6; + * @return \Google\Cloud\Recommender\V1\InsightStateInfo|null + */ + public function getStateInfo() + { + return $this->state_info; + } + + public function hasStateInfo() + { + return isset($this->state_info); + } + + public function clearStateInfo() + { + unset($this->state_info); + } + + /** + * Information state and metadata. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightStateInfo state_info = 6; + * @param \Google\Cloud\Recommender\V1\InsightStateInfo $var + * @return $this + */ + public function setStateInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\InsightStateInfo::class); + $this->state_info = $var; + + return $this; + } + + /** + * Category being targeted by the insight. + * + * Generated from protobuf field .google.cloud.recommender.v1.Insight.Category category = 7; + * @return int + */ + public function getCategory() + { + return $this->category; + } + + /** + * Category being targeted by the insight. + * + * Generated from protobuf field .google.cloud.recommender.v1.Insight.Category category = 7; + * @param int $var + * @return $this + */ + public function setCategory($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Recommender\V1\Insight\Category::class); + $this->category = $var; + + return $this; + } + + /** + * Insight's severity. + * + * Generated from protobuf field .google.cloud.recommender.v1.Insight.Severity severity = 15; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Insight's severity. + * + * Generated from protobuf field .google.cloud.recommender.v1.Insight.Severity severity = 15; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Recommender\V1\Insight\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * Fingerprint of the Insight. Provides optimistic locking when updating + * states. + * + * Generated from protobuf field string etag = 11; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Fingerprint of the Insight. Provides optimistic locking when updating + * states. + * + * Generated from protobuf field string etag = 11; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Recommendations derived from this insight. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Insight.RecommendationReference associated_recommendations = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAssociatedRecommendations() + { + return $this->associated_recommendations; + } + + /** + * Recommendations derived from this insight. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Insight.RecommendationReference associated_recommendations = 8; + * @param array<\Google\Cloud\Recommender\V1\Insight\RecommendationReference>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAssociatedRecommendations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Recommender\V1\Insight\RecommendationReference::class); + $this->associated_recommendations = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight/Category.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight/Category.php new file mode 100644 index 000000000000..2bd1978a8018 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight/Category.php @@ -0,0 +1,92 @@ +google.cloud.recommender.v1.Insight.Category + */ +class Category +{ + /** + * Unspecified category. + * + * Generated from protobuf enum CATEGORY_UNSPECIFIED = 0; + */ + const CATEGORY_UNSPECIFIED = 0; + /** + * The insight is related to cost. + * + * Generated from protobuf enum COST = 1; + */ + const COST = 1; + /** + * The insight is related to security. + * + * Generated from protobuf enum SECURITY = 2; + */ + const SECURITY = 2; + /** + * The insight is related to performance. + * + * Generated from protobuf enum PERFORMANCE = 3; + */ + const PERFORMANCE = 3; + /** + * This insight is related to manageability. + * + * Generated from protobuf enum MANAGEABILITY = 4; + */ + const MANAGEABILITY = 4; + /** + * The insight is related to sustainability. + * + * Generated from protobuf enum SUSTAINABILITY = 5; + */ + const SUSTAINABILITY = 5; + /** + * This insight is related to reliability. + * + * Generated from protobuf enum RELIABILITY = 6; + */ + const RELIABILITY = 6; + + private static $valueToName = [ + self::CATEGORY_UNSPECIFIED => 'CATEGORY_UNSPECIFIED', + self::COST => 'COST', + self::SECURITY => 'SECURITY', + self::PERFORMANCE => 'PERFORMANCE', + self::MANAGEABILITY => 'MANAGEABILITY', + self::SUSTAINABILITY => 'SUSTAINABILITY', + self::RELIABILITY => 'RELIABILITY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Category::class, \Google\Cloud\Recommender\V1\Insight_Category::class); + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight/RecommendationReference.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight/RecommendationReference.php new file mode 100644 index 000000000000..2b8fdf78c012 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight/RecommendationReference.php @@ -0,0 +1,74 @@ +google.cloud.recommender.v1.Insight.RecommendationReference + */ +class RecommendationReference extends \Google\Protobuf\Internal\Message +{ + /** + * Recommendation resource name, e.g. + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendations/[RECOMMENDATION_ID] + * + * Generated from protobuf field string recommendation = 1; + */ + protected $recommendation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $recommendation + * Recommendation resource name, e.g. + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendations/[RECOMMENDATION_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Insight::initOnce(); + parent::__construct($data); + } + + /** + * Recommendation resource name, e.g. + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendations/[RECOMMENDATION_ID] + * + * Generated from protobuf field string recommendation = 1; + * @return string + */ + public function getRecommendation() + { + return $this->recommendation; + } + + /** + * Recommendation resource name, e.g. + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendations/[RECOMMENDATION_ID] + * + * Generated from protobuf field string recommendation = 1; + * @param string $var + * @return $this + */ + public function setRecommendation($var) + { + GPBUtil::checkString($var, True); + $this->recommendation = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RecommendationReference::class, \Google\Cloud\Recommender\V1\Insight_RecommendationReference::class); + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight/Severity.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight/Severity.php new file mode 100644 index 000000000000..4370e3d0118e --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Insight/Severity.php @@ -0,0 +1,78 @@ +google.cloud.recommender.v1.Insight.Severity + */ +class Severity +{ + /** + * Insight has unspecified severity. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * Insight has low severity. + * + * Generated from protobuf enum LOW = 1; + */ + const LOW = 1; + /** + * Insight has medium severity. + * + * Generated from protobuf enum MEDIUM = 2; + */ + const MEDIUM = 2; + /** + * Insight has high severity. + * + * Generated from protobuf enum HIGH = 3; + */ + const HIGH = 3; + /** + * Insight has critical severity. + * + * Generated from protobuf enum CRITICAL = 4; + */ + const CRITICAL = 4; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::LOW => 'LOW', + self::MEDIUM => 'MEDIUM', + self::HIGH => 'HIGH', + self::CRITICAL => 'CRITICAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Severity::class, \Google\Cloud\Recommender\V1\Insight_Severity::class); + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightStateInfo.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightStateInfo.php new file mode 100644 index 000000000000..e34f0b84d941 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightStateInfo.php @@ -0,0 +1,101 @@ +google.cloud.recommender.v1.InsightStateInfo + */ +class InsightStateInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Insight state. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightStateInfo.State state = 1; + */ + protected $state = 0; + /** + * A map of metadata for the state, provided by user or automations systems. + * + * Generated from protobuf field map state_metadata = 2; + */ + private $state_metadata; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * Insight state. + * @type array|\Google\Protobuf\Internal\MapField $state_metadata + * A map of metadata for the state, provided by user or automations systems. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Insight::initOnce(); + parent::__construct($data); + } + + /** + * Insight state. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightStateInfo.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Insight state. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightStateInfo.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Recommender\V1\InsightStateInfo\State::class); + $this->state = $var; + + return $this; + } + + /** + * A map of metadata for the state, provided by user or automations systems. + * + * Generated from protobuf field map state_metadata = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getStateMetadata() + { + return $this->state_metadata; + } + + /** + * A map of metadata for the state, provided by user or automations systems. + * + * Generated from protobuf field map state_metadata = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setStateMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->state_metadata = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightStateInfo/State.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightStateInfo/State.php new file mode 100644 index 000000000000..648ce14b4594 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightStateInfo/State.php @@ -0,0 +1,77 @@ +google.cloud.recommender.v1.InsightStateInfo.State + */ +class State +{ + /** + * Unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Insight is active. Content for ACTIVE insights can be updated by Google. + * ACTIVE insights can be marked DISMISSED OR ACCEPTED. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Some action has been taken based on this insight. Insights become + * accepted when a recommendation derived from the insight has been marked + * CLAIMED, SUCCEEDED, or FAILED. ACTIVE insights can also be marked + * ACCEPTED explicitly. Content for ACCEPTED insights is immutable. ACCEPTED + * insights can only be marked ACCEPTED (which may update state metadata). + * + * Generated from protobuf enum ACCEPTED = 2; + */ + const ACCEPTED = 2; + /** + * Insight is dismissed. Content for DISMISSED insights can be updated by + * Google. DISMISSED insights can be marked as ACTIVE. + * + * Generated from protobuf enum DISMISSED = 3; + */ + const DISMISSED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::ACCEPTED => 'ACCEPTED', + self::DISMISSED => 'DISMISSED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Recommender\V1\InsightStateInfo_State::class); + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightTypeConfig.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightTypeConfig.php new file mode 100644 index 000000000000..dc2cf99dabcd --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightTypeConfig.php @@ -0,0 +1,347 @@ +google.cloud.recommender.v1.InsightTypeConfig + */ +class InsightTypeConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Name of insight type config. + * Eg, + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * InsightTypeGenerationConfig which configures the generation of + * insights for this insight type. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightTypeGenerationConfig insight_type_generation_config = 2; + */ + protected $insight_type_generation_config = null; + /** + * Fingerprint of the InsightTypeConfig. Provides optimistic locking when + * updating. + * + * Generated from protobuf field string etag = 3; + */ + protected $etag = ''; + /** + * Last time when the config was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + protected $update_time = null; + /** + * Output only. Immutable. The revision ID of the config. + * A new revision is committed whenever the config is changed in any way. + * The format is an 8-character hexadecimal string. + * + * Generated from protobuf field string revision_id = 5 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision_id = ''; + /** + * Allows clients to store small amounts of arbitrary data. Annotations must + * follow the Kubernetes syntax. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 6; + */ + private $annotations; + /** + * A user-settable field to provide a human-readable name to be used in user + * interfaces. + * + * Generated from protobuf field string display_name = 7; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of insight type config. + * Eg, + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config + * @type \Google\Cloud\Recommender\V1\InsightTypeGenerationConfig $insight_type_generation_config + * InsightTypeGenerationConfig which configures the generation of + * insights for this insight type. + * @type string $etag + * Fingerprint of the InsightTypeConfig. Provides optimistic locking when + * updating. + * @type \Google\Protobuf\Timestamp $update_time + * Last time when the config was updated. + * @type string $revision_id + * Output only. Immutable. The revision ID of the config. + * A new revision is committed whenever the config is changed in any way. + * The format is an 8-character hexadecimal string. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Allows clients to store small amounts of arbitrary data. Annotations must + * follow the Kubernetes syntax. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * @type string $display_name + * A user-settable field to provide a human-readable name to be used in user + * interfaces. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\InsightTypeConfig::initOnce(); + parent::__construct($data); + } + + /** + * Name of insight type config. + * Eg, + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of insight type config. + * Eg, + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * InsightTypeGenerationConfig which configures the generation of + * insights for this insight type. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightTypeGenerationConfig insight_type_generation_config = 2; + * @return \Google\Cloud\Recommender\V1\InsightTypeGenerationConfig|null + */ + public function getInsightTypeGenerationConfig() + { + return $this->insight_type_generation_config; + } + + public function hasInsightTypeGenerationConfig() + { + return isset($this->insight_type_generation_config); + } + + public function clearInsightTypeGenerationConfig() + { + unset($this->insight_type_generation_config); + } + + /** + * InsightTypeGenerationConfig which configures the generation of + * insights for this insight type. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightTypeGenerationConfig insight_type_generation_config = 2; + * @param \Google\Cloud\Recommender\V1\InsightTypeGenerationConfig $var + * @return $this + */ + public function setInsightTypeGenerationConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\InsightTypeGenerationConfig::class); + $this->insight_type_generation_config = $var; + + return $this; + } + + /** + * Fingerprint of the InsightTypeConfig. Provides optimistic locking when + * updating. + * + * Generated from protobuf field string etag = 3; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Fingerprint of the InsightTypeConfig. Provides optimistic locking when + * updating. + * + * Generated from protobuf field string etag = 3; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Last time when the config was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Last time when the config was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. Immutable. The revision ID of the config. + * A new revision is committed whenever the config is changed in any way. + * The format is an 8-character hexadecimal string. + * + * Generated from protobuf field string revision_id = 5 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRevisionId() + { + return $this->revision_id; + } + + /** + * Output only. Immutable. The revision ID of the config. + * A new revision is committed whenever the config is changed in any way. + * The format is an 8-character hexadecimal string. + * + * Generated from protobuf field string revision_id = 5 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->revision_id = $var; + + return $this; + } + + /** + * Allows clients to store small amounts of arbitrary data. Annotations must + * follow the Kubernetes syntax. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Allows clients to store small amounts of arbitrary data. Annotations must + * follow the Kubernetes syntax. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * A user-settable field to provide a human-readable name to be used in user + * interfaces. + * + * Generated from protobuf field string display_name = 7; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A user-settable field to provide a human-readable name to be used in user + * interfaces. + * + * Generated from protobuf field string display_name = 7; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightTypeGenerationConfig.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightTypeGenerationConfig.php new file mode 100644 index 000000000000..93d2117a35ce --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/InsightTypeGenerationConfig.php @@ -0,0 +1,83 @@ +google.cloud.recommender.v1.InsightTypeGenerationConfig + */ +class InsightTypeGenerationConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Parameters for this InsightTypeGenerationConfig. These configs can be used + * by or are applied to all subtypes. + * + * Generated from protobuf field .google.protobuf.Struct params = 1; + */ + protected $params = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Struct $params + * Parameters for this InsightTypeGenerationConfig. These configs can be used + * by or are applied to all subtypes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\InsightTypeConfig::initOnce(); + parent::__construct($data); + } + + /** + * Parameters for this InsightTypeGenerationConfig. These configs can be used + * by or are applied to all subtypes. + * + * Generated from protobuf field .google.protobuf.Struct params = 1; + * @return \Google\Protobuf\Struct|null + */ + public function getParams() + { + return $this->params; + } + + public function hasParams() + { + return isset($this->params); + } + + public function clearParams() + { + unset($this->params); + } + + /** + * Parameters for this InsightTypeGenerationConfig. These configs can be used + * by or are applied to all subtypes. + * + * Generated from protobuf field .google.protobuf.Struct params = 1; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setParams($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->params = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListInsightsRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListInsightsRequest.php new file mode 100644 index 000000000000..d61b254dc69a --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListInsightsRequest.php @@ -0,0 +1,319 @@ +google.cloud.recommender.v1.ListInsightsRequest + */ +class ListInsightsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The container resource on which to execute the request. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * INSIGHT_TYPE_ID refers to supported insight types: + * https://cloud.google.com/recommender/docs/insights/insight-types. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. If not specified, the server will + * determine the number of results to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters must be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter expression to restrict the insights returned. Supported + * filter fields: + * * `stateInfo.state` + * * `insightSubtype` + * * `severity` + * * `targetResources` + * Examples: + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * * `insightSubtype = PERMISSIONS_USAGE` + * * `severity = CRITICAL OR severity = HIGH` + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * * `stateInfo.state = ACTIVE AND (severity = CRITICAL OR severity = HIGH)` + * The max allowed filter length is 500 characters. + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The container resource on which to execute the request. + * Acceptable formats: + * + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * * `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * INSIGHT_TYPE_ID refers to supported insight types: + * https://cloud.google.com/recommender/docs/insights/insight-types. Please see + * {@see RecommenderClient::insightTypeName()} for help formatting this field. + * + * @return \Google\Cloud\Recommender\V1\ListInsightsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The container resource on which to execute the request. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * INSIGHT_TYPE_ID refers to supported insight types: + * https://cloud.google.com/recommender/docs/insights/insight-types. + * @type int $page_size + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. If not specified, the server will + * determine the number of results to return. + * @type string $page_token + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters must be identical to those in the previous call. + * @type string $filter + * Optional. Filter expression to restrict the insights returned. Supported + * filter fields: + * * `stateInfo.state` + * * `insightSubtype` + * * `severity` + * * `targetResources` + * Examples: + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * * `insightSubtype = PERMISSIONS_USAGE` + * * `severity = CRITICAL OR severity = HIGH` + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * * `stateInfo.state = ACTIVE AND (severity = CRITICAL OR severity = HIGH)` + * The max allowed filter length is 500 characters. + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The container resource on which to execute the request. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * INSIGHT_TYPE_ID refers to supported insight types: + * https://cloud.google.com/recommender/docs/insights/insight-types. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The container resource on which to execute the request. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * INSIGHT_TYPE_ID refers to supported insight types: + * https://cloud.google.com/recommender/docs/insights/insight-types. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. If not specified, the server will + * determine the number of results to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. If not specified, the server will + * determine the number of results to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters must be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters must be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filter expression to restrict the insights returned. Supported + * filter fields: + * * `stateInfo.state` + * * `insightSubtype` + * * `severity` + * * `targetResources` + * Examples: + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * * `insightSubtype = PERMISSIONS_USAGE` + * * `severity = CRITICAL OR severity = HIGH` + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * * `stateInfo.state = ACTIVE AND (severity = CRITICAL OR severity = HIGH)` + * The max allowed filter length is 500 characters. + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter expression to restrict the insights returned. Supported + * filter fields: + * * `stateInfo.state` + * * `insightSubtype` + * * `severity` + * * `targetResources` + * Examples: + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * * `insightSubtype = PERMISSIONS_USAGE` + * * `severity = CRITICAL OR severity = HIGH` + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * * `stateInfo.state = ACTIVE AND (severity = CRITICAL OR severity = HIGH)` + * The max allowed filter length is 500 characters. + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListInsightsResponse.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListInsightsResponse.php new file mode 100644 index 000000000000..559624b870fb --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListInsightsResponse.php @@ -0,0 +1,105 @@ +google.cloud.recommender.v1.ListInsightsResponse + */ +class ListInsightsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The set of insights for the `parent` resource. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Insight insights = 1; + */ + private $insights; + /** + * A token that can be used to request the next page of results. This field is + * empty if there are no additional results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Recommender\V1\Insight>|\Google\Protobuf\Internal\RepeatedField $insights + * The set of insights for the `parent` resource. + * @type string $next_page_token + * A token that can be used to request the next page of results. This field is + * empty if there are no additional results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * The set of insights for the `parent` resource. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Insight insights = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInsights() + { + return $this->insights; + } + + /** + * The set of insights for the `parent` resource. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Insight insights = 1; + * @param array<\Google\Cloud\Recommender\V1\Insight>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInsights($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Recommender\V1\Insight::class); + $this->insights = $arr; + + return $this; + } + + /** + * A token that can be used to request the next page of results. This field is + * empty if there are no additional results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be used to request the next page of results. This field is + * empty if there are no additional results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListRecommendationsRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListRecommendationsRequest.php new file mode 100644 index 000000000000..4d1306e50f46 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListRecommendationsRequest.php @@ -0,0 +1,378 @@ +google.cloud.recommender.v1.ListRecommendationsRequest + */ +class ListRecommendationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The container resource on which to execute the request. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * RECOMMENDER_ID refers to supported recommenders: + * https://cloud.google.com/recommender/docs/recommenders. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. If not specified, the server will + * determine the number of results to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters must be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Filter expression to restrict the recommendations returned. Supported + * filter fields: + * * `state_info.state` + * * `recommenderSubtype` + * * `priority` + * * `targetResources` + * Examples: + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * * `recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE` + * * `priority = P1 OR priority = P2` + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * * `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)` + * The max allowed filter length is 500 characters. + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * + * Generated from protobuf field string filter = 5; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The container resource on which to execute the request. + * Acceptable formats: + * + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * RECOMMENDER_ID refers to supported recommenders: + * https://cloud.google.com/recommender/docs/recommenders. Please see + * {@see RecommenderClient::recommenderName()} for help formatting this field. + * + * @return \Google\Cloud\Recommender\V1\ListRecommendationsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * @param string $parent Required. The container resource on which to execute the request. + * Acceptable formats: + * + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * RECOMMENDER_ID refers to supported recommenders: + * https://cloud.google.com/recommender/docs/recommenders. Please see + * {@see RecommenderClient::recommenderName()} for help formatting this field. + * @param string $filter Filter expression to restrict the recommendations returned. Supported + * filter fields: + * + * * `state_info.state` + * + * * `recommenderSubtype` + * + * * `priority` + * + * * `targetResources` + * + * Examples: + * + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * + * * `recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE` + * + * * `priority = P1 OR priority = P2` + * + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * + * * `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)` + * + * The max allowed filter length is 500 characters. + * + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * + * @return \Google\Cloud\Recommender\V1\ListRecommendationsRequest + * + * @experimental + */ + public static function buildFromParentFilter(string $parent, string $filter): self + { + return (new self()) + ->setParent($parent) + ->setFilter($filter); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The container resource on which to execute the request. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * RECOMMENDER_ID refers to supported recommenders: + * https://cloud.google.com/recommender/docs/recommenders. + * @type int $page_size + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. If not specified, the server will + * determine the number of results to return. + * @type string $page_token + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters must be identical to those in the previous call. + * @type string $filter + * Filter expression to restrict the recommendations returned. Supported + * filter fields: + * * `state_info.state` + * * `recommenderSubtype` + * * `priority` + * * `targetResources` + * Examples: + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * * `recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE` + * * `priority = P1 OR priority = P2` + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * * `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)` + * The max allowed filter length is 500 characters. + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The container resource on which to execute the request. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * RECOMMENDER_ID refers to supported recommenders: + * https://cloud.google.com/recommender/docs/recommenders. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The container resource on which to execute the request. + * Acceptable formats: + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * RECOMMENDER_ID refers to supported recommenders: + * https://cloud.google.com/recommender/docs/recommenders. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. If not specified, the server will + * determine the number of results to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. If not specified, the server will + * determine the number of results to return. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters must be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. If present, retrieves the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters must be identical to those in the previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Filter expression to restrict the recommendations returned. Supported + * filter fields: + * * `state_info.state` + * * `recommenderSubtype` + * * `priority` + * * `targetResources` + * Examples: + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * * `recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE` + * * `priority = P1 OR priority = P2` + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * * `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)` + * The max allowed filter length is 500 characters. + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * + * Generated from protobuf field string filter = 5; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filter expression to restrict the recommendations returned. Supported + * filter fields: + * * `state_info.state` + * * `recommenderSubtype` + * * `priority` + * * `targetResources` + * Examples: + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * * `recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE` + * * `priority = P1 OR priority = P2` + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * * `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)` + * The max allowed filter length is 500 characters. + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * + * Generated from protobuf field string filter = 5; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListRecommendationsResponse.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListRecommendationsResponse.php new file mode 100644 index 000000000000..e1f49c49e2b3 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ListRecommendationsResponse.php @@ -0,0 +1,105 @@ +google.cloud.recommender.v1.ListRecommendationsResponse + */ +class ListRecommendationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The set of recommendations for the `parent` resource. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Recommendation recommendations = 1; + */ + private $recommendations; + /** + * A token that can be used to request the next page of results. This field is + * empty if there are no additional results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Recommender\V1\Recommendation>|\Google\Protobuf\Internal\RepeatedField $recommendations + * The set of recommendations for the `parent` resource. + * @type string $next_page_token + * A token that can be used to request the next page of results. This field is + * empty if there are no additional results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * The set of recommendations for the `parent` resource. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Recommendation recommendations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRecommendations() + { + return $this->recommendations; + } + + /** + * The set of recommendations for the `parent` resource. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Recommendation recommendations = 1; + * @param array<\Google\Cloud\Recommender\V1\Recommendation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRecommendations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Recommender\V1\Recommendation::class); + $this->recommendations = $arr; + + return $this; + } + + /** + * A token that can be used to request the next page of results. This field is + * empty if there are no additional results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that can be used to request the next page of results. This field is + * empty if there are no additional results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkInsightAcceptedRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkInsightAcceptedRequest.php new file mode 100644 index 000000000000..44812d4b120b --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkInsightAcceptedRequest.php @@ -0,0 +1,158 @@ +google.cloud.recommender.v1.MarkInsightAcceptedRequest + */ +class MarkInsightAcceptedRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the insight. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. State properties user wish to include with this state. Full + * replace of the current state_metadata. + * + * Generated from protobuf field map state_metadata = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $state_metadata; + /** + * Required. Fingerprint of the Insight. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $etag = ''; + + /** + * @param string $name Required. Name of the insight. Please see + * {@see RecommenderClient::insightName()} for help formatting this field. + * @param array $stateMetadata Optional. State properties user wish to include with this state. Full + * replace of the current state_metadata. + * @param string $etag Required. Fingerprint of the Insight. Provides optimistic locking. + * + * @return \Google\Cloud\Recommender\V1\MarkInsightAcceptedRequest + * + * @experimental + */ + public static function build(string $name, array $stateMetadata, string $etag): self + { + return (new self()) + ->setName($name) + ->setStateMetadata($stateMetadata) + ->setEtag($etag); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the insight. + * @type array|\Google\Protobuf\Internal\MapField $state_metadata + * Optional. State properties user wish to include with this state. Full + * replace of the current state_metadata. + * @type string $etag + * Required. Fingerprint of the Insight. Provides optimistic locking. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the insight. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the insight. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. State properties user wish to include with this state. Full + * replace of the current state_metadata. + * + * Generated from protobuf field map state_metadata = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getStateMetadata() + { + return $this->state_metadata; + } + + /** + * Optional. State properties user wish to include with this state. Full + * replace of the current state_metadata. + * + * Generated from protobuf field map state_metadata = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setStateMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->state_metadata = $arr; + + return $this; + } + + /** + * Required. Fingerprint of the Insight. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Required. Fingerprint of the Insight. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationClaimedRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationClaimedRequest.php new file mode 100644 index 000000000000..a95547ef0f17 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationClaimedRequest.php @@ -0,0 +1,168 @@ +google.cloud.recommender.v1.MarkRecommendationClaimedRequest + */ +class MarkRecommendationClaimedRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * + * Generated from protobuf field map state_metadata = 2; + */ + private $state_metadata; + /** + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $etag = ''; + + /** + * @param string $name Required. Name of the recommendation. Please see + * {@see RecommenderClient::recommendationName()} for help formatting this field. + * @param array $stateMetadata State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * @param string $etag Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * @return \Google\Cloud\Recommender\V1\MarkRecommendationClaimedRequest + * + * @experimental + */ + public static function build(string $name, array $stateMetadata, string $etag): self + { + return (new self()) + ->setName($name) + ->setStateMetadata($stateMetadata) + ->setEtag($etag); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the recommendation. + * @type array|\Google\Protobuf\Internal\MapField $state_metadata + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * @type string $etag + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * + * Generated from protobuf field map state_metadata = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getStateMetadata() + { + return $this->state_metadata; + } + + /** + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * + * Generated from protobuf field map state_metadata = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setStateMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->state_metadata = $arr; + + return $this; + } + + /** + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationDismissedRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationDismissedRequest.php new file mode 100644 index 000000000000..41cc6032babd --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationDismissedRequest.php @@ -0,0 +1,101 @@ +google.cloud.recommender.v1.MarkRecommendationDismissedRequest + */ +class MarkRecommendationDismissedRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 2; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the recommendation. + * @type string $etag + * Fingerprint of the Recommendation. Provides optimistic locking. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 2; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 2; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationFailedRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationFailedRequest.php new file mode 100644 index 000000000000..9130a402746f --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationFailedRequest.php @@ -0,0 +1,168 @@ +google.cloud.recommender.v1.MarkRecommendationFailedRequest + */ +class MarkRecommendationFailedRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * + * Generated from protobuf field map state_metadata = 2; + */ + private $state_metadata; + /** + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $etag = ''; + + /** + * @param string $name Required. Name of the recommendation. Please see + * {@see RecommenderClient::recommendationName()} for help formatting this field. + * @param array $stateMetadata State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * @param string $etag Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * @return \Google\Cloud\Recommender\V1\MarkRecommendationFailedRequest + * + * @experimental + */ + public static function build(string $name, array $stateMetadata, string $etag): self + { + return (new self()) + ->setName($name) + ->setStateMetadata($stateMetadata) + ->setEtag($etag); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the recommendation. + * @type array|\Google\Protobuf\Internal\MapField $state_metadata + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * @type string $etag + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * + * Generated from protobuf field map state_metadata = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getStateMetadata() + { + return $this->state_metadata; + } + + /** + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * + * Generated from protobuf field map state_metadata = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setStateMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->state_metadata = $arr; + + return $this; + } + + /** + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationSucceededRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationSucceededRequest.php new file mode 100644 index 000000000000..5d95a39fbe78 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/MarkRecommendationSucceededRequest.php @@ -0,0 +1,168 @@ +google.cloud.recommender.v1.MarkRecommendationSucceededRequest + */ +class MarkRecommendationSucceededRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * + * Generated from protobuf field map state_metadata = 2; + */ + private $state_metadata; + /** + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $etag = ''; + + /** + * @param string $name Required. Name of the recommendation. Please see + * {@see RecommenderClient::recommendationName()} for help formatting this field. + * @param array $stateMetadata State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * @param string $etag Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * @return \Google\Cloud\Recommender\V1\MarkRecommendationSucceededRequest + * + * @experimental + */ + public static function build(string $name, array $stateMetadata, string $etag): self + { + return (new self()) + ->setName($name) + ->setStateMetadata($stateMetadata) + ->setEtag($etag); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the recommendation. + * @type array|\Google\Protobuf\Internal\MapField $state_metadata + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * @type string $etag + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the recommendation. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * + * Generated from protobuf field map state_metadata = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getStateMetadata() + { + return $this->state_metadata; + } + + /** + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * + * Generated from protobuf field map state_metadata = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setStateMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->state_metadata = $arr; + + return $this; + } + + /** + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Required. Fingerprint of the Recommendation. Provides optimistic locking. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Operation.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Operation.php new file mode 100644 index 000000000000..096085bea6f7 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Operation.php @@ -0,0 +1,564 @@ +google.cloud.recommender.v1.Operation + */ +class Operation extends \Google\Protobuf\Internal\Message +{ + /** + * Type of this operation. Contains one of 'add', 'remove', 'replace', 'move', + * 'copy', 'test' and custom operations. This field is case-insensitive and + * always populated. + * + * Generated from protobuf field string action = 1; + */ + protected $action = ''; + /** + * Type of GCP resource being modified/tested. This field is always populated. + * Example: cloudresourcemanager.googleapis.com/Project, + * compute.googleapis.com/Instance + * + * Generated from protobuf field string resource_type = 2; + */ + protected $resource_type = ''; + /** + * Contains the fully qualified resource name. This field is always populated. + * ex: //cloudresourcemanager.googleapis.com/projects/foo. + * + * Generated from protobuf field string resource = 3; + */ + protected $resource = ''; + /** + * Path to the target field being operated on. If the operation is at the + * resource level, then path should be "/". This field is always populated. + * + * Generated from protobuf field string path = 4; + */ + protected $path = ''; + /** + * Can be set with action 'copy' to copy resource configuration across + * different resources of the same type. Example: A resource clone can be + * done via action = 'copy', path = "/", from = "/", + * source_resource = and resource_name = . + * This field is empty for all other values of `action`. + * + * Generated from protobuf field string source_resource = 5; + */ + protected $source_resource = ''; + /** + * Can be set with action 'copy' or 'move' to indicate the source field within + * resource or source_resource, ignored if provided for other operation types. + * + * Generated from protobuf field string source_path = 6; + */ + protected $source_path = ''; + /** + * Set of filters to apply if `path` refers to array elements or nested array + * elements in order to narrow down to a single unique element that is being + * tested/modified. + * This is intended to be an exact match per filter. To perform advanced + * matching, use path_value_matchers. + * * Example: + * ``` + * { + * "/versions/*/name" : "it-123" + * "/versions/*/targetSize/percent": 20 + * } + * ``` + * * Example: + * ``` + * { + * "/bindings/*/role": "roles/owner" + * "/bindings/*/condition" : null + * } + * ``` + * * Example: + * ``` + * { + * "/bindings/*/role": "roles/owner" + * "/bindings/*/members/*" : ["x@example.com", "y@example.com"] + * } + * ``` + * When both path_filters and path_value_matchers are set, an implicit AND + * must be performed. + * + * Generated from protobuf field map path_filters = 8; + */ + private $path_filters; + /** + * Similar to path_filters, this contains set of filters to apply if `path` + * field refers to array elements. This is meant to support value matching + * beyond exact match. To perform exact match, use path_filters. + * When both path_filters and path_value_matchers are set, an implicit AND + * must be performed. + * + * Generated from protobuf field map path_value_matchers = 11; + */ + private $path_value_matchers; + protected $path_value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $action + * Type of this operation. Contains one of 'add', 'remove', 'replace', 'move', + * 'copy', 'test' and custom operations. This field is case-insensitive and + * always populated. + * @type string $resource_type + * Type of GCP resource being modified/tested. This field is always populated. + * Example: cloudresourcemanager.googleapis.com/Project, + * compute.googleapis.com/Instance + * @type string $resource + * Contains the fully qualified resource name. This field is always populated. + * ex: //cloudresourcemanager.googleapis.com/projects/foo. + * @type string $path + * Path to the target field being operated on. If the operation is at the + * resource level, then path should be "/". This field is always populated. + * @type string $source_resource + * Can be set with action 'copy' to copy resource configuration across + * different resources of the same type. Example: A resource clone can be + * done via action = 'copy', path = "/", from = "/", + * source_resource = and resource_name = . + * This field is empty for all other values of `action`. + * @type string $source_path + * Can be set with action 'copy' or 'move' to indicate the source field within + * resource or source_resource, ignored if provided for other operation types. + * @type \Google\Protobuf\Value $value + * Value for the `path` field. Will be set for actions:'add'/'replace'. + * Maybe set for action: 'test'. Either this or `value_matcher` will be set + * for 'test' operation. An exact match must be performed. + * @type \Google\Cloud\Recommender\V1\ValueMatcher $value_matcher + * Can be set for action 'test' for advanced matching for the value of + * 'path' field. Either this or `value` will be set for 'test' operation. + * @type array|\Google\Protobuf\Internal\MapField $path_filters + * Set of filters to apply if `path` refers to array elements or nested array + * elements in order to narrow down to a single unique element that is being + * tested/modified. + * This is intended to be an exact match per filter. To perform advanced + * matching, use path_value_matchers. + * * Example: + * ``` + * { + * "/versions/*/name" : "it-123" + * "/versions/*/targetSize/percent": 20 + * } + * ``` + * * Example: + * ``` + * { + * "/bindings/*/role": "roles/owner" + * "/bindings/*/condition" : null + * } + * ``` + * * Example: + * ``` + * { + * "/bindings/*/role": "roles/owner" + * "/bindings/*/members/*" : ["x@example.com", "y@example.com"] + * } + * ``` + * When both path_filters and path_value_matchers are set, an implicit AND + * must be performed. + * @type array|\Google\Protobuf\Internal\MapField $path_value_matchers + * Similar to path_filters, this contains set of filters to apply if `path` + * field refers to array elements. This is meant to support value matching + * beyond exact match. To perform exact match, use path_filters. + * When both path_filters and path_value_matchers are set, an implicit AND + * must be performed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * Type of this operation. Contains one of 'add', 'remove', 'replace', 'move', + * 'copy', 'test' and custom operations. This field is case-insensitive and + * always populated. + * + * Generated from protobuf field string action = 1; + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * Type of this operation. Contains one of 'add', 'remove', 'replace', 'move', + * 'copy', 'test' and custom operations. This field is case-insensitive and + * always populated. + * + * Generated from protobuf field string action = 1; + * @param string $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkString($var, True); + $this->action = $var; + + return $this; + } + + /** + * Type of GCP resource being modified/tested. This field is always populated. + * Example: cloudresourcemanager.googleapis.com/Project, + * compute.googleapis.com/Instance + * + * Generated from protobuf field string resource_type = 2; + * @return string + */ + public function getResourceType() + { + return $this->resource_type; + } + + /** + * Type of GCP resource being modified/tested. This field is always populated. + * Example: cloudresourcemanager.googleapis.com/Project, + * compute.googleapis.com/Instance + * + * Generated from protobuf field string resource_type = 2; + * @param string $var + * @return $this + */ + public function setResourceType($var) + { + GPBUtil::checkString($var, True); + $this->resource_type = $var; + + return $this; + } + + /** + * Contains the fully qualified resource name. This field is always populated. + * ex: //cloudresourcemanager.googleapis.com/projects/foo. + * + * Generated from protobuf field string resource = 3; + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * Contains the fully qualified resource name. This field is always populated. + * ex: //cloudresourcemanager.googleapis.com/projects/foo. + * + * Generated from protobuf field string resource = 3; + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * Path to the target field being operated on. If the operation is at the + * resource level, then path should be "/". This field is always populated. + * + * Generated from protobuf field string path = 4; + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Path to the target field being operated on. If the operation is at the + * resource level, then path should be "/". This field is always populated. + * + * Generated from protobuf field string path = 4; + * @param string $var + * @return $this + */ + public function setPath($var) + { + GPBUtil::checkString($var, True); + $this->path = $var; + + return $this; + } + + /** + * Can be set with action 'copy' to copy resource configuration across + * different resources of the same type. Example: A resource clone can be + * done via action = 'copy', path = "/", from = "/", + * source_resource = and resource_name = . + * This field is empty for all other values of `action`. + * + * Generated from protobuf field string source_resource = 5; + * @return string + */ + public function getSourceResource() + { + return $this->source_resource; + } + + /** + * Can be set with action 'copy' to copy resource configuration across + * different resources of the same type. Example: A resource clone can be + * done via action = 'copy', path = "/", from = "/", + * source_resource = and resource_name = . + * This field is empty for all other values of `action`. + * + * Generated from protobuf field string source_resource = 5; + * @param string $var + * @return $this + */ + public function setSourceResource($var) + { + GPBUtil::checkString($var, True); + $this->source_resource = $var; + + return $this; + } + + /** + * Can be set with action 'copy' or 'move' to indicate the source field within + * resource or source_resource, ignored if provided for other operation types. + * + * Generated from protobuf field string source_path = 6; + * @return string + */ + public function getSourcePath() + { + return $this->source_path; + } + + /** + * Can be set with action 'copy' or 'move' to indicate the source field within + * resource or source_resource, ignored if provided for other operation types. + * + * Generated from protobuf field string source_path = 6; + * @param string $var + * @return $this + */ + public function setSourcePath($var) + { + GPBUtil::checkString($var, True); + $this->source_path = $var; + + return $this; + } + + /** + * Value for the `path` field. Will be set for actions:'add'/'replace'. + * Maybe set for action: 'test'. Either this or `value_matcher` will be set + * for 'test' operation. An exact match must be performed. + * + * Generated from protobuf field .google.protobuf.Value value = 7; + * @return \Google\Protobuf\Value|null + */ + public function getValue() + { + return $this->readOneof(7); + } + + public function hasValue() + { + return $this->hasOneof(7); + } + + /** + * Value for the `path` field. Will be set for actions:'add'/'replace'. + * Maybe set for action: 'test'. Either this or `value_matcher` will be set + * for 'test' operation. An exact match must be performed. + * + * Generated from protobuf field .google.protobuf.Value value = 7; + * @param \Google\Protobuf\Value $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Value::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Can be set for action 'test' for advanced matching for the value of + * 'path' field. Either this or `value` will be set for 'test' operation. + * + * Generated from protobuf field .google.cloud.recommender.v1.ValueMatcher value_matcher = 10; + * @return \Google\Cloud\Recommender\V1\ValueMatcher|null + */ + public function getValueMatcher() + { + return $this->readOneof(10); + } + + public function hasValueMatcher() + { + return $this->hasOneof(10); + } + + /** + * Can be set for action 'test' for advanced matching for the value of + * 'path' field. Either this or `value` will be set for 'test' operation. + * + * Generated from protobuf field .google.cloud.recommender.v1.ValueMatcher value_matcher = 10; + * @param \Google\Cloud\Recommender\V1\ValueMatcher $var + * @return $this + */ + public function setValueMatcher($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\ValueMatcher::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Set of filters to apply if `path` refers to array elements or nested array + * elements in order to narrow down to a single unique element that is being + * tested/modified. + * This is intended to be an exact match per filter. To perform advanced + * matching, use path_value_matchers. + * * Example: + * ``` + * { + * "/versions/*/name" : "it-123" + * "/versions/*/targetSize/percent": 20 + * } + * ``` + * * Example: + * ``` + * { + * "/bindings/*/role": "roles/owner" + * "/bindings/*/condition" : null + * } + * ``` + * * Example: + * ``` + * { + * "/bindings/*/role": "roles/owner" + * "/bindings/*/members/*" : ["x@example.com", "y@example.com"] + * } + * ``` + * When both path_filters and path_value_matchers are set, an implicit AND + * must be performed. + * + * Generated from protobuf field map path_filters = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getPathFilters() + { + return $this->path_filters; + } + + /** + * Set of filters to apply if `path` refers to array elements or nested array + * elements in order to narrow down to a single unique element that is being + * tested/modified. + * This is intended to be an exact match per filter. To perform advanced + * matching, use path_value_matchers. + * * Example: + * ``` + * { + * "/versions/*/name" : "it-123" + * "/versions/*/targetSize/percent": 20 + * } + * ``` + * * Example: + * ``` + * { + * "/bindings/*/role": "roles/owner" + * "/bindings/*/condition" : null + * } + * ``` + * * Example: + * ``` + * { + * "/bindings/*/role": "roles/owner" + * "/bindings/*/members/*" : ["x@example.com", "y@example.com"] + * } + * ``` + * When both path_filters and path_value_matchers are set, an implicit AND + * must be performed. + * + * Generated from protobuf field map path_filters = 8; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setPathFilters($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); + $this->path_filters = $arr; + + return $this; + } + + /** + * Similar to path_filters, this contains set of filters to apply if `path` + * field refers to array elements. This is meant to support value matching + * beyond exact match. To perform exact match, use path_filters. + * When both path_filters and path_value_matchers are set, an implicit AND + * must be performed. + * + * Generated from protobuf field map path_value_matchers = 11; + * @return \Google\Protobuf\Internal\MapField + */ + public function getPathValueMatchers() + { + return $this->path_value_matchers; + } + + /** + * Similar to path_filters, this contains set of filters to apply if `path` + * field refers to array elements. This is meant to support value matching + * beyond exact match. To perform exact match, use path_filters. + * When both path_filters and path_value_matchers are set, an implicit AND + * must be performed. + * + * Generated from protobuf field map path_value_matchers = 11; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setPathValueMatchers($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Recommender\V1\ValueMatcher::class); + $this->path_value_matchers = $arr; + + return $this; + } + + /** + * @return string + */ + public function getPathValue() + { + return $this->whichOneof("path_value"); + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/OperationGroup.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/OperationGroup.php new file mode 100644 index 000000000000..f074d103714a --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/OperationGroup.php @@ -0,0 +1,71 @@ +google.cloud.recommender.v1.OperationGroup + */ +class OperationGroup extends \Google\Protobuf\Internal\Message +{ + /** + * List of operations across one or more resources that belong to this group. + * Loosely based on RFC6902 and should be performed in the order they appear. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Operation operations = 1; + */ + private $operations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Recommender\V1\Operation>|\Google\Protobuf\Internal\RepeatedField $operations + * List of operations across one or more resources that belong to this group. + * Loosely based on RFC6902 and should be performed in the order they appear. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * List of operations across one or more resources that belong to this group. + * Loosely based on RFC6902 and should be performed in the order they appear. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Operation operations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOperations() + { + return $this->operations; + } + + /** + * List of operations across one or more resources that belong to this group. + * Loosely based on RFC6902 and should be performed in the order they appear. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Operation operations = 1; + * @param array<\Google\Cloud\Recommender\V1\Operation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Recommender\V1\Operation::class); + $this->operations = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Recommendation.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Recommendation.php new file mode 100644 index 000000000000..0883027776d1 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Recommendation.php @@ -0,0 +1,546 @@ +google.cloud.recommender.v1.Recommendation + */ +class Recommendation extends \Google\Protobuf\Internal\Message +{ + /** + * Name of recommendation. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Free-form human readable summary in English. The maximum length is 500 + * characters. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Contains an identifier for a subtype of recommendations produced for the + * same recommender. Subtype is a function of content and impact, meaning a + * new subtype might be added when significant changes to `content` or + * `primary_impact.category` are introduced. See the Recommenders section + * to see a list of subtypes for a given Recommender. + * Examples: + * For recommender = "google.iam.policy.Recommender", + * recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE" + * + * Generated from protobuf field string recommender_subtype = 12; + */ + protected $recommender_subtype = ''; + /** + * Last time this recommendation was refreshed by the system that created it + * in the first place. + * + * Generated from protobuf field .google.protobuf.Timestamp last_refresh_time = 4; + */ + protected $last_refresh_time = null; + /** + * The primary impact that this recommendation can have while trying to + * optimize for one category. + * + * Generated from protobuf field .google.cloud.recommender.v1.Impact primary_impact = 5; + */ + protected $primary_impact = null; + /** + * Optional set of additional impact that this recommendation may have when + * trying to optimize for the primary category. These may be positive + * or negative. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Impact additional_impact = 6; + */ + private $additional_impact; + /** + * Recommendation's priority. + * + * Generated from protobuf field .google.cloud.recommender.v1.Recommendation.Priority priority = 17; + */ + protected $priority = 0; + /** + * Content of the recommendation describing recommended changes to resources. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommendationContent content = 7; + */ + protected $content = null; + /** + * Information for state. Contains state and metadata. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommendationStateInfo state_info = 10; + */ + protected $state_info = null; + /** + * Fingerprint of the Recommendation. Provides optimistic locking when + * updating states. + * + * Generated from protobuf field string etag = 11; + */ + protected $etag = ''; + /** + * Insights that led to this recommendation. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Recommendation.InsightReference associated_insights = 14; + */ + private $associated_insights; + /** + * Corresponds to a mutually exclusive group ID within a recommender. + * A non-empty ID indicates that the recommendation belongs to a mutually + * exclusive group. This means that only one recommendation within the group + * is suggested to be applied. + * + * Generated from protobuf field string xor_group_id = 18; + */ + protected $xor_group_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of recommendation. + * @type string $description + * Free-form human readable summary in English. The maximum length is 500 + * characters. + * @type string $recommender_subtype + * Contains an identifier for a subtype of recommendations produced for the + * same recommender. Subtype is a function of content and impact, meaning a + * new subtype might be added when significant changes to `content` or + * `primary_impact.category` are introduced. See the Recommenders section + * to see a list of subtypes for a given Recommender. + * Examples: + * For recommender = "google.iam.policy.Recommender", + * recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE" + * @type \Google\Protobuf\Timestamp $last_refresh_time + * Last time this recommendation was refreshed by the system that created it + * in the first place. + * @type \Google\Cloud\Recommender\V1\Impact $primary_impact + * The primary impact that this recommendation can have while trying to + * optimize for one category. + * @type array<\Google\Cloud\Recommender\V1\Impact>|\Google\Protobuf\Internal\RepeatedField $additional_impact + * Optional set of additional impact that this recommendation may have when + * trying to optimize for the primary category. These may be positive + * or negative. + * @type int $priority + * Recommendation's priority. + * @type \Google\Cloud\Recommender\V1\RecommendationContent $content + * Content of the recommendation describing recommended changes to resources. + * @type \Google\Cloud\Recommender\V1\RecommendationStateInfo $state_info + * Information for state. Contains state and metadata. + * @type string $etag + * Fingerprint of the Recommendation. Provides optimistic locking when + * updating states. + * @type array<\Google\Cloud\Recommender\V1\Recommendation\InsightReference>|\Google\Protobuf\Internal\RepeatedField $associated_insights + * Insights that led to this recommendation. + * @type string $xor_group_id + * Corresponds to a mutually exclusive group ID within a recommender. + * A non-empty ID indicates that the recommendation belongs to a mutually + * exclusive group. This means that only one recommendation within the group + * is suggested to be applied. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * Name of recommendation. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of recommendation. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Free-form human readable summary in English. The maximum length is 500 + * characters. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Free-form human readable summary in English. The maximum length is 500 + * characters. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Contains an identifier for a subtype of recommendations produced for the + * same recommender. Subtype is a function of content and impact, meaning a + * new subtype might be added when significant changes to `content` or + * `primary_impact.category` are introduced. See the Recommenders section + * to see a list of subtypes for a given Recommender. + * Examples: + * For recommender = "google.iam.policy.Recommender", + * recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE" + * + * Generated from protobuf field string recommender_subtype = 12; + * @return string + */ + public function getRecommenderSubtype() + { + return $this->recommender_subtype; + } + + /** + * Contains an identifier for a subtype of recommendations produced for the + * same recommender. Subtype is a function of content and impact, meaning a + * new subtype might be added when significant changes to `content` or + * `primary_impact.category` are introduced. See the Recommenders section + * to see a list of subtypes for a given Recommender. + * Examples: + * For recommender = "google.iam.policy.Recommender", + * recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE" + * + * Generated from protobuf field string recommender_subtype = 12; + * @param string $var + * @return $this + */ + public function setRecommenderSubtype($var) + { + GPBUtil::checkString($var, True); + $this->recommender_subtype = $var; + + return $this; + } + + /** + * Last time this recommendation was refreshed by the system that created it + * in the first place. + * + * Generated from protobuf field .google.protobuf.Timestamp last_refresh_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastRefreshTime() + { + return $this->last_refresh_time; + } + + public function hasLastRefreshTime() + { + return isset($this->last_refresh_time); + } + + public function clearLastRefreshTime() + { + unset($this->last_refresh_time); + } + + /** + * Last time this recommendation was refreshed by the system that created it + * in the first place. + * + * Generated from protobuf field .google.protobuf.Timestamp last_refresh_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastRefreshTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_refresh_time = $var; + + return $this; + } + + /** + * The primary impact that this recommendation can have while trying to + * optimize for one category. + * + * Generated from protobuf field .google.cloud.recommender.v1.Impact primary_impact = 5; + * @return \Google\Cloud\Recommender\V1\Impact|null + */ + public function getPrimaryImpact() + { + return $this->primary_impact; + } + + public function hasPrimaryImpact() + { + return isset($this->primary_impact); + } + + public function clearPrimaryImpact() + { + unset($this->primary_impact); + } + + /** + * The primary impact that this recommendation can have while trying to + * optimize for one category. + * + * Generated from protobuf field .google.cloud.recommender.v1.Impact primary_impact = 5; + * @param \Google\Cloud\Recommender\V1\Impact $var + * @return $this + */ + public function setPrimaryImpact($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\Impact::class); + $this->primary_impact = $var; + + return $this; + } + + /** + * Optional set of additional impact that this recommendation may have when + * trying to optimize for the primary category. These may be positive + * or negative. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Impact additional_impact = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdditionalImpact() + { + return $this->additional_impact; + } + + /** + * Optional set of additional impact that this recommendation may have when + * trying to optimize for the primary category. These may be positive + * or negative. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Impact additional_impact = 6; + * @param array<\Google\Cloud\Recommender\V1\Impact>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdditionalImpact($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Recommender\V1\Impact::class); + $this->additional_impact = $arr; + + return $this; + } + + /** + * Recommendation's priority. + * + * Generated from protobuf field .google.cloud.recommender.v1.Recommendation.Priority priority = 17; + * @return int + */ + public function getPriority() + { + return $this->priority; + } + + /** + * Recommendation's priority. + * + * Generated from protobuf field .google.cloud.recommender.v1.Recommendation.Priority priority = 17; + * @param int $var + * @return $this + */ + public function setPriority($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Recommender\V1\Recommendation\Priority::class); + $this->priority = $var; + + return $this; + } + + /** + * Content of the recommendation describing recommended changes to resources. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommendationContent content = 7; + * @return \Google\Cloud\Recommender\V1\RecommendationContent|null + */ + public function getContent() + { + return $this->content; + } + + public function hasContent() + { + return isset($this->content); + } + + public function clearContent() + { + unset($this->content); + } + + /** + * Content of the recommendation describing recommended changes to resources. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommendationContent content = 7; + * @param \Google\Cloud\Recommender\V1\RecommendationContent $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\RecommendationContent::class); + $this->content = $var; + + return $this; + } + + /** + * Information for state. Contains state and metadata. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommendationStateInfo state_info = 10; + * @return \Google\Cloud\Recommender\V1\RecommendationStateInfo|null + */ + public function getStateInfo() + { + return $this->state_info; + } + + public function hasStateInfo() + { + return isset($this->state_info); + } + + public function clearStateInfo() + { + unset($this->state_info); + } + + /** + * Information for state. Contains state and metadata. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommendationStateInfo state_info = 10; + * @param \Google\Cloud\Recommender\V1\RecommendationStateInfo $var + * @return $this + */ + public function setStateInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\RecommendationStateInfo::class); + $this->state_info = $var; + + return $this; + } + + /** + * Fingerprint of the Recommendation. Provides optimistic locking when + * updating states. + * + * Generated from protobuf field string etag = 11; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Fingerprint of the Recommendation. Provides optimistic locking when + * updating states. + * + * Generated from protobuf field string etag = 11; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Insights that led to this recommendation. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Recommendation.InsightReference associated_insights = 14; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAssociatedInsights() + { + return $this->associated_insights; + } + + /** + * Insights that led to this recommendation. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.Recommendation.InsightReference associated_insights = 14; + * @param array<\Google\Cloud\Recommender\V1\Recommendation\InsightReference>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAssociatedInsights($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Recommender\V1\Recommendation\InsightReference::class); + $this->associated_insights = $arr; + + return $this; + } + + /** + * Corresponds to a mutually exclusive group ID within a recommender. + * A non-empty ID indicates that the recommendation belongs to a mutually + * exclusive group. This means that only one recommendation within the group + * is suggested to be applied. + * + * Generated from protobuf field string xor_group_id = 18; + * @return string + */ + public function getXorGroupId() + { + return $this->xor_group_id; + } + + /** + * Corresponds to a mutually exclusive group ID within a recommender. + * A non-empty ID indicates that the recommendation belongs to a mutually + * exclusive group. This means that only one recommendation within the group + * is suggested to be applied. + * + * Generated from protobuf field string xor_group_id = 18; + * @param string $var + * @return $this + */ + public function setXorGroupId($var) + { + GPBUtil::checkString($var, True); + $this->xor_group_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Recommendation/InsightReference.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Recommendation/InsightReference.php new file mode 100644 index 000000000000..bbf72313b89d --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Recommendation/InsightReference.php @@ -0,0 +1,74 @@ +google.cloud.recommender.v1.Recommendation.InsightReference + */ +class InsightReference extends \Google\Protobuf\Internal\Message +{ + /** + * Insight resource name, e.g. + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ID] + * + * Generated from protobuf field string insight = 1; + */ + protected $insight = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $insight + * Insight resource name, e.g. + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ID] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * Insight resource name, e.g. + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ID] + * + * Generated from protobuf field string insight = 1; + * @return string + */ + public function getInsight() + { + return $this->insight; + } + + /** + * Insight resource name, e.g. + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ID] + * + * Generated from protobuf field string insight = 1; + * @param string $var + * @return $this + */ + public function setInsight($var) + { + GPBUtil::checkString($var, True); + $this->insight = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InsightReference::class, \Google\Cloud\Recommender\V1\Recommendation_InsightReference::class); + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Recommendation/Priority.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Recommendation/Priority.php new file mode 100644 index 000000000000..0077380a5659 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/Recommendation/Priority.php @@ -0,0 +1,78 @@ +google.cloud.recommender.v1.Recommendation.Priority + */ +class Priority +{ + /** + * Recommendation has unspecified priority. + * + * Generated from protobuf enum PRIORITY_UNSPECIFIED = 0; + */ + const PRIORITY_UNSPECIFIED = 0; + /** + * Recommendation has P4 priority (lowest priority). + * + * Generated from protobuf enum P4 = 1; + */ + const P4 = 1; + /** + * Recommendation has P3 priority (second lowest priority). + * + * Generated from protobuf enum P3 = 2; + */ + const P3 = 2; + /** + * Recommendation has P2 priority (second highest priority). + * + * Generated from protobuf enum P2 = 3; + */ + const P2 = 3; + /** + * Recommendation has P1 priority (highest priority). + * + * Generated from protobuf enum P1 = 4; + */ + const P1 = 4; + + private static $valueToName = [ + self::PRIORITY_UNSPECIFIED => 'PRIORITY_UNSPECIFIED', + self::P4 => 'P4', + self::P3 => 'P3', + self::P2 => 'P2', + self::P1 => 'P1', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Priority::class, \Google\Cloud\Recommender\V1\Recommendation_Priority::class); + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommendationContent.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommendationContent.php new file mode 100644 index 000000000000..8f9bc53a3a93 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommendationContent.php @@ -0,0 +1,119 @@ +google.cloud.recommender.v1.RecommendationContent + */ +class RecommendationContent extends \Google\Protobuf\Internal\Message +{ + /** + * Operations to one or more Google Cloud resources grouped in such a way + * that, all operations within one group are expected to be performed + * atomically and in an order. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.OperationGroup operation_groups = 2; + */ + private $operation_groups; + /** + * Condensed overview information about the recommendation. + * + * Generated from protobuf field .google.protobuf.Struct overview = 3; + */ + protected $overview = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Recommender\V1\OperationGroup>|\Google\Protobuf\Internal\RepeatedField $operation_groups + * Operations to one or more Google Cloud resources grouped in such a way + * that, all operations within one group are expected to be performed + * atomically and in an order. + * @type \Google\Protobuf\Struct $overview + * Condensed overview information about the recommendation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * Operations to one or more Google Cloud resources grouped in such a way + * that, all operations within one group are expected to be performed + * atomically and in an order. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.OperationGroup operation_groups = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOperationGroups() + { + return $this->operation_groups; + } + + /** + * Operations to one or more Google Cloud resources grouped in such a way + * that, all operations within one group are expected to be performed + * atomically and in an order. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.OperationGroup operation_groups = 2; + * @param array<\Google\Cloud\Recommender\V1\OperationGroup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOperationGroups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Recommender\V1\OperationGroup::class); + $this->operation_groups = $arr; + + return $this; + } + + /** + * Condensed overview information about the recommendation. + * + * Generated from protobuf field .google.protobuf.Struct overview = 3; + * @return \Google\Protobuf\Struct|null + */ + public function getOverview() + { + return $this->overview; + } + + public function hasOverview() + { + return isset($this->overview); + } + + public function clearOverview() + { + unset($this->overview); + } + + /** + * Condensed overview information about the recommendation. + * + * Generated from protobuf field .google.protobuf.Struct overview = 3; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setOverview($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->overview = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommendationStateInfo.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommendationStateInfo.php new file mode 100644 index 000000000000..af3d2fa1cc79 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommendationStateInfo.php @@ -0,0 +1,101 @@ +google.cloud.recommender.v1.RecommendationStateInfo + */ +class RecommendationStateInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the recommendation, Eg ACTIVE, SUCCEEDED, FAILED. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommendationStateInfo.State state = 1; + */ + protected $state = 0; + /** + * A map of metadata for the state, provided by user or automations systems. + * + * Generated from protobuf field map state_metadata = 2; + */ + private $state_metadata; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the recommendation, Eg ACTIVE, SUCCEEDED, FAILED. + * @type array|\Google\Protobuf\Internal\MapField $state_metadata + * A map of metadata for the state, provided by user or automations systems. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * The state of the recommendation, Eg ACTIVE, SUCCEEDED, FAILED. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommendationStateInfo.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the recommendation, Eg ACTIVE, SUCCEEDED, FAILED. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommendationStateInfo.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Recommender\V1\RecommendationStateInfo\State::class); + $this->state = $var; + + return $this; + } + + /** + * A map of metadata for the state, provided by user or automations systems. + * + * Generated from protobuf field map state_metadata = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getStateMetadata() + { + return $this->state_metadata; + } + + /** + * A map of metadata for the state, provided by user or automations systems. + * + * Generated from protobuf field map state_metadata = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setStateMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->state_metadata = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommendationStateInfo/State.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommendationStateInfo/State.php new file mode 100644 index 000000000000..4813573e86d2 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommendationStateInfo/State.php @@ -0,0 +1,95 @@ +google.cloud.recommender.v1.RecommendationStateInfo.State + */ +class State +{ + /** + * Default state. Don't use directly. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Recommendation is active and can be applied. Recommendations content can + * be updated by Google. + * ACTIVE recommendations can be marked as CLAIMED, SUCCEEDED, or FAILED. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Recommendation is in claimed state. Recommendations content is + * immutable and cannot be updated by Google. + * CLAIMED recommendations can be marked as CLAIMED, SUCCEEDED, or FAILED. + * + * Generated from protobuf enum CLAIMED = 6; + */ + const CLAIMED = 6; + /** + * Recommendation is in succeeded state. Recommendations content is + * immutable and cannot be updated by Google. + * SUCCEEDED recommendations can be marked as SUCCEEDED, or FAILED. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * Recommendation is in failed state. Recommendations content is immutable + * and cannot be updated by Google. + * FAILED recommendations can be marked as SUCCEEDED, or FAILED. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * Recommendation is in dismissed state. Recommendation content can be + * updated by Google. + * DISMISSED recommendations can be marked as ACTIVE. + * + * Generated from protobuf enum DISMISSED = 5; + */ + const DISMISSED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CLAIMED => 'CLAIMED', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::DISMISSED => 'DISMISSED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Recommender\V1\RecommendationStateInfo_State::class); + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommenderConfig.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommenderConfig.php new file mode 100644 index 000000000000..8e6b676d2551 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommenderConfig.php @@ -0,0 +1,347 @@ +google.cloud.recommender.v1.RecommenderConfig + */ +class RecommenderConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Name of recommender config. + * Eg, + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * RecommenderGenerationConfig which configures the Generation of + * recommendations for this recommender. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommenderGenerationConfig recommender_generation_config = 2; + */ + protected $recommender_generation_config = null; + /** + * Fingerprint of the RecommenderConfig. Provides optimistic locking when + * updating. + * + * Generated from protobuf field string etag = 3; + */ + protected $etag = ''; + /** + * Last time when the config was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + protected $update_time = null; + /** + * Output only. Immutable. The revision ID of the config. + * A new revision is committed whenever the config is changed in any way. + * The format is an 8-character hexadecimal string. + * + * Generated from protobuf field string revision_id = 5 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision_id = ''; + /** + * Allows clients to store small amounts of arbitrary data. Annotations must + * follow the Kubernetes syntax. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 6; + */ + private $annotations; + /** + * A user-settable field to provide a human-readable name to be used in user + * interfaces. + * + * Generated from protobuf field string display_name = 7; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of recommender config. + * Eg, + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config + * @type \Google\Cloud\Recommender\V1\RecommenderGenerationConfig $recommender_generation_config + * RecommenderGenerationConfig which configures the Generation of + * recommendations for this recommender. + * @type string $etag + * Fingerprint of the RecommenderConfig. Provides optimistic locking when + * updating. + * @type \Google\Protobuf\Timestamp $update_time + * Last time when the config was updated. + * @type string $revision_id + * Output only. Immutable. The revision ID of the config. + * A new revision is committed whenever the config is changed in any way. + * The format is an 8-character hexadecimal string. + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Allows clients to store small amounts of arbitrary data. Annotations must + * follow the Kubernetes syntax. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * @type string $display_name + * A user-settable field to provide a human-readable name to be used in user + * interfaces. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderConfig::initOnce(); + parent::__construct($data); + } + + /** + * Name of recommender config. + * Eg, + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of recommender config. + * Eg, + * projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * RecommenderGenerationConfig which configures the Generation of + * recommendations for this recommender. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommenderGenerationConfig recommender_generation_config = 2; + * @return \Google\Cloud\Recommender\V1\RecommenderGenerationConfig|null + */ + public function getRecommenderGenerationConfig() + { + return $this->recommender_generation_config; + } + + public function hasRecommenderGenerationConfig() + { + return isset($this->recommender_generation_config); + } + + public function clearRecommenderGenerationConfig() + { + unset($this->recommender_generation_config); + } + + /** + * RecommenderGenerationConfig which configures the Generation of + * recommendations for this recommender. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommenderGenerationConfig recommender_generation_config = 2; + * @param \Google\Cloud\Recommender\V1\RecommenderGenerationConfig $var + * @return $this + */ + public function setRecommenderGenerationConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\RecommenderGenerationConfig::class); + $this->recommender_generation_config = $var; + + return $this; + } + + /** + * Fingerprint of the RecommenderConfig. Provides optimistic locking when + * updating. + * + * Generated from protobuf field string etag = 3; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Fingerprint of the RecommenderConfig. Provides optimistic locking when + * updating. + * + * Generated from protobuf field string etag = 3; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Last time when the config was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Last time when the config was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. Immutable. The revision ID of the config. + * A new revision is committed whenever the config is changed in any way. + * The format is an 8-character hexadecimal string. + * + * Generated from protobuf field string revision_id = 5 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRevisionId() + { + return $this->revision_id; + } + + /** + * Output only. Immutable. The revision ID of the config. + * A new revision is committed whenever the config is changed in any way. + * The format is an 8-character hexadecimal string. + * + * Generated from protobuf field string revision_id = 5 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->revision_id = $var; + + return $this; + } + + /** + * Allows clients to store small amounts of arbitrary data. Annotations must + * follow the Kubernetes syntax. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Allows clients to store small amounts of arbitrary data. Annotations must + * follow the Kubernetes syntax. + * The total size of all keys and values combined is limited to 256k. + * Key can have 2 segments: prefix (optional) and name (required), + * separated by a slash (/). + * Prefix must be a DNS subdomain. + * Name must be 63 characters or less, begin and end with alphanumerics, + * with dashes (-), underscores (_), dots (.), and alphanumerics between. + * + * Generated from protobuf field map annotations = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * A user-settable field to provide a human-readable name to be used in user + * interfaces. + * + * Generated from protobuf field string display_name = 7; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * A user-settable field to provide a human-readable name to be used in user + * interfaces. + * + * Generated from protobuf field string display_name = 7; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommenderGenerationConfig.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommenderGenerationConfig.php new file mode 100644 index 000000000000..7c2e642c0a83 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/RecommenderGenerationConfig.php @@ -0,0 +1,83 @@ +google.cloud.recommender.v1.RecommenderGenerationConfig + */ +class RecommenderGenerationConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Parameters for this RecommenderGenerationConfig. These configs can be used + * by or are applied to all subtypes. + * + * Generated from protobuf field .google.protobuf.Struct params = 1; + */ + protected $params = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Struct $params + * Parameters for this RecommenderGenerationConfig. These configs can be used + * by or are applied to all subtypes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderConfig::initOnce(); + parent::__construct($data); + } + + /** + * Parameters for this RecommenderGenerationConfig. These configs can be used + * by or are applied to all subtypes. + * + * Generated from protobuf field .google.protobuf.Struct params = 1; + * @return \Google\Protobuf\Struct|null + */ + public function getParams() + { + return $this->params; + } + + public function hasParams() + { + return isset($this->params); + } + + public function clearParams() + { + unset($this->params); + } + + /** + * Parameters for this RecommenderGenerationConfig. These configs can be used + * by or are applied to all subtypes. + * + * Generated from protobuf field .google.protobuf.Struct params = 1; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setParams($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->params = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ReliabilityProjection.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ReliabilityProjection.php new file mode 100644 index 000000000000..10f00f46f499 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ReliabilityProjection.php @@ -0,0 +1,111 @@ +google.cloud.recommender.v1.ReliabilityProjection + */ +class ReliabilityProjection extends \Google\Protobuf\Internal\Message +{ + /** + * Reliability risks mitigated by this recommendation. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + */ + private $risks; + /** + * Per-recommender projection. + * + * Generated from protobuf field .google.protobuf.Struct details = 2; + */ + protected $details = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $risks + * Reliability risks mitigated by this recommendation. + * @type \Google\Protobuf\Struct $details + * Per-recommender projection. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * Reliability risks mitigated by this recommendation. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRisks() + { + return $this->risks; + } + + /** + * Reliability risks mitigated by this recommendation. + * + * Generated from protobuf field repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRisks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Recommender\V1\ReliabilityProjection\RiskType::class); + $this->risks = $arr; + + return $this; + } + + /** + * Per-recommender projection. + * + * Generated from protobuf field .google.protobuf.Struct details = 2; + * @return \Google\Protobuf\Struct|null + */ + public function getDetails() + { + return $this->details; + } + + public function hasDetails() + { + return isset($this->details); + } + + public function clearDetails() + { + unset($this->details); + } + + /** + * Per-recommender projection. + * + * Generated from protobuf field .google.protobuf.Struct details = 2; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->details = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ReliabilityProjection/RiskType.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ReliabilityProjection/RiskType.php new file mode 100644 index 000000000000..3f37986fd3a7 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ReliabilityProjection/RiskType.php @@ -0,0 +1,72 @@ +google.cloud.recommender.v1.ReliabilityProjection.RiskType + */ +class RiskType +{ + /** + * Default unspecified risk. Don't use directly. + * + * Generated from protobuf enum RISK_TYPE_UNSPECIFIED = 0; + */ + const RISK_TYPE_UNSPECIFIED = 0; + /** + * Potential service downtime. + * + * Generated from protobuf enum SERVICE_DISRUPTION = 1; + */ + const SERVICE_DISRUPTION = 1; + /** + * Potential data loss. + * + * Generated from protobuf enum DATA_LOSS = 2; + */ + const DATA_LOSS = 2; + /** + * Potential access denial. The service is still up but some or all clients + * can't access it. + * + * Generated from protobuf enum ACCESS_DENY = 3; + */ + const ACCESS_DENY = 3; + + private static $valueToName = [ + self::RISK_TYPE_UNSPECIFIED => 'RISK_TYPE_UNSPECIFIED', + self::SERVICE_DISRUPTION => 'SERVICE_DISRUPTION', + self::DATA_LOSS => 'DATA_LOSS', + self::ACCESS_DENY => 'ACCESS_DENY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RiskType::class, \Google\Cloud\Recommender\V1\ReliabilityProjection_RiskType::class); + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/SecurityProjection.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/SecurityProjection.php new file mode 100644 index 000000000000..dffe739191c5 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/SecurityProjection.php @@ -0,0 +1,77 @@ +google.cloud.recommender.v1.SecurityProjection + */ +class SecurityProjection extends \Google\Protobuf\Internal\Message +{ + /** + * Additional security impact details that is provided by the recommender. + * + * Generated from protobuf field .google.protobuf.Struct details = 2; + */ + protected $details = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Struct $details + * Additional security impact details that is provided by the recommender. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * Additional security impact details that is provided by the recommender. + * + * Generated from protobuf field .google.protobuf.Struct details = 2; + * @return \Google\Protobuf\Struct|null + */ + public function getDetails() + { + return $this->details; + } + + public function hasDetails() + { + return isset($this->details); + } + + public function clearDetails() + { + unset($this->details); + } + + /** + * Additional security impact details that is provided by the recommender. + * + * Generated from protobuf field .google.protobuf.Struct details = 2; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->details = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/SustainabilityProjection.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/SustainabilityProjection.php new file mode 100644 index 000000000000..a1d4678563e6 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/SustainabilityProjection.php @@ -0,0 +1,116 @@ +google.cloud.recommender.v1.SustainabilityProjection + */ +class SustainabilityProjection extends \Google\Protobuf\Internal\Message +{ + /** + * Carbon Footprint generated in kg of CO2 equivalent. + * Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e). + * + * Generated from protobuf field double kg_c_o2e = 1; + */ + protected $kg_c_o2e = 0.0; + /** + * Duration for which this sustainability applies. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + */ + protected $duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $kg_c_o2e + * Carbon Footprint generated in kg of CO2 equivalent. + * Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e). + * @type \Google\Protobuf\Duration $duration + * Duration for which this sustainability applies. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * Carbon Footprint generated in kg of CO2 equivalent. + * Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e). + * + * Generated from protobuf field double kg_c_o2e = 1; + * @return float + */ + public function getKgCO2E() + { + return $this->kg_c_o2e; + } + + /** + * Carbon Footprint generated in kg of CO2 equivalent. + * Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e). + * + * Generated from protobuf field double kg_c_o2e = 1; + * @param float $var + * @return $this + */ + public function setKgCO2E($var) + { + GPBUtil::checkDouble($var); + $this->kg_c_o2e = $var; + + return $this; + } + + /** + * Duration for which this sustainability applies. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration for which this sustainability applies. + * + * Generated from protobuf field .google.protobuf.Duration duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/UpdateInsightTypeConfigRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/UpdateInsightTypeConfigRequest.php new file mode 100644 index 000000000000..6c402f186c4c --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/UpdateInsightTypeConfigRequest.php @@ -0,0 +1,174 @@ +google.cloud.recommender.v1.UpdateInsightTypeConfigRequest + */ +class UpdateInsightTypeConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The InsightTypeConfig to update. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightTypeConfig insight_type_config = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $insight_type_config = null; + /** + * The list of fields to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + /** + * If true, validate the request and preview the change, but do not actually + * update it. + * + * Generated from protobuf field bool validate_only = 3; + */ + protected $validate_only = false; + + /** + * @param \Google\Cloud\Recommender\V1\InsightTypeConfig $insightTypeConfig Required. The InsightTypeConfig to update. + * @param \Google\Protobuf\FieldMask $updateMask The list of fields to be updated. + * + * @return \Google\Cloud\Recommender\V1\UpdateInsightTypeConfigRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Recommender\V1\InsightTypeConfig $insightTypeConfig, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setInsightTypeConfig($insightTypeConfig) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Recommender\V1\InsightTypeConfig $insight_type_config + * Required. The InsightTypeConfig to update. + * @type \Google\Protobuf\FieldMask $update_mask + * The list of fields to be updated. + * @type bool $validate_only + * If true, validate the request and preview the change, but do not actually + * update it. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The InsightTypeConfig to update. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightTypeConfig insight_type_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Recommender\V1\InsightTypeConfig|null + */ + public function getInsightTypeConfig() + { + return $this->insight_type_config; + } + + public function hasInsightTypeConfig() + { + return isset($this->insight_type_config); + } + + public function clearInsightTypeConfig() + { + unset($this->insight_type_config); + } + + /** + * Required. The InsightTypeConfig to update. + * + * Generated from protobuf field .google.cloud.recommender.v1.InsightTypeConfig insight_type_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Recommender\V1\InsightTypeConfig $var + * @return $this + */ + public function setInsightTypeConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\InsightTypeConfig::class); + $this->insight_type_config = $var; + + return $this; + } + + /** + * The list of fields to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The list of fields to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * If true, validate the request and preview the change, but do not actually + * update it. + * + * Generated from protobuf field bool validate_only = 3; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If true, validate the request and preview the change, but do not actually + * update it. + * + * Generated from protobuf field bool validate_only = 3; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/UpdateRecommenderConfigRequest.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/UpdateRecommenderConfigRequest.php new file mode 100644 index 000000000000..9977e4f6feff --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/UpdateRecommenderConfigRequest.php @@ -0,0 +1,174 @@ +google.cloud.recommender.v1.UpdateRecommenderConfigRequest + */ +class UpdateRecommenderConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The RecommenderConfig to update. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommenderConfig recommender_config = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $recommender_config = null; + /** + * The list of fields to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + /** + * If true, validate the request and preview the change, but do not actually + * update it. + * + * Generated from protobuf field bool validate_only = 3; + */ + protected $validate_only = false; + + /** + * @param \Google\Cloud\Recommender\V1\RecommenderConfig $recommenderConfig Required. The RecommenderConfig to update. + * @param \Google\Protobuf\FieldMask $updateMask The list of fields to be updated. + * + * @return \Google\Cloud\Recommender\V1\UpdateRecommenderConfigRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Recommender\V1\RecommenderConfig $recommenderConfig, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setRecommenderConfig($recommenderConfig) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Recommender\V1\RecommenderConfig $recommender_config + * Required. The RecommenderConfig to update. + * @type \Google\Protobuf\FieldMask $update_mask + * The list of fields to be updated. + * @type bool $validate_only + * If true, validate the request and preview the change, but do not actually + * update it. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\RecommenderService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The RecommenderConfig to update. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommenderConfig recommender_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Recommender\V1\RecommenderConfig|null + */ + public function getRecommenderConfig() + { + return $this->recommender_config; + } + + public function hasRecommenderConfig() + { + return isset($this->recommender_config); + } + + public function clearRecommenderConfig() + { + unset($this->recommender_config); + } + + /** + * Required. The RecommenderConfig to update. + * + * Generated from protobuf field .google.cloud.recommender.v1.RecommenderConfig recommender_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Recommender\V1\RecommenderConfig $var + * @return $this + */ + public function setRecommenderConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Recommender\V1\RecommenderConfig::class); + $this->recommender_config = $var; + + return $this; + } + + /** + * The list of fields to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The list of fields to be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * If true, validate the request and preview the change, but do not actually + * update it. + * + * Generated from protobuf field bool validate_only = 3; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * If true, validate the request and preview the change, but do not actually + * update it. + * + * Generated from protobuf field bool validate_only = 3; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ValueMatcher.php b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ValueMatcher.php new file mode 100644 index 000000000000..eac350eddd64 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/proto/src/Google/Cloud/Recommender/V1/ValueMatcher.php @@ -0,0 +1,81 @@ +google.cloud.recommender.v1.ValueMatcher + */ +class ValueMatcher extends \Google\Protobuf\Internal\Message +{ + protected $match_variant; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $matches_pattern + * To be used for full regex matching. The regular expression is using the + * Google RE2 syntax (https://github.com/google/re2/wiki/Syntax), so to be + * used with RE2::FullMatch + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Recommender\V1\Recommendation::initOnce(); + parent::__construct($data); + } + + /** + * To be used for full regex matching. The regular expression is using the + * Google RE2 syntax (https://github.com/google/re2/wiki/Syntax), so to be + * used with RE2::FullMatch + * + * Generated from protobuf field string matches_pattern = 1; + * @return string + */ + public function getMatchesPattern() + { + return $this->readOneof(1); + } + + public function hasMatchesPattern() + { + return $this->hasOneof(1); + } + + /** + * To be used for full regex matching. The regular expression is using the + * Google RE2 syntax (https://github.com/google/re2/wiki/Syntax), so to be + * used with RE2::FullMatch + * + * Generated from protobuf field string matches_pattern = 1; + * @param string $var + * @return $this + */ + public function setMatchesPattern($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getMatchVariant() + { + return $this->whichOneof("match_variant"); + } + +} + diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_insight.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_insight.php new file mode 100644 index 000000000000..5c502b5e1b7b --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_insight.php @@ -0,0 +1,72 @@ +getInsight($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = RecommenderClient::insightName( + '[PROJECT]', + '[LOCATION]', + '[INSIGHT_TYPE]', + '[INSIGHT]' + ); + + get_insight_sample($formattedName); +} +// [END recommender_v1_generated_Recommender_GetInsight_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_insight_type_config.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_insight_type_config.php new file mode 100644 index 000000000000..7fb4e53aee22 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_insight_type_config.php @@ -0,0 +1,81 @@ +getInsightTypeConfig($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = RecommenderClient::insightTypeConfigName( + '[PROJECT]', + '[LOCATION]', + '[INSIGHT_TYPE]' + ); + + get_insight_type_config_sample($formattedName); +} +// [END recommender_v1_generated_Recommender_GetInsightTypeConfig_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_recommendation.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_recommendation.php new file mode 100644 index 000000000000..261705b1f737 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_recommendation.php @@ -0,0 +1,72 @@ +getRecommendation($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = RecommenderClient::recommendationName( + '[PROJECT]', + '[LOCATION]', + '[RECOMMENDER]', + '[RECOMMENDATION]' + ); + + get_recommendation_sample($formattedName); +} +// [END recommender_v1_generated_Recommender_GetRecommendation_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_recommender_config.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_recommender_config.php new file mode 100644 index 000000000000..cb5294a103d8 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/get_recommender_config.php @@ -0,0 +1,81 @@ +getRecommenderConfig($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = RecommenderClient::recommenderConfigName( + '[PROJECT]', + '[LOCATION]', + '[RECOMMENDER]' + ); + + get_recommender_config_sample($formattedName); +} +// [END recommender_v1_generated_Recommender_GetRecommenderConfig_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/list_insights.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/list_insights.php new file mode 100644 index 000000000000..660b2ab3e744 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/list_insights.php @@ -0,0 +1,88 @@ +listInsights($formattedParent); + + /** @var Insight $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = RecommenderClient::insightTypeName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + + list_insights_sample($formattedParent); +} +// [END recommender_v1_generated_Recommender_ListInsights_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/list_recommendations.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/list_recommendations.php new file mode 100644 index 000000000000..956fe8c23c1e --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/list_recommendations.php @@ -0,0 +1,88 @@ +listRecommendations($formattedParent); + + /** @var Recommendation $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = RecommenderClient::recommenderName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + + list_recommendations_sample($formattedParent); +} +// [END recommender_v1_generated_Recommender_ListRecommendations_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_insight_accepted.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_insight_accepted.php new file mode 100644 index 000000000000..f0cc08eb2b59 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_insight_accepted.php @@ -0,0 +1,78 @@ +markInsightAccepted($formattedName, $etag); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = RecommenderClient::insightName( + '[PROJECT]', + '[LOCATION]', + '[INSIGHT_TYPE]', + '[INSIGHT]' + ); + $etag = '[ETAG]'; + + mark_insight_accepted_sample($formattedName, $etag); +} +// [END recommender_v1_generated_Recommender_MarkInsightAccepted_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_claimed.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_claimed.php new file mode 100644 index 000000000000..e40aecdd3327 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_claimed.php @@ -0,0 +1,82 @@ +markRecommendationClaimed($formattedName, $etag); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = RecommenderClient::recommendationName( + '[PROJECT]', + '[LOCATION]', + '[RECOMMENDER]', + '[RECOMMENDATION]' + ); + $etag = '[ETAG]'; + + mark_recommendation_claimed_sample($formattedName, $etag); +} +// [END recommender_v1_generated_Recommender_MarkRecommendationClaimed_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_dismissed.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_dismissed.php new file mode 100644 index 000000000000..e0abf3faa2bc --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_dismissed.php @@ -0,0 +1,79 @@ +markRecommendationDismissed($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = RecommenderClient::recommendationName( + '[PROJECT]', + '[LOCATION]', + '[RECOMMENDER]', + '[RECOMMENDATION]' + ); + + mark_recommendation_dismissed_sample($formattedName); +} +// [END recommender_v1_generated_Recommender_MarkRecommendationDismissed_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_failed.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_failed.php new file mode 100644 index 000000000000..d5b860a3002a --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_failed.php @@ -0,0 +1,83 @@ +markRecommendationFailed($formattedName, $etag); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = RecommenderClient::recommendationName( + '[PROJECT]', + '[LOCATION]', + '[RECOMMENDER]', + '[RECOMMENDATION]' + ); + $etag = '[ETAG]'; + + mark_recommendation_failed_sample($formattedName, $etag); +} +// [END recommender_v1_generated_Recommender_MarkRecommendationFailed_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_succeeded.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_succeeded.php new file mode 100644 index 000000000000..818360175e54 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/mark_recommendation_succeeded.php @@ -0,0 +1,83 @@ +markRecommendationSucceeded($formattedName, $etag); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = RecommenderClient::recommendationName( + '[PROJECT]', + '[LOCATION]', + '[RECOMMENDER]', + '[RECOMMENDATION]' + ); + $etag = '[ETAG]'; + + mark_recommendation_succeeded_sample($formattedName, $etag); +} +// [END recommender_v1_generated_Recommender_MarkRecommendationSucceeded_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/update_insight_type_config.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/update_insight_type_config.php new file mode 100644 index 000000000000..a2ce44db01ba --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/update_insight_type_config.php @@ -0,0 +1,57 @@ +updateInsightTypeConfig($insightTypeConfig); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END recommender_v1_generated_Recommender_UpdateInsightTypeConfig_sync] diff --git a/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/update_recommender_config.php b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/update_recommender_config.php new file mode 100644 index 000000000000..1398b72423c8 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/samples/V1/RecommenderClient/update_recommender_config.php @@ -0,0 +1,57 @@ +updateRecommenderConfig($recommenderConfig); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END recommender_v1_generated_Recommender_UpdateRecommenderConfig_sync] diff --git a/owl-bot-staging/Recommender/v1/src/V1/Client/RecommenderClient.php b/owl-bot-staging/Recommender/v1/src/V1/Client/RecommenderClient.php new file mode 100644 index 000000000000..c9b9e3ad9e6b --- /dev/null +++ b/owl-bot-staging/Recommender/v1/src/V1/Client/RecommenderClient.php @@ -0,0 +1,1167 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/recommender_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/recommender_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/recommender_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/recommender_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_insight_type resource. + * + * @param string $billingAccount + * @param string $location + * @param string $insightType + * + * @return string The formatted billing_account_location_insight_type resource. + */ + public static function billingAccountLocationInsightTypeName(string $billingAccount, string $location, string $insightType): string + { + return self::getPathTemplate('billingAccountLocationInsightType')->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_insight_type_config resource. + * + * @param string $billingAccount + * @param string $location + * @param string $insightType + * + * @return string The formatted billing_account_location_insight_type_config resource. + */ + public static function billingAccountLocationInsightTypeConfigName(string $billingAccount, string $location, string $insightType): string + { + return self::getPathTemplate('billingAccountLocationInsightTypeConfig')->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_insight_type_insight resource. + * + * @param string $billingAccount + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted billing_account_location_insight_type_insight resource. + */ + public static function billingAccountLocationInsightTypeInsightName(string $billingAccount, string $location, string $insightType, string $insight): string + { + return self::getPathTemplate('billingAccountLocationInsightTypeInsight')->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_recommender resource. + * + * @param string $billingAccount + * @param string $location + * @param string $recommender + * + * @return string The formatted billing_account_location_recommender resource. + */ + public static function billingAccountLocationRecommenderName(string $billingAccount, string $location, string $recommender): string + { + return self::getPathTemplate('billingAccountLocationRecommender')->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_recommender_config resource. + * + * @param string $billingAccount + * @param string $location + * @param string $recommender + * + * @return string The formatted billing_account_location_recommender_config resource. + */ + public static function billingAccountLocationRecommenderConfigName(string $billingAccount, string $location, string $recommender): string + { + return self::getPathTemplate('billingAccountLocationRecommenderConfig')->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_recommender_recommendation resource. + * + * @param string $billingAccount + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted billing_account_location_recommender_recommendation resource. + */ + public static function billingAccountLocationRecommenderRecommendationName(string $billingAccount, string $location, string $recommender, string $recommendation): string + { + return self::getPathTemplate('billingAccountLocationRecommenderRecommendation')->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_insight_type resource. + * + * @param string $folder + * @param string $location + * @param string $insightType + * + * @return string The formatted folder_location_insight_type resource. + */ + public static function folderLocationInsightTypeName(string $folder, string $location, string $insightType): string + { + return self::getPathTemplate('folderLocationInsightType')->render([ + 'folder' => $folder, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_insight_type_insight resource. + * + * @param string $folder + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted folder_location_insight_type_insight resource. + */ + public static function folderLocationInsightTypeInsightName(string $folder, string $location, string $insightType, string $insight): string + { + return self::getPathTemplate('folderLocationInsightTypeInsight')->render([ + 'folder' => $folder, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_recommender resource. + * + * @param string $folder + * @param string $location + * @param string $recommender + * + * @return string The formatted folder_location_recommender resource. + */ + public static function folderLocationRecommenderName(string $folder, string $location, string $recommender): string + { + return self::getPathTemplate('folderLocationRecommender')->render([ + 'folder' => $folder, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_recommender_recommendation resource. + * + * @param string $folder + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted folder_location_recommender_recommendation resource. + */ + public static function folderLocationRecommenderRecommendationName(string $folder, string $location, string $recommender, string $recommendation): string + { + return self::getPathTemplate('folderLocationRecommenderRecommendation')->render([ + 'folder' => $folder, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a insight + * resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted insight resource. + */ + public static function insightName(string $project, string $location, string $insightType, string $insight): string + { + return self::getPathTemplate('insight')->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a insight_type + * resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * + * @return string The formatted insight_type resource. + */ + public static function insightTypeName(string $project, string $location, string $insightType): string + { + return self::getPathTemplate('insightType')->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * insight_type_config resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * + * @return string The formatted insight_type_config resource. + */ + public static function insightTypeConfigName(string $project, string $location, string $insightType): string + { + return self::getPathTemplate('insightTypeConfig')->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_insight_type resource. + * + * @param string $organization + * @param string $location + * @param string $insightType + * + * @return string The formatted organization_location_insight_type resource. + */ + public static function organizationLocationInsightTypeName(string $organization, string $location, string $insightType): string + { + return self::getPathTemplate('organizationLocationInsightType')->render([ + 'organization' => $organization, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_insight_type_config resource. + * + * @param string $organization + * @param string $location + * @param string $insightType + * + * @return string The formatted organization_location_insight_type_config resource. + */ + public static function organizationLocationInsightTypeConfigName(string $organization, string $location, string $insightType): string + { + return self::getPathTemplate('organizationLocationInsightTypeConfig')->render([ + 'organization' => $organization, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_insight_type_insight resource. + * + * @param string $organization + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted organization_location_insight_type_insight resource. + */ + public static function organizationLocationInsightTypeInsightName(string $organization, string $location, string $insightType, string $insight): string + { + return self::getPathTemplate('organizationLocationInsightTypeInsight')->render([ + 'organization' => $organization, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_recommender resource. + * + * @param string $organization + * @param string $location + * @param string $recommender + * + * @return string The formatted organization_location_recommender resource. + */ + public static function organizationLocationRecommenderName(string $organization, string $location, string $recommender): string + { + return self::getPathTemplate('organizationLocationRecommender')->render([ + 'organization' => $organization, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_recommender_config resource. + * + * @param string $organization + * @param string $location + * @param string $recommender + * + * @return string The formatted organization_location_recommender_config resource. + */ + public static function organizationLocationRecommenderConfigName(string $organization, string $location, string $recommender): string + { + return self::getPathTemplate('organizationLocationRecommenderConfig')->render([ + 'organization' => $organization, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_recommender_recommendation resource. + * + * @param string $organization + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted organization_location_recommender_recommendation resource. + */ + public static function organizationLocationRecommenderRecommendationName(string $organization, string $location, string $recommender, string $recommendation): string + { + return self::getPathTemplate('organizationLocationRecommenderRecommendation')->render([ + 'organization' => $organization, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_insight_type resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * + * @return string The formatted project_location_insight_type resource. + */ + public static function projectLocationInsightTypeName(string $project, string $location, string $insightType): string + { + return self::getPathTemplate('projectLocationInsightType')->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_insight_type_config resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * + * @return string The formatted project_location_insight_type_config resource. + */ + public static function projectLocationInsightTypeConfigName(string $project, string $location, string $insightType): string + { + return self::getPathTemplate('projectLocationInsightTypeConfig')->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_insight_type_insight resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted project_location_insight_type_insight resource. + */ + public static function projectLocationInsightTypeInsightName(string $project, string $location, string $insightType, string $insight): string + { + return self::getPathTemplate('projectLocationInsightTypeInsight')->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_recommender resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * + * @return string The formatted project_location_recommender resource. + */ + public static function projectLocationRecommenderName(string $project, string $location, string $recommender): string + { + return self::getPathTemplate('projectLocationRecommender')->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_recommender_config resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * + * @return string The formatted project_location_recommender_config resource. + */ + public static function projectLocationRecommenderConfigName(string $project, string $location, string $recommender): string + { + return self::getPathTemplate('projectLocationRecommenderConfig')->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_recommender_recommendation resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted project_location_recommender_recommendation resource. + */ + public static function projectLocationRecommenderRecommendationName(string $project, string $location, string $recommender, string $recommendation): string + { + return self::getPathTemplate('projectLocationRecommenderRecommendation')->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * recommendation resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted recommendation resource. + */ + public static function recommendationName(string $project, string $location, string $recommender, string $recommendation): string + { + return self::getPathTemplate('recommendation')->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a recommender + * resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * + * @return string The formatted recommender resource. + */ + public static function recommenderName(string $project, string $location, string $recommender): string + { + return self::getPathTemplate('recommender')->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * recommender_config resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * + * @return string The formatted recommender_config resource. + */ + public static function recommenderConfigName(string $project, string $location, string $recommender): string + { + return self::getPathTemplate('recommenderConfig')->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - billingAccountLocationInsightType: billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type} + * - billingAccountLocationInsightTypeConfig: billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/config + * - billingAccountLocationInsightTypeInsight: billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - billingAccountLocationRecommender: billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender} + * - billingAccountLocationRecommenderConfig: billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/config + * - billingAccountLocationRecommenderRecommendation: billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - folderLocationInsightType: folders/{folder}/locations/{location}/insightTypes/{insight_type} + * - folderLocationInsightTypeInsight: folders/{folder}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - folderLocationRecommender: folders/{folder}/locations/{location}/recommenders/{recommender} + * - folderLocationRecommenderRecommendation: folders/{folder}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - insight: projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - insightType: projects/{project}/locations/{location}/insightTypes/{insight_type} + * - insightTypeConfig: projects/{project}/locations/{location}/insightTypes/{insight_type}/config + * - organizationLocationInsightType: organizations/{organization}/locations/{location}/insightTypes/{insight_type} + * - organizationLocationInsightTypeConfig: organizations/{organization}/locations/{location}/insightTypes/{insight_type}/config + * - organizationLocationInsightTypeInsight: organizations/{organization}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - organizationLocationRecommender: organizations/{organization}/locations/{location}/recommenders/{recommender} + * - organizationLocationRecommenderConfig: organizations/{organization}/locations/{location}/recommenders/{recommender}/config + * - organizationLocationRecommenderRecommendation: organizations/{organization}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - projectLocationInsightType: projects/{project}/locations/{location}/insightTypes/{insight_type} + * - projectLocationInsightTypeConfig: projects/{project}/locations/{location}/insightTypes/{insight_type}/config + * - projectLocationInsightTypeInsight: projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - projectLocationRecommender: projects/{project}/locations/{location}/recommenders/{recommender} + * - projectLocationRecommenderConfig: projects/{project}/locations/{location}/recommenders/{recommender}/config + * - projectLocationRecommenderRecommendation: projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - recommendation: projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - recommender: projects/{project}/locations/{location}/recommenders/{recommender} + * - recommenderConfig: projects/{project}/locations/{location}/recommenders/{recommender}/config + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'recommender.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Gets the requested insight. Requires the recommender.*.get IAM permission + * for the specified insight type. + * + * The async variant is {@see RecommenderClient::getInsightAsync()} . + * + * @param GetInsightRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Insight + * + * @throws ApiException Thrown if the API call fails. + */ + public function getInsight(GetInsightRequest $request, array $callOptions = []): Insight + { + return $this->startApiCall('GetInsight', $request, $callOptions)->wait(); + } + + /** + * Gets the requested InsightTypeConfig. There is only one instance of the + * config for each InsightType. + * + * The async variant is {@see RecommenderClient::getInsightTypeConfigAsync()} . + * + * @param GetInsightTypeConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return InsightTypeConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getInsightTypeConfig(GetInsightTypeConfigRequest $request, array $callOptions = []): InsightTypeConfig + { + return $this->startApiCall('GetInsightTypeConfig', $request, $callOptions)->wait(); + } + + /** + * Gets the requested recommendation. Requires the recommender.*.get + * IAM permission for the specified recommender. + * + * The async variant is {@see RecommenderClient::getRecommendationAsync()} . + * + * @param GetRecommendationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Recommendation + * + * @throws ApiException Thrown if the API call fails. + */ + public function getRecommendation(GetRecommendationRequest $request, array $callOptions = []): Recommendation + { + return $this->startApiCall('GetRecommendation', $request, $callOptions)->wait(); + } + + /** + * Gets the requested Recommender Config. There is only one instance of the + * config for each Recommender. + * + * The async variant is {@see RecommenderClient::getRecommenderConfigAsync()} . + * + * @param GetRecommenderConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return RecommenderConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getRecommenderConfig(GetRecommenderConfigRequest $request, array $callOptions = []): RecommenderConfig + { + return $this->startApiCall('GetRecommenderConfig', $request, $callOptions)->wait(); + } + + /** + * Lists insights for the specified Cloud Resource. Requires the + * recommender.*.list IAM permission for the specified insight type. + * + * The async variant is {@see RecommenderClient::listInsightsAsync()} . + * + * @param ListInsightsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listInsights(ListInsightsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListInsights', $request, $callOptions); + } + + /** + * Lists recommendations for the specified Cloud Resource. Requires the + * recommender.*.list IAM permission for the specified recommender. + * + * The async variant is {@see RecommenderClient::listRecommendationsAsync()} . + * + * @param ListRecommendationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listRecommendations(ListRecommendationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListRecommendations', $request, $callOptions); + } + + /** + * Marks the Insight State as Accepted. Users can use this method to + * indicate to the Recommender API that they have applied some action based + * on the insight. This stops the insight content from being updated. + * + * MarkInsightAccepted can be applied to insights in ACTIVE state. Requires + * the recommender.*.update IAM permission for the specified insight. + * + * The async variant is {@see RecommenderClient::markInsightAcceptedAsync()} . + * + * @param MarkInsightAcceptedRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Insight + * + * @throws ApiException Thrown if the API call fails. + */ + public function markInsightAccepted(MarkInsightAcceptedRequest $request, array $callOptions = []): Insight + { + return $this->startApiCall('MarkInsightAccepted', $request, $callOptions)->wait(); + } + + /** + * Marks the Recommendation State as Claimed. Users can use this method to + * indicate to the Recommender API that they are starting to apply the + * recommendation themselves. This stops the recommendation content from being + * updated. Associated insights are frozen and placed in the ACCEPTED state. + * + * MarkRecommendationClaimed can be applied to recommendations in CLAIMED, + * SUCCEEDED, FAILED, or ACTIVE state. + * + * Requires the recommender.*.update IAM permission for the specified + * recommender. + * + * The async variant is {@see RecommenderClient::markRecommendationClaimedAsync()} + * . + * + * @param MarkRecommendationClaimedRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Recommendation + * + * @throws ApiException Thrown if the API call fails. + */ + public function markRecommendationClaimed(MarkRecommendationClaimedRequest $request, array $callOptions = []): Recommendation + { + return $this->startApiCall('MarkRecommendationClaimed', $request, $callOptions)->wait(); + } + + /** + * Mark the Recommendation State as Dismissed. Users can use this method to + * indicate to the Recommender API that an ACTIVE recommendation has to + * be marked back as DISMISSED. + * + * MarkRecommendationDismissed can be applied to recommendations in ACTIVE + * state. + * + * Requires the recommender.*.update IAM permission for the specified + * recommender. + * + * The async variant is + * {@see RecommenderClient::markRecommendationDismissedAsync()} . + * + * @param MarkRecommendationDismissedRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Recommendation + * + * @throws ApiException Thrown if the API call fails. + */ + public function markRecommendationDismissed(MarkRecommendationDismissedRequest $request, array $callOptions = []): Recommendation + { + return $this->startApiCall('MarkRecommendationDismissed', $request, $callOptions)->wait(); + } + + /** + * Marks the Recommendation State as Failed. Users can use this method to + * indicate to the Recommender API that they have applied the recommendation + * themselves, and the operation failed. This stops the recommendation content + * from being updated. Associated insights are frozen and placed in the + * ACCEPTED state. + * + * MarkRecommendationFailed can be applied to recommendations in ACTIVE, + * CLAIMED, SUCCEEDED, or FAILED state. + * + * Requires the recommender.*.update IAM permission for the specified + * recommender. + * + * The async variant is {@see RecommenderClient::markRecommendationFailedAsync()} . + * + * @param MarkRecommendationFailedRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Recommendation + * + * @throws ApiException Thrown if the API call fails. + */ + public function markRecommendationFailed(MarkRecommendationFailedRequest $request, array $callOptions = []): Recommendation + { + return $this->startApiCall('MarkRecommendationFailed', $request, $callOptions)->wait(); + } + + /** + * Marks the Recommendation State as Succeeded. Users can use this method to + * indicate to the Recommender API that they have applied the recommendation + * themselves, and the operation was successful. This stops the recommendation + * content from being updated. Associated insights are frozen and placed in + * the ACCEPTED state. + * + * MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, + * CLAIMED, SUCCEEDED, or FAILED state. + * + * Requires the recommender.*.update IAM permission for the specified + * recommender. + * + * The async variant is + * {@see RecommenderClient::markRecommendationSucceededAsync()} . + * + * @param MarkRecommendationSucceededRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Recommendation + * + * @throws ApiException Thrown if the API call fails. + */ + public function markRecommendationSucceeded(MarkRecommendationSucceededRequest $request, array $callOptions = []): Recommendation + { + return $this->startApiCall('MarkRecommendationSucceeded', $request, $callOptions)->wait(); + } + + /** + * Updates an InsightTypeConfig change. This will create a new revision of the + * config. + * + * The async variant is {@see RecommenderClient::updateInsightTypeConfigAsync()} . + * + * @param UpdateInsightTypeConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return InsightTypeConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateInsightTypeConfig(UpdateInsightTypeConfigRequest $request, array $callOptions = []): InsightTypeConfig + { + return $this->startApiCall('UpdateInsightTypeConfig', $request, $callOptions)->wait(); + } + + /** + * Updates a Recommender Config. This will create a new revision of the + * config. + * + * The async variant is {@see RecommenderClient::updateRecommenderConfigAsync()} . + * + * @param UpdateRecommenderConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return RecommenderConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateRecommenderConfig(UpdateRecommenderConfigRequest $request, array $callOptions = []): RecommenderConfig + { + return $this->startApiCall('UpdateRecommenderConfig', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Recommender/v1/src/V1/Gapic/RecommenderGapicClient.php b/owl-bot-staging/Recommender/v1/src/V1/Gapic/RecommenderGapicClient.php new file mode 100644 index 000000000000..59c6daf9f6dc --- /dev/null +++ b/owl-bot-staging/Recommender/v1/src/V1/Gapic/RecommenderGapicClient.php @@ -0,0 +1,1962 @@ +insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + * $response = $recommenderClient->getInsight($formattedName); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * This service has a new (beta) implementation. See {@see + * \Google\Cloud\Recommender\V1\Client\RecommenderClient} to use the new surface. + */ +class RecommenderGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.recommender.v1.Recommender'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'recommender.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $billingAccountLocationInsightTypeNameTemplate; + + private static $billingAccountLocationInsightTypeConfigNameTemplate; + + private static $billingAccountLocationInsightTypeInsightNameTemplate; + + private static $billingAccountLocationRecommenderNameTemplate; + + private static $billingAccountLocationRecommenderConfigNameTemplate; + + private static $billingAccountLocationRecommenderRecommendationNameTemplate; + + private static $folderLocationInsightTypeNameTemplate; + + private static $folderLocationInsightTypeInsightNameTemplate; + + private static $folderLocationRecommenderNameTemplate; + + private static $folderLocationRecommenderRecommendationNameTemplate; + + private static $insightNameTemplate; + + private static $insightTypeNameTemplate; + + private static $insightTypeConfigNameTemplate; + + private static $organizationLocationInsightTypeNameTemplate; + + private static $organizationLocationInsightTypeConfigNameTemplate; + + private static $organizationLocationInsightTypeInsightNameTemplate; + + private static $organizationLocationRecommenderNameTemplate; + + private static $organizationLocationRecommenderConfigNameTemplate; + + private static $organizationLocationRecommenderRecommendationNameTemplate; + + private static $projectLocationInsightTypeNameTemplate; + + private static $projectLocationInsightTypeConfigNameTemplate; + + private static $projectLocationInsightTypeInsightNameTemplate; + + private static $projectLocationRecommenderNameTemplate; + + private static $projectLocationRecommenderConfigNameTemplate; + + private static $projectLocationRecommenderRecommendationNameTemplate; + + private static $recommendationNameTemplate; + + private static $recommenderNameTemplate; + + private static $recommenderConfigNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/recommender_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/recommender_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/recommender_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/recommender_rest_client_config.php', + ], + ], + ]; + } + + private static function getBillingAccountLocationInsightTypeNameTemplate() + { + if (self::$billingAccountLocationInsightTypeNameTemplate == null) { + self::$billingAccountLocationInsightTypeNameTemplate = new PathTemplate('billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}'); + } + + return self::$billingAccountLocationInsightTypeNameTemplate; + } + + private static function getBillingAccountLocationInsightTypeConfigNameTemplate() + { + if (self::$billingAccountLocationInsightTypeConfigNameTemplate == null) { + self::$billingAccountLocationInsightTypeConfigNameTemplate = new PathTemplate('billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/config'); + } + + return self::$billingAccountLocationInsightTypeConfigNameTemplate; + } + + private static function getBillingAccountLocationInsightTypeInsightNameTemplate() + { + if (self::$billingAccountLocationInsightTypeInsightNameTemplate == null) { + self::$billingAccountLocationInsightTypeInsightNameTemplate = new PathTemplate('billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/insights/{insight}'); + } + + return self::$billingAccountLocationInsightTypeInsightNameTemplate; + } + + private static function getBillingAccountLocationRecommenderNameTemplate() + { + if (self::$billingAccountLocationRecommenderNameTemplate == null) { + self::$billingAccountLocationRecommenderNameTemplate = new PathTemplate('billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}'); + } + + return self::$billingAccountLocationRecommenderNameTemplate; + } + + private static function getBillingAccountLocationRecommenderConfigNameTemplate() + { + if (self::$billingAccountLocationRecommenderConfigNameTemplate == null) { + self::$billingAccountLocationRecommenderConfigNameTemplate = new PathTemplate('billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/config'); + } + + return self::$billingAccountLocationRecommenderConfigNameTemplate; + } + + private static function getBillingAccountLocationRecommenderRecommendationNameTemplate() + { + if (self::$billingAccountLocationRecommenderRecommendationNameTemplate == null) { + self::$billingAccountLocationRecommenderRecommendationNameTemplate = new PathTemplate('billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}'); + } + + return self::$billingAccountLocationRecommenderRecommendationNameTemplate; + } + + private static function getFolderLocationInsightTypeNameTemplate() + { + if (self::$folderLocationInsightTypeNameTemplate == null) { + self::$folderLocationInsightTypeNameTemplate = new PathTemplate('folders/{folder}/locations/{location}/insightTypes/{insight_type}'); + } + + return self::$folderLocationInsightTypeNameTemplate; + } + + private static function getFolderLocationInsightTypeInsightNameTemplate() + { + if (self::$folderLocationInsightTypeInsightNameTemplate == null) { + self::$folderLocationInsightTypeInsightNameTemplate = new PathTemplate('folders/{folder}/locations/{location}/insightTypes/{insight_type}/insights/{insight}'); + } + + return self::$folderLocationInsightTypeInsightNameTemplate; + } + + private static function getFolderLocationRecommenderNameTemplate() + { + if (self::$folderLocationRecommenderNameTemplate == null) { + self::$folderLocationRecommenderNameTemplate = new PathTemplate('folders/{folder}/locations/{location}/recommenders/{recommender}'); + } + + return self::$folderLocationRecommenderNameTemplate; + } + + private static function getFolderLocationRecommenderRecommendationNameTemplate() + { + if (self::$folderLocationRecommenderRecommendationNameTemplate == null) { + self::$folderLocationRecommenderRecommendationNameTemplate = new PathTemplate('folders/{folder}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}'); + } + + return self::$folderLocationRecommenderRecommendationNameTemplate; + } + + private static function getInsightNameTemplate() + { + if (self::$insightNameTemplate == null) { + self::$insightNameTemplate = new PathTemplate('projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}'); + } + + return self::$insightNameTemplate; + } + + private static function getInsightTypeNameTemplate() + { + if (self::$insightTypeNameTemplate == null) { + self::$insightTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/insightTypes/{insight_type}'); + } + + return self::$insightTypeNameTemplate; + } + + private static function getInsightTypeConfigNameTemplate() + { + if (self::$insightTypeConfigNameTemplate == null) { + self::$insightTypeConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/insightTypes/{insight_type}/config'); + } + + return self::$insightTypeConfigNameTemplate; + } + + private static function getOrganizationLocationInsightTypeNameTemplate() + { + if (self::$organizationLocationInsightTypeNameTemplate == null) { + self::$organizationLocationInsightTypeNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/insightTypes/{insight_type}'); + } + + return self::$organizationLocationInsightTypeNameTemplate; + } + + private static function getOrganizationLocationInsightTypeConfigNameTemplate() + { + if (self::$organizationLocationInsightTypeConfigNameTemplate == null) { + self::$organizationLocationInsightTypeConfigNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/insightTypes/{insight_type}/config'); + } + + return self::$organizationLocationInsightTypeConfigNameTemplate; + } + + private static function getOrganizationLocationInsightTypeInsightNameTemplate() + { + if (self::$organizationLocationInsightTypeInsightNameTemplate == null) { + self::$organizationLocationInsightTypeInsightNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/insightTypes/{insight_type}/insights/{insight}'); + } + + return self::$organizationLocationInsightTypeInsightNameTemplate; + } + + private static function getOrganizationLocationRecommenderNameTemplate() + { + if (self::$organizationLocationRecommenderNameTemplate == null) { + self::$organizationLocationRecommenderNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/recommenders/{recommender}'); + } + + return self::$organizationLocationRecommenderNameTemplate; + } + + private static function getOrganizationLocationRecommenderConfigNameTemplate() + { + if (self::$organizationLocationRecommenderConfigNameTemplate == null) { + self::$organizationLocationRecommenderConfigNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/recommenders/{recommender}/config'); + } + + return self::$organizationLocationRecommenderConfigNameTemplate; + } + + private static function getOrganizationLocationRecommenderRecommendationNameTemplate() + { + if (self::$organizationLocationRecommenderRecommendationNameTemplate == null) { + self::$organizationLocationRecommenderRecommendationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}'); + } + + return self::$organizationLocationRecommenderRecommendationNameTemplate; + } + + private static function getProjectLocationInsightTypeNameTemplate() + { + if (self::$projectLocationInsightTypeNameTemplate == null) { + self::$projectLocationInsightTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/insightTypes/{insight_type}'); + } + + return self::$projectLocationInsightTypeNameTemplate; + } + + private static function getProjectLocationInsightTypeConfigNameTemplate() + { + if (self::$projectLocationInsightTypeConfigNameTemplate == null) { + self::$projectLocationInsightTypeConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/insightTypes/{insight_type}/config'); + } + + return self::$projectLocationInsightTypeConfigNameTemplate; + } + + private static function getProjectLocationInsightTypeInsightNameTemplate() + { + if (self::$projectLocationInsightTypeInsightNameTemplate == null) { + self::$projectLocationInsightTypeInsightNameTemplate = new PathTemplate('projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}'); + } + + return self::$projectLocationInsightTypeInsightNameTemplate; + } + + private static function getProjectLocationRecommenderNameTemplate() + { + if (self::$projectLocationRecommenderNameTemplate == null) { + self::$projectLocationRecommenderNameTemplate = new PathTemplate('projects/{project}/locations/{location}/recommenders/{recommender}'); + } + + return self::$projectLocationRecommenderNameTemplate; + } + + private static function getProjectLocationRecommenderConfigNameTemplate() + { + if (self::$projectLocationRecommenderConfigNameTemplate == null) { + self::$projectLocationRecommenderConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/recommenders/{recommender}/config'); + } + + return self::$projectLocationRecommenderConfigNameTemplate; + } + + private static function getProjectLocationRecommenderRecommendationNameTemplate() + { + if (self::$projectLocationRecommenderRecommendationNameTemplate == null) { + self::$projectLocationRecommenderRecommendationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}'); + } + + return self::$projectLocationRecommenderRecommendationNameTemplate; + } + + private static function getRecommendationNameTemplate() + { + if (self::$recommendationNameTemplate == null) { + self::$recommendationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}'); + } + + return self::$recommendationNameTemplate; + } + + private static function getRecommenderNameTemplate() + { + if (self::$recommenderNameTemplate == null) { + self::$recommenderNameTemplate = new PathTemplate('projects/{project}/locations/{location}/recommenders/{recommender}'); + } + + return self::$recommenderNameTemplate; + } + + private static function getRecommenderConfigNameTemplate() + { + if (self::$recommenderConfigNameTemplate == null) { + self::$recommenderConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/recommenders/{recommender}/config'); + } + + return self::$recommenderConfigNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'billingAccountLocationInsightType' => self::getBillingAccountLocationInsightTypeNameTemplate(), + 'billingAccountLocationInsightTypeConfig' => self::getBillingAccountLocationInsightTypeConfigNameTemplate(), + 'billingAccountLocationInsightTypeInsight' => self::getBillingAccountLocationInsightTypeInsightNameTemplate(), + 'billingAccountLocationRecommender' => self::getBillingAccountLocationRecommenderNameTemplate(), + 'billingAccountLocationRecommenderConfig' => self::getBillingAccountLocationRecommenderConfigNameTemplate(), + 'billingAccountLocationRecommenderRecommendation' => self::getBillingAccountLocationRecommenderRecommendationNameTemplate(), + 'folderLocationInsightType' => self::getFolderLocationInsightTypeNameTemplate(), + 'folderLocationInsightTypeInsight' => self::getFolderLocationInsightTypeInsightNameTemplate(), + 'folderLocationRecommender' => self::getFolderLocationRecommenderNameTemplate(), + 'folderLocationRecommenderRecommendation' => self::getFolderLocationRecommenderRecommendationNameTemplate(), + 'insight' => self::getInsightNameTemplate(), + 'insightType' => self::getInsightTypeNameTemplate(), + 'insightTypeConfig' => self::getInsightTypeConfigNameTemplate(), + 'organizationLocationInsightType' => self::getOrganizationLocationInsightTypeNameTemplate(), + 'organizationLocationInsightTypeConfig' => self::getOrganizationLocationInsightTypeConfigNameTemplate(), + 'organizationLocationInsightTypeInsight' => self::getOrganizationLocationInsightTypeInsightNameTemplate(), + 'organizationLocationRecommender' => self::getOrganizationLocationRecommenderNameTemplate(), + 'organizationLocationRecommenderConfig' => self::getOrganizationLocationRecommenderConfigNameTemplate(), + 'organizationLocationRecommenderRecommendation' => self::getOrganizationLocationRecommenderRecommendationNameTemplate(), + 'projectLocationInsightType' => self::getProjectLocationInsightTypeNameTemplate(), + 'projectLocationInsightTypeConfig' => self::getProjectLocationInsightTypeConfigNameTemplate(), + 'projectLocationInsightTypeInsight' => self::getProjectLocationInsightTypeInsightNameTemplate(), + 'projectLocationRecommender' => self::getProjectLocationRecommenderNameTemplate(), + 'projectLocationRecommenderConfig' => self::getProjectLocationRecommenderConfigNameTemplate(), + 'projectLocationRecommenderRecommendation' => self::getProjectLocationRecommenderRecommendationNameTemplate(), + 'recommendation' => self::getRecommendationNameTemplate(), + 'recommender' => self::getRecommenderNameTemplate(), + 'recommenderConfig' => self::getRecommenderConfigNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_insight_type resource. + * + * @param string $billingAccount + * @param string $location + * @param string $insightType + * + * @return string The formatted billing_account_location_insight_type resource. + */ + public static function billingAccountLocationInsightTypeName($billingAccount, $location, $insightType) + { + return self::getBillingAccountLocationInsightTypeNameTemplate()->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_insight_type_config resource. + * + * @param string $billingAccount + * @param string $location + * @param string $insightType + * + * @return string The formatted billing_account_location_insight_type_config resource. + */ + public static function billingAccountLocationInsightTypeConfigName($billingAccount, $location, $insightType) + { + return self::getBillingAccountLocationInsightTypeConfigNameTemplate()->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_insight_type_insight resource. + * + * @param string $billingAccount + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted billing_account_location_insight_type_insight resource. + */ + public static function billingAccountLocationInsightTypeInsightName($billingAccount, $location, $insightType, $insight) + { + return self::getBillingAccountLocationInsightTypeInsightNameTemplate()->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_recommender resource. + * + * @param string $billingAccount + * @param string $location + * @param string $recommender + * + * @return string The formatted billing_account_location_recommender resource. + */ + public static function billingAccountLocationRecommenderName($billingAccount, $location, $recommender) + { + return self::getBillingAccountLocationRecommenderNameTemplate()->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_recommender_config resource. + * + * @param string $billingAccount + * @param string $location + * @param string $recommender + * + * @return string The formatted billing_account_location_recommender_config resource. + */ + public static function billingAccountLocationRecommenderConfigName($billingAccount, $location, $recommender) + { + return self::getBillingAccountLocationRecommenderConfigNameTemplate()->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * billing_account_location_recommender_recommendation resource. + * + * @param string $billingAccount + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted billing_account_location_recommender_recommendation resource. + */ + public static function billingAccountLocationRecommenderRecommendationName($billingAccount, $location, $recommender, $recommendation) + { + return self::getBillingAccountLocationRecommenderRecommendationNameTemplate()->render([ + 'billing_account' => $billingAccount, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_insight_type resource. + * + * @param string $folder + * @param string $location + * @param string $insightType + * + * @return string The formatted folder_location_insight_type resource. + */ + public static function folderLocationInsightTypeName($folder, $location, $insightType) + { + return self::getFolderLocationInsightTypeNameTemplate()->render([ + 'folder' => $folder, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_insight_type_insight resource. + * + * @param string $folder + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted folder_location_insight_type_insight resource. + */ + public static function folderLocationInsightTypeInsightName($folder, $location, $insightType, $insight) + { + return self::getFolderLocationInsightTypeInsightNameTemplate()->render([ + 'folder' => $folder, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_recommender resource. + * + * @param string $folder + * @param string $location + * @param string $recommender + * + * @return string The formatted folder_location_recommender resource. + */ + public static function folderLocationRecommenderName($folder, $location, $recommender) + { + return self::getFolderLocationRecommenderNameTemplate()->render([ + 'folder' => $folder, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * folder_location_recommender_recommendation resource. + * + * @param string $folder + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted folder_location_recommender_recommendation resource. + */ + public static function folderLocationRecommenderRecommendationName($folder, $location, $recommender, $recommendation) + { + return self::getFolderLocationRecommenderRecommendationNameTemplate()->render([ + 'folder' => $folder, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a insight + * resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted insight resource. + */ + public static function insightName($project, $location, $insightType, $insight) + { + return self::getInsightNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a insight_type + * resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * + * @return string The formatted insight_type resource. + */ + public static function insightTypeName($project, $location, $insightType) + { + return self::getInsightTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * insight_type_config resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * + * @return string The formatted insight_type_config resource. + */ + public static function insightTypeConfigName($project, $location, $insightType) + { + return self::getInsightTypeConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_insight_type resource. + * + * @param string $organization + * @param string $location + * @param string $insightType + * + * @return string The formatted organization_location_insight_type resource. + */ + public static function organizationLocationInsightTypeName($organization, $location, $insightType) + { + return self::getOrganizationLocationInsightTypeNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_insight_type_config resource. + * + * @param string $organization + * @param string $location + * @param string $insightType + * + * @return string The formatted organization_location_insight_type_config resource. + */ + public static function organizationLocationInsightTypeConfigName($organization, $location, $insightType) + { + return self::getOrganizationLocationInsightTypeConfigNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_insight_type_insight resource. + * + * @param string $organization + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted organization_location_insight_type_insight resource. + */ + public static function organizationLocationInsightTypeInsightName($organization, $location, $insightType, $insight) + { + return self::getOrganizationLocationInsightTypeInsightNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_recommender resource. + * + * @param string $organization + * @param string $location + * @param string $recommender + * + * @return string The formatted organization_location_recommender resource. + */ + public static function organizationLocationRecommenderName($organization, $location, $recommender) + { + return self::getOrganizationLocationRecommenderNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_recommender_config resource. + * + * @param string $organization + * @param string $location + * @param string $recommender + * + * @return string The formatted organization_location_recommender_config resource. + */ + public static function organizationLocationRecommenderConfigName($organization, $location, $recommender) + { + return self::getOrganizationLocationRecommenderConfigNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_recommender_recommendation resource. + * + * @param string $organization + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted organization_location_recommender_recommendation resource. + */ + public static function organizationLocationRecommenderRecommendationName($organization, $location, $recommender, $recommendation) + { + return self::getOrganizationLocationRecommenderRecommendationNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_insight_type resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * + * @return string The formatted project_location_insight_type resource. + */ + public static function projectLocationInsightTypeName($project, $location, $insightType) + { + return self::getProjectLocationInsightTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_insight_type_config resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * + * @return string The formatted project_location_insight_type_config resource. + */ + public static function projectLocationInsightTypeConfigName($project, $location, $insightType) + { + return self::getProjectLocationInsightTypeConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_insight_type_insight resource. + * + * @param string $project + * @param string $location + * @param string $insightType + * @param string $insight + * + * @return string The formatted project_location_insight_type_insight resource. + */ + public static function projectLocationInsightTypeInsightName($project, $location, $insightType, $insight) + { + return self::getProjectLocationInsightTypeInsightNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'insight_type' => $insightType, + 'insight' => $insight, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_recommender resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * + * @return string The formatted project_location_recommender resource. + */ + public static function projectLocationRecommenderName($project, $location, $recommender) + { + return self::getProjectLocationRecommenderNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_recommender_config resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * + * @return string The formatted project_location_recommender_config resource. + */ + public static function projectLocationRecommenderConfigName($project, $location, $recommender) + { + return self::getProjectLocationRecommenderConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_recommender_recommendation resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted project_location_recommender_recommendation resource. + */ + public static function projectLocationRecommenderRecommendationName($project, $location, $recommender, $recommendation) + { + return self::getProjectLocationRecommenderRecommendationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * recommendation resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * @param string $recommendation + * + * @return string The formatted recommendation resource. + */ + public static function recommendationName($project, $location, $recommender, $recommendation) + { + return self::getRecommendationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + 'recommendation' => $recommendation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a recommender + * resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * + * @return string The formatted recommender resource. + */ + public static function recommenderName($project, $location, $recommender) + { + return self::getRecommenderNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * recommender_config resource. + * + * @param string $project + * @param string $location + * @param string $recommender + * + * @return string The formatted recommender_config resource. + */ + public static function recommenderConfigName($project, $location, $recommender) + { + return self::getRecommenderConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'recommender' => $recommender, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - billingAccountLocationInsightType: billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type} + * - billingAccountLocationInsightTypeConfig: billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/config + * - billingAccountLocationInsightTypeInsight: billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - billingAccountLocationRecommender: billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender} + * - billingAccountLocationRecommenderConfig: billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/config + * - billingAccountLocationRecommenderRecommendation: billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - folderLocationInsightType: folders/{folder}/locations/{location}/insightTypes/{insight_type} + * - folderLocationInsightTypeInsight: folders/{folder}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - folderLocationRecommender: folders/{folder}/locations/{location}/recommenders/{recommender} + * - folderLocationRecommenderRecommendation: folders/{folder}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - insight: projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - insightType: projects/{project}/locations/{location}/insightTypes/{insight_type} + * - insightTypeConfig: projects/{project}/locations/{location}/insightTypes/{insight_type}/config + * - organizationLocationInsightType: organizations/{organization}/locations/{location}/insightTypes/{insight_type} + * - organizationLocationInsightTypeConfig: organizations/{organization}/locations/{location}/insightTypes/{insight_type}/config + * - organizationLocationInsightTypeInsight: organizations/{organization}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - organizationLocationRecommender: organizations/{organization}/locations/{location}/recommenders/{recommender} + * - organizationLocationRecommenderConfig: organizations/{organization}/locations/{location}/recommenders/{recommender}/config + * - organizationLocationRecommenderRecommendation: organizations/{organization}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - projectLocationInsightType: projects/{project}/locations/{location}/insightTypes/{insight_type} + * - projectLocationInsightTypeConfig: projects/{project}/locations/{location}/insightTypes/{insight_type}/config + * - projectLocationInsightTypeInsight: projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight} + * - projectLocationRecommender: projects/{project}/locations/{location}/recommenders/{recommender} + * - projectLocationRecommenderConfig: projects/{project}/locations/{location}/recommenders/{recommender}/config + * - projectLocationRecommenderRecommendation: projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - recommendation: projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation} + * - recommender: projects/{project}/locations/{location}/recommenders/{recommender} + * - recommenderConfig: projects/{project}/locations/{location}/recommenders/{recommender}/config + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'recommender.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Gets the requested insight. Requires the recommender.*.get IAM permission + * for the specified insight type. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedName = $recommenderClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + * $response = $recommenderClient->getInsight($formattedName); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the insight. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\Insight + * + * @throws ApiException if the remote call fails + */ + public function getInsight($name, array $optionalArgs = []) + { + $request = new GetInsightRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetInsight', Insight::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the requested InsightTypeConfig. There is only one instance of the + * config for each InsightType. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedName = $recommenderClient->insightTypeConfigName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + * $response = $recommenderClient->getInsightTypeConfig($formattedName); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the InsightTypeConfig to get. + * + * Acceptable formats: + * + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\InsightTypeConfig + * + * @throws ApiException if the remote call fails + */ + public function getInsightTypeConfig($name, array $optionalArgs = []) + { + $request = new GetInsightTypeConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetInsightTypeConfig', InsightTypeConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the requested recommendation. Requires the recommender.*.get + * IAM permission for the specified recommender. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedName = $recommenderClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + * $response = $recommenderClient->getRecommendation($formattedName); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the recommendation. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\Recommendation + * + * @throws ApiException if the remote call fails + */ + public function getRecommendation($name, array $optionalArgs = []) + { + $request = new GetRecommendationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetRecommendation', Recommendation::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the requested Recommender Config. There is only one instance of the + * config for each Recommender. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedName = $recommenderClient->recommenderConfigName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + * $response = $recommenderClient->getRecommenderConfig($formattedName); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the Recommendation Config to get. + * + * Acceptable formats: + * + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\RecommenderConfig + * + * @throws ApiException if the remote call fails + */ + public function getRecommenderConfig($name, array $optionalArgs = []) + { + $request = new GetRecommenderConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetRecommenderConfig', RecommenderConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists insights for the specified Cloud Resource. Requires the + * recommender.*.list IAM permission for the specified insight type. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedParent = $recommenderClient->insightTypeName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + * // Iterate over pages of elements + * $pagedResponse = $recommenderClient->listInsights($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $recommenderClient->listInsights($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $parent Required. The container resource on which to execute the request. + * Acceptable formats: + * + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * * `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]` + * + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * INSIGHT_TYPE_ID refers to supported insight types: + * https://cloud.google.com/recommender/docs/insights/insight-types. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filter expression to restrict the insights returned. Supported + * filter fields: + * + * * `stateInfo.state` + * + * * `insightSubtype` + * + * * `severity` + * + * * `targetResources` + * + * Examples: + * + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * + * * `insightSubtype = PERMISSIONS_USAGE` + * + * * `severity = CRITICAL OR severity = HIGH` + * + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * + * * `stateInfo.state = ACTIVE AND (severity = CRITICAL OR severity = HIGH)` + * + * The max allowed filter length is 500 characters. + * + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInsights($parent, array $optionalArgs = []) + { + $request = new ListInsightsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInsights', $optionalArgs, ListInsightsResponse::class, $request); + } + + /** + * Lists recommendations for the specified Cloud Resource. Requires the + * recommender.*.list IAM permission for the specified recommender. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedParent = $recommenderClient->recommenderName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + * // Iterate over pages of elements + * $pagedResponse = $recommenderClient->listRecommendations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $recommenderClient->listRecommendations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $parent Required. The container resource on which to execute the request. + * Acceptable formats: + * + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]` + * + * LOCATION here refers to GCP Locations: + * https://cloud.google.com/about/locations/ + * RECOMMENDER_ID refers to supported recommenders: + * https://cloud.google.com/recommender/docs/recommenders. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Filter expression to restrict the recommendations returned. Supported + * filter fields: + * + * * `state_info.state` + * + * * `recommenderSubtype` + * + * * `priority` + * + * * `targetResources` + * + * Examples: + * + * * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED` + * + * * `recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE` + * + * * `priority = P1 OR priority = P2` + * + * * `targetResources : + * //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1` + * + * * `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)` + * + * The max allowed filter length is 500 characters. + * + * (These expressions are based on the filter language described at + * https://google.aip.dev/160) + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listRecommendations($parent, array $optionalArgs = []) + { + $request = new ListRecommendationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListRecommendations', $optionalArgs, ListRecommendationsResponse::class, $request); + } + + /** + * Marks the Insight State as Accepted. Users can use this method to + * indicate to the Recommender API that they have applied some action based + * on the insight. This stops the insight content from being updated. + * + * MarkInsightAccepted can be applied to insights in ACTIVE state. Requires + * the recommender.*.update IAM permission for the specified insight. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedName = $recommenderClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + * $etag = 'etag'; + * $response = $recommenderClient->markInsightAccepted($formattedName, $etag); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the insight. + * @param string $etag Required. Fingerprint of the Insight. Provides optimistic locking. + * @param array $optionalArgs { + * Optional. + * + * @type array $stateMetadata + * Optional. State properties user wish to include with this state. Full + * replace of the current state_metadata. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\Insight + * + * @throws ApiException if the remote call fails + */ + public function markInsightAccepted($name, $etag, array $optionalArgs = []) + { + $request = new MarkInsightAcceptedRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setEtag($etag); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['stateMetadata'])) { + $request->setStateMetadata($optionalArgs['stateMetadata']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('MarkInsightAccepted', Insight::class, $optionalArgs, $request)->wait(); + } + + /** + * Marks the Recommendation State as Claimed. Users can use this method to + * indicate to the Recommender API that they are starting to apply the + * recommendation themselves. This stops the recommendation content from being + * updated. Associated insights are frozen and placed in the ACCEPTED state. + * + * MarkRecommendationClaimed can be applied to recommendations in CLAIMED, + * SUCCEEDED, FAILED, or ACTIVE state. + * + * Requires the recommender.*.update IAM permission for the specified + * recommender. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedName = $recommenderClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + * $etag = 'etag'; + * $response = $recommenderClient->markRecommendationClaimed($formattedName, $etag); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the recommendation. + * @param string $etag Required. Fingerprint of the Recommendation. Provides optimistic locking. + * @param array $optionalArgs { + * Optional. + * + * @type array $stateMetadata + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\Recommendation + * + * @throws ApiException if the remote call fails + */ + public function markRecommendationClaimed($name, $etag, array $optionalArgs = []) + { + $request = new MarkRecommendationClaimedRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setEtag($etag); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['stateMetadata'])) { + $request->setStateMetadata($optionalArgs['stateMetadata']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('MarkRecommendationClaimed', Recommendation::class, $optionalArgs, $request)->wait(); + } + + /** + * Mark the Recommendation State as Dismissed. Users can use this method to + * indicate to the Recommender API that an ACTIVE recommendation has to + * be marked back as DISMISSED. + * + * MarkRecommendationDismissed can be applied to recommendations in ACTIVE + * state. + * + * Requires the recommender.*.update IAM permission for the specified + * recommender. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedName = $recommenderClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + * $response = $recommenderClient->markRecommendationDismissed($formattedName); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the recommendation. + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * Fingerprint of the Recommendation. Provides optimistic locking. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\Recommendation + * + * @throws ApiException if the remote call fails + */ + public function markRecommendationDismissed($name, array $optionalArgs = []) + { + $request = new MarkRecommendationDismissedRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('MarkRecommendationDismissed', Recommendation::class, $optionalArgs, $request)->wait(); + } + + /** + * Marks the Recommendation State as Failed. Users can use this method to + * indicate to the Recommender API that they have applied the recommendation + * themselves, and the operation failed. This stops the recommendation content + * from being updated. Associated insights are frozen and placed in the + * ACCEPTED state. + * + * MarkRecommendationFailed can be applied to recommendations in ACTIVE, + * CLAIMED, SUCCEEDED, or FAILED state. + * + * Requires the recommender.*.update IAM permission for the specified + * recommender. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedName = $recommenderClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + * $etag = 'etag'; + * $response = $recommenderClient->markRecommendationFailed($formattedName, $etag); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the recommendation. + * @param string $etag Required. Fingerprint of the Recommendation. Provides optimistic locking. + * @param array $optionalArgs { + * Optional. + * + * @type array $stateMetadata + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\Recommendation + * + * @throws ApiException if the remote call fails + */ + public function markRecommendationFailed($name, $etag, array $optionalArgs = []) + { + $request = new MarkRecommendationFailedRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setEtag($etag); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['stateMetadata'])) { + $request->setStateMetadata($optionalArgs['stateMetadata']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('MarkRecommendationFailed', Recommendation::class, $optionalArgs, $request)->wait(); + } + + /** + * Marks the Recommendation State as Succeeded. Users can use this method to + * indicate to the Recommender API that they have applied the recommendation + * themselves, and the operation was successful. This stops the recommendation + * content from being updated. Associated insights are frozen and placed in + * the ACCEPTED state. + * + * MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, + * CLAIMED, SUCCEEDED, or FAILED state. + * + * Requires the recommender.*.update IAM permission for the specified + * recommender. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $formattedName = $recommenderClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + * $etag = 'etag'; + * $response = $recommenderClient->markRecommendationSucceeded($formattedName, $etag); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the recommendation. + * @param string $etag Required. Fingerprint of the Recommendation. Provides optimistic locking. + * @param array $optionalArgs { + * Optional. + * + * @type array $stateMetadata + * State properties to include with this state. Overwrites any existing + * `state_metadata`. + * Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. + * Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\Recommendation + * + * @throws ApiException if the remote call fails + */ + public function markRecommendationSucceeded($name, $etag, array $optionalArgs = []) + { + $request = new MarkRecommendationSucceededRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setEtag($etag); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['stateMetadata'])) { + $request->setStateMetadata($optionalArgs['stateMetadata']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('MarkRecommendationSucceeded', Recommendation::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates an InsightTypeConfig change. This will create a new revision of the + * config. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $insightTypeConfig = new InsightTypeConfig(); + * $response = $recommenderClient->updateInsightTypeConfig($insightTypeConfig); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param InsightTypeConfig $insightTypeConfig Required. The InsightTypeConfig to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The list of fields to be updated. + * @type bool $validateOnly + * If true, validate the request and preview the change, but do not actually + * update it. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\InsightTypeConfig + * + * @throws ApiException if the remote call fails + */ + public function updateInsightTypeConfig($insightTypeConfig, array $optionalArgs = []) + { + $request = new UpdateInsightTypeConfigRequest(); + $requestParamHeaders = []; + $request->setInsightTypeConfig($insightTypeConfig); + $requestParamHeaders['insight_type_config.name'] = $insightTypeConfig->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateInsightTypeConfig', InsightTypeConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates a Recommender Config. This will create a new revision of the + * config. + * + * Sample code: + * ``` + * $recommenderClient = new RecommenderClient(); + * try { + * $recommenderConfig = new RecommenderConfig(); + * $response = $recommenderClient->updateRecommenderConfig($recommenderConfig); + * } finally { + * $recommenderClient->close(); + * } + * ``` + * + * @param RecommenderConfig $recommenderConfig Required. The RecommenderConfig to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The list of fields to be updated. + * @type bool $validateOnly + * If true, validate the request and preview the change, but do not actually + * update it. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Recommender\V1\RecommenderConfig + * + * @throws ApiException if the remote call fails + */ + public function updateRecommenderConfig($recommenderConfig, array $optionalArgs = []) + { + $request = new UpdateRecommenderConfigRequest(); + $requestParamHeaders = []; + $request->setRecommenderConfig($recommenderConfig); + $requestParamHeaders['recommender_config.name'] = $recommenderConfig->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateRecommenderConfig', RecommenderConfig::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Recommender/v1/src/V1/RecommenderClient.php b/owl-bot-staging/Recommender/v1/src/V1/RecommenderClient.php new file mode 100644 index 000000000000..61d7d1f46db5 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/src/V1/RecommenderClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.recommender.v1.Recommender' => [ + 'GetInsight' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\Insight', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetInsightTypeConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\InsightTypeConfig', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetRecommendation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\Recommendation', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetRecommenderConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\RecommenderConfig', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListInsights' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getInsights', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\ListInsightsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListRecommendations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getRecommendations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\ListRecommendationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'MarkInsightAccepted' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\Insight', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'MarkRecommendationClaimed' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\Recommendation', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'MarkRecommendationDismissed' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\Recommendation', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'MarkRecommendationFailed' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\Recommendation', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'MarkRecommendationSucceeded' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\Recommendation', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateInsightTypeConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\InsightTypeConfig', + 'headerParams' => [ + [ + 'keyName' => 'insight_type_config.name', + 'fieldAccessors' => [ + 'getInsightTypeConfig', + 'getName', + ], + ], + ], + ], + 'UpdateRecommenderConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Recommender\V1\RecommenderConfig', + 'headerParams' => [ + [ + 'keyName' => 'recommender_config.name', + 'fieldAccessors' => [ + 'getRecommenderConfig', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'billingAccountLocationInsightType' => 'billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}', + 'billingAccountLocationInsightTypeConfig' => 'billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/config', + 'billingAccountLocationInsightTypeInsight' => 'billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/insights/{insight}', + 'billingAccountLocationRecommender' => 'billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}', + 'billingAccountLocationRecommenderConfig' => 'billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/config', + 'billingAccountLocationRecommenderRecommendation' => 'billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}', + 'folderLocationInsightType' => 'folders/{folder}/locations/{location}/insightTypes/{insight_type}', + 'folderLocationInsightTypeInsight' => 'folders/{folder}/locations/{location}/insightTypes/{insight_type}/insights/{insight}', + 'folderLocationRecommender' => 'folders/{folder}/locations/{location}/recommenders/{recommender}', + 'folderLocationRecommenderRecommendation' => 'folders/{folder}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}', + 'insight' => 'projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}', + 'insightType' => 'projects/{project}/locations/{location}/insightTypes/{insight_type}', + 'insightTypeConfig' => 'projects/{project}/locations/{location}/insightTypes/{insight_type}/config', + 'organizationLocationInsightType' => 'organizations/{organization}/locations/{location}/insightTypes/{insight_type}', + 'organizationLocationInsightTypeConfig' => 'organizations/{organization}/locations/{location}/insightTypes/{insight_type}/config', + 'organizationLocationInsightTypeInsight' => 'organizations/{organization}/locations/{location}/insightTypes/{insight_type}/insights/{insight}', + 'organizationLocationRecommender' => 'organizations/{organization}/locations/{location}/recommenders/{recommender}', + 'organizationLocationRecommenderConfig' => 'organizations/{organization}/locations/{location}/recommenders/{recommender}/config', + 'organizationLocationRecommenderRecommendation' => 'organizations/{organization}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}', + 'projectLocationInsightType' => 'projects/{project}/locations/{location}/insightTypes/{insight_type}', + 'projectLocationInsightTypeConfig' => 'projects/{project}/locations/{location}/insightTypes/{insight_type}/config', + 'projectLocationInsightTypeInsight' => 'projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}', + 'projectLocationRecommender' => 'projects/{project}/locations/{location}/recommenders/{recommender}', + 'projectLocationRecommenderConfig' => 'projects/{project}/locations/{location}/recommenders/{recommender}/config', + 'projectLocationRecommenderRecommendation' => 'projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}', + 'recommendation' => 'projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}', + 'recommender' => 'projects/{project}/locations/{location}/recommenders/{recommender}', + 'recommenderConfig' => 'projects/{project}/locations/{location}/recommenders/{recommender}/config', + ], + ], + ], +]; diff --git a/owl-bot-staging/Recommender/v1/src/V1/resources/recommender_rest_client_config.php b/owl-bot-staging/Recommender/v1/src/V1/resources/recommender_rest_client_config.php new file mode 100644 index 000000000000..99442217b5f0 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/src/V1/resources/recommender_rest_client_config.php @@ -0,0 +1,346 @@ + [ + 'google.cloud.recommender.v1.Recommender' => [ + 'GetInsight' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/insightTypes/*/insights/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=billingAccounts/*/locations/*/insightTypes/*/insights/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=folders/*/locations/*/insightTypes/*/insights/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/insightTypes/*/insights/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetInsightTypeConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/insightTypes/*/config}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/insightTypes/*/config}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=billingAccounts/*/locations/*/insightTypes/*/config}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetRecommendation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetRecommenderConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/recommenders/*/config}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/recommenders/*/config}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=billingAccounts/*/locations/*/recommenders/*/config}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListInsights' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/insightTypes/*}/insights', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=billingAccounts/*/locations/*/insightTypes/*}/insights', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=folders/*/locations/*/insightTypes/*}/insights', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*/locations/*/insightTypes/*}/insights', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListRecommendations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/recommenders/*}/recommendations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=billingAccounts/*/locations/*/recommenders/*}/recommendations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=folders/*/locations/*/recommenders/*}/recommendations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*/locations/*/recommenders/*}/recommendations', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'MarkInsightAccepted' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/insightTypes/*/insights/*}:markAccepted', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=billingAccounts/*/locations/*/insightTypes/*/insights/*}:markAccepted', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=folders/*/locations/*/insightTypes/*/insights/*}:markAccepted', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/insightTypes/*/insights/*}:markAccepted', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'MarkRecommendationClaimed' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markClaimed', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markClaimed', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markClaimed', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'MarkRecommendationDismissed' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markDismissed', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markDismissed', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markDismissed', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markDismissed', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'MarkRecommendationFailed' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markFailed', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markFailed', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markFailed', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'MarkRecommendationSucceeded' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markSucceeded', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markSucceeded', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markSucceeded', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateInsightTypeConfig' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{insight_type_config.name=projects/*/locations/*/insightTypes/*/config}', + 'body' => 'insight_type_config', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{insight_type_config.name=organizations/*/locations/*/insightTypes/*/config}', + 'body' => 'insight_type_config', + ], + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{insight_type_config.name=billingAccounts/*/locations/*/insightTypes/*/config}', + 'body' => 'insight_type_config', + ], + ], + 'placeholders' => [ + 'insight_type_config.name' => [ + 'getters' => [ + 'getInsightTypeConfig', + 'getName', + ], + ], + ], + ], + 'UpdateRecommenderConfig' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{recommender_config.name=projects/*/locations/*/recommenders/*/config}', + 'body' => 'recommender_config', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{recommender_config.name=organizations/*/locations/*/recommenders/*/config}', + 'body' => 'recommender_config', + ], + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{recommender_config.name=billingAccounts/*/locations/*/recommenders/*/config}', + 'body' => 'recommender_config', + ], + ], + 'placeholders' => [ + 'recommender_config.name' => [ + 'getters' => [ + 'getRecommenderConfig', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Recommender/v1/tests/Unit/V1/Client/RecommenderClientTest.php b/owl-bot-staging/Recommender/v1/tests/Unit/V1/Client/RecommenderClientTest.php new file mode 100644 index 000000000000..c277a8ff0e36 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/tests/Unit/V1/Client/RecommenderClientTest.php @@ -0,0 +1,1062 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return RecommenderClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new RecommenderClient($options); + } + + /** @test */ + public function getInsightTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $insightSubtype = 'insightSubtype-1491142701'; + $etag = 'etag3123477'; + $expectedResponse = new Insight(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setInsightSubtype($insightSubtype); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + $request = (new GetInsightRequest()) + ->setName($formattedName); + $response = $gapicClient->getInsight($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/GetInsight', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInsightExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + $request = (new GetInsightRequest()) + ->setName($formattedName); + try { + $gapicClient->getInsight($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInsightTypeConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $revisionId = 'revisionId513861631'; + $displayName = 'displayName1615086568'; + $expectedResponse = new InsightTypeConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->insightTypeConfigName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + $request = (new GetInsightTypeConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->getInsightTypeConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/GetInsightTypeConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInsightTypeConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->insightTypeConfigName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + $request = (new GetInsightTypeConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->getInsightTypeConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRecommendationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag = 'etag3123477'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $request = (new GetRecommendationRequest()) + ->setName($formattedName); + $response = $gapicClient->getRecommendation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/GetRecommendation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRecommendationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $request = (new GetRecommendationRequest()) + ->setName($formattedName); + try { + $gapicClient->getRecommendation($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRecommenderConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $revisionId = 'revisionId513861631'; + $displayName = 'displayName1615086568'; + $expectedResponse = new RecommenderConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommenderConfigName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + $request = (new GetRecommenderConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->getRecommenderConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/GetRecommenderConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRecommenderConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommenderConfigName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + $request = (new GetRecommenderConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->getRecommenderConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInsightsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $insightsElement = new Insight(); + $insights = [ + $insightsElement, + ]; + $expectedResponse = new ListInsightsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInsights($insights); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->insightTypeName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + $request = (new ListInsightsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listInsights($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInsights()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/ListInsights', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInsightsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->insightTypeName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + $request = (new ListInsightsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listInsights($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRecommendationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $recommendationsElement = new Recommendation(); + $recommendations = [ + $recommendationsElement, + ]; + $expectedResponse = new ListRecommendationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRecommendations($recommendations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->recommenderName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + $request = (new ListRecommendationsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listRecommendations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRecommendations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/ListRecommendations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRecommendationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->recommenderName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + $request = (new ListRecommendationsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listRecommendations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markInsightAcceptedTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $insightSubtype = 'insightSubtype-1491142701'; + $etag2 = 'etag2-1293302904'; + $expectedResponse = new Insight(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setInsightSubtype($insightSubtype); + $expectedResponse->setEtag($etag2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + $etag = 'etag3123477'; + $request = (new MarkInsightAcceptedRequest()) + ->setName($formattedName) + ->setEtag($etag); + $response = $gapicClient->markInsightAccepted($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkInsightAccepted', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getEtag(); + $this->assertProtobufEquals($etag, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markInsightAcceptedExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + $etag = 'etag3123477'; + $request = (new MarkInsightAcceptedRequest()) + ->setName($formattedName) + ->setEtag($etag); + try { + $gapicClient->markInsightAccepted($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationClaimedTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag2 = 'etag2-1293302904'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag2); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + $request = (new MarkRecommendationClaimedRequest()) + ->setName($formattedName) + ->setEtag($etag); + $response = $gapicClient->markRecommendationClaimed($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkRecommendationClaimed', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getEtag(); + $this->assertProtobufEquals($etag, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationClaimedExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + $request = (new MarkRecommendationClaimedRequest()) + ->setName($formattedName) + ->setEtag($etag); + try { + $gapicClient->markRecommendationClaimed($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationDismissedTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag2 = 'etag2-1293302904'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag2); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $request = (new MarkRecommendationDismissedRequest()) + ->setName($formattedName); + $response = $gapicClient->markRecommendationDismissed($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkRecommendationDismissed', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationDismissedExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $request = (new MarkRecommendationDismissedRequest()) + ->setName($formattedName); + try { + $gapicClient->markRecommendationDismissed($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationFailedTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag2 = 'etag2-1293302904'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag2); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + $request = (new MarkRecommendationFailedRequest()) + ->setName($formattedName) + ->setEtag($etag); + $response = $gapicClient->markRecommendationFailed($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkRecommendationFailed', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getEtag(); + $this->assertProtobufEquals($etag, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationFailedExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + $request = (new MarkRecommendationFailedRequest()) + ->setName($formattedName) + ->setEtag($etag); + try { + $gapicClient->markRecommendationFailed($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationSucceededTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag2 = 'etag2-1293302904'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag2); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + $request = (new MarkRecommendationSucceededRequest()) + ->setName($formattedName) + ->setEtag($etag); + $response = $gapicClient->markRecommendationSucceeded($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkRecommendationSucceeded', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getEtag(); + $this->assertProtobufEquals($etag, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationSucceededExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + $request = (new MarkRecommendationSucceededRequest()) + ->setName($formattedName) + ->setEtag($etag); + try { + $gapicClient->markRecommendationSucceeded($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateInsightTypeConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $revisionId = 'revisionId513861631'; + $displayName = 'displayName1615086568'; + $expectedResponse = new InsightTypeConfig(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $insightTypeConfig = new InsightTypeConfig(); + $request = (new UpdateInsightTypeConfigRequest()) + ->setInsightTypeConfig($insightTypeConfig); + $response = $gapicClient->updateInsightTypeConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/UpdateInsightTypeConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getInsightTypeConfig(); + $this->assertProtobufEquals($insightTypeConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateInsightTypeConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $insightTypeConfig = new InsightTypeConfig(); + $request = (new UpdateInsightTypeConfigRequest()) + ->setInsightTypeConfig($insightTypeConfig); + try { + $gapicClient->updateInsightTypeConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateRecommenderConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $revisionId = 'revisionId513861631'; + $displayName = 'displayName1615086568'; + $expectedResponse = new RecommenderConfig(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $recommenderConfig = new RecommenderConfig(); + $request = (new UpdateRecommenderConfigRequest()) + ->setRecommenderConfig($recommenderConfig); + $response = $gapicClient->updateRecommenderConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/UpdateRecommenderConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getRecommenderConfig(); + $this->assertProtobufEquals($recommenderConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateRecommenderConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $recommenderConfig = new RecommenderConfig(); + $request = (new UpdateRecommenderConfigRequest()) + ->setRecommenderConfig($recommenderConfig); + try { + $gapicClient->updateRecommenderConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInsightAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $insightSubtype = 'insightSubtype-1491142701'; + $etag = 'etag3123477'; + $expectedResponse = new Insight(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setInsightSubtype($insightSubtype); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + $request = (new GetInsightRequest()) + ->setName($formattedName); + $response = $gapicClient->getInsightAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/GetInsight', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Recommender/v1/tests/Unit/V1/RecommenderClientTest.php b/owl-bot-staging/Recommender/v1/tests/Unit/V1/RecommenderClientTest.php new file mode 100644 index 000000000000..e321889ef249 --- /dev/null +++ b/owl-bot-staging/Recommender/v1/tests/Unit/V1/RecommenderClientTest.php @@ -0,0 +1,954 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return RecommenderClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new RecommenderClient($options); + } + + /** @test */ + public function getInsightTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $insightSubtype = 'insightSubtype-1491142701'; + $etag = 'etag3123477'; + $expectedResponse = new Insight(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setInsightSubtype($insightSubtype); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + $response = $gapicClient->getInsight($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/GetInsight', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInsightExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + try { + $gapicClient->getInsight($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInsightTypeConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $revisionId = 'revisionId513861631'; + $displayName = 'displayName1615086568'; + $expectedResponse = new InsightTypeConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->insightTypeConfigName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + $response = $gapicClient->getInsightTypeConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/GetInsightTypeConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInsightTypeConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->insightTypeConfigName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + try { + $gapicClient->getInsightTypeConfig($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRecommendationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag = 'etag3123477'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $response = $gapicClient->getRecommendation($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/GetRecommendation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRecommendationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + try { + $gapicClient->getRecommendation($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRecommenderConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $revisionId = 'revisionId513861631'; + $displayName = 'displayName1615086568'; + $expectedResponse = new RecommenderConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommenderConfigName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + $response = $gapicClient->getRecommenderConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/GetRecommenderConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRecommenderConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommenderConfigName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + try { + $gapicClient->getRecommenderConfig($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInsightsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $insightsElement = new Insight(); + $insights = [ + $insightsElement, + ]; + $expectedResponse = new ListInsightsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInsights($insights); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->insightTypeName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + $response = $gapicClient->listInsights($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInsights()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/ListInsights', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInsightsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->insightTypeName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]'); + try { + $gapicClient->listInsights($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRecommendationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $recommendationsElement = new Recommendation(); + $recommendations = [ + $recommendationsElement, + ]; + $expectedResponse = new ListRecommendationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRecommendations($recommendations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->recommenderName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + $response = $gapicClient->listRecommendations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRecommendations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/ListRecommendations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRecommendationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->recommenderName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]'); + try { + $gapicClient->listRecommendations($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markInsightAcceptedTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $insightSubtype = 'insightSubtype-1491142701'; + $etag2 = 'etag2-1293302904'; + $expectedResponse = new Insight(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setInsightSubtype($insightSubtype); + $expectedResponse->setEtag($etag2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + $etag = 'etag3123477'; + $response = $gapicClient->markInsightAccepted($formattedName, $etag); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkInsightAccepted', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getEtag(); + $this->assertProtobufEquals($etag, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markInsightAcceptedExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->insightName('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]'); + $etag = 'etag3123477'; + try { + $gapicClient->markInsightAccepted($formattedName, $etag); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationClaimedTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag2 = 'etag2-1293302904'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag2); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + $response = $gapicClient->markRecommendationClaimed($formattedName, $etag); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkRecommendationClaimed', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getEtag(); + $this->assertProtobufEquals($etag, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationClaimedExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + try { + $gapicClient->markRecommendationClaimed($formattedName, $etag); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationDismissedTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag2 = 'etag2-1293302904'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag2); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $response = $gapicClient->markRecommendationDismissed($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkRecommendationDismissed', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationDismissedExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + try { + $gapicClient->markRecommendationDismissed($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationFailedTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag2 = 'etag2-1293302904'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag2); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + $response = $gapicClient->markRecommendationFailed($formattedName, $etag); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkRecommendationFailed', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getEtag(); + $this->assertProtobufEquals($etag, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationFailedExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + try { + $gapicClient->markRecommendationFailed($formattedName, $etag); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationSucceededTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $recommenderSubtype = 'recommenderSubtype-1488504412'; + $etag2 = 'etag2-1293302904'; + $xorGroupId = 'xorGroupId381095487'; + $expectedResponse = new Recommendation(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRecommenderSubtype($recommenderSubtype); + $expectedResponse->setEtag($etag2); + $expectedResponse->setXorGroupId($xorGroupId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + $response = $gapicClient->markRecommendationSucceeded($formattedName, $etag); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/MarkRecommendationSucceeded', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getEtag(); + $this->assertProtobufEquals($etag, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function markRecommendationSucceededExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->recommendationName('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]'); + $etag = 'etag3123477'; + try { + $gapicClient->markRecommendationSucceeded($formattedName, $etag); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateInsightTypeConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $revisionId = 'revisionId513861631'; + $displayName = 'displayName1615086568'; + $expectedResponse = new InsightTypeConfig(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $insightTypeConfig = new InsightTypeConfig(); + $response = $gapicClient->updateInsightTypeConfig($insightTypeConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/UpdateInsightTypeConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getInsightTypeConfig(); + $this->assertProtobufEquals($insightTypeConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateInsightTypeConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $insightTypeConfig = new InsightTypeConfig(); + try { + $gapicClient->updateInsightTypeConfig($insightTypeConfig); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateRecommenderConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $etag = 'etag3123477'; + $revisionId = 'revisionId513861631'; + $displayName = 'displayName1615086568'; + $expectedResponse = new RecommenderConfig(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $recommenderConfig = new RecommenderConfig(); + $response = $gapicClient->updateRecommenderConfig($recommenderConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.recommender.v1.Recommender/UpdateRecommenderConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getRecommenderConfig(); + $this->assertProtobufEquals($recommenderConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateRecommenderConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $recommenderConfig = new RecommenderConfig(); + try { + $gapicClient->updateRecommenderConfig($recommenderConfig); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +}