Repository: googleapis/java-storage
Pull request #393 (2020-06-25 15:25:29)

Revert "feat: expose all the methods of notification"
Reverts googleapis/java-storage#141

I missed this in review: the surface library shouldn't expose the underlying Google API client object model, specifically line:
https://github.com/athakor/java-storage/blob/300c60459ee91669c20283bcc986737002a9ffb6/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java#L24

Which is used as a return type to CRUD operations: 

https://github.com/athakor/java-storage/blob/300c60459ee91669c20283bcc986737002a9ffb6/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java#L3438-L3468


codecov[bot]: # [Codecov](https://codecov.io/gh/googleapis/java-storage/pull/393?src=pr&el=h1) Report
> Merging [#393](https://codecov.io/gh/googleapis/java-storage/pull/393?src=pr&el=desc) into [master](https://codecov.io/gh/googleapis/java-storage/commit/8dfc0cbf8294a7fc426948e22e5c2182da97b630&el=desc) will **decrease** coverage by `0.48%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/googleapis/java-storage/pull/393/graphs/tree.svg?width=650&height=150&src=pr&token=ssm139YOdp)](https://codecov.io/gh/googleapis/java-storage/pull/393?src=pr&el=tree)

```diff
@@             Coverage Diff              @@
##             master     #393      +/-   ##
============================================
- Coverage     63.61%   63.13%   -0.49%     
+ Complexity      632      601      -31     
============================================
  Files            33       32       -1     
  Lines          5222     5078     -144     
  Branches        498      481      -17     
============================================
- Hits           3322     3206     -116     
+ Misses         1730     1708      -22     
+ Partials        170      164       -6     
```


| [Impacted Files](https://codecov.io/gh/googleapis/java-storage/pull/393?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...rc/main/java/com/google/cloud/storage/Storage.java](https://codecov.io/gh/googleapis/java-storage/pull/393/diff?src=pr&el=tree#diff-Z29vZ2xlLWNsb3VkLXN0b3JhZ2Uvc3JjL21haW4vamF2YS9jb20vZ29vZ2xlL2Nsb3VkL3N0b3JhZ2UvU3RvcmFnZS5qYXZh) | `80.90% <ø> (ø)` | `0.00 <0.00> (ø)` | |
| [...ain/java/com/google/cloud/storage/StorageImpl.java](https://codecov.io/gh/googleapis/java-storage/pull/393/diff?src=pr&el=tree#diff-Z29vZ2xlLWNsb3VkLXN0b3JhZ2Uvc3JjL21haW4vamF2YS9jb20vZ29vZ2xlL2Nsb3VkL3N0b3JhZ2UvU3RvcmFnZUltcGwuamF2YQ==) | `80.52% <ø> (+0.28%)` | `131.00 <0.00> (-4.00)` | :arrow_up: |
| [...om/google/cloud/storage/spi/v1/HttpStorageRpc.java](https://codecov.io/gh/googleapis/java-storage/pull/393/diff?src=pr&el=tree#diff-Z29vZ2xlLWNsb3VkLXN0b3JhZ2Uvc3JjL21haW4vamF2YS9jb20vZ29vZ2xlL2Nsb3VkL3N0b3JhZ2Uvc3BpL3YxL0h0dHBTdG9yYWdlUnBjLmphdmE=) | `1.52% <ø> (+0.01%)` | `1.00 <0.00> (ø)` | |
| [...ogle/cloud/storage/spi/v1/HttpStorageRpcSpans.java](https://codecov.io/gh/googleapis/java-storage/pull/393/diff?src=pr&el=tree#diff-Z29vZ2xlLWNsb3VkLXN0b3JhZ2Uvc3JjL21haW4vamF2YS9jb20vZ29vZ2xlL2Nsb3VkL3N0b3JhZ2Uvc3BpL3YxL0h0dHBTdG9yYWdlUnBjU3BhbnMuamF2YQ==) | `0.00% <ø> (ø)` | `0.00 <0.00> (ø)` | |
| [...va/com/google/cloud/storage/spi/v1/StorageRpc.java](https://codecov.io/gh/googleapis/java-storage/pull/393/diff?src=pr&el=tree#diff-Z29vZ2xlLWNsb3VkLXN0b3JhZ2Uvc3JjL21haW4vamF2YS9jb20vZ29vZ2xlL2Nsb3VkL3N0b3JhZ2Uvc3BpL3YxL1N0b3JhZ2VScGMuamF2YQ==) | `64.86% <ø> (ø)` | `0.00 <0.00> (ø)` | |
| [...ogle/cloud/storage/testing/StorageRpcTestBase.java](https://codecov.io/gh/googleapis/java-storage/pull/393/diff?src=pr&el=tree#diff-Z29vZ2xlLWNsb3VkLXN0b3JhZ2Uvc3JjL21haW4vamF2YS9jb20vZ29vZ2xlL2Nsb3VkL3N0b3JhZ2UvdGVzdGluZy9TdG9yYWdlUnBjVGVzdEJhc2UuamF2YQ==) | `97.95% <ø> (-0.05%)` | `48.00 <0.00> (-1.00)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/googleapis/java-storage/pull/393?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/googleapis/java-storage/pull/393?src=pr&el=footer). Last update [8dfc0cb...b951cad](https://codecov.io/gh/googleapis/java-storage/pull/393?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/google-cloud-storage/clirr-ignored-differences.xml b/google-cloud-storage/clirr-ignored-differences.xml
index 2aababb9..ace7a6ef 100644
--- a/google-cloud-storage/clirr-ignored-differences.xml
+++ b/google-cloud-storage/clirr-ignored-differences.xml
@@ -26,29 +26,4 @@
         <method>com.google.cloud.storage.BucketInfo$Builder deleteLifecycleRules()</method>
         <differenceType>7013</differenceType>
     </difference>
-    <difference>
-        <className>com/google/cloud/storage/Storage</className>
-        <method>com.google.api.services.storage.model.Notification createNotification(java.lang.String, com.google.cloud.storage.NotificationInfo)</method>
-        <differenceType>7012</differenceType>
-    </difference>
-    <difference>
-        <className>com/google/cloud/storage/Storage</className>
-        <method>com.google.api.services.storage.model.Notification getNotification(java.lang.String, java.lang.String)</method>
-        <differenceType>7012</differenceType>
-    </difference>
-    <difference>
-        <className>com/google/cloud/storage/Storage</className>
-        <method>java.util.List listNotifications(java.lang.String)</method>
-        <differenceType>7012</differenceType>
-    </difference>
-    <difference>
-        <className>com/google/cloud/storage/Storage</className>
-        <method>boolean deleteNotification(java.lang.String, java.lang.String)</method>
-        <differenceType>7012</differenceType>
-    </difference>
-    <difference>
-        <className>com/google/cloud/storage/spi/v1/StorageRpc</className>
-        <method>com.google.api.services.storage.model.Notification getNotification(java.lang.String, java.lang.String)</method>
-        <differenceType>7012</differenceType>
-    </difference>
 </differences>
diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml
index 1be67d6b..3e2dbb0b 100644
--- a/google-cloud-storage/pom.xml
+++ b/google-cloud-storage/pom.xml
@@ -155,11 +155,6 @@
       <artifactId>truth</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>com.google.cloud</groupId>
-      <artifactId>google-cloud-pubsub</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.easymock</groupId>
       <artifactId>easymock</artifactId>
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/NotificationInfo.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/NotificationInfo.java
deleted file mode 100644
index 34c2d326..00000000
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/NotificationInfo.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.google.cloud.storage;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.api.pathtemplate.PathTemplate;
-import com.google.api.services.storage.model.Notification;
-import com.google.common.base.Function;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Google Storage Notification metadata;
- *
- * @see <a href="https://cloud.google.com/storage/docs/concepts-techniques#concepts">Concepts and
- *     Terminology</a>
- */
-public class NotificationInfo implements Serializable {
-
-  private static final long serialVersionUID = 5725883368559753810L;
-  private static final PathTemplate PATH_TEMPLATE =
-      PathTemplate.createWithoutUrlEncoding("projects/{project}/topics/{topic}");
-
-  public enum PayloadFormat {
-    JSON_API_V1,
-    NONE
-  }
-
-  static final Function<Notification, NotificationInfo> FROM_PB_FUNCTION =
-      new Function<Notification, NotificationInfo>() {
-        @Override
-        public NotificationInfo apply(Notification pb) {
-          return NotificationInfo.fromPb(pb);
-        }
-      };
-  static final Function<NotificationInfo, Notification> TO_PB_FUNCTION =
-      new Function<NotificationInfo, Notification>() {
-        @Override
-        public Notification apply(NotificationInfo NotificationInfo) {
-          return NotificationInfo.toPb();
-        }
-      };
-  private final String generatedId;
-  private final String topic;
-  private final List<String> eventTypes;
-  private final Map<String, String> customAttributes;
-  private final PayloadFormat payloadFormat;
-  private final String objectNamePrefix;
-  private final String etag;
-  private final String selfLink;
-
-  public static final class Builder {
-
-    private String generatedId;
-    private String topic;
-    private List<String> eventTypes;
-    private Map<String, String> customAttributes;
-    private PayloadFormat payloadFormat;
-    private String objectNamePrefix;
-    private String etag;
-    private String selfLink;
-
-    Builder(String topic) {
-      this.topic = topic;
-    }
-
-    Builder(NotificationInfo NotificationInfo) {
-      generatedId = NotificationInfo.generatedId;
-      etag = NotificationInfo.etag;
-      selfLink = NotificationInfo.selfLink;
-      topic = NotificationInfo.topic;
-      eventTypes = NotificationInfo.eventTypes;
-      customAttributes = NotificationInfo.customAttributes;
-      payloadFormat = NotificationInfo.payloadFormat;
-      objectNamePrefix = NotificationInfo.objectNamePrefix;
-    }
-
-    Builder setGeneratedId(String generatedId) {
-      this.generatedId = generatedId;
-      return this;
-    }
-
-    Builder setSelfLink(String selfLink) {
-      this.selfLink = selfLink;
-      return this;
-    }
-
-    /** The name of the topic. It must have the format "projects/{project}/topics/{topic}". */
-    public Builder setTopic(String topic) {
-      this.topic = topic;
-      return this;
-    }
-
-    public Builder setPayloadFormat(PayloadFormat payloadFormat) {
-      this.payloadFormat = payloadFormat;
-      return this;
-    }
-
-    public Builder setObjectNamePrefix(String objectNamePrefix) {
-      this.objectNamePrefix = objectNamePrefix;
-      return this;
-    }
-
-    public Builder setEventTypes(Iterable<String> eventTypes) {
-      this.eventTypes = eventTypes != null ? ImmutableList.copyOf(eventTypes) : null;
-      return this;
-    }
-
-    Builder setEtag(String etag) {
-      this.etag = etag;
-      return this;
-    }
-
-    public Builder setCustomAttributes(Map<String, String> customAttributes) {
-      this.customAttributes =
-          customAttributes != null ? ImmutableMap.copyOf(customAttributes) : null;
-      return this;
-    }
-
-    public NotificationInfo build() {
-      checkNotNull(topic);
-      return new NotificationInfo(this);
-    }
-  }
-
-  NotificationInfo(Builder builder) {
-    generatedId = builder.generatedId;
-    etag = builder.etag;
-    selfLink = builder.selfLink;
-    topic = builder.topic;
-    eventTypes = builder.eventTypes;
-    customAttributes = builder.customAttributes;
-    payloadFormat = builder.payloadFormat;
-    objectNamePrefix = builder.objectNamePrefix;
-  }
-
-  /** Returns the service-generated id for the notification. */
-  public String getGeneratedId() {
-    return generatedId;
-  }
-
-  /** Returns the topic to which this subscription publishes. */
-  public String getTopic() {
-    return topic;
-  }
-
-  /** Returns the canonical URI of this topic as a string. */
-  public String getSelfLink() {
-    return selfLink;
-  }
-
-  /** Returns the desired content of the Payload. */
-  public PayloadFormat getPayloadFormat() {
-    return payloadFormat;
-  }
-
-  /** Returns the object name prefix for which this notification configuration applies. */
-  public String getObjectNamePrefix() {
-    return objectNamePrefix;
-  }
-
-  /**
-   * Returns HTTP 1.1 Entity tag for the notification.
-   *
-   * @see <a href="http://tools.ietf.org/html/rfc2616#section-3.11">Entity Tags</a>
-   */
-  public String getEtag() {
-    return etag;
-  }
-
-  /**
-   * Returns the list of event types that this notification will apply to. If empty, notifications
-   * will be sent on all event types.
-   *
-   * @see <a href="https://cloud.google.com/storage/docs/cross-origin">Cross-Origin Resource Sharing
-   *     (CORS)</a>
-   */
-  public List<String> getEventTypes() {
-    return eventTypes;
-  }
-
-  /**
-   * Returns the list of additional attributes to attach to each Cloud PubSub message published for
-   * this notification subscription.
-   *
-   * @see <a href="https://cloud.google.com/storage/docs/access-control#About-Access-Control-Lists">
-   *     About Access Control Lists</a>
-   */
-  public Map<String, String> getCustomAttributes() {
-    return customAttributes;
-  }
-
-  /** Returns a builder for the current notification. */
-  public Builder toBuilder() {
-    return new Builder(this);
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(getTopic());
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    return obj == this
-        || obj != null
-            && obj.getClass().equals(NotificationInfo.class)
-            && Objects.equals(toPb(), ((NotificationInfo) obj).toPb());
-  }
-
-  @Override
-  public String toString() {
-    return MoreObjects.toStringHelper(this).add("topic", getTopic()).toString();
-  }
-
-  Notification toPb() {
-    Notification notificationPb = new Notification();
-    notificationPb.setId(generatedId);
-    notificationPb.setEtag(etag);
-    if (customAttributes != null) {
-      notificationPb.setCustomAttributes(customAttributes);
-    }
-    if (eventTypes != null) {
-      notificationPb.setEventTypes(eventTypes);
-    }
-    if (objectNamePrefix != null) {
-      notificationPb.setObjectNamePrefix(objectNamePrefix);
-    }
-    if (payloadFormat != null) {
-      notificationPb.setPayloadFormat(payloadFormat.toString());
-    } else {
-      notificationPb.setPayloadFormat(PayloadFormat.NONE.toString());
-    }
-    notificationPb.setSelfLink(selfLink);
-    notificationPb.setTopic(topic);
-
-    return notificationPb;
-  }
-
-  /**
-   * Creates a {@code NotificationInfo} object for the provided topic name.
-   *
-   * @param topic The name of the topic. It must have the format
-   *     "projects/{project}/topics/{topic}".
-   */
-  public static NotificationInfo of(String topic) {
-    PATH_TEMPLATE.validatedMatch(topic, "topic name must be in valid format");
-    return newBuilder(topic).build();
-  }
-
-  /**
-   * Returns a {@code NotificationInfo} builder where the topic's name is set to the provided name.
-   *
-   * @param topic The name of the topic. It must have the format
-   *     "projects/{project}/topics/{topic}".
-   */
-  public static Builder newBuilder(String topic) {
-    PATH_TEMPLATE.validatedMatch(topic, "topic name must be in valid format");
-    return new Builder(topic);
-  }
-
-  static NotificationInfo fromPb(Notification notificationPb) {
-    Builder builder = newBuilder(notificationPb.getTopic());
-    if (notificationPb.getId() != null) {
-      builder.setGeneratedId(notificationPb.getId());
-    }
-    if (notificationPb.getEtag() != null) {
-      builder.setEtag(notificationPb.getEtag());
-    }
-    if (notificationPb.getCustomAttributes() != null) {
-      builder.setCustomAttributes(notificationPb.getCustomAttributes());
-    }
-    if (notificationPb.getSelfLink() != null) {
-      builder.setSelfLink(notificationPb.getSelfLink());
-    }
-    if (notificationPb.getObjectNamePrefix() != null) {
-      builder.setObjectNamePrefix(notificationPb.getObjectNamePrefix());
-    }
-    if (notificationPb.getTopic() != null) {
-      builder.setTopic(notificationPb.getTopic());
-    }
-    if (notificationPb.getEventTypes() != null) {
-      builder.setEventTypes(notificationPb.getEventTypes());
-    }
-    if (notificationPb.getPayloadFormat() != null) {
-      builder.setPayloadFormat(PayloadFormat.valueOf(notificationPb.getPayloadFormat()));
-    }
-    return builder.build();
-  }
-}
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
index fa196c90..988f87d3 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java
@@ -21,7 +21,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
 
 import com.google.api.core.InternalExtensionOnly;
 import com.google.api.gax.paging.Page;
-import com.google.api.services.storage.model.Notification;
 import com.google.auth.ServiceAccountSigner;
 import com.google.auth.ServiceAccountSigner.SigningException;
 import com.google.cloud.FieldSelector;
@@ -3434,36 +3433,4 @@ public interface Storage extends Service<StorageOptions> {
    * @throws StorageException upon failure
    */
   ServiceAccount getServiceAccount(String projectId);
-
-  /**
-   * Creates a notification with the specified entity on the specified bucket.
-   *
-   * @return the notification that was created.
-   * @throws StorageException upon failure
-   */
-  Notification createNotification(String bucket, NotificationInfo notification);
-
-  /**
-   * Get the notification with the specified name on the specified object.
-   *
-   * @return the notification object that exist on the bucket.
-   * @throws StorageException upon failure
-   */
-  Notification getNotification(String bucket, String notification);
-
-  /**
-   * List the notifications for the provided bucket.
-   *
-   * @return a list of {@link Notification} objects that exist on the bucket.
-   * @throws StorageException upon failure
-   */
-  List<Notification> listNotifications(String bucket);
-
-  /**
-   * Deletes the notification with the specified name on the specified object.
-   *
-   * @return {@code true} if the notification was deleted, {@code false} if it was not found
-   * @throws StorageException upon failure
-   */
-  boolean deleteNotification(String bucket, String notification);
 }
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
index ef46249d..0e24521e 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
@@ -36,7 +36,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
 
 import com.google.api.gax.paging.Page;
 import com.google.api.services.storage.model.BucketAccessControl;
-import com.google.api.services.storage.model.Notification;
 import com.google.api.services.storage.model.ObjectAccessControl;
 import com.google.api.services.storage.model.StorageObject;
 import com.google.api.services.storage.model.TestIamPermissionsResponse;
@@ -1699,79 +1698,6 @@ final class StorageImpl extends BaseService<StorageOptions> implements Storage {
     }
   }
 
-  @Override
-  public Notification createNotification(final String bucket, final NotificationInfo notification) {
-    final com.google.api.services.storage.model.Notification notificationPb = notification.toPb();
-    try {
-      return runWithRetries(
-          new Callable<com.google.api.services.storage.model.Notification>() {
-            @Override
-            public com.google.api.services.storage.model.Notification call() {
-              return storageRpc.createNotification(bucket, notificationPb);
-            }
-          },
-          getOptions().getRetrySettings(),
-          EXCEPTION_HANDLER,
-          getOptions().getClock());
-    } catch (RetryHelperException e) {
-      throw StorageException.translateAndThrow(e);
-    }
-  }
-
-  @Override
-  public Notification getNotification(final String bucket, final String notification) {
-    try {
-      return runWithRetries(
-          new Callable<Notification>() {
-            @Override
-            public Notification call() {
-              return storageRpc.getNotification(bucket, notification);
-            }
-          },
-          getOptions().getRetrySettings(),
-          EXCEPTION_HANDLER,
-          getOptions().getClock());
-    } catch (RetryHelperException e) {
-      throw StorageException.translateAndThrow(e);
-    }
-  }
-
-  @Override
-  public List<Notification> listNotifications(final String bucket) {
-    try {
-      return runWithRetries(
-          new Callable<List<Notification>>() {
-            @Override
-            public List<Notification> call() {
-              return storageRpc.listNotifications(bucket);
-            }
-          },
-          getOptions().getRetrySettings(),
-          EXCEPTION_HANDLER,
-          getOptions().getClock());
-    } catch (RetryHelperException e) {
-      throw StorageException.translateAndThrow(e);
-    }
-  }
-
-  @Override
-  public boolean deleteNotification(final String bucket, final String notification) {
-    try {
-      return runWithRetries(
-          new Callable<Boolean>() {
-            @Override
-            public Boolean call() {
-              return storageRpc.deleteNotification(bucket, notification);
-            }
-          },
-          getOptions().getRetrySettings(),
-          EXCEPTION_HANDLER,
-          getOptions().getClock());
-    } catch (RetryHelperException e) {
-      throw StorageException.translateAndThrow(e);
-    }
-  }
-
   private static <T> void addToOptionMap(
       StorageRpc.Option option, T defaultValue, Map<StorageRpc.Option, Object> map) {
     addToOptionMap(option, option, defaultValue, map);
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
index 97ceafa3..e211c027 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
@@ -1489,21 +1489,6 @@ public class HttpStorageRpc implements StorageRpc {
     }
   }
 
-  @Override
-  public Notification getNotification(String bucket, String notification) {
-    Span span = startSpan(HttpStorageRpcSpans.SPAN_NAME_GET_NOTIFICATION);
-    Scope scope = tracer.withSpan(span);
-    try {
-      return storage.notifications().get(bucket, notification).execute();
-    } catch (IOException ex) {
-      span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage()));
-      throw translate(ex);
-    } finally {
-      scope.close();
-      span.end();
-    }
-  }
-
   @Override
   public Bucket lockRetentionPolicy(Bucket bucket, Map<Option, ?> options) {
     Span span = startSpan(HttpStorageRpcSpans.SPAN_LOCK_RETENTION_POLICY);
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpcSpans.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpcSpans.java
index 11a33d8d..a5e4daf7 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpcSpans.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpcSpans.java
@@ -89,8 +89,6 @@ class HttpStorageRpcSpans {
   static final String SPAN_NAME_LIST_NOTIFICATIONS = getTraceSpanName("listNotifications(String)");
   static final String SPAN_NAME_CREATE_NOTIFICATION =
       getTraceSpanName("createNotification(String,Notification)");
-  static final String SPAN_NAME_GET_NOTIFICATION =
-      getTraceSpanName("getNotification(String,String)");
   static final String SPAN_LOCK_RETENTION_POLICY =
       getTraceSpanName("lockRetentionPolicy(String,Long)");
   static final String SPAN_NAME_GET_SERVICE_ACCOUNT = getTraceSpanName("getServiceAccount(String)");
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/StorageRpc.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/StorageRpc.java
index 0291d920..36c7a5ff 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/StorageRpc.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/StorageRpc.java
@@ -532,14 +532,6 @@ public interface StorageRpc extends ServiceRpc {
    */
   Notification createNotification(String bucket, Notification notification);
 
-  /**
-   * Get the notification with the specified name on the specified object.
-   *
-   * @return the notification object that exist on the bucket.
-   * @throws StorageException upon failure
-   */
-  Notification getNotification(String bucket, String notification);
-
   /**
    * Lock retention policy for the provided bucket.
    *
diff --git a/pom.xml b/pom.xml
index aa0146a4..02c4dd39 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,12 +80,6 @@
         <artifactId>google-api-services-storage</artifactId>
         <version>v1-rev20200430-1.30.9</version>
       </dependency>
-      <dependency>
-        <groupId>com.google.cloud</groupId>
-        <artifactId>google-cloud-pubsub</artifactId>
-        <version>1.106.0</version>
-        <scope>test</scope>
-      </dependency>
       <dependency>
         <groupId>org.easymock</groupId>
         <artifactId>easymock</artifactId>


Test patch:
diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/testing/StorageRpcTestBase.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/testing/StorageRpcTestBase.java
index 0f8e651a..6bd2d487 100644
--- a/google-cloud-storage/src/main/java/com/google/cloud/storage/testing/StorageRpcTestBase.java
+++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/testing/StorageRpcTestBase.java
@@ -280,11 +280,6 @@ public class StorageRpcTestBase implements StorageRpc {
     throw new UnsupportedOperationException("Not implemented yet");
   }
 
-  @Override
-  public Notification getNotification(String bucket, String notification) {
-    throw new UnsupportedOperationException("Not implemented yet");
-  }
-
   @Override
   public Bucket lockRetentionPolicy(Bucket bucket, Map<Option, ?> options) {
     throw new UnsupportedOperationException("Not implemented yet");
diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/NotificationInfoTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/NotificationInfoTest.java
deleted file mode 100644
index 40b8a5cc..00000000
--- a/google-cloud-storage/src/test/java/com/google/cloud/storage/NotificationInfoTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.cloud.storage;
-
-import static org.junit.Assert.assertEquals;
-
-import com.google.cloud.storage.NotificationInfo.PayloadFormat;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import java.util.List;
-import java.util.Map;
-import org.junit.Test;
-
-public class NotificationInfoTest {
-
-  private static final String ETAG = "0xFF00";
-  private static final String GENERATED_ID = "B/N:1";
-  private static final String SELF_LINK = "http://storage/b/n";
-  private static final List<String> EVENT_TYPES =
-      ImmutableList.of("OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE");
-  private static final String OBJECT_NAME_PREFIX = "index.html";
-  private static final PayloadFormat PAYLOAD_FORMAT = PayloadFormat.JSON_API_V1.JSON_API_V1;
-  private static final String TOPIC = "projects/myProject/topics/topic1";
-  private static final Map<String, String> CUSTOM_ATTRIBUTES = ImmutableMap.of("label1", "value1");
-  private static final NotificationInfo NOTIFICATION_INFO =
-      NotificationInfo.newBuilder(TOPIC)
-          .setEtag(ETAG)
-          .setCustomAttributes(CUSTOM_ATTRIBUTES)
-          .setSelfLink(SELF_LINK)
-          .setEventTypes(EVENT_TYPES)
-          .setObjectNamePrefix(OBJECT_NAME_PREFIX)
-          .setPayloadFormat(PAYLOAD_FORMAT)
-          .setGeneratedId(GENERATED_ID)
-          .build();
-
-  @Test
-  public void testToBuilder() {
-    compareBuckets(NOTIFICATION_INFO, NOTIFICATION_INFO.toBuilder().build());
-    NotificationInfo bucketInfo = NOTIFICATION_INFO.toBuilder().setGeneratedId("id").build();
-    assertEquals("id", bucketInfo.getGeneratedId());
-    bucketInfo = bucketInfo.toBuilder().setGeneratedId(GENERATED_ID).build();
-    compareBuckets(NOTIFICATION_INFO, bucketInfo);
-  }
-
-  @Test
-  public void testToBuilderIncomplete() {
-    NotificationInfo incompleteBucketInfo = NotificationInfo.newBuilder(TOPIC).build();
-    compareBuckets(incompleteBucketInfo, incompleteBucketInfo.toBuilder().build());
-  }
-
-  @Test
-  public void testOf() {
-    NotificationInfo bucketInfo = NotificationInfo.of(TOPIC);
-    assertEquals(TOPIC, bucketInfo.getTopic());
-  }
-
-  @Test
-  public void testBuilder() {
-    assertEquals(ETAG, NOTIFICATION_INFO.getEtag());
-    assertEquals(GENERATED_ID, NOTIFICATION_INFO.getGeneratedId());
-    assertEquals(SELF_LINK, NOTIFICATION_INFO.getSelfLink());
-    assertEquals(EVENT_TYPES, NOTIFICATION_INFO.getEventTypes());
-    assertEquals(OBJECT_NAME_PREFIX, NOTIFICATION_INFO.getObjectNamePrefix());
-    assertEquals(PAYLOAD_FORMAT, NOTIFICATION_INFO.getPayloadFormat());
-    assertEquals(TOPIC, NOTIFICATION_INFO.getTopic());
-    assertEquals(CUSTOM_ATTRIBUTES, NOTIFICATION_INFO.getCustomAttributes());
-  }
-
-  @Test
-  public void testToPbAndFromPb() {
-    compareBuckets(NOTIFICATION_INFO, NotificationInfo.fromPb(NOTIFICATION_INFO.toPb()));
-    NotificationInfo bucketInfo =
-        NotificationInfo.of(TOPIC).toBuilder().setPayloadFormat(PayloadFormat.NONE).build();
-    compareBuckets(bucketInfo, NotificationInfo.fromPb(bucketInfo.toPb()));
-  }
-
-  private void compareBuckets(NotificationInfo expected, NotificationInfo value) {
-    assertEquals(expected, value);
-    assertEquals(expected.getGeneratedId(), value.getGeneratedId());
-    assertEquals(expected.getCustomAttributes(), value.getCustomAttributes());
-    assertEquals(expected.getEtag(), value.getEtag());
-    assertEquals(expected.getSelfLink(), value.getSelfLink());
-    assertEquals(expected.getEventTypes(), value.getEventTypes());
-    assertEquals(expected.getObjectNamePrefix(), value.getObjectNamePrefix());
-    assertEquals(expected.getPayloadFormat(), value.getPayloadFormat());
-    assertEquals(expected.getTopic(), value.getTopic());
-  }
-}
diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java
index ec06f264..86bbdef7 100644
--- a/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java
+++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java
@@ -31,7 +31,6 @@ import static org.junit.Assert.assertTrue;
 import com.google.api.client.googleapis.json.GoogleJsonError;
 import com.google.api.core.ApiClock;
 import com.google.api.gax.paging.Page;
-import com.google.api.services.storage.model.Notification;
 import com.google.api.services.storage.model.Policy.Bindings;
 import com.google.api.services.storage.model.StorageObject;
 import com.google.api.services.storage.model.TestIamPermissionsResponse;
@@ -57,7 +56,6 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
 import com.google.common.io.BaseEncoding;
-import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -74,7 +72,6 @@ import java.security.spec.EncodedKeySpec;
 import java.security.spec.InvalidKeySpecException;
 import java.security.spec.PKCS8EncodedKeySpec;
 import java.security.spec.X509EncodedKeySpec;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -372,38 +369,6 @@ public class StorageImplTest {
           .put('~', "~")
           .build();
 
-  // Notification
-  private static final String ETAG = "0xFF00";
-  private static final String GENERATED_ID = "B/N:1";
-  private static final String SELF_LINK = "http://storage/b/n";
-  private static final List<String> EVENT_TYPES =
-      ImmutableList.of("OBJECT_FINALIZE", "OBJECT_METADATA_UPDATE");
-  private static final String OBJECT_NAME_PREFIX = "index.html";
-  private static final NotificationInfo.PayloadFormat PAYLOAD_FORMAT =
-      NotificationInfo.PayloadFormat.JSON_API_V1.JSON_API_V1;
-  private static final String TOPIC = "projects/myProject/topics/topic1";
-  private static final Map<String, String> CUSTOM_ATTRIBUTES = ImmutableMap.of("label1", "value1");
-  private static final NotificationInfo NOTIFICATION_INFO_01 =
-      NotificationInfo.newBuilder(TOPIC)
-          .setEtag(ETAG)
-          .setCustomAttributes(CUSTOM_ATTRIBUTES)
-          .setSelfLink(SELF_LINK)
-          .setEventTypes(EVENT_TYPES)
-          .setObjectNamePrefix(OBJECT_NAME_PREFIX)
-          .setPayloadFormat(PAYLOAD_FORMAT)
-          .setGeneratedId(GENERATED_ID)
-          .build();
-  private static final NotificationInfo NOTIFICATION_INFO_02 =
-      NotificationInfo.newBuilder(TOPIC)
-          .setEtag(ETAG)
-          .setCustomAttributes(CUSTOM_ATTRIBUTES)
-          .setSelfLink(SELF_LINK)
-          .setEventTypes(EVENT_TYPES)
-          .setObjectNamePrefix(OBJECT_NAME_PREFIX)
-          .setPayloadFormat(PAYLOAD_FORMAT)
-          .setGeneratedId(GENERATED_ID)
-          .build();
-
   private static final String ACCOUNT = "account";
   private static PrivateKey privateKey;
   private static PublicKey publicKey;
@@ -417,8 +382,7 @@ public class StorageImplTest {
   private Bucket expectedBucket1, expectedBucket2, expectedBucket3;
 
   @BeforeClass
-  public static void beforeClass()
-      throws NoSuchAlgorithmException, InvalidKeySpecException, IOException {
+  public static void beforeClass() throws NoSuchAlgorithmException, InvalidKeySpecException {
     KeyFactory keyFactory = KeyFactory.getInstance("RSA");
     EncodedKeySpec privateKeySpec =
         new PKCS8EncodedKeySpec(BaseEncoding.base64().decode(PRIVATE_KEY_STRING));
@@ -2507,56 +2471,4 @@ public class StorageImplTest {
     assertEquals(outputFields.get("key"), "my-object");
     assertEquals("https://storage.googleapis.com/my-bucket/", policy.getUrl());
   }
-
-  @Test
-  public void testCreateNotification() {
-    Notification notification = NOTIFICATION_INFO_01.toPb();
-    EasyMock.expect(storageRpcMock.createNotification(BUCKET_NAME1, notification))
-        .andReturn(notification);
-    EasyMock.replay(storageRpcMock);
-    initializeService();
-    Notification remoteNotification =
-        storage.createNotification(BUCKET_NAME1, NOTIFICATION_INFO_01);
-    compareBucketsNotification(remoteNotification);
-  }
-
-  @Test
-  public void testGetNotification() {
-    EasyMock.expect(storageRpcMock.getNotification(BUCKET_NAME1, GENERATED_ID))
-        .andReturn(NOTIFICATION_INFO_01.toPb());
-    EasyMock.replay(storageRpcMock);
-    initializeService();
-    Notification notification = storage.getNotification(BUCKET_NAME1, GENERATED_ID);
-    compareBucketsNotification(notification);
-  }
-
-  @Test
-  public void testListNotification() {
-    EasyMock.expect(storageRpcMock.listNotifications(BUCKET_NAME1))
-        .andReturn(Arrays.asList(NOTIFICATION_INFO_01.toPb(), NOTIFICATION_INFO_02.toPb()));
-    EasyMock.replay(storageRpcMock);
-    initializeService();
-    List<Notification> notifications = storage.listNotifications(BUCKET_NAME1);
-    assertEquals(2, notifications.size());
-  }
-
-  @Test
-  public void testDeleteNotification() {
-    EasyMock.expect(storageRpcMock.deleteNotification(BUCKET_NAME1, GENERATED_ID)).andReturn(true);
-    EasyMock.replay(storageRpcMock);
-    initializeService();
-    Boolean isDeleted = storage.deleteNotification(BUCKET_NAME1, GENERATED_ID);
-    assertEquals(isDeleted, Boolean.TRUE);
-  }
-
-  private void compareBucketsNotification(Notification value) {
-    assertEquals(GENERATED_ID, value.getId());
-    assertEquals(CUSTOM_ATTRIBUTES, value.getCustomAttributes());
-    assertEquals(ETAG, value.getEtag());
-    assertEquals(SELF_LINK, value.getSelfLink());
-    assertEquals(EVENT_TYPES, value.getEventTypes());
-    assertEquals(OBJECT_NAME_PREFIX, value.getObjectNamePrefix());
-    assertEquals(PAYLOAD_FORMAT.name(), value.getPayloadFormat());
-    assertEquals(TOPIC, value.getTopic());
-  }
 }
diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java
index 38fff667..7966c928 100644
--- a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java
+++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java
@@ -33,7 +33,6 @@ import com.google.api.client.http.HttpTransport;
 import com.google.api.client.http.apache.ApacheHttpTransport;
 import com.google.api.client.util.DateTime;
 import com.google.api.gax.paging.Page;
-import com.google.api.services.storage.model.Notification;
 import com.google.auth.ServiceAccountSigner;
 import com.google.auth.http.HttpTransportFactory;
 import com.google.auth.oauth2.GoogleCredentials;
@@ -42,7 +41,6 @@ import com.google.cloud.Identity;
 import com.google.cloud.Policy;
 import com.google.cloud.ReadChannel;
 import com.google.cloud.RestorableState;
-import com.google.cloud.ServiceOptions;
 import com.google.cloud.TransportOptions;
 import com.google.cloud.WriteChannel;
 import com.google.cloud.http.HttpTransportOptions;
@@ -56,7 +54,6 @@ import com.google.cloud.kms.v1.KeyManagementServiceGrpc;
 import com.google.cloud.kms.v1.KeyManagementServiceGrpc.KeyManagementServiceBlockingStub;
 import com.google.cloud.kms.v1.KeyRingName;
 import com.google.cloud.kms.v1.LocationName;
-import com.google.cloud.pubsub.v1.TopicAdminClient;
 import com.google.cloud.storage.Acl;
 import com.google.cloud.storage.Acl.Role;
 import com.google.cloud.storage.Acl.User;
@@ -71,7 +68,6 @@ import com.google.cloud.storage.BucketInfo.LifecycleRule.LifecycleCondition;
 import com.google.cloud.storage.CopyWriter;
 import com.google.cloud.storage.HmacKey;
 import com.google.cloud.storage.HttpMethod;
-import com.google.cloud.storage.NotificationInfo;
 import com.google.cloud.storage.PostPolicyV4;
 import com.google.cloud.storage.PostPolicyV4.PostFieldsV4;
 import com.google.cloud.storage.ServiceAccount;
@@ -124,7 +120,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Random;
 import java.util.Set;
-import java.util.UUID;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
@@ -147,8 +142,6 @@ public class ITStorageTest {
 
   private static RemoteStorageHelper remoteStorageHelper;
   private static Storage storage;
-  private static TopicAdminClient topicAdminClient;
-  private static Notification notification;
   private static String kmsKeyOneResourcePath;
   private static String kmsKeyTwoResourcePath;
   private static Metadata requestParamsHeader = new Metadata();
@@ -203,15 +196,6 @@ public class ITStorageTest {
   private static final ImmutableList<LifecycleRule> LIFECYCLE_RULES =
       ImmutableList.of(LIFECYCLE_RULE_1, LIFECYCLE_RULE_2);
 
-  private static final String PROJECT = ServiceOptions.getDefaultProjectId();
-  private static final String ID = UUID.randomUUID().toString().substring(0, 8);
-  private static final NotificationInfo.PayloadFormat PAYLOAD_FORMAT =
-      NotificationInfo.PayloadFormat.JSON_API_V1.JSON_API_V1;
-
-  private static final String TOPIC =
-      String.format("projects/%s/topics/test_topic_foo_%s", PROJECT, ID);
-  private static final Map<String, String> CUSTOM_ATTRIBUTES = ImmutableMap.of("label1", "value1");
-
   @BeforeClass
   public static void beforeClass() throws IOException {
     remoteStorageHelper = RemoteStorageHelper.create();
@@ -229,22 +213,6 @@ public class ITStorageTest {
 
     // Prepare KMS KeyRing for CMEK tests
     prepareKmsKeys();
-
-    // Create pubsub topic for notification.
-    topicAdminClient = TopicAdminClient.create();
-    topicAdminClient.createTopic(TOPIC);
-    com.google.iam.v1.Policy policy = topicAdminClient.getIamPolicy(TOPIC);
-    Binding binding =
-        Binding.newBuilder().setRole("roles/owner").addMembers("allAuthenticatedUsers").build();
-    topicAdminClient.setIamPolicy(TOPIC, policy.toBuilder().addBindings(binding).build());
-
-    // Create a notification on a bucket.
-    NotificationInfo notificationInfo =
-        NotificationInfo.newBuilder(TOPIC)
-            .setCustomAttributes(CUSTOM_ATTRIBUTES)
-            .setPayloadFormat(PAYLOAD_FORMAT)
-            .build();
-    notification = storage.createNotification(BUCKET, notificationInfo);
   }
 
   @Before
@@ -267,13 +235,6 @@ public class ITStorageTest {
   @AfterClass
   public static void afterClass() throws ExecutionException, InterruptedException {
     if (storage != null) {
-
-      /* Delete the specified notification on the specified bucket as well as delete the pubsub topic */
-      if (topicAdminClient != null) {
-        storage.deleteNotification(BUCKET, notification.getId());
-        topicAdminClient.deleteTopic(TOPIC);
-        topicAdminClient.close();
-      }
       // In beforeClass, we make buckets auto-delete blobs older than a day old.
       // Here, delete all buckets older than 2 days. They should already be empty and easy.
       long cleanTime = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(2);
@@ -3361,24 +3322,4 @@ public class ITStorageTest {
       RemoteStorageHelper.forceDelete(storage, bucketName, 5, TimeUnit.SECONDS);
     }
   }
-
-  @Test
-  public void testGetNotification() {
-    Notification actualNotification = storage.getNotification(BUCKET, notification.getId());
-    assertEquals(CUSTOM_ATTRIBUTES, actualNotification.getCustomAttributes());
-    assertEquals(PAYLOAD_FORMAT.name(), actualNotification.getPayloadFormat());
-    assertTrue(actualNotification.getTopic().contains(TOPIC));
-  }
-
-  @Test
-  public void testListNotification() {
-    List<Notification> notifications = storage.listNotifications(BUCKET);
-    for (Notification actualNotification : notifications) {
-      if (actualNotification.getId().equals(notification.getId())) {
-        assertEquals(CUSTOM_ATTRIBUTES, actualNotification.getCustomAttributes());
-        assertEquals(PAYLOAD_FORMAT.name(), actualNotification.getPayloadFormat());
-        assertTrue(actualNotification.getTopic().contains(TOPIC));
-      }
-    }
-  }
 }
diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/testing/StorageRpcTestBaseTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/testing/StorageRpcTestBaseTest.java
index 7feef9f1..b798ad57 100644
--- a/google-cloud-storage/src/test/java/com/google/cloud/storage/testing/StorageRpcTestBaseTest.java
+++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/testing/StorageRpcTestBaseTest.java
@@ -577,17 +577,6 @@ public class StorageRpcTestBaseTest {
         };
   }
 
-  @Test
-  public void testGetNotification() {
-    rpc =
-        new Callable<Notification>() {
-          @Override
-          public Notification call() {
-            return STORAGE_RPC.getNotification("bucket", "notification");
-          }
-        };
-  }
-
   @Test
   public void testLockRetentionPolicy() {
     rpc =