Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
feat!: proto/grpc classes moved to com.google.cloud.secretmanager pac…
…kage (#20)

* [CHANGE ME] Re-generated  to pick up changes in the API or client library generator.

* feat!: remove proto/grpc classes from old package

* fix: use new packages in integration test

* fix!: allow breaking interface changes for the package rename

* chore(lint): fix lint

Co-authored-by: Jeff Ching <chingor@google.com>
  • Loading branch information
yoshi-automation and chingor13 committed Jan 9, 2020
1 parent 809421d commit 710d449
Show file tree
Hide file tree
Showing 65 changed files with 2,220 additions and 1,877 deletions.
15 changes: 14 additions & 1 deletion .kokoro/build.sh
Expand Up @@ -44,13 +44,26 @@ test)
bash .kokoro/coerce_logs.sh
;;
lint)
mvn com.coveo:fmt-maven-plugin:check
mvn \
-Penable-samples \
com.coveo:fmt-maven-plugin:check
;;
javadoc)
mvn javadoc:javadoc javadoc:test-javadoc
;;
integration)
mvn -B ${INTEGRATION_TEST_ARGS} \
-Penable-integration-tests \
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
-fae \
verify
bash .kokoro/coerce_logs.sh
;;
samples)
mvn -B \
-Penable-samples \
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
Expand Down
31 changes: 31 additions & 0 deletions .kokoro/continuous/samples.cfg
@@ -0,0 +1,31 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
}

env_vars: {
key: "JOB_TYPE"
value: "samples"
}

env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "java_it_service_account"
}
}
}
31 changes: 31 additions & 0 deletions .kokoro/nightly/samples.cfg
@@ -0,0 +1,31 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
}

env_vars: {
key: "JOB_TYPE"
value: "samples"
}

env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "java_it_service_account"
}
}
}
31 changes: 31 additions & 0 deletions .kokoro/presubmit/samples.cfg
@@ -0,0 +1,31 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
}

env_vars: {
key: "JOB_TYPE"
value: "samples"
}

env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "java_it_service_account"
}
}
}
104 changes: 103 additions & 1 deletion CONTRIBUTING.md
Expand Up @@ -25,4 +25,106 @@ information on using pull requests.
## Community Guidelines

This project follows
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).

## Building the project

To build, package, and run all unit tests run the command

```
mvn clean verify
```

### Running Integration tests

To include integration tests when building the project, you need access to
a GCP Project with a valid service account.

For instructions on how to generate a service account and corresponding
credentials JSON see: [Creating a Service Account][1].

Then run the following to build, package, run all unit tests and run all
integration tests.

```bash
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json
mvn -Penable-integration-tests clean verify
```

## Code Samples

Code Samples must be bundled in separate Maven modules, and guarded by a
Maven profile with the name `enable-samples`.

The samples must be separate from the primary project for a few reasons:
1. Primary projects have a minimum Java version of Java 7 whereas samples have
a minimum Java version of Java 8. Due to this we need the ability to
selectively exclude samples from a build run.
2. Many code samples depend on external GCP services and need
credentials to access the service.
3. Code samples are not released as Maven artifacts and must be excluded from
release builds.

### Building

```bash
mvn -Penable-samples clean verify
```

Some samples require access to GCP services and require a service account:

```bash
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json
mvn -Penable-samples clean verify
```

### Profile Config

1. To add samples in a profile to your Maven project, add the following to your
`pom.xml`

```xml
<project>
[...]
<profiles>
<profile>
<id>enable-samples</id>
<modules>
<module>sample</module>
</modules>
</profile>
</profiles>
[...]
</project>
```

2. [Activate](#profile-activation) the profile.
3. Define your samples in a normal Maven project in the `samples/` directory

### Profile Activation

To include code samples when building and testing the project, enable the
`enable-samples` Maven profile.

#### Command line

To activate the Maven profile on the command line add `-Penable-samples` to your
Maven command.

#### Maven `settings.xml`

To activate the Maven profile in your `~/.m2/settings.xml` add an entry of
`enable-samples` following the instructions in [Active Profiles][2].

This method has the benefit of applying to all projects you build (and is
respected by IntelliJ IDEA) and is recommended if you are going to be
contributing samples to several projects.

#### IntelliJ IDEA

To activate the Maven Profile inside IntelliJ IDEA, follow the instructions in
[Activate Maven profiles][3] to activate `enable-samples`.

[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account
[2]: https://maven.apache.org/settings.html#Active_Profiles
[3]: https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -19,16 +19,16 @@ If you are using Maven, add this to your pom.xml file
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-secretmanager</artifactId>
<version>0.0.0</version>
<version>0.102.0-beta</version>
</dependency>
```
If you are using Gradle, add this to your dependencies
```Groovy
compile 'com.google.cloud:google-cloud-secretmanager:0.0.0'
compile 'com.google.cloud:google-cloud-secretmanager:0.102.0-beta'
```
If you are using SBT, add this to your dependencies
```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-secretmanager" % "0.0.0"
libraryDependencies += "com.google.cloud" % "google-cloud-secretmanager" % "0.102.0-beta"
```
[//]: # ({x-version-update-end})

Expand Down Expand Up @@ -101,7 +101,7 @@ Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3]
Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4]
Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5]

[api-reference]: https://cloud.google.com/solutions/secrets-management/
[api-reference]:
[product-docs]: https://cloud.google.com/solutions/secrets-management/
[javadocs]: https://googleapis.dev/java/java-secretmanager/latest
[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-secretmanager/java7.svg
Expand Down
16 changes: 16 additions & 0 deletions google-cloud-secretmanager/clirr-ignored-differences.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<difference>
<differenceType>7005</differenceType>
<className>com/google/cloud/secretmanager/v1beta1/SecretManagerServiceClient*</className>
<method>* *(*com.google.cloud.secrets.v1beta1*)</method>
<to>* *(*com.google.cloud.secretmanager.v1beta1*)</to>
</difference>
<difference>
<differenceType>7006</differenceType>
<className>com/google/cloud/secretmanager/v1beta1/SecretManagerServiceClient</className>
<method>com.google.cloud.secrets.v1beta1.* *(*)</method>
<to>com.google.cloud.secretmanager.v1beta1.*</to>
</difference>
</differences>
Expand Up @@ -27,27 +27,6 @@
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.secretmanager.v1beta1.stub.SecretManagerServiceStub;
import com.google.cloud.secretmanager.v1beta1.stub.SecretManagerServiceStubSettings;
import com.google.cloud.secrets.v1beta1.AccessSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.AccessSecretVersionResponse;
import com.google.cloud.secrets.v1beta1.AddSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.CreateSecretRequest;
import com.google.cloud.secrets.v1beta1.DeleteSecretRequest;
import com.google.cloud.secrets.v1beta1.DestroySecretVersionRequest;
import com.google.cloud.secrets.v1beta1.DisableSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.EnableSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.GetSecretRequest;
import com.google.cloud.secrets.v1beta1.GetSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.ListSecretVersionsRequest;
import com.google.cloud.secrets.v1beta1.ListSecretVersionsResponse;
import com.google.cloud.secrets.v1beta1.ListSecretsRequest;
import com.google.cloud.secrets.v1beta1.ListSecretsResponse;
import com.google.cloud.secrets.v1beta1.ProjectName;
import com.google.cloud.secrets.v1beta1.Secret;
import com.google.cloud.secrets.v1beta1.SecretName;
import com.google.cloud.secrets.v1beta1.SecretPayload;
import com.google.cloud.secrets.v1beta1.SecretVersion;
import com.google.cloud.secrets.v1beta1.SecretVersionName;
import com.google.cloud.secrets.v1beta1.UpdateSecretRequest;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
Expand Down
Expand Up @@ -30,23 +30,6 @@
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.secretmanager.v1beta1.stub.SecretManagerServiceStubSettings;
import com.google.cloud.secrets.v1beta1.AccessSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.AccessSecretVersionResponse;
import com.google.cloud.secrets.v1beta1.AddSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.CreateSecretRequest;
import com.google.cloud.secrets.v1beta1.DeleteSecretRequest;
import com.google.cloud.secrets.v1beta1.DestroySecretVersionRequest;
import com.google.cloud.secrets.v1beta1.DisableSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.EnableSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.GetSecretRequest;
import com.google.cloud.secrets.v1beta1.GetSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.ListSecretVersionsRequest;
import com.google.cloud.secrets.v1beta1.ListSecretVersionsResponse;
import com.google.cloud.secrets.v1beta1.ListSecretsRequest;
import com.google.cloud.secrets.v1beta1.ListSecretsResponse;
import com.google.cloud.secrets.v1beta1.Secret;
import com.google.cloud.secrets.v1beta1.SecretVersion;
import com.google.cloud.secrets.v1beta1.UpdateSecretRequest;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
Expand Down
Expand Up @@ -26,23 +26,23 @@
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.RequestParamsExtractor;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.secrets.v1beta1.AccessSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.AccessSecretVersionResponse;
import com.google.cloud.secrets.v1beta1.AddSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.CreateSecretRequest;
import com.google.cloud.secrets.v1beta1.DeleteSecretRequest;
import com.google.cloud.secrets.v1beta1.DestroySecretVersionRequest;
import com.google.cloud.secrets.v1beta1.DisableSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.EnableSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.GetSecretRequest;
import com.google.cloud.secrets.v1beta1.GetSecretVersionRequest;
import com.google.cloud.secrets.v1beta1.ListSecretVersionsRequest;
import com.google.cloud.secrets.v1beta1.ListSecretVersionsResponse;
import com.google.cloud.secrets.v1beta1.ListSecretsRequest;
import com.google.cloud.secrets.v1beta1.ListSecretsResponse;
import com.google.cloud.secrets.v1beta1.Secret;
import com.google.cloud.secrets.v1beta1.SecretVersion;
import com.google.cloud.secrets.v1beta1.UpdateSecretRequest;
import com.google.cloud.secretmanager.v1beta1.AccessSecretVersionRequest;
import com.google.cloud.secretmanager.v1beta1.AccessSecretVersionResponse;
import com.google.cloud.secretmanager.v1beta1.AddSecretVersionRequest;
import com.google.cloud.secretmanager.v1beta1.CreateSecretRequest;
import com.google.cloud.secretmanager.v1beta1.DeleteSecretRequest;
import com.google.cloud.secretmanager.v1beta1.DestroySecretVersionRequest;
import com.google.cloud.secretmanager.v1beta1.DisableSecretVersionRequest;
import com.google.cloud.secretmanager.v1beta1.EnableSecretVersionRequest;
import com.google.cloud.secretmanager.v1beta1.GetSecretRequest;
import com.google.cloud.secretmanager.v1beta1.GetSecretVersionRequest;
import com.google.cloud.secretmanager.v1beta1.ListSecretVersionsRequest;
import com.google.cloud.secretmanager.v1beta1.ListSecretVersionsResponse;
import com.google.cloud.secretmanager.v1beta1.ListSecretsRequest;
import com.google.cloud.secretmanager.v1beta1.ListSecretsResponse;
import com.google.cloud.secretmanager.v1beta1.Secret;
import com.google.cloud.secretmanager.v1beta1.SecretVersion;
import com.google.cloud.secretmanager.v1beta1.UpdateSecretRequest;
import com.google.common.collect.ImmutableMap;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
Expand Down

0 comments on commit 710d449

Please sign in to comment.