@@ -617,12 +617,13 @@ def blob(
617617
618618 def notification (
619619 self ,
620- topic_name ,
620+ topic_name = None ,
621621 topic_project = None ,
622622 custom_attributes = None ,
623623 event_types = None ,
624624 blob_name_prefix = None ,
625625 payload_format = NONE_PAYLOAD_FORMAT ,
626+ notification_id = None ,
626627 ):
627628 """Factory: create a notification resource for the bucket.
628629
@@ -632,12 +633,13 @@ def notification(
632633 """
633634 return BucketNotification (
634635 self ,
635- topic_name ,
636+ topic_name = topic_name ,
636637 topic_project = topic_project ,
637638 custom_attributes = custom_attributes ,
638639 event_types = event_types ,
639640 blob_name_prefix = blob_name_prefix ,
640641 payload_format = payload_format ,
642+ notification_id = notification_id ,
641643 )
642644
643645 def exists (self , client = None , timeout = _DEFAULT_TIMEOUT ):
@@ -1021,6 +1023,44 @@ def list_notifications(self, client=None, timeout=_DEFAULT_TIMEOUT):
10211023 iterator .bucket = self
10221024 return iterator
10231025
1026+ def get_notification (self , notification_id , client = None , timeout = _DEFAULT_TIMEOUT ):
1027+ """Get Pub / Sub notification for this bucket.
1028+
1029+ See:
1030+ https://cloud.google.com/storage/docs/json_api/v1/notifications/get
1031+
1032+ If :attr:`user_project` is set, bills the API request to that project.
1033+
1034+ :type notification_id: str
1035+ :param notification_id: The notification id to retrieve the notification configuration.
1036+
1037+ :type client: :class:`~google.cloud.storage.client.Client` or
1038+ ``NoneType``
1039+ :param client: (optional) The client to use. If not passed, falls back
1040+ to the ``client`` stored on the current bucket.
1041+ :type timeout: float or tuple
1042+ :param timeout: (optional) The amount of time, in seconds, to wait
1043+ for the server response.
1044+
1045+ Can also be passed as a tuple (connect_timeout, read_timeout).
1046+ See :meth:`requests.Session.request` documentation for details.
1047+
1048+ :rtype: :class:`.BucketNotification`
1049+ :returns: notification instance.
1050+
1051+ Example:
1052+ Get notification using notification id.
1053+
1054+ >>> from google.cloud import storage
1055+ >>> client = storage.Client()
1056+ >>> bucket = client.get_bucket('my-bucket-name') # API request.
1057+ >>> notification = bucket.get_notification(notification_id='id') # API request.
1058+
1059+ """
1060+ notification = self .notification (notification_id = notification_id )
1061+ notification .reload (client = client , timeout = timeout )
1062+ return notification
1063+
10241064 def delete (self , force = False , client = None , timeout = _DEFAULT_TIMEOUT ):
10251065 """Delete this bucket.
10261066
0 commit comments