Recommender V1 API - Class Google::Cloud::Recommender::V1::Recommender::Rest::Client (v0.15.0)

Reference documentation and code samples for the Recommender V1 API class Google::Cloud::Recommender::V1::Recommender::Rest::Client.

REST client for the Recommender service.

Provides insights and recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. Insights and recommendations are generated automatically based on analysis of user resources, configuration and monitoring metrics.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the Recommender Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Recommender clients
::Google::Cloud::Recommender::V1::Recommender::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the Recommender Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#get_insight

def get_insight(request, options = nil) -> ::Google::Cloud::Recommender::V1::Insight
def get_insight(name: nil) -> ::Google::Cloud::Recommender::V1::Insight

Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.

Overloads
def get_insight(request, options = nil) -> ::Google::Cloud::Recommender::V1::Insight
Pass arguments to get_insight via a request object, either of type GetInsightRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::GetInsightRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_insight(name: nil) -> ::Google::Cloud::Recommender::V1::Insight
Pass arguments to get_insight via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Name of the insight.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::GetInsightRequest.new

# Call the get_insight method.
result = client.get_insight request

# The returned object is of type Google::Cloud::Recommender::V1::Insight.
p result

#get_insight_type_config

def get_insight_type_config(request, options = nil) -> ::Google::Cloud::Recommender::V1::InsightTypeConfig
def get_insight_type_config(name: nil) -> ::Google::Cloud::Recommender::V1::InsightTypeConfig

Gets the requested InsightTypeConfig. There is only one instance of the config for each InsightType.

Overloads
def get_insight_type_config(request, options = nil) -> ::Google::Cloud::Recommender::V1::InsightTypeConfig
Pass arguments to get_insight_type_config via a request object, either of type GetInsightTypeConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::GetInsightTypeConfigRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_insight_type_config(name: nil) -> ::Google::Cloud::Recommender::V1::InsightTypeConfig
Pass arguments to get_insight_type_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) —

    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

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::GetInsightTypeConfigRequest.new

# Call the get_insight_type_config method.
result = client.get_insight_type_config request

# The returned object is of type Google::Cloud::Recommender::V1::InsightTypeConfig.
p result

#get_recommendation

def get_recommendation(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
def get_recommendation(name: nil) -> ::Google::Cloud::Recommender::V1::Recommendation

Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.

Overloads
def get_recommendation(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to get_recommendation via a request object, either of type GetRecommendationRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::GetRecommendationRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_recommendation(name: nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to get_recommendation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Name of the recommendation.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::GetRecommendationRequest.new

# Call the get_recommendation method.
result = client.get_recommendation request

# The returned object is of type Google::Cloud::Recommender::V1::Recommendation.
p result

#get_recommender_config

def get_recommender_config(request, options = nil) -> ::Google::Cloud::Recommender::V1::RecommenderConfig
def get_recommender_config(name: nil) -> ::Google::Cloud::Recommender::V1::RecommenderConfig

Gets the requested Recommender Config. There is only one instance of the config for each Recommender.

Overloads
def get_recommender_config(request, options = nil) -> ::Google::Cloud::Recommender::V1::RecommenderConfig
Pass arguments to get_recommender_config via a request object, either of type GetRecommenderConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::GetRecommenderConfigRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_recommender_config(name: nil) -> ::Google::Cloud::Recommender::V1::RecommenderConfig
Pass arguments to get_recommender_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) —

    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

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::GetRecommenderConfigRequest.new

# Call the get_recommender_config method.
result = client.get_recommender_config request

# The returned object is of type Google::Cloud::Recommender::V1::RecommenderConfig.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new Recommender REST client object.

Yields
  • (config) — Configure the Recommender client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Recommender::V1::Recommender::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_insights

def list_insights(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>
def list_insights(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>

Lists insights for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified insight type.

Overloads
def list_insights(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>
Pass arguments to list_insights via a request object, either of type ListInsightsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::ListInsightsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_insights(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>
Pass arguments to list_insights via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — 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.

  • page_size (::Integer) — 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.
  • page_token (::String) — 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.
  • filter (::String) — Optional. Filter expression to restrict the insights returned. Supported filter fields:

    • stateInfo.state

    • insightSubtype

    • severity

    Examples:

    • stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED

    • insightSubtype = PERMISSIONS_USAGE

    • severity = CRITICAL OR severity = HIGH

    • stateInfo.state = ACTIVE AND (severity = CRITICAL OR severity = HIGH)

    (These expressions are based on the filter language described at https://google.aip.dev/160)

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::ListInsightsRequest.new

# Call the list_insights method.
result = client.list_insights request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Recommender::V1::Insight.
  p item
end

#list_recommendations

def list_recommendations(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Recommender::V1::Recommendation>
def list_recommendations(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Recommender::V1::Recommendation>

Lists recommendations for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified recommender.

Overloads
def list_recommendations(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Recommender::V1::Recommendation>
Pass arguments to list_recommendations via a request object, either of type ListRecommendationsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::ListRecommendationsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_recommendations(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Recommender::V1::Recommendation>
Pass arguments to list_recommendations via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — 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.

  • page_size (::Integer) — 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.
  • page_token (::String) — 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.
  • filter (::String) — Filter expression to restrict the recommendations returned. Supported filter fields:

    • state_info.state

    • recommenderSubtype

    • priority

    Examples:

    • stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED

    • recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE

    • priority = P1 OR priority = P2

    • stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)

    (These expressions are based on the filter language described at https://google.aip.dev/160)

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::ListRecommendationsRequest.new

# Call the list_recommendations method.
result = client.list_recommendations request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Recommender::V1::Recommendation.
  p item
end

#mark_insight_accepted

def mark_insight_accepted(request, options = nil) -> ::Google::Cloud::Recommender::V1::Insight
def mark_insight_accepted(name: nil, state_metadata: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Insight

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.

Overloads
def mark_insight_accepted(request, options = nil) -> ::Google::Cloud::Recommender::V1::Insight
Pass arguments to mark_insight_accepted via a request object, either of type MarkInsightAcceptedRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::MarkInsightAcceptedRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def mark_insight_accepted(name: nil, state_metadata: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Insight
Pass arguments to mark_insight_accepted via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. Name of the insight.
  • state_metadata (::Hash{::String => ::String}) — Optional. State properties user wish to include with this state. Full replace of the current state_metadata.
  • etag (::String) — Required. Fingerprint of the Insight. Provides optimistic locking.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::MarkInsightAcceptedRequest.new

# Call the mark_insight_accepted method.
result = client.mark_insight_accepted request

# The returned object is of type Google::Cloud::Recommender::V1::Insight.
p result

#mark_recommendation_claimed

def mark_recommendation_claimed(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
def mark_recommendation_claimed(name: nil, state_metadata: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Recommendation

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.

Overloads
def mark_recommendation_claimed(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to mark_recommendation_claimed via a request object, either of type MarkRecommendationClaimedRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::MarkRecommendationClaimedRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def mark_recommendation_claimed(name: nil, state_metadata: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to mark_recommendation_claimed via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. Name of the recommendation.
  • state_metadata (::Hash{::String => ::String}) — 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}$/.
  • etag (::String) — Required. Fingerprint of the Recommendation. Provides optimistic locking.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::MarkRecommendationClaimedRequest.new

# Call the mark_recommendation_claimed method.
result = client.mark_recommendation_claimed request

# The returned object is of type Google::Cloud::Recommender::V1::Recommendation.
p result

#mark_recommendation_dismissed

def mark_recommendation_dismissed(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
def mark_recommendation_dismissed(name: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Recommendation

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.

Overloads
def mark_recommendation_dismissed(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to mark_recommendation_dismissed via a request object, either of type MarkRecommendationDismissedRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::MarkRecommendationDismissedRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def mark_recommendation_dismissed(name: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to mark_recommendation_dismissed via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Name of the recommendation.
  • etag (::String) — Fingerprint of the Recommendation. Provides optimistic locking.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::MarkRecommendationDismissedRequest.new

# Call the mark_recommendation_dismissed method.
result = client.mark_recommendation_dismissed request

# The returned object is of type Google::Cloud::Recommender::V1::Recommendation.
p result

#mark_recommendation_failed

def mark_recommendation_failed(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
def mark_recommendation_failed(name: nil, state_metadata: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Recommendation

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.

Overloads
def mark_recommendation_failed(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to mark_recommendation_failed via a request object, either of type MarkRecommendationFailedRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::MarkRecommendationFailedRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def mark_recommendation_failed(name: nil, state_metadata: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to mark_recommendation_failed via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. Name of the recommendation.
  • state_metadata (::Hash{::String => ::String}) — 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}$/.
  • etag (::String) — Required. Fingerprint of the Recommendation. Provides optimistic locking.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::MarkRecommendationFailedRequest.new

# Call the mark_recommendation_failed method.
result = client.mark_recommendation_failed request

# The returned object is of type Google::Cloud::Recommender::V1::Recommendation.
p result

#mark_recommendation_succeeded

def mark_recommendation_succeeded(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
def mark_recommendation_succeeded(name: nil, state_metadata: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Recommendation

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.

Overloads
def mark_recommendation_succeeded(request, options = nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to mark_recommendation_succeeded via a request object, either of type MarkRecommendationSucceededRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::MarkRecommendationSucceededRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def mark_recommendation_succeeded(name: nil, state_metadata: nil, etag: nil) -> ::Google::Cloud::Recommender::V1::Recommendation
Pass arguments to mark_recommendation_succeeded via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. Name of the recommendation.
  • state_metadata (::Hash{::String => ::String}) — 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}$/.
  • etag (::String) — Required. Fingerprint of the Recommendation. Provides optimistic locking.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::MarkRecommendationSucceededRequest.new

# Call the mark_recommendation_succeeded method.
result = client.mark_recommendation_succeeded request

# The returned object is of type Google::Cloud::Recommender::V1::Recommendation.
p result

#update_insight_type_config

def update_insight_type_config(request, options = nil) -> ::Google::Cloud::Recommender::V1::InsightTypeConfig
def update_insight_type_config(insight_type_config: nil, update_mask: nil, validate_only: nil) -> ::Google::Cloud::Recommender::V1::InsightTypeConfig

Updates an InsightTypeConfig change. This will create a new revision of the config.

Overloads
def update_insight_type_config(request, options = nil) -> ::Google::Cloud::Recommender::V1::InsightTypeConfig
Pass arguments to update_insight_type_config via a request object, either of type UpdateInsightTypeConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::UpdateInsightTypeConfigRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_insight_type_config(insight_type_config: nil, update_mask: nil, validate_only: nil) -> ::Google::Cloud::Recommender::V1::InsightTypeConfig
Pass arguments to update_insight_type_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::UpdateInsightTypeConfigRequest.new

# Call the update_insight_type_config method.
result = client.update_insight_type_config request

# The returned object is of type Google::Cloud::Recommender::V1::InsightTypeConfig.
p result

#update_recommender_config

def update_recommender_config(request, options = nil) -> ::Google::Cloud::Recommender::V1::RecommenderConfig
def update_recommender_config(recommender_config: nil, update_mask: nil, validate_only: nil) -> ::Google::Cloud::Recommender::V1::RecommenderConfig

Updates a Recommender Config. This will create a new revision of the config.

Overloads
def update_recommender_config(request, options = nil) -> ::Google::Cloud::Recommender::V1::RecommenderConfig
Pass arguments to update_recommender_config via a request object, either of type UpdateRecommenderConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Recommender::V1::UpdateRecommenderConfigRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_recommender_config(recommender_config: nil, update_mask: nil, validate_only: nil) -> ::Google::Cloud::Recommender::V1::RecommenderConfig
Pass arguments to update_recommender_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/recommender/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Recommender::V1::Recommender::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Recommender::V1::UpdateRecommenderConfigRequest.new

# Call the update_recommender_config method.
result = client.update_recommender_config request

# The returned object is of type Google::Cloud::Recommender::V1::RecommenderConfig.
p result