Skip to content

Container Analysis Samples #1024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions container-registry/container-analysis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Container Analysis
These samples demonstrate how to interact with the [Container Analysis API](https://cloud-dot-devsite.googleplex.com/container-analysis/api/reference/rest/) through Java.


## Getting Started


1. [Download](https://maven.apache.org/download.cgi) and [install](https://maven.apache.org/install.html) maven to handle the project's dependencies
2. [Register your Google Cloud Platform project with the Container Analysis API]((https://console.cloud.google.com/flows/enableapi?apiid=containeranalysis.googleapis.com))
3. Set your GOOGLE_CLOUD_PROJECT environment variable to your Project ID
4. run `mvn clean verify` to build the project and run the tests

## Samples
- **getDiscoveryInfo**
- Retrieves the Discovery occurrence created for a specified image
- **getOccurrencesForNote**
- Retrieves all the occurrences associated with a specified note
- **getOccurrencesForImage**
- Retrieves all the occurrences associated with a specified image
- **pubSub**
- Handle incoming occurrences using a pubsub subscription
- **createOccurrenceSubscription**
- Creates and returns a pubsub subscription object listening to the occurrence topic
83 changes: 83 additions & 0 deletions container-registry/container-analysis/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<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>

<groupId>com.google.containerregistry</groupId>
<artifactId>containeranalysis</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>containeranalysis</name>
<url>http://maven.apache.org</url>

<!-- local maven repo contains container analysis client library -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you planning to release this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library is currently publicly hosted for download on GCS, and it's on track to be added to the maven repo once it reaches beta

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then why have you included it in the repo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version currently hosted on GCS is just a .tar.gz of a gradle project, so I needed some way to integrate it into the maven project here. I'm pretty new to maven, Is there a better way to do it?

<repositories>
<repository>
<id>project.local</id>
<url>file:///${project.basedir}/repo</url>
</repository>
</repositories>

<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.8</version>
</parent>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<!-- [START dependencies] -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-containeranalysis</artifactId>
<version>0.1.1-alpha</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-pubsub</artifactId>
<version>0.32.0-beta</version>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.7.Final</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not happy to see this, but I understand why it's here. Why not schedule a release w/ the Veneer team?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it, a release is scheduled for beta, but they don't have the bandwidth to handle it in alpha

</dependency>

<!-- [END dependencies] -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-containeranalysis</artifactId>
<version>0.1.1-alpha</version>
<description>POM was created from install:install-file</description>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-containeranalysis</artifactId>
<versioning>
<release>0.1.1-alpha</release>
<versions>
<version>0.1.1-alpha</version>
</versions>
<lastUpdated>20180212185424</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Manifest-Version: 1.0
Main-Class: com.google.cloud.devtools.containeranalysis.v1alpha1.Sampl
eApp

Loading