Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
fix: rename parent to project in SearchRelatedAccountGroupMemberships…
Browse files Browse the repository at this point in the history
…Request (#227)

- [ ] Regenerate this pull request now.

feat: introduced WafSettings

PiperOrigin-RevId: 446496512

Source-Link: googleapis/googleapis@63d4fba

Source-Link: https://github.com/googleapis/googleapis-gen/commit/f168b29e44d1d09bc407e8ef09587b7c8fcfe622
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjE2OGIyOWU0NGQxZDA5YmM0MDdlOGVmMDk1ODdiN2M4ZmNmZTYyMiJ9
  • Loading branch information
gcf-owl-bot[bot] authored May 5, 2022
1 parent 89c3b7c commit 86096a4
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 36 deletions.
2 changes: 2 additions & 0 deletions google/cloud/recaptchaenterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
TestingOptions,
TokenProperties,
UpdateKeyRequest,
WafSettings,
WebKeySettings,
)

Expand Down Expand Up @@ -91,5 +92,6 @@
"TestingOptions",
"TokenProperties",
"UpdateKeyRequest",
"WafSettings",
"WebKeySettings",
)
2 changes: 2 additions & 0 deletions google/cloud/recaptchaenterprise_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
TestingOptions,
TokenProperties,
UpdateKeyRequest,
WafSettings,
WebKeySettings,
)

Expand Down Expand Up @@ -89,5 +90,6 @@
"TestingOptions",
"TokenProperties",
"UpdateKeyRequest",
"WafSettings",
"WebKeySettings",
)
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ async def search_related_account_group_memberships(
recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest, dict
] = None,
*,
parent: str = None,
project: str = None,
hashed_account_id: bytes = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -1238,7 +1238,7 @@ async def sample_search_related_account_group_memberships():
# Initialize request argument(s)
request = recaptchaenterprise_v1.SearchRelatedAccountGroupMembershipsRequest(
parent="parent_value",
project="project_value",
)
# Make the request
Expand All @@ -1252,13 +1252,13 @@ async def sample_search_related_account_group_memberships():
request (Union[google.cloud.recaptchaenterprise_v1.types.SearchRelatedAccountGroupMembershipsRequest, dict]):
The request object. The request message to search
related account group memberships.
parent (:class:`str`):
project (:class:`str`):
Required. The name of the project to
search related account group memberships
from, in the format
"projects/{project}".
This corresponds to the ``parent`` field
This corresponds to the ``project`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
hashed_account_id (:class:`bytes`):
Expand Down Expand Up @@ -1288,7 +1288,7 @@ async def sample_search_related_account_group_memberships():
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, hashed_account_id])
has_flattened_params = any([project, hashed_account_id])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
Expand All @@ -1301,8 +1301,8 @@ async def sample_search_related_account_group_memberships():

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if project is not None:
request.project = project
if hashed_account_id is not None:
request.hashed_account_id = hashed_account_id

Expand All @@ -1317,7 +1317,7 @@ async def sample_search_related_account_group_memberships():
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
gapic_v1.routing_header.to_grpc_metadata((("project", request.project),)),
)

# Send the request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ def search_related_account_group_memberships(
recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest, dict
] = None,
*,
parent: str = None,
project: str = None,
hashed_account_id: bytes = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -1522,7 +1522,7 @@ def sample_search_related_account_group_memberships():
# Initialize request argument(s)
request = recaptchaenterprise_v1.SearchRelatedAccountGroupMembershipsRequest(
parent="parent_value",
project="project_value",
)
# Make the request
Expand All @@ -1536,13 +1536,13 @@ def sample_search_related_account_group_memberships():
request (Union[google.cloud.recaptchaenterprise_v1.types.SearchRelatedAccountGroupMembershipsRequest, dict]):
The request object. The request message to search
related account group memberships.
parent (str):
project (str):
Required. The name of the project to
search related account group memberships
from, in the format
"projects/{project}".
This corresponds to the ``parent`` field
This corresponds to the ``project`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
hashed_account_id (bytes):
Expand Down Expand Up @@ -1572,7 +1572,7 @@ def sample_search_related_account_group_memberships():
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, hashed_account_id])
has_flattened_params = any([project, hashed_account_id])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
Expand All @@ -1591,8 +1591,8 @@ def sample_search_related_account_group_memberships():
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if project is not None:
request.project = project
if hashed_account_id is not None:
request.hashed_account_id = hashed_account_id

Expand All @@ -1605,7 +1605,7 @@ def sample_search_related_account_group_memberships():
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
gapic_v1.routing_header.to_grpc_metadata((("project", request.project),)),
)

# Send the request.
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/recaptchaenterprise_v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
TestingOptions,
TokenProperties,
UpdateKeyRequest,
WafSettings,
WebKeySettings,
)

Expand Down Expand Up @@ -82,5 +83,6 @@
"TestingOptions",
"TokenProperties",
"UpdateKeyRequest",
"WafSettings",
"WebKeySettings",
)
50 changes: 48 additions & 2 deletions google/cloud/recaptchaenterprise_v1/types/recaptchaenterprise.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"SearchRelatedAccountGroupMembershipsResponse",
"RelatedAccountGroupMembership",
"RelatedAccountGroup",
"WafSettings",
},
)

Expand Down Expand Up @@ -620,6 +621,8 @@ class Key(proto.Message):
of this Key.
testing_options (google.cloud.recaptchaenterprise_v1.types.TestingOptions):
Options for user acceptance testing.
waf_settings (google.cloud.recaptchaenterprise_v1.types.WafSettings):
Settings for WAF
"""

name = proto.Field(
Expand Down Expand Up @@ -663,6 +666,11 @@ class Key(proto.Message):
number=9,
message="TestingOptions",
)
waf_settings = proto.Field(
proto.MESSAGE,
number=10,
message="WafSettings",
)


class TestingOptions(proto.Message):
Expand Down Expand Up @@ -1030,7 +1038,7 @@ class SearchRelatedAccountGroupMembershipsRequest(proto.Message):
memberships.
Attributes:
parent (str):
project (str):
Required. The name of the project to search
related account group memberships from, in the
format "projects/{project}".
Expand All @@ -1055,7 +1063,7 @@ class SearchRelatedAccountGroupMembershipsRequest(proto.Message):
that provided the page token.
"""

parent = proto.Field(
project = proto.Field(
proto.STRING,
number=1,
)
Expand Down Expand Up @@ -1140,4 +1148,42 @@ class RelatedAccountGroup(proto.Message):
)


class WafSettings(proto.Message):
r"""Settings specific to keys that can be used for WAF (Web
Application Firewall).
Attributes:
waf_service (google.cloud.recaptchaenterprise_v1.types.WafSettings.WafService):
Required. The WAF service that uses this key.
waf_feature (google.cloud.recaptchaenterprise_v1.types.WafSettings.WafFeature):
Required. The WAF feature for which this key
is enabled.
"""

class WafFeature(proto.Enum):
r"""Supported WAF features. For more information, see
https://cloud.google.com/recaptcha-enterprise/docs/usecase#comparison_of_features.
"""
WAF_FEATURE_UNSPECIFIED = 0
CHALLENGE_PAGE = 1
SESSION_TOKEN = 2
ACTION_TOKEN = 3

class WafService(proto.Enum):
r"""Web Application Firewalls supported by reCAPTCHA Enterprise."""
WAF_SERVICE_UNSPECIFIED = 0
CA = 1

waf_service = proto.Field(
proto.ENUM,
number=1,
enum=WafService,
)
waf_feature = proto.Field(
proto.ENUM,
number=2,
enum=WafFeature,
)


__all__ = tuple(sorted(__protobuf__.manifest))
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def sample_search_related_account_group_memberships():

# Initialize request argument(s)
request = recaptchaenterprise_v1.SearchRelatedAccountGroupMembershipsRequest(
parent="parent_value",
project="project_value",
)

# Make the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def sample_search_related_account_group_memberships():

# Initialize request argument(s)
request = recaptchaenterprise_v1.SearchRelatedAccountGroupMembershipsRequest(
parent="parent_value",
project="project_value",
)

# Make the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@
"type": "google.cloud.recaptchaenterprise_v1.types.SearchRelatedAccountGroupMembershipsRequest"
},
{
"name": "parent",
"name": "project",
"type": "str"
},
{
Expand Down Expand Up @@ -1697,7 +1697,7 @@
"type": "google.cloud.recaptchaenterprise_v1.types.SearchRelatedAccountGroupMembershipsRequest"
},
{
"name": "parent",
"name": "project",
"type": "str"
},
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/fixup_recaptchaenterprise_v1_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class recaptchaenterpriseCallTransformer(cst.CSTTransformer):
'list_related_account_group_memberships': ('parent', 'page_size', 'page_token', ),
'list_related_account_groups': ('parent', 'page_size', 'page_token', ),
'migrate_key': ('name', ),
'search_related_account_group_memberships': ('parent', 'hashed_account_id', 'page_size', 'page_token', ),
'search_related_account_group_memberships': ('project', 'hashed_account_id', 'page_size', 'page_token', ),
'update_key': ('key', 'update_mask', ),
}

Expand Down
Loading

0 comments on commit 86096a4

Please sign in to comment.