Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


from .services.recommender import RecommenderAsyncClient, RecommenderClient
from .types.insight import Insight, InsightStateInfo
from .types.insight import Insight, InsightStateInfo, InsightType
from .types.insight_type_config import InsightTypeConfig, InsightTypeGenerationConfig
from .types.recommendation import (
CostProjection,
Expand All @@ -29,6 +29,7 @@
Recommendation,
RecommendationContent,
RecommendationStateInfo,
RecommenderType,
SecurityProjection,
SustainabilityProjection,
ValueMatcher,
Expand All @@ -41,8 +42,12 @@
GetRecommenderConfigRequest,
ListInsightsRequest,
ListInsightsResponse,
ListInsightTypesRequest,
ListInsightTypesResponse,
ListRecommendationsRequest,
ListRecommendationsResponse,
ListRecommendersRequest,
ListRecommendersResponse,
MarkInsightAcceptedRequest,
MarkRecommendationClaimedRequest,
MarkRecommendationFailedRequest,
Expand All @@ -61,12 +66,17 @@
"Impact",
"Insight",
"InsightStateInfo",
"InsightType",
"InsightTypeConfig",
"InsightTypeGenerationConfig",
"ListInsightTypesRequest",
"ListInsightTypesResponse",
"ListInsightsRequest",
"ListInsightsResponse",
"ListRecommendationsRequest",
"ListRecommendationsResponse",
"ListRecommendersRequest",
"ListRecommendersResponse",
"MarkInsightAcceptedRequest",
"MarkRecommendationClaimedRequest",
"MarkRecommendationFailedRequest",
Expand All @@ -79,6 +89,7 @@
"RecommenderClient",
"RecommenderConfig",
"RecommenderGenerationConfig",
"RecommenderType",
"SecurityProjection",
"SustainabilityProjection",
"UpdateInsightTypeConfigRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
"get_recommender_config"
]
},
"ListInsightTypes": {
"methods": [
"list_insight_types"
]
},
"ListInsights": {
"methods": [
"list_insights"
Expand All @@ -40,6 +45,11 @@
"list_recommendations"
]
},
"ListRecommenders": {
"methods": [
"list_recommenders"
]
},
"MarkInsightAccepted": {
"methods": [
"mark_insight_accepted"
Expand Down Expand Up @@ -95,6 +105,11 @@
"get_recommender_config"
]
},
"ListInsightTypes": {
"methods": [
"list_insight_types"
]
},
"ListInsights": {
"methods": [
"list_insights"
Expand All @@ -105,6 +120,11 @@
"list_recommendations"
]
},
"ListRecommenders": {
"methods": [
"list_recommenders"
]
},
"MarkInsightAccepted": {
"methods": [
"mark_insight_accepted"
Expand Down Expand Up @@ -160,6 +180,11 @@
"get_recommender_config"
]
},
"ListInsightTypes": {
"methods": [
"list_insight_types"
]
},
"ListInsights": {
"methods": [
"list_insights"
Expand All @@ -170,6 +195,11 @@
"list_recommendations"
]
},
"ListRecommenders": {
"methods": [
"list_recommenders"
]
},
"MarkInsightAccepted": {
"methods": [
"mark_insight_accepted"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ async def sample_get_insight():
google.cloud.recommender_v1beta1.types.Insight:
An insight along with the information
used to derive the insight. The insight
may have associated recomendations as
may have associated recommendations as
well.

"""
Expand Down Expand Up @@ -579,7 +579,7 @@ async def sample_mark_insight_accepted():
google.cloud.recommender_v1beta1.types.Insight:
An insight along with the information
used to derive the insight. The insight
may have associated recomendations as
may have associated recommendations as
well.

"""
Expand Down Expand Up @@ -1769,6 +1769,180 @@ async def sample_update_insight_type_config():
# Done; return the response.
return response

async def list_recommenders(
self,
request: Optional[
Union[recommender_service.ListRecommendersRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListRecommendersAsyncPager:
r"""Lists all available Recommenders.
No IAM permissions are required.

.. code-block:: python

# This snippet 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 as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_list_recommenders():
# Create a client
client = recommender_v1beta1.RecommenderAsyncClient()

# Initialize request argument(s)
request = recommender_v1beta1.ListRecommendersRequest(
)

# Make the request
page_result = client.list_recommenders(request=request)

# Handle the response
async for response in page_result:
print(response)

Args:
request (Optional[Union[google.cloud.recommender_v1beta1.types.ListRecommendersRequest, dict]]):
The request object. Request for the ``ListRecommender`` method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.

Returns:
google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendersAsyncPager:
Response for the ListRecommender method.

Iterating over this object will yield results and
resolve additional pages automatically.

"""
# Create or coerce a protobuf request object.
request = recommender_service.ListRecommendersRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.list_recommenders,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListRecommendersAsyncPager(
method=rpc,
request=request,
response=response,
metadata=metadata,
)

# Done; return the response.
return response

async def list_insight_types(
self,
request: Optional[
Union[recommender_service.ListInsightTypesRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListInsightTypesAsyncPager:
r"""Lists available InsightTypes.
No IAM permissions are required.

.. code-block:: python

# This snippet 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 as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_list_insight_types():
# Create a client
client = recommender_v1beta1.RecommenderAsyncClient()

# Initialize request argument(s)
request = recommender_v1beta1.ListInsightTypesRequest(
)

# Make the request
page_result = client.list_insight_types(request=request)

# Handle the response
async for response in page_result:
print(response)

Args:
request (Optional[Union[google.cloud.recommender_v1beta1.types.ListInsightTypesRequest, dict]]):
The request object. Request for the ``ListInsightTypes`` method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.

Returns:
google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightTypesAsyncPager:
Response for the ListInsightTypes method.

Iterating over this object will yield results and
resolve additional pages automatically.

"""
# Create or coerce a protobuf request object.
request = recommender_service.ListInsightTypesRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.list_insight_types,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListInsightTypesAsyncPager(
method=rpc,
request=request,
response=response,
metadata=metadata,
)

# Done; return the response.
return response

async def __aenter__(self) -> "RecommenderAsyncClient":
return self

Expand Down
Loading