Skip to content

Commit e395513

Browse files
feat: add new RPCs GetSettings, UpdateSettings and new messages Settings, NotificationSettings, GetSettingsRequest, UpdateSettingsRequest (#11752)
BEGIN_COMMIT_OVERRIDE feat: add new RPCs GetSettings, UpdateSettings and new messages Settings, NotificationSettings, GetSettingsRequest, UpdateSettingsRequest END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. PiperOrigin-RevId: 568252764 Source-Link: googleapis/googleapis@c981bf5 Source-Link: googleapis/googleapis-gen@a37d28d Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFkdmlzb3J5bm90aWZpY2F0aW9ucy8uT3dsQm90LnlhbWwiLCJoIjoiYTM3ZDI4ZGFjYmNkMThmYWY1Mjk3ZDJmZGZhZTI5ZmVhMDBkOTZiZCJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent b254665 commit e395513

22 files changed

+2731
-222
lines changed

packages/google-cloud-advisorynotifications/CONTRIBUTING.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ Running System Tests
143143
$ nox -s system
144144

145145
# Run a single system test
146-
$ nox -s system- -- -k <name of test>
146+
$ nox -s system-3.11 -- -k <name of test>
147147

148148

149149
.. note::
150150

151-
System tests are only configured to run under Python.
151+
System tests are only configured to run under Python 3.8, 3.9, 3.10 and 3.11.
152152
For expediency, we do not run them in older versions of Python 3.
153153

154154
This alone will not run the tests. You'll need to change some local

packages/google-cloud-advisorynotifications/google/cloud/advisorynotifications/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,19 @@
2828
Attachment,
2929
Csv,
3030
GetNotificationRequest,
31+
GetSettingsRequest,
3132
ListNotificationsRequest,
3233
ListNotificationsResponse,
3334
LocalizationState,
3435
Message,
3536
Notification,
37+
NotificationSettings,
3638
NotificationType,
3739
NotificationView,
40+
Settings,
3841
Subject,
3942
Text,
43+
UpdateSettingsRequest,
4044
)
4145

4246
__all__ = (
@@ -45,12 +49,16 @@
4549
"Attachment",
4650
"Csv",
4751
"GetNotificationRequest",
52+
"GetSettingsRequest",
4853
"ListNotificationsRequest",
4954
"ListNotificationsResponse",
5055
"Message",
5156
"Notification",
57+
"NotificationSettings",
58+
"Settings",
5259
"Subject",
5360
"Text",
61+
"UpdateSettingsRequest",
5462
"LocalizationState",
5563
"NotificationType",
5664
"NotificationView",

packages/google-cloud-advisorynotifications/google/cloud/advisorynotifications/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.3.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-advisorynotifications/google/cloud/advisorynotifications_v1/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,19 @@
2626
Attachment,
2727
Csv,
2828
GetNotificationRequest,
29+
GetSettingsRequest,
2930
ListNotificationsRequest,
3031
ListNotificationsResponse,
3132
LocalizationState,
3233
Message,
3334
Notification,
35+
NotificationSettings,
3436
NotificationType,
3537
NotificationView,
38+
Settings,
3639
Subject,
3740
Text,
41+
UpdateSettingsRequest,
3842
)
3943

4044
__all__ = (
@@ -43,13 +47,17 @@
4347
"Attachment",
4448
"Csv",
4549
"GetNotificationRequest",
50+
"GetSettingsRequest",
4651
"ListNotificationsRequest",
4752
"ListNotificationsResponse",
4853
"LocalizationState",
4954
"Message",
5055
"Notification",
56+
"NotificationSettings",
5157
"NotificationType",
5258
"NotificationView",
59+
"Settings",
5360
"Subject",
5461
"Text",
62+
"UpdateSettingsRequest",
5563
)

packages/google-cloud-advisorynotifications/google/cloud/advisorynotifications_v1/gapic_metadata.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,20 @@
1515
"get_notification"
1616
]
1717
},
18+
"GetSettings": {
19+
"methods": [
20+
"get_settings"
21+
]
22+
},
1823
"ListNotifications": {
1924
"methods": [
2025
"list_notifications"
2126
]
27+
},
28+
"UpdateSettings": {
29+
"methods": [
30+
"update_settings"
31+
]
2232
}
2333
}
2434
},
@@ -30,10 +40,20 @@
3040
"get_notification"
3141
]
3242
},
43+
"GetSettings": {
44+
"methods": [
45+
"get_settings"
46+
]
47+
},
3348
"ListNotifications": {
3449
"methods": [
3550
"list_notifications"
3651
]
52+
},
53+
"UpdateSettings": {
54+
"methods": [
55+
"update_settings"
56+
]
3757
}
3858
}
3959
},
@@ -45,10 +65,20 @@
4565
"get_notification"
4666
]
4767
},
68+
"GetSettings": {
69+
"methods": [
70+
"get_settings"
71+
]
72+
},
4873
"ListNotifications": {
4974
"methods": [
5075
"list_notifications"
5176
]
77+
},
78+
"UpdateSettings": {
79+
"methods": [
80+
"update_settings"
81+
]
5282
}
5383
}
5484
}

packages/google-cloud-advisorynotifications/google/cloud/advisorynotifications_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.3.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-advisorynotifications/google/cloud/advisorynotifications_v1/services/advisory_notifications_service/async_client.py

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ class AdvisoryNotificationsServiceAsyncClient:
6868
parse_notification_path = staticmethod(
6969
AdvisoryNotificationsServiceClient.parse_notification_path
7070
)
71+
settings_path = staticmethod(AdvisoryNotificationsServiceClient.settings_path)
72+
parse_settings_path = staticmethod(
73+
AdvisoryNotificationsServiceClient.parse_settings_path
74+
)
7175
common_billing_account_path = staticmethod(
7276
AdvisoryNotificationsServiceClient.common_billing_account_path
7377
)
@@ -468,6 +472,209 @@ async def sample_get_notification():
468472
# Done; return the response.
469473
return response
470474

475+
async def get_settings(
476+
self,
477+
request: Optional[Union[service.GetSettingsRequest, dict]] = None,
478+
*,
479+
name: Optional[str] = None,
480+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
481+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
482+
metadata: Sequence[Tuple[str, str]] = (),
483+
) -> service.Settings:
484+
r"""Get notification settings.
485+
486+
.. code-block:: python
487+
488+
# This snippet has been automatically generated and should be regarded as a
489+
# code template only.
490+
# It will require modifications to work:
491+
# - It may require correct/in-range values for request initialization.
492+
# - It may require specifying regional endpoints when creating the service
493+
# client as shown in:
494+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
495+
from google.cloud import advisorynotifications_v1
496+
497+
async def sample_get_settings():
498+
# Create a client
499+
client = advisorynotifications_v1.AdvisoryNotificationsServiceAsyncClient()
500+
501+
# Initialize request argument(s)
502+
request = advisorynotifications_v1.GetSettingsRequest(
503+
name="name_value",
504+
)
505+
506+
# Make the request
507+
response = await client.get_settings(request=request)
508+
509+
# Handle the response
510+
print(response)
511+
512+
Args:
513+
request (Optional[Union[google.cloud.advisorynotifications_v1.types.GetSettingsRequest, dict]]):
514+
The request object. Request of GetSettings endpoint.
515+
name (:class:`str`):
516+
Required. The resource name of the
517+
settings to retrieve. Format:
518+
519+
organizations/{organization}/locations/{location}/settings.
520+
521+
This corresponds to the ``name`` field
522+
on the ``request`` instance; if ``request`` is provided, this
523+
should not be set.
524+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
525+
should be retried.
526+
timeout (float): The timeout for this request.
527+
metadata (Sequence[Tuple[str, str]]): Strings which should be
528+
sent along with the request as metadata.
529+
530+
Returns:
531+
google.cloud.advisorynotifications_v1.types.Settings:
532+
Settings for Advisory Notifications.
533+
"""
534+
# Create or coerce a protobuf request object.
535+
# Quick check: If we got a request object, we should *not* have
536+
# gotten any keyword arguments that map to the request.
537+
has_flattened_params = any([name])
538+
if request is not None and has_flattened_params:
539+
raise ValueError(
540+
"If the `request` argument is set, then none of "
541+
"the individual field arguments should be set."
542+
)
543+
544+
request = service.GetSettingsRequest(request)
545+
546+
# If we have keyword arguments corresponding to fields on the
547+
# request, apply these.
548+
if name is not None:
549+
request.name = name
550+
551+
# Wrap the RPC method; this adds retry and timeout information,
552+
# and friendly error handling.
553+
rpc = gapic_v1.method_async.wrap_method(
554+
self._client._transport.get_settings,
555+
default_timeout=None,
556+
client_info=DEFAULT_CLIENT_INFO,
557+
)
558+
559+
# Certain fields should be provided within the metadata header;
560+
# add these here.
561+
metadata = tuple(metadata) + (
562+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
563+
)
564+
565+
# Send the request.
566+
response = await rpc(
567+
request,
568+
retry=retry,
569+
timeout=timeout,
570+
metadata=metadata,
571+
)
572+
573+
# Done; return the response.
574+
return response
575+
576+
async def update_settings(
577+
self,
578+
request: Optional[Union[service.UpdateSettingsRequest, dict]] = None,
579+
*,
580+
settings: Optional[service.Settings] = None,
581+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
582+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
583+
metadata: Sequence[Tuple[str, str]] = (),
584+
) -> service.Settings:
585+
r"""Update notification settings.
586+
587+
.. code-block:: python
588+
589+
# This snippet has been automatically generated and should be regarded as a
590+
# code template only.
591+
# It will require modifications to work:
592+
# - It may require correct/in-range values for request initialization.
593+
# - It may require specifying regional endpoints when creating the service
594+
# client as shown in:
595+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
596+
from google.cloud import advisorynotifications_v1
597+
598+
async def sample_update_settings():
599+
# Create a client
600+
client = advisorynotifications_v1.AdvisoryNotificationsServiceAsyncClient()
601+
602+
# Initialize request argument(s)
603+
settings = advisorynotifications_v1.Settings()
604+
settings.etag = "etag_value"
605+
606+
request = advisorynotifications_v1.UpdateSettingsRequest(
607+
settings=settings,
608+
)
609+
610+
# Make the request
611+
response = await client.update_settings(request=request)
612+
613+
# Handle the response
614+
print(response)
615+
616+
Args:
617+
request (Optional[Union[google.cloud.advisorynotifications_v1.types.UpdateSettingsRequest, dict]]):
618+
The request object. Request of UpdateSettings endpoint.
619+
settings (:class:`google.cloud.advisorynotifications_v1.types.Settings`):
620+
Required. New settings.
621+
This corresponds to the ``settings`` field
622+
on the ``request`` instance; if ``request`` is provided, this
623+
should not be set.
624+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
625+
should be retried.
626+
timeout (float): The timeout for this request.
627+
metadata (Sequence[Tuple[str, str]]): Strings which should be
628+
sent along with the request as metadata.
629+
630+
Returns:
631+
google.cloud.advisorynotifications_v1.types.Settings:
632+
Settings for Advisory Notifications.
633+
"""
634+
# Create or coerce a protobuf request object.
635+
# Quick check: If we got a request object, we should *not* have
636+
# gotten any keyword arguments that map to the request.
637+
has_flattened_params = any([settings])
638+
if request is not None and has_flattened_params:
639+
raise ValueError(
640+
"If the `request` argument is set, then none of "
641+
"the individual field arguments should be set."
642+
)
643+
644+
request = service.UpdateSettingsRequest(request)
645+
646+
# If we have keyword arguments corresponding to fields on the
647+
# request, apply these.
648+
if settings is not None:
649+
request.settings = settings
650+
651+
# Wrap the RPC method; this adds retry and timeout information,
652+
# and friendly error handling.
653+
rpc = gapic_v1.method_async.wrap_method(
654+
self._client._transport.update_settings,
655+
default_timeout=None,
656+
client_info=DEFAULT_CLIENT_INFO,
657+
)
658+
659+
# Certain fields should be provided within the metadata header;
660+
# add these here.
661+
metadata = tuple(metadata) + (
662+
gapic_v1.routing_header.to_grpc_metadata(
663+
(("settings.name", request.settings.name),)
664+
),
665+
)
666+
667+
# Send the request.
668+
response = await rpc(
669+
request,
670+
retry=retry,
671+
timeout=timeout,
672+
metadata=metadata,
673+
)
674+
675+
# Done; return the response.
676+
return response
677+
471678
async def __aenter__(self) -> "AdvisoryNotificationsServiceAsyncClient":
472679
return self
473680

0 commit comments

Comments
 (0)