Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2d13c45
initial work for Notifications in Storage surface
andreamlin Oct 31, 2017
1b03ea7
update nio FakeStorageRpc with @Override methods
andreamlin Nov 1, 2017
1126650
completed implementation of Notification methods
andreamlin Nov 1, 2017
d1506ad
added NotificationTest
andreamlin Nov 1, 2017
56c2f8c
adding new Notification module
andreamlin Nov 1, 2017
bf7c508
null check
andreamlin Nov 1, 2017
ec6aa58
moving notification test from Storage to Notification module
andreamlin Nov 1, 2017
dd42687
Merge branch 'master' into pubsub_notifications
andreamlin Nov 1, 2017
946c48e
add serialVersionUID to NotificationInfo
andreamlin Nov 1, 2017
9f90b6d
moving Notification files to new module
andreamlin Nov 1, 2017
08162e8
moving notification methods from Storage to Notification
andreamlin Nov 1, 2017
a06c8bf
moving notification methods from Storage to Notification
andreamlin Nov 1, 2017
4e83f66
public-ing some Storage methods for use by Notification
andreamlin Nov 1, 2017
2144677
remove NotificationOptions
andreamlin Nov 1, 2017
7ead27b
fixed pom.xml for Notification dependencies on latest versions of Pub…
andreamlin Nov 1, 2017
69d0bf8
use TopicName instead of String topic for NotificationInfo
andreamlin Nov 2, 2017
0a0aa9f
NotificationInfo javadoc
andreamlin Nov 2, 2017
9925276
javadoc and removing unused imports
andreamlin Nov 2, 2017
f460a9c
adding storage.projects.serviceAccounts.get model class, rpc methods,…
andreamlin Nov 6, 2017
084bc89
Merge branch 'master' into pubsub_notifications
andreamlin Nov 6, 2017
810a3ef
implement new StorageRpce method in FakeStorageRpc
andreamlin Nov 6, 2017
24e0d8f
merge master
andreamlin Nov 6, 2017
2302daa
remove unused imports and unnecessary qualifications
andreamlin Nov 6, 2017
103c183
remove unused imports and vars"
andreamlin Nov 6, 2017
2f3f4e4
remove unused import
andreamlin Nov 6, 2017
f52876c
update notification's README.md
andreamlin Nov 7, 2017
31c5f27
removed unused setStorage() and s/2015/2017/g
andreamlin Nov 7, 2017
c5a22e5
adding license header to notificationImpl
andreamlin Nov 7, 2017
3f305c1
better documentation for notifications
andreamlin Nov 7, 2017
90270c7
comments
andreamlin Nov 7, 2017
2d218fd
internalapi storageexception
andreamlin Nov 7, 2017
e5df141
no Set
andreamlin Nov 7, 2017
56baae8
Merge branch 'master' into pubsub_notifications
andreamlin Nov 9, 2017
7dc06b7
Merge branch 'master' into pubsub_notifications
andreamlin Nov 16, 2017
4cf5bf1
remove 'abstract' from NotificationInfo.Builder
andreamlin Nov 17, 2017
79bc0c3
Notification no longer a service
andreamlin Nov 17, 2017
323a044
google java format
andreamlin Nov 17, 2017
7670897
notification uses Storage as constructor parameter
andreamlin Nov 17, 2017
d3b58d6
Merge branch 'master' into pubsub_notifications
andreamlin Nov 21, 2017
9d6c73b
update versions in readme and pom.xml
andreamlin Nov 21, 2017
195e821
comments; keep getStorageRpcV1 protected
andreamlin Nov 21, 2017
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 @@ -18,8 +18,10 @@

import com.google.api.services.storage.model.Bucket;
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.Policy;
import com.google.api.services.storage.model.ServiceAccount;
import com.google.api.services.storage.model.StorageObject;
import com.google.api.services.storage.model.TestIamPermissionsResponse;
import com.google.cloud.Tuple;
Expand Down Expand Up @@ -462,4 +464,24 @@ public Policy setIamPolicy(String bucket, Policy policy, Map<Option, ?> options)
public TestIamPermissionsResponse testIamPermissions(String bucket, List<String> permissions, Map<Option, ?> options) {
throw new UnsupportedOperationException();
}

@Override
public boolean deleteNotification(String bucket, String notification) {
throw new UnsupportedOperationException();
}

@Override
public List<Notification> listNotifications(String bucket) {
throw new UnsupportedOperationException();
}

@Override
public Notification createNotification(String bucket, Notification notification) {
throw new UnsupportedOperationException();
}

@Override
public ServiceAccount getServiceAccount(String projectId) {
return null;
}
}
77 changes: 77 additions & 0 deletions google-cloud-notification/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Google Cloud Java Client for Cloud Pub/Sub Notifications
=================================


- [Product Documentation](https://cloud.google.com/storage/docs/pubsub-notifications)
- [Client Library Documentation](https://googlecloudplatform.github.io/google-cloud-java/latest/apidocs/index.html?com/google/cloud/notification/package-summary.html)

Quickstart
----------
If you are using Maven, add this to your pom.xml file
```xml
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-notification</artifactId>
<version>0.30.0-alpha</version>
</dependency>
```
If you are using Gradle, add this to your dependencies
```Groovy
compile 'com.google.cloud:google-cloud-notification:0.30.0-alpha'
```
If you are using SBT, add this to your dependencies
```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-notification" % "0.30.0-alpha"
```

Authentication
--------------

See the
[Authentication](https://github.com/GoogleCloudPlatform/google-cloud-java#authentication)
section in the base directory's README.

About Google Cloud Pub/Sub Notifications
----------------------------

Cloud Pub/Sub Notifications sends information about changes to objects in your buckets to Google Cloud Pub/Sub, where the information is added to a Cloud Pub/Sub topic of your choice in the form of messages. For example, you can track objects that are created and deleted in your bucket. Each notification contains information describing both the event that triggered it and the object that changed.

Troubleshooting
---------------

To get help, follow the instructions in the [shared Troubleshooting document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/troubleshooting/readme.md#troubleshooting).

Java Versions
-------------

Java 7 or above is required for using this client.

Versioning
----------

This library follows [Semantic Versioning](http://semver.org/).

It is currently in major version zero (``0.y.z``), which means that anything
may change at any time and the public API should not be considered
stable.

Contributing
------------

Contributions to this library are always welcome and highly encouraged.

See `google-cloud`'s [CONTRIBUTING] documentation and the [shared documentation](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/contributing/readme.md#how-to-contribute-to-gcloud) for more information on how to get started.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information.

License
-------

Apache 2.0 - See [LICENSE] for more information.


[CONTRIBUTING]:https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/CONTRIBUTING.md
[code-of-conduct]:https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct
[LICENSE]: https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/LICENSE
[cloud-platform]: https://cloud.google.com/
[developers-console]:https://console.developers.google.com/
196 changes: 196 additions & 0 deletions google-cloud-notification/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>google-cloud-notification</artifactId>
<version>0.30.1-alpha-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Google Cloud Pub/Sub Notifications for Google Cloud Storage</name>
<url>https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-notification
</url>
<description>
Java idiomatic client for Google Cloud Notification.
</description>
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-pom</artifactId>
<version>0.30.1-alpha-SNAPSHOT</version>
</parent>
<properties>
<site.installationModule>google-cloud-notification</site.installationModule>
<artifact.version>${project.version}</artifact.version>
</properties>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>google-cloud-core</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>google-cloud-storage</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>google-cloud-pubsub</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>google-cloud-core-grpc</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-pubsub-v1</artifactId>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-pubsub-v1</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-auth</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>google-cloud-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>doclint-java8-disable</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<!-- add this to disable checking -->
<javadoc.opts>-Xdoclint:none</javadoc.opts>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>./..</directory>
<filtering>true</filtering>
<includes>
<include>project.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<copy file="${project.build.outputDirectory}/project.properties"
toFile="${project.build.outputDirectory}/com/google/cloud/notification/project.properties"
overwrite="true" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>write-project-properties</goal>
</goals>
<configuration>
<outputFile>${project.build.outputDirectory}/project.properties</outputFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>generated/src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalparam>${javadoc.opts}</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2017 Google Inc. All Rights Reserved.
*
* 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.notification;

import com.google.api.core.BetaApi;
import com.google.cloud.storage.Storage;
import java.util.List;

/**
* An interface for Pub/Sub Notifications in Google Cloud Storage.
*
* <p>This is a light wrapper around a Storage client.
*
* @see <a href="https://cloud.google.com/storage/docs/pubsub-notifications">Google Cloud Pub/Sub
* Notifications for Storage</a>
*/
public interface Notification {

/* Create a Notifications client wrapper on top of a given a Storage client. */
Notification create(Storage storage);

/* Delete the specified notification on the specified bucket.
*
* @return true if the notification was deleted, or false if not.
*/
@BetaApi
boolean deleteNotification(String bucket, String notification);

/* List the notifications that are present on a given bucket. */
@BetaApi
List<NotificationInfo> listNotifications(String bucket);

/* Create a notification on a bucket. */
@BetaApi
NotificationInfo createNotification(String bucket, NotificationInfo notification);
}
Loading