diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index 772b69bb..ed5f374a 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-containeranalysis.git", - "sha": "c7da905c9252220a9ae38d78d6cb393a2a42f0ce" + "sha": "979b50a50903ba0836bd516d3f759da9d97cc048" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "2414b817065726eae0bc525346c7e874f969369d" + "sha": "6946fd71ae9215b0e7ae188f5057df765ee6d7d2" } } ] diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 98a472e1..def8b3a2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,17 +55,10 @@ jobs: java-version: 8 - run: java -version - name: Install artifacts to local Maven repository - run: | - source .kokoro/common.sh - retry_with_backoff 3 10 \ - mvn install -B -V \ - -Dmaven.test.skip -DskipTests=true \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dmaven.javadoc.skip=true \ - -Dgcloud.download.skip=true + run: .kokoro/build.sh shell: bash - - uses: GoogleCloudPlatform/cloud-opensource-java/linkage-monitor@v1-linkagemonitor + - name: Validate any conflicts with regard to com.google.cloud:libraries-bom (latest release) + uses: GoogleCloudPlatform/cloud-opensource-java/linkage-monitor@v1-linkagemonitor lint: runs-on: ubuntu-latest steps: diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 7b56cbbc..e8c85e6c 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -29,7 +29,7 @@ echo ${JOB_TYPE} # attempt to install 3 times with exponential backoff (starting with 10 seconds) retry_with_backoff 3 10 \ - mvn install -B -V \ + mvn install -B -V -ntp \ -DskipTests=true \ -Dclirr.skip=true \ -Denforcer.skip=true \ @@ -60,6 +60,7 @@ javadoc) ;; integration) mvn -B ${INTEGRATION_TEST_ARGS} \ + -ntp \ -Penable-integration-tests \ -DtrimStackTrace=false \ -Dclirr.skip=true \ @@ -81,6 +82,7 @@ samples) pushd ${SAMPLES_DIR} mvn -B \ -Penable-samples \ + -ntp \ -DtrimStackTrace=false \ -Dclirr.skip=true \ -Denforcer.skip=true \ diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh index c91e5a56..0fb8c843 100755 --- a/.kokoro/dependencies.sh +++ b/.kokoro/dependencies.sh @@ -31,7 +31,7 @@ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" # this should run maven enforcer retry_with_backoff 3 10 \ - mvn install -B -V \ + mvn install -B -V -ntp \ -DskipTests=true \ -Dclirr.skip=true @@ -86,4 +86,4 @@ then else msg "Errors found. See log statements above." exit 1 -fi \ No newline at end of file +fi diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg index 73c31506..5a56a3b6 100644 --- a/.kokoro/release/publish_javadoc.cfg +++ b/.kokoro/release/publish_javadoc.cfg @@ -7,10 +7,10 @@ env_vars: { value: "docs-staging" } +# cloud-rad staging env_vars: { key: "STAGING_BUCKET_V2" - value: "docs-staging-v2" - # Production will be at: docs-staging-v2 + value: "docs-staging-v2-staging" } env_vars: { diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh index 36a41444..ae2ddf0a 100755 --- a/.kokoro/release/publish_javadoc.sh +++ b/.kokoro/release/publish_javadoc.sh @@ -71,7 +71,7 @@ python3 -m docuploader create-metadata \ --version ${VERSION} \ --language java -# upload docs +# upload docs to staging bucket python3 -m docuploader upload . \ --credentials ${CREDENTIALS} \ --staging-bucket ${STAGING_BUCKET_V2} diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg index 4b3c8dfa..458bcedb 100644 --- a/.kokoro/release/publish_javadoc11.cfg +++ b/.kokoro/release/publish_javadoc11.cfg @@ -1,9 +1,9 @@ # Format: //devtools/kokoro/config/proto/build.proto +# cloud-rad production env_vars: { key: "STAGING_BUCKET_V2" value: "docs-staging-v2" - # Production will be at: docs-staging-v2 } # Configure the docker image for kokoro-trampoline diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh index a20b84bb..8f6cacbc 100755 --- a/.kokoro/release/publish_javadoc11.sh +++ b/.kokoro/release/publish_javadoc11.sh @@ -48,7 +48,7 @@ python3 -m docuploader create-metadata \ --version ${VERSION} \ --language java -# upload yml +# upload yml to production bucket python3 -m docuploader upload . \ --credentials ${CREDENTIALS} \ --staging-bucket ${STAGING_BUCKET_V2} \ diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c3b6d56..dc1a23fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,132 @@ # Changelog +### [1.2.12](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.11...v1.2.12) (2021-02-23) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.19.0 ([#452](https://www.github.com/googleapis/java-containeranalysis/issues/452)) ([2a1a1ff](https://www.github.com/googleapis/java-containeranalysis/commit/2a1a1ff5aa28d9dbec1b54f713da5014a93ccb4a)) +* update dependency io.grafeas:grafeas to v1.0.9 ([2a1a1ff](https://www.github.com/googleapis/java-containeranalysis/commit/2a1a1ff5aa28d9dbec1b54f713da5014a93ccb4a)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + +### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-17) + + +### Dependencies + +* update dependency io.grafeas:grafeas to v1.0.8 ([#403](https://www.github.com/googleapis/java-containeranalysis/issues/403)) ([9be3c62](https://www.github.com/googleapis/java-containeranalysis/commit/9be3c62f334002451785329a6b30c629c26693da)) + ### [1.2.11](https://www.github.com/googleapis/java-containeranalysis/compare/v1.2.10...v1.2.11) (2021-02-16) diff --git a/README.md b/README.md index a211a482..63551f5f 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-containeranalysis - 1.2.10 + 1.2.11 ``` @@ -51,12 +51,12 @@ compile 'com.google.cloud:google-cloud-containeranalysis' ``` If you are using Gradle without BOM, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-containeranalysis:1.2.10' +compile 'com.google.cloud:google-cloud-containeranalysis:1.2.11' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-containeranalysis" % "1.2.10" +libraryDependencies += "com.google.cloud" % "google-cloud-containeranalysis" % "1.2.11" ``` ## Authentication diff --git a/google-cloud-containeranalysis-bom/pom.xml b/google-cloud-containeranalysis-bom/pom.xml index 7150c75f..c1731ba7 100644 --- a/google-cloud-containeranalysis-bom/pom.xml +++ b/google-cloud-containeranalysis-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-containeranalysis-bom - 1.2.11 + 1.2.29 pom com.google.cloud @@ -64,27 +64,27 @@ com.google.api.grpc proto-google-cloud-containeranalysis-v1 - 1.2.11 + 1.2.29 com.google.api.grpc grpc-google-cloud-containeranalysis-v1beta1 - 0.88.11 + 0.88.29 com.google.cloud google-cloud-containeranalysis - 1.2.11 + 1.2.29 com.google.api.grpc grpc-google-cloud-containeranalysis-v1 - 1.2.11 + 1.2.29 com.google.api.grpc proto-google-cloud-containeranalysis-v1beta1 - 0.88.11 + 0.88.29 diff --git a/google-cloud-containeranalysis/pom.xml b/google-cloud-containeranalysis/pom.xml index 4e08b26f..a94bea78 100644 --- a/google-cloud-containeranalysis/pom.xml +++ b/google-cloud-containeranalysis/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-containeranalysis - 1.2.11 + 1.2.29 jar Google Cloud Container Analysis https://github.com/googleapis/java-containeranalysis @@ -11,7 +11,7 @@ com.google.cloud google-cloud-containeranalysis-parent - 1.2.11 + 1.2.29 google-cloud-containeranalysis diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java index 8219bfbd..1ed88581 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.devtools.containeranalysis.v1; import com.google.api.core.BetaApi; @@ -35,7 +36,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: Retrieves analysis results of Cloud components such as Docker container * images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. @@ -52,17 +53,7 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
- *   ResourceName resource = ProjectName.of("[PROJECT]");
- *   Policy policy = Policy.newBuilder().build();
- *   Policy response = containerAnalysisClient.setIamPolicy(resource, policy);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the containerAnalysisClient object to clean up resources + *

Note: close() needs to be called on the ContainerAnalysisClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). * @@ -91,30 +82,27 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * ContainerAnalysisSettings containerAnalysisSettings =
  *     ContainerAnalysisSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * ContainerAnalysisClient containerAnalysisClient =
  *     ContainerAnalysisClient.create(containerAnalysisSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * ContainerAnalysisSettings containerAnalysisSettings =
  *     ContainerAnalysisSettings.newBuilder().setEndpoint(myEndpoint).build();
  * ContainerAnalysisClient containerAnalysisClient =
  *     ContainerAnalysisClient.create(containerAnalysisSettings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class ContainerAnalysisClient implements BackgroundResource { private final ContainerAnalysisSettings settings; private final ContainerAnalysisStub stub; @@ -143,7 +131,7 @@ public static final ContainerAnalysisClient create(ContainerAnalysisSettings set /** * Constructs an instance of ContainerAnalysisClient, using the given stub for making calls. This - * is for advanced usage - prefer to use ContainerAnalysisSettings}. + * is for advanced usage - prefer using create(ContainerAnalysisSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final ContainerAnalysisClient create(ContainerAnalysisStub stub) { @@ -175,7 +163,7 @@ public ContainerAnalysisStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified note or occurrence. Requires * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` @@ -184,16 +172,6 @@ public ContainerAnalysisStub getStub() { *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = containerAnalysisClient.setIamPolicy(resource, policy);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the @@ -210,7 +188,7 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified note or occurrence. Requires * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` @@ -219,16 +197,6 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) { *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = containerAnalysisClient.setIamPolicy(resource.toString(), policy);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the @@ -242,7 +210,7 @@ public final Policy setIamPolicy(String resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified note or occurrence. Requires * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` @@ -251,20 +219,6 @@ public final Policy setIamPolicy(String resource, Policy policy) { *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   Policy response = containerAnalysisClient.setIamPolicy(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -272,7 +226,7 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { return setIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified note or occurrence. Requires * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` @@ -282,26 +236,12 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   ApiFuture<Policy> future = containerAnalysisClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something
-   *   Policy response = future.get();
-   * }
-   * 
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a note or an occurrence resource. Requires * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` @@ -310,15 +250,6 @@ public final UnaryCallable setIamPolicyCallable() { *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy response = containerAnalysisClient.getIamPolicy(resource);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -331,7 +262,7 @@ public final Policy getIamPolicy(ResourceName resource) { return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a note or an occurrence resource. Requires * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` @@ -340,15 +271,6 @@ public final Policy getIamPolicy(ResourceName resource) { *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy response = containerAnalysisClient.getIamPolicy(resource.toString());
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -358,7 +280,7 @@ public final Policy getIamPolicy(String resource) { return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a note or an occurrence resource. Requires * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` @@ -367,18 +289,6 @@ public final Policy getIamPolicy(String resource) { *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   Policy response = containerAnalysisClient.getIamPolicy(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -386,7 +296,7 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { return getIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a note or an occurrence resource. Requires * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` @@ -396,24 +306,12 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   ApiFuture<Policy> future = containerAnalysisClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something
-   *   Policy response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the permissions that a caller has on the specified note or occurrence. Requires list * permission on the project (for example, `containeranalysis.notes.list`). @@ -421,16 +319,6 @@ public final UnaryCallable getIamPolicyCallable() { *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = containerAnalysisClient.testIamPermissions(resource, permissions);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with @@ -448,7 +336,7 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the permissions that a caller has on the specified note or occurrence. Requires list * permission on the project (for example, `containeranalysis.notes.list`). @@ -456,16 +344,6 @@ public final TestIamPermissionsResponse testIamPermissions( *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = containerAnalysisClient.testIamPermissions(resource.toString(), permissions);
-   * }
-   * 
- * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with @@ -483,7 +361,7 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the permissions that a caller has on the specified note or occurrence. Requires list * permission on the project (for example, `containeranalysis.notes.list`). @@ -491,20 +369,6 @@ public final TestIamPermissionsResponse testIamPermissions( *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   TestIamPermissionsResponse response = containerAnalysisClient.testIamPermissions(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -512,7 +376,7 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq return testIamPermissionsCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the permissions that a caller has on the specified note or occurrence. Requires list * permission on the project (for example, `containeranalysis.notes.list`). @@ -521,40 +385,16 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   ApiFuture<TestIamPermissionsResponse> future = containerAnalysisClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something
-   *   TestIamPermissionsResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable testIamPermissionsCallable() { return stub.testIamPermissionsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a summary of the number and severity of occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   String filter = "";
-   *   VulnerabilityOccurrencesSummary response = containerAnalysisClient.getVulnerabilityOccurrencesSummary(parent, filter);
-   * }
-   * 
- * * @param parent The name of the project to get a vulnerability summary for in the form of * `projects/[PROJECT_ID]`. * @param filter The filter expression. @@ -570,20 +410,10 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( return getVulnerabilityOccurrencesSummary(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a summary of the number and severity of occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   String filter = "";
-   *   VulnerabilityOccurrencesSummary response = containerAnalysisClient.getVulnerabilityOccurrencesSummary(parent.toString(), filter);
-   * }
-   * 
- * * @param parent The name of the project to get a vulnerability summary for in the form of * `projects/[PROJECT_ID]`. * @param filter The filter expression. @@ -599,22 +429,10 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( return getVulnerabilityOccurrencesSummary(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a summary of the number and severity of occurrences. * - *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   GetVulnerabilityOccurrencesSummaryRequest request = GetVulnerabilityOccurrencesSummaryRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   VulnerabilityOccurrencesSummary response = containerAnalysisClient.getVulnerabilityOccurrencesSummary(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -623,23 +441,11 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( return getVulnerabilityOccurrencesSummaryCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a summary of the number and severity of occurrences. * *

Sample code: - * - *


-   * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   GetVulnerabilityOccurrencesSummaryRequest request = GetVulnerabilityOccurrencesSummaryRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<VulnerabilityOccurrencesSummary> future = containerAnalysisClient.getVulnerabilityOccurrencesSummaryCallable().futureCall(request);
-   *   // Do something
-   *   VulnerabilityOccurrencesSummary response = future.get();
-   * }
-   * 
*/ public final UnaryCallable< GetVulnerabilityOccurrencesSummaryRequest, VulnerabilityOccurrencesSummary> diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisSettings.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisSettings.java index ec36003b..3b04fe4b 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisSettings.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.devtools.containeranalysis.v1; import com.google.api.core.ApiFunction; @@ -37,7 +38,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link ContainerAnalysisClient}. * @@ -55,23 +56,24 @@ * *

For example, to set the total timeout of setIamPolicy to 30 seconds: * - *

- * 
+ * 
{@code
  * ContainerAnalysisSettings.Builder containerAnalysisSettingsBuilder =
  *     ContainerAnalysisSettings.newBuilder();
  * containerAnalysisSettingsBuilder
  *     .setIamPolicySettings()
  *     .setRetrySettings(
- *         containerAnalysisSettingsBuilder.setIamPolicySettings().getRetrySettings().toBuilder()
+ *         containerAnalysisSettingsBuilder
+ *             .setIamPolicySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * ContainerAnalysisSettings containerAnalysisSettings = containerAnalysisSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class ContainerAnalysisSettings extends ClientSettings { + /** Returns the object with the settings used for calls to setIamPolicy. */ public UnaryCallSettings setIamPolicySettings() { return ((ContainerAnalysisStubSettings) getStubSettings()).setIamPolicySettings(); @@ -156,18 +158,15 @@ protected ContainerAnalysisSettings(Builder settingsBuilder) throws IOException /** Builder for ContainerAnalysisSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(ContainerAnalysisStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(ContainerAnalysisStubSettings.newBuilder()); - } - protected Builder(ContainerAnalysisSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -176,11 +175,15 @@ protected Builder(ContainerAnalysisStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(ContainerAnalysisStubSettings.newBuilder()); + } + public ContainerAnalysisStubSettings.Builder getStubSettingsBuilder() { return ((ContainerAnalysisStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/package-info.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/package-info.java index 0a2831fd..20d05f6c 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/package-info.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/package-info.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -15,9 +15,7 @@ */ /** - * A client to Container Analysis API. - * - *

The interfaces provided are listed below, along with usage samples. + * The interfaces provided are listed below, along with usage samples. * *

======================= ContainerAnalysisClient ======================= * @@ -34,18 +32,8 @@ * to that note. * *

Sample for ContainerAnalysisClient: - * - *

- * 
- * try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
- *   ResourceName resource = ProjectName.of("[PROJECT]");
- *   Policy policy = Policy.newBuilder().build();
- *   Policy response = containerAnalysisClient.setIamPolicy(resource, policy);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.devtools.containeranalysis.v1; import javax.annotation.Generated; diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/ContainerAnalysisStub.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/ContainerAnalysisStub.java index 7577d06a..ae74efb2 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/ContainerAnalysisStub.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/ContainerAnalysisStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.devtools.containeranalysis.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest; @@ -27,14 +27,13 @@ import com.google.iam.v1.TestIamPermissionsResponse; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Container Analysis API. + * Base stub class for the ContainerAnalysis service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public abstract class ContainerAnalysisStub implements BackgroundResource { public UnaryCallable setIamPolicyCallable() { diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/ContainerAnalysisStubSettings.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/ContainerAnalysisStubSettings.java index 980c85bb..afe8a91d 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/ContainerAnalysisStubSettings.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/ContainerAnalysisStubSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.devtools.containeranalysis.v1.stub; import com.google.api.core.ApiFunction; @@ -46,7 +47,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link ContainerAnalysisStub}. * @@ -64,22 +65,23 @@ * *

For example, to set the total timeout of setIamPolicy to 30 seconds: * - *

- * 
+ * 
{@code
  * ContainerAnalysisStubSettings.Builder containerAnalysisSettingsBuilder =
  *     ContainerAnalysisStubSettings.newBuilder();
  * containerAnalysisSettingsBuilder
  *     .setIamPolicySettings()
  *     .setRetrySettings(
- *         containerAnalysisSettingsBuilder.setIamPolicySettings().getRetrySettings().toBuilder()
+ *         containerAnalysisSettingsBuilder
+ *             .setIamPolicySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * ContainerAnalysisStubSettings containerAnalysisSettings = containerAnalysisSettingsBuilder.build();
- * 
- * 
+ * ContainerAnalysisStubSettings containerAnalysisSettings = + * containerAnalysisSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class ContainerAnalysisStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -122,10 +124,10 @@ public ContainerAnalysisStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcContainerAnalysisStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -195,7 +197,6 @@ protected ContainerAnalysisStubSettings(Builder settingsBuilder) throws IOExcept /** Builder for ContainerAnalysisStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder setIamPolicySettings; private final UnaryCallSettings.Builder getIamPolicySettings; private final UnaryCallSettings.Builder @@ -203,16 +204,15 @@ public static class Builder extends StubSettings.Builder getVulnerabilityOccurrencesSummarySettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder> definitions = ImmutableMap.builder(); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + "no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -221,8 +221,6 @@ public static class Builder extends StubSettings.Builder definitions = ImmutableMap.builder(); RetrySettings settings = null; - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(30000L)) @@ -230,23 +228,22 @@ public static class Builder extends StubSettings.Builder>of( + setIamPolicySettings, + getIamPolicySettings, + testIamPermissionsSettings, + getVulnerabilityOccurrencesSummarySettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .setIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .getIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .testIamPermissionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .getVulnerabilityOccurrencesSummarySettings() @@ -293,24 +307,7 @@ private static Builder initDefaults(Builder builder) { return builder; } - protected Builder(ContainerAnalysisStubSettings settings) { - super(settings); - - setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); - getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); - testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); - getVulnerabilityOccurrencesSummarySettings = - settings.getVulnerabilityOccurrencesSummarySettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - setIamPolicySettings, - getIamPolicySettings, - testIamPermissionsSettings, - getVulnerabilityOccurrencesSummarySettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisCallableFactory.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisCallableFactory.java index 10889167..9b8cb871 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisCallableFactory.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisCallableFactory.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.devtools.containeranalysis.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Container Analysis API. + * gRPC callable factory implementation for the ContainerAnalysis service API. * *

This class is for advanced usage. */ -@Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +@Generated("by gapic-generator-java") public class GrpcContainerAnalysisCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisStub.java b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisStub.java index 1d0cfe8a..8bca88c1 100644 --- a/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisStub.java +++ b/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/stub/GrpcContainerAnalysisStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.devtools.containeranalysis.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -31,6 +31,7 @@ import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; @@ -38,16 +39,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Container Analysis API. + * gRPC stub implementation for the ContainerAnalysis service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcContainerAnalysisStub extends ContainerAnalysisStub { - private static final MethodDescriptor setIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -55,6 +54,7 @@ public class GrpcContainerAnalysisStub extends ContainerAnalysisStub { .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); + private static final MethodDescriptor getIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -62,6 +62,7 @@ public class GrpcContainerAnalysisStub extends ContainerAnalysisStub { .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); + private static final MethodDescriptor testIamPermissionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -73,6 +74,7 @@ public class GrpcContainerAnalysisStub extends ContainerAnalysisStub { .setResponseMarshaller( ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor< GetVulnerabilityOccurrencesSummaryRequest, VulnerabilityOccurrencesSummary> getVulnerabilityOccurrencesSummaryMethodDescriptor = @@ -89,8 +91,6 @@ public class GrpcContainerAnalysisStub extends ContainerAnalysisStub { ProtoUtils.marshaller(VulnerabilityOccurrencesSummary.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable setIamPolicyCallable; private final UnaryCallable getIamPolicyCallable; private final UnaryCallable @@ -99,6 +99,8 @@ public class GrpcContainerAnalysisStub extends ContainerAnalysisStub { GetVulnerabilityOccurrencesSummaryRequest, VulnerabilityOccurrencesSummary> getVulnerabilityOccurrencesSummaryCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcContainerAnalysisStub create(ContainerAnalysisStubSettings settings) @@ -139,6 +141,7 @@ protected GrpcContainerAnalysisStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings setIamPolicyTransportSettings = GrpcCallSettings.newBuilder() @@ -215,7 +218,12 @@ public Map extract( settings.getVulnerabilityOccurrencesSummarySettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable setIamPolicyCallable() { diff --git a/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClientTest.java b/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClientTest.java index e246db6a..b7f12bc7 100644 --- a/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClientTest.java +++ b/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClientTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.devtools.containeranalysis.v1; import com.google.api.gax.core.NoCredentialsProvider; @@ -26,6 +27,7 @@ import com.google.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest; import com.google.containeranalysis.v1.ProjectName; import com.google.containeranalysis.v1.VulnerabilityOccurrencesSummary; +import com.google.iam.v1.Binding; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; @@ -33,14 +35,13 @@ import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.AbstractMessage; import com.google.protobuf.ByteString; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Objects; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -48,31 +49,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class ContainerAnalysisClientTest { - private static MockContainerAnalysis mockContainerAnalysis; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private ContainerAnalysisClient client; + private static MockContainerAnalysis mockContainerAnalysis; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockContainerAnalysis = new MockContainerAnalysis(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), Arrays.asList(mockContainerAnalysis)); - serviceHelper.start(); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); ContainerAnalysisSettings settings = ContainerAnalysisSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -87,11 +88,13 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void setIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockContainerAnalysis.addResponse(expectedResponse); ResourceName resource = ProjectName.of("[PROJECT]"); @@ -102,9 +105,9 @@ public void setIamPolicyTest() { List actualRequests = mockContainerAnalysis.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(policy, actualRequest.getPolicy()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -113,28 +116,71 @@ public void setIamPolicyTest() { } @Test - @SuppressWarnings("all") public void setIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockContainerAnalysis.addException(exception); try { ResourceName resource = ProjectName.of("[PROJECT]"); Policy policy = Policy.newBuilder().build(); + client.setIamPolicy(resource, policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockContainerAnalysis.addResponse(expectedResponse); + + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); + + Policy actualResponse = client.setIamPolicy(resource, policy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockContainerAnalysis.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockContainerAnalysis.addException(exception); + try { + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); client.setIamPolicy(resource, policy); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockContainerAnalysis.addResponse(expectedResponse); ResourceName resource = ProjectName.of("[PROJECT]"); @@ -144,9 +190,9 @@ public void getIamPolicyTest() { List actualRequests = mockContainerAnalysis.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -154,25 +200,63 @@ public void getIamPolicyTest() { } @Test - @SuppressWarnings("all") public void getIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockContainerAnalysis.addException(exception); try { ResourceName resource = ProjectName.of("[PROJECT]"); + client.getIamPolicy(resource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockContainerAnalysis.addResponse(expectedResponse); + + String resource = "resource-341064690"; + + Policy actualResponse = client.getIamPolicy(resource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockContainerAnalysis.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockContainerAnalysis.addException(exception); + + try { + String resource = "resource-341064690"; client.getIamPolicy(resource); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void testIamPermissionsTest() { - TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockContainerAnalysis.addResponse(expectedResponse); ResourceName resource = ProjectName.of("[PROJECT]"); @@ -183,9 +267,9 @@ public void testIamPermissionsTest() { List actualRequests = mockContainerAnalysis.getRequests(); Assert.assertEquals(1, actualRequests.size()); - TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(permissions, actualRequest.getPermissionsList()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -194,27 +278,65 @@ public void testIamPermissionsTest() { } @Test - @SuppressWarnings("all") public void testIamPermissionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockContainerAnalysis.addException(exception); try { ResourceName resource = ProjectName.of("[PROJECT]"); List permissions = new ArrayList<>(); + client.testIamPermissions(resource, permissions); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest2() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockContainerAnalysis.addResponse(expectedResponse); + + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockContainerAnalysis.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockContainerAnalysis.addException(exception); + + try { + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); client.testIamPermissions(resource, permissions); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getVulnerabilityOccurrencesSummaryTest() { + public void getVulnerabilityOccurrencesSummaryTest() throws Exception { VulnerabilityOccurrencesSummary expectedResponse = - VulnerabilityOccurrencesSummary.newBuilder().build(); + VulnerabilityOccurrencesSummary.newBuilder() + .addAllCounts(new ArrayList()) + .build(); mockContainerAnalysis.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); @@ -227,9 +349,9 @@ public void getVulnerabilityOccurrencesSummaryTest() { List actualRequests = mockContainerAnalysis.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetVulnerabilityOccurrencesSummaryRequest actualRequest = - (GetVulnerabilityOccurrencesSummaryRequest) actualRequests.get(0); + ((GetVulnerabilityOccurrencesSummaryRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(filter, actualRequest.getFilter()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -238,19 +360,60 @@ public void getVulnerabilityOccurrencesSummaryTest() { } @Test - @SuppressWarnings("all") public void getVulnerabilityOccurrencesSummaryExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockContainerAnalysis.addException(exception); try { ProjectName parent = ProjectName.of("[PROJECT]"); String filter = "filter-1274492040"; + client.getVulnerabilityOccurrencesSummary(parent, filter); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getVulnerabilityOccurrencesSummaryTest2() throws Exception { + VulnerabilityOccurrencesSummary expectedResponse = + VulnerabilityOccurrencesSummary.newBuilder() + .addAllCounts(new ArrayList()) + .build(); + mockContainerAnalysis.addResponse(expectedResponse); + + String parent = "parent-995424086"; + String filter = "filter-1274492040"; + + VulnerabilityOccurrencesSummary actualResponse = + client.getVulnerabilityOccurrencesSummary(parent, filter); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockContainerAnalysis.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetVulnerabilityOccurrencesSummaryRequest actualRequest = + ((GetVulnerabilityOccurrencesSummaryRequest) actualRequests.get(0)); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(filter, actualRequest.getFilter()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getVulnerabilityOccurrencesSummaryExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockContainerAnalysis.addException(exception); + + try { + String parent = "parent-995424086"; + String filter = "filter-1274492040"; client.getVulnerabilityOccurrencesSummary(parent, filter); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/MockContainerAnalysis.java b/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/MockContainerAnalysis.java index 5d45f6ab..a64fe61e 100644 --- a/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/MockContainerAnalysis.java +++ b/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/MockContainerAnalysis.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.devtools.containeranalysis.v1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockContainerAnalysis implements MockGrpcService { private final MockContainerAnalysisImpl serviceImpl; diff --git a/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/MockContainerAnalysisImpl.java b/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/MockContainerAnalysisImpl.java index f890c448..ee65fb5d 100644 --- a/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/MockContainerAnalysisImpl.java +++ b/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1/MockContainerAnalysisImpl.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.devtools.containeranalysis.v1; import com.google.api.core.BetaApi; @@ -30,9 +31,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockContainerAnalysisImpl extends ContainerAnalysisImplBase { private List requests; private Queue responses; @@ -68,10 +70,10 @@ public void setIamPolicy(SetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -82,10 +84,10 @@ public void getIamPolicy(GetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -98,10 +100,10 @@ public void testIamPermissions( Object response = responses.remove(); if (response instanceof TestIamPermissionsResponse) { requests.add(request); - responseObserver.onNext((TestIamPermissionsResponse) response); + responseObserver.onNext(((TestIamPermissionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -114,10 +116,10 @@ public void getVulnerabilityOccurrencesSummary( Object response = responses.remove(); if (response instanceof VulnerabilityOccurrencesSummary) { requests.add(request); - responseObserver.onNext((VulnerabilityOccurrencesSummary) response); + responseObserver.onNext(((VulnerabilityOccurrencesSummary) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/grpc-google-cloud-containeranalysis-v1/pom.xml b/grpc-google-cloud-containeranalysis-v1/pom.xml index 8e6d4b22..b242b948 100644 --- a/grpc-google-cloud-containeranalysis-v1/pom.xml +++ b/grpc-google-cloud-containeranalysis-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-containeranalysis-v1 - 1.2.11 + 1.2.29 grpc-google-cloud-containeranalysis-v1 GRPC library for grpc-google-cloud-containeranalysis-v1 com.google.cloud google-cloud-containeranalysis-parent - 1.2.11 + 1.2.29 diff --git a/grpc-google-cloud-containeranalysis-v1beta1/pom.xml b/grpc-google-cloud-containeranalysis-v1beta1/pom.xml index 3fa90827..e0a5ef15 100644 --- a/grpc-google-cloud-containeranalysis-v1beta1/pom.xml +++ b/grpc-google-cloud-containeranalysis-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-containeranalysis-v1beta1 - 0.88.11 + 0.88.29 grpc-google-cloud-containeranalysis-v1beta1 GRPC library for grpc-google-cloud-containeranalysis-v1beta1 com.google.cloud google-cloud-containeranalysis-parent - 1.2.11 + 1.2.29 diff --git a/pom.xml b/pom.xml index 60b938c5..c371e5ba 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-containeranalysis-parent pom - 1.2.11 + 1.2.29 Google Cloud Container Analysis Parent https://github.com/googleapis/java-containeranalysis @@ -70,33 +70,33 @@ com.google.api.grpc proto-google-cloud-containeranalysis-v1 - 1.2.11 + 1.2.29 com.google.api.grpc proto-google-cloud-containeranalysis-v1beta1 - 0.88.11 + 0.88.29 com.google.api.grpc grpc-google-cloud-containeranalysis-v1beta1 - 0.88.11 + 0.88.29 com.google.api.grpc grpc-google-cloud-containeranalysis-v1 - 1.2.11 + 1.2.29 com.google.cloud google-cloud-containeranalysis - 1.2.11 + 1.2.29 com.google.cloud google-cloud-shared-dependencies - 0.18.0 + 0.19.0 pom import @@ -105,7 +105,7 @@ io.grafeas grafeas - 1.0.8 + 1.0.9 diff --git a/proto-google-cloud-containeranalysis-v1/pom.xml b/proto-google-cloud-containeranalysis-v1/pom.xml index 16aeba33..13f43324 100644 --- a/proto-google-cloud-containeranalysis-v1/pom.xml +++ b/proto-google-cloud-containeranalysis-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-containeranalysis-v1 - 1.2.11 + 1.2.29 proto-google-cloud-containeranalysis-v1 PROTO library for proto-google-cloud-containeranalysis-v1 com.google.cloud google-cloud-containeranalysis-parent - 1.2.11 + 1.2.29 diff --git a/proto-google-cloud-containeranalysis-v1/src/main/java/com/google/containeranalysis/v1/ProjectName.java b/proto-google-cloud-containeranalysis-v1/src/main/java/com/google/containeranalysis/v1/ProjectName.java index 651c4994..2c6f990e 100644 --- a/proto-google-cloud-containeranalysis-v1/src/main/java/com/google/containeranalysis/v1/ProjectName.java +++ b/proto-google-cloud-containeranalysis-v1/src/main/java/com/google/containeranalysis/v1/ProjectName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://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, @@ -23,18 +23,26 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ProjectName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT = PathTemplate.createWithoutUrlEncoding("projects/{project}"); - private volatile Map fieldValuesMap; - private final String project; + @Deprecated + protected ProjectName() { + project = null; + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + public String getProject() { return project; } @@ -47,10 +55,6 @@ public Builder toBuilder() { return new Builder(this); } - private ProjectName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - } - public static ProjectName of(String project) { return newBuilder().setProject(project).build(); } @@ -64,7 +68,7 @@ public static ProjectName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT.validatedMatch( formattedString, "ProjectName.parse: formattedString not in valid format"); return of(matchMap.get("project")); } @@ -78,7 +82,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ProjectName value : values) { if (value == null) { list.add(""); @@ -90,15 +94,18 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); + if (project != null) { + fieldMapBuilder.put("project", project); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -112,14 +119,35 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project); + return PROJECT.instantiate("project", project); } - /** Builder for ProjectName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ProjectName that = ((ProjectName) o); + return Objects.equals(this.project, that.project); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + return h; + } + + /** Builder for projects/{project}. */ + public static class Builder { private String project; + protected Builder() {} + public String getProject() { return project; } @@ -129,8 +157,6 @@ public Builder setProject(String project) { return this; } - private Builder() {} - private Builder(ProjectName projectName) { project = projectName.project; } @@ -139,24 +165,4 @@ public ProjectName build() { return new ProjectName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ProjectName) { - ProjectName that = (ProjectName) o; - return (this.project.equals(that.project)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - return h; - } } diff --git a/proto-google-cloud-containeranalysis-v1beta1/pom.xml b/proto-google-cloud-containeranalysis-v1beta1/pom.xml index 1782cf7b..36ff7ae3 100644 --- a/proto-google-cloud-containeranalysis-v1beta1/pom.xml +++ b/proto-google-cloud-containeranalysis-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-containeranalysis-v1beta1 - 0.88.11 + 0.88.29 proto-google-cloud-containeranalysis-v1beta1 PROTO library for proto-google-cloud-containeranalysis-v1beta1 com.google.cloud google-cloud-containeranalysis-parent - 1.2.11 + 1.2.29 diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index ea2c3450..0550d06b 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-containeranalysis - 1.2.10 + 1.2.11 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index f5b3cd17..d2d365f7 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-containeranalysis - 1.2.10 + 1.2.11 diff --git a/synth.metadata b/synth.metadata index 266031a7..989fd3b1 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-containeranalysis.git", - "sha": "e4a4bffaf5c26f1c51e5f8ed13bbbc98cb8a452e" + "sha": "6b9f88aad1d512c8080f797768dd05660630047d" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "2414b817065726eae0bc525346c7e874f969369d" + "sha": "6946fd71ae9215b0e7ae188f5057df765ee6d7d2" } } ], diff --git a/versions.txt b/versions.txt index ffcee7d0..51b8d952 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -proto-google-cloud-containeranalysis-v1:1.2.11:1.2.11 -proto-google-cloud-containeranalysis-v1beta1:0.88.11:0.88.11 -grpc-google-cloud-containeranalysis-v1beta1:0.88.11:0.88.11 -grpc-google-cloud-containeranalysis-v1:1.2.11:1.2.11 -google-cloud-containeranalysis:1.2.11:1.2.11 +proto-google-cloud-containeranalysis-v1:1.2.29:1.2.29 +proto-google-cloud-containeranalysis-v1beta1:0.88.29:0.88.29 +grpc-google-cloud-containeranalysis-v1beta1:0.88.29:0.88.29 +grpc-google-cloud-containeranalysis-v1:1.2.29:1.2.29 +google-cloud-containeranalysis:1.2.29:1.2.29