From 6de1b0754d1512ff8f17e07908decebe6137708b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 26 May 2022 17:22:21 +0000 Subject: [PATCH 01/14] chore(main): release 1.1.2-SNAPSHOT (#221) :robot: I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- google-cloud-binary-authorization-bom/pom.xml | 12 ++++++------ google-cloud-binary-authorization/pom.xml | 4 ++-- grpc-google-cloud-binary-authorization-v1/pom.xml | 4 ++-- .../pom.xml | 4 ++-- pom.xml | 12 ++++++------ proto-google-cloud-binary-authorization-v1/pom.xml | 4 ++-- .../pom.xml | 4 ++-- versions.txt | 10 +++++----- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/google-cloud-binary-authorization-bom/pom.xml b/google-cloud-binary-authorization-bom/pom.xml index 96783d8d..5d216d57 100644 --- a/google-cloud-binary-authorization-bom/pom.xml +++ b/google-cloud-binary-authorization-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-binary-authorization-bom - 1.1.1 + 1.1.2-SNAPSHOT pom com.google.cloud @@ -56,27 +56,27 @@ com.google.cloud google-cloud-binary-authorization - 1.1.1 + 1.1.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-binary-authorization-v1beta1 - 0.6.1 + 0.6.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-binary-authorization-v1 - 1.1.1 + 1.1.2-SNAPSHOT com.google.api.grpc proto-google-cloud-binary-authorization-v1beta1 - 0.6.1 + 0.6.2-SNAPSHOT com.google.api.grpc proto-google-cloud-binary-authorization-v1 - 1.1.1 + 1.1.2-SNAPSHOT diff --git a/google-cloud-binary-authorization/pom.xml b/google-cloud-binary-authorization/pom.xml index ffd5af9d..7737f183 100644 --- a/google-cloud-binary-authorization/pom.xml +++ b/google-cloud-binary-authorization/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-binary-authorization - 1.1.1 + 1.1.2-SNAPSHOT jar Google Binary Authorization https://github.com/googleapis/java-binary-authorization @@ -11,7 +11,7 @@ com.google.cloud google-cloud-binary-authorization-parent - 1.1.1 + 1.1.2-SNAPSHOT google-cloud-binary-authorization diff --git a/grpc-google-cloud-binary-authorization-v1/pom.xml b/grpc-google-cloud-binary-authorization-v1/pom.xml index faafc550..f6818d00 100644 --- a/grpc-google-cloud-binary-authorization-v1/pom.xml +++ b/grpc-google-cloud-binary-authorization-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-binary-authorization-v1 - 1.1.1 + 1.1.2-SNAPSHOT grpc-google-cloud-binary-authorization-v1 GRPC library for google-cloud-binary-authorization com.google.cloud google-cloud-binary-authorization-parent - 1.1.1 + 1.1.2-SNAPSHOT diff --git a/grpc-google-cloud-binary-authorization-v1beta1/pom.xml b/grpc-google-cloud-binary-authorization-v1beta1/pom.xml index 322ba10f..14db1ddc 100644 --- a/grpc-google-cloud-binary-authorization-v1beta1/pom.xml +++ b/grpc-google-cloud-binary-authorization-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-binary-authorization-v1beta1 - 0.6.1 + 0.6.2-SNAPSHOT grpc-google-cloud-binary-authorization-v1beta1 GRPC library for google-cloud-binary-authorization com.google.cloud google-cloud-binary-authorization-parent - 1.1.1 + 1.1.2-SNAPSHOT diff --git a/pom.xml b/pom.xml index 8d4416b2..b8133590 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-binary-authorization-parent pom - 1.1.1 + 1.1.2-SNAPSHOT Google Binary Authorization Parent https://github.com/googleapis/java-binary-authorization @@ -60,27 +60,27 @@ com.google.cloud google-cloud-binary-authorization - 1.1.1 + 1.1.2-SNAPSHOT com.google.api.grpc proto-google-cloud-binary-authorization-v1 - 1.1.1 + 1.1.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-binary-authorization-v1 - 1.1.1 + 1.1.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-binary-authorization-v1beta1 - 0.6.1 + 0.6.2-SNAPSHOT com.google.api.grpc proto-google-cloud-binary-authorization-v1beta1 - 0.6.1 + 0.6.2-SNAPSHOT diff --git a/proto-google-cloud-binary-authorization-v1/pom.xml b/proto-google-cloud-binary-authorization-v1/pom.xml index d8f63018..ad4c99e9 100644 --- a/proto-google-cloud-binary-authorization-v1/pom.xml +++ b/proto-google-cloud-binary-authorization-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-binary-authorization-v1 - 1.1.1 + 1.1.2-SNAPSHOT proto-google-cloud-binary-authorization-v1 Proto library for google-cloud-binary-authorization com.google.cloud google-cloud-binary-authorization-parent - 1.1.1 + 1.1.2-SNAPSHOT diff --git a/proto-google-cloud-binary-authorization-v1beta1/pom.xml b/proto-google-cloud-binary-authorization-v1beta1/pom.xml index 99e8a6f9..1da4d587 100644 --- a/proto-google-cloud-binary-authorization-v1beta1/pom.xml +++ b/proto-google-cloud-binary-authorization-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-binary-authorization-v1beta1 - 0.6.1 + 0.6.2-SNAPSHOT proto-google-cloud-binary-authorization-v1beta1 Proto library for google-cloud-binary-authorization com.google.cloud google-cloud-binary-authorization-parent - 1.1.1 + 1.1.2-SNAPSHOT diff --git a/versions.txt b/versions.txt index 0f89d7ca..967742ed 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-binary-authorization:1.1.1:1.1.1 -grpc-google-cloud-binary-authorization-v1beta1:0.6.1:0.6.1 -grpc-google-cloud-binary-authorization-v1:1.1.1:1.1.1 -proto-google-cloud-binary-authorization-v1beta1:0.6.1:0.6.1 -proto-google-cloud-binary-authorization-v1:1.1.1:1.1.1 +google-cloud-binary-authorization:1.1.1:1.1.2-SNAPSHOT +grpc-google-cloud-binary-authorization-v1beta1:0.6.1:0.6.2-SNAPSHOT +grpc-google-cloud-binary-authorization-v1:1.1.1:1.1.2-SNAPSHOT +proto-google-cloud-binary-authorization-v1beta1:0.6.1:0.6.2-SNAPSHOT +proto-google-cloud-binary-authorization-v1:1.1.1:1.1.2-SNAPSHOT From b8a10c1ccd2bbc4382a23d4d91b08a7d269c8367 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 27 May 2022 19:00:21 +0000 Subject: [PATCH 02/14] chore(deps): upgrade gapic-generator-java to 2.8.0 and update gax-java to 2.18.1 (#218) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 450543911 Source-Link: https://github.com/googleapis/googleapis/commit/55283447ab72f10b6c2571d770af0498b593e84f Source-Link: https://github.com/googleapis/googleapis-gen/commit/9f6775cab1958982b88967a43e5e806af0f135db Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWY2Nzc1Y2FiMTk1ODk4MmI4ODk2N2E0M2U1ZTgwNmFmMGYxMzVkYiJ9 --- .../v1beta1/BinauthzManagementServiceV1Beta1Client.java | 3 --- .../v1beta1/SystemPolicyV1Beta1Client.java | 3 --- .../stub/BinauthzManagementServiceV1Beta1StubSettings.java | 1 - .../v1beta1/stub/SystemPolicyV1Beta1StubSettings.java | 1 - .../v1/BinauthzManagementServiceV1Client.java | 4 ---- .../cloud/binaryauthorization/v1/SystemPolicyV1Client.java | 4 ---- .../binaryauthorization/v1/ValidationHelperV1Client.java | 4 ---- .../v1/stub/BinauthzManagementServiceV1StubSettings.java | 1 - .../v1/stub/SystemPolicyV1StubSettings.java | 1 - .../v1/stub/ValidationHelperV1StubSettings.java | 1 - 10 files changed, 23 deletions(-) diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java index 63745435..fccbdb57 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java @@ -138,7 +138,6 @@ public static final BinauthzManagementServiceV1Beta1Client create( * making calls. This is for advanced usage - prefer using * create(BinauthzManagementServiceV1Beta1Settings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final BinauthzManagementServiceV1Beta1Client create( BinauthzManagementServiceV1Beta1Stub stub) { return new BinauthzManagementServiceV1Beta1Client(stub); @@ -156,7 +155,6 @@ protected BinauthzManagementServiceV1Beta1Client( ((BinauthzManagementServiceV1Beta1StubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected BinauthzManagementServiceV1Beta1Client(BinauthzManagementServiceV1Beta1Stub stub) { this.settings = null; this.stub = stub; @@ -166,7 +164,6 @@ public final BinauthzManagementServiceV1Beta1Settings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public BinauthzManagementServiceV1Beta1Stub getStub() { return stub; } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java index 4179be08..97668fc9 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java @@ -118,7 +118,6 @@ public static final SystemPolicyV1Beta1Client create(SystemPolicyV1Beta1Settings * Constructs an instance of SystemPolicyV1Beta1Client, using the given stub for making calls. * This is for advanced usage - prefer using create(SystemPolicyV1Beta1Settings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final SystemPolicyV1Beta1Client create(SystemPolicyV1Beta1Stub stub) { return new SystemPolicyV1Beta1Client(stub); } @@ -133,7 +132,6 @@ protected SystemPolicyV1Beta1Client(SystemPolicyV1Beta1Settings settings) throws this.stub = ((SystemPolicyV1Beta1StubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected SystemPolicyV1Beta1Client(SystemPolicyV1Beta1Stub stub) { this.settings = null; this.stub = stub; @@ -143,7 +141,6 @@ public final SystemPolicyV1Beta1Settings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public SystemPolicyV1Beta1Stub getStub() { return stub; } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/BinauthzManagementServiceV1Beta1StubSettings.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/BinauthzManagementServiceV1Beta1StubSettings.java index 87d464e7..1e95f878 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/BinauthzManagementServiceV1Beta1StubSettings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/BinauthzManagementServiceV1Beta1StubSettings.java @@ -204,7 +204,6 @@ public UnaryCallSettings deleteAttestorSettings() return deleteAttestorSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public BinauthzManagementServiceV1Beta1Stub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/SystemPolicyV1Beta1StubSettings.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/SystemPolicyV1Beta1StubSettings.java index 22b913e1..a5ba7c01 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/SystemPolicyV1Beta1StubSettings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/SystemPolicyV1Beta1StubSettings.java @@ -91,7 +91,6 @@ public UnaryCallSettings getSystemPolicySettings return getSystemPolicySettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public SystemPolicyV1Beta1Stub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java index 6eae898d..e754f330 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java @@ -18,7 +18,6 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -136,7 +135,6 @@ public static final BinauthzManagementServiceV1Client create( * Constructs an instance of BinauthzManagementServiceV1Client, using the given stub for making * calls. This is for advanced usage - prefer using create(BinauthzManagementServiceV1Settings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final BinauthzManagementServiceV1Client create( BinauthzManagementServiceV1Stub stub) { return new BinauthzManagementServiceV1Client(stub); @@ -153,7 +151,6 @@ protected BinauthzManagementServiceV1Client(BinauthzManagementServiceV1Settings this.stub = ((BinauthzManagementServiceV1StubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected BinauthzManagementServiceV1Client(BinauthzManagementServiceV1Stub stub) { this.settings = null; this.stub = stub; @@ -163,7 +160,6 @@ public final BinauthzManagementServiceV1Settings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public BinauthzManagementServiceV1Stub getStub() { return stub; } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java index fd8fa1dd..c0d107b0 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java @@ -16,7 +16,6 @@ package com.google.protos.google.cloud.binaryauthorization.v1; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.protos.google.cloud.binaryauthorization.v1.stub.SystemPolicyV1Stub; @@ -114,7 +113,6 @@ public static final SystemPolicyV1Client create(SystemPolicyV1Settings settings) * Constructs an instance of SystemPolicyV1Client, using the given stub for making calls. This is * for advanced usage - prefer using create(SystemPolicyV1Settings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final SystemPolicyV1Client create(SystemPolicyV1Stub stub) { return new SystemPolicyV1Client(stub); } @@ -129,7 +127,6 @@ protected SystemPolicyV1Client(SystemPolicyV1Settings settings) throws IOExcepti this.stub = ((SystemPolicyV1StubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected SystemPolicyV1Client(SystemPolicyV1Stub stub) { this.settings = null; this.stub = stub; @@ -139,7 +136,6 @@ public final SystemPolicyV1Settings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public SystemPolicyV1Stub getStub() { return stub; } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Client.java index c54b1d67..7375f421 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Client.java @@ -16,7 +16,6 @@ package com.google.protos.google.cloud.binaryauthorization.v1; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.protos.google.cloud.binaryauthorization.v1.stub.ValidationHelperV1Stub; @@ -124,7 +123,6 @@ public static final ValidationHelperV1Client create(ValidationHelperV1Settings s * Constructs an instance of ValidationHelperV1Client, using the given stub for making calls. This * is for advanced usage - prefer using create(ValidationHelperV1Settings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final ValidationHelperV1Client create(ValidationHelperV1Stub stub) { return new ValidationHelperV1Client(stub); } @@ -139,7 +137,6 @@ protected ValidationHelperV1Client(ValidationHelperV1Settings settings) throws I this.stub = ((ValidationHelperV1StubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected ValidationHelperV1Client(ValidationHelperV1Stub stub) { this.settings = null; this.stub = stub; @@ -149,7 +146,6 @@ public final ValidationHelperV1Settings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public ValidationHelperV1Stub getStub() { return stub; } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/BinauthzManagementServiceV1StubSettings.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/BinauthzManagementServiceV1StubSettings.java index bb269765..47ddca33 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/BinauthzManagementServiceV1StubSettings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/BinauthzManagementServiceV1StubSettings.java @@ -212,7 +212,6 @@ public UnaryCallSettings deleteAttestorSet return deleteAttestorSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public BinauthzManagementServiceV1Stub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/SystemPolicyV1StubSettings.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/SystemPolicyV1StubSettings.java index 8c9ffc4e..5c459673 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/SystemPolicyV1StubSettings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/SystemPolicyV1StubSettings.java @@ -91,7 +91,6 @@ public class SystemPolicyV1StubSettings extends StubSettings Date: Mon, 13 Jun 2022 19:02:27 +0200 Subject: [PATCH 03/14] build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.5.0 (#226) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-config](https://togithub.com/googleapis/java-shared-config) | `1.4.0` -> `1.5.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/compatibility-slim/1.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/1.5.0/confidence-slim/1.4.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. ⚠ **Warning**: custom changes will be lost. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-binary-authorization). --- README.md | 6 +++--- google-cloud-binary-authorization-bom/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 379ceae4..fb726425 100644 --- a/README.md +++ b/README.md @@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-binary-authorization - 1.1.0 + 1.1.1 ``` If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-binary-authorization:1.1.0' +implementation 'com.google.cloud:google-cloud-binary-authorization:1.1.1' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-binary-authorization" % "1.1.0" +libraryDependencies += "com.google.cloud" % "google-cloud-binary-authorization" % "1.1.1" ``` ## Authentication diff --git a/google-cloud-binary-authorization-bom/pom.xml b/google-cloud-binary-authorization-bom/pom.xml index 5d216d57..09588b87 100644 --- a/google-cloud-binary-authorization-bom/pom.xml +++ b/google-cloud-binary-authorization-bom/pom.xml @@ -8,7 +8,7 @@ com.google.cloud google-cloud-shared-config - 1.4.0 + 1.5.0 Google Binary Authorization BOM diff --git a/pom.xml b/pom.xml index b8133590..399a6e49 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 1.4.0 + 1.5.0 From bb477621b3634b9fc7d0cfd3f7749a0b810427f5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 13 Jun 2022 20:16:25 +0000 Subject: [PATCH 04/14] chore: Integrate new gapic-generator-java and rules_gapic (#223) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 454027580 Source-Link: https://github.com/googleapis/googleapis/commit/1b222777baa702e7135610355706570ed2b56318 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e04cea20d0d12eb5c3bdb360a9e72b654edcb638 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTA0Y2VhMjBkMGQxMmViNWMzYmRiMzYwYTllNzJiNjU0ZWRjYjYzOCJ9 --- .../v1beta1/BinauthzManagementServiceV1Beta1Client.java | 2 +- .../v1beta1/SystemPolicyV1Beta1Client.java | 8 ++++---- .../cloud/binaryauthorization/v1beta1/package-info.java | 2 +- .../v1/BinauthzManagementServiceV1Client.java | 2 +- .../binaryauthorization/v1/SystemPolicyV1Client.java | 8 ++++---- .../google/cloud/binaryauthorization/v1/package-info.java | 2 +- .../v1beta1/SystemPolicyV1Beta1ClientTest.java | 8 ++++---- .../binaryauthorization/v1/SystemPolicyV1ClientTest.java | 8 ++++---- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java index fccbdb57..ca587ae1 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java @@ -870,7 +870,7 @@ public final ListAttestorsPagedResponse listAttestors(ListAttestorsRequest reque * while (true) { * ListAttestorsResponse response = * binauthzManagementServiceV1Beta1Client.listAttestorsCallable().call(request); - * for (Attestor element : response.getResponsesList()) { + * for (Attestor element : response.getAttestorsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java index 97668fc9..5fb4e062 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java @@ -36,7 +36,7 @@ * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.create()) { - * PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + * PolicyName name = PolicyName.ofLocationName("[LOCATION]"); * Policy response = systemPolicyV1Beta1Client.getSystemPolicy(name); * } * } @@ -155,7 +155,7 @@ public SystemPolicyV1Beta1Stub getStub() { * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.create()) { - * PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + * PolicyName name = PolicyName.ofLocationName("[LOCATION]"); * Policy response = systemPolicyV1Beta1Client.getSystemPolicy(name); * } * } @@ -206,7 +206,7 @@ public final Policy getSystemPolicy(String name) { * try (SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.create()) { * GetSystemPolicyRequest request = * GetSystemPolicyRequest.newBuilder() - * .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + * .setName(PolicyName.ofLocationName("[LOCATION]").toString()) * .build(); * Policy response = systemPolicyV1Beta1Client.getSystemPolicy(request); * } @@ -231,7 +231,7 @@ public final Policy getSystemPolicy(GetSystemPolicyRequest request) { * try (SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.create()) { * GetSystemPolicyRequest request = * GetSystemPolicyRequest.newBuilder() - * .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + * .setName(PolicyName.ofLocationName("[LOCATION]").toString()) * .build(); * ApiFuture future = * systemPolicyV1Beta1Client.getSystemPolicyCallable().futureCall(request); diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/package-info.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/package-info.java index 0b43613d..c9ab463f 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/package-info.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/package-info.java @@ -51,7 +51,7 @@ * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.create()) { - * PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + * PolicyName name = PolicyName.ofLocationName("[LOCATION]"); * Policy response = systemPolicyV1Beta1Client.getSystemPolicy(name); * } * } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java index e754f330..dce518a8 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java @@ -875,7 +875,7 @@ public final ListAttestorsPagedResponse listAttestors(Service.ListAttestorsReque * while (true) { * Service.ListAttestorsResponse response = * binauthzManagementServiceV1Client.listAttestorsCallable().call(request); - * for (Resources.Attestor element : response.getResponsesList()) { + * for (Resources.Attestor element : response.getAttestorsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java index c0d107b0..c55d857e 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java @@ -35,7 +35,7 @@ * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create()) { - * PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + * PolicyName name = PolicyName.ofLocationName("[LOCATION]"); * Resources.Policy response = systemPolicyV1Client.getSystemPolicy(name); * } * } @@ -150,7 +150,7 @@ public SystemPolicyV1Stub getStub() { * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create()) { - * PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + * PolicyName name = PolicyName.ofLocationName("[LOCATION]"); * Resources.Policy response = systemPolicyV1Client.getSystemPolicy(name); * } * } @@ -204,7 +204,7 @@ public final Resources.Policy getSystemPolicy(String name) { * try (SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create()) { * Service.GetSystemPolicyRequest request = * Service.GetSystemPolicyRequest.newBuilder() - * .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + * .setName(PolicyName.ofLocationName("[LOCATION]").toString()) * .build(); * Resources.Policy response = systemPolicyV1Client.getSystemPolicy(request); * } @@ -229,7 +229,7 @@ public final Resources.Policy getSystemPolicy(Service.GetSystemPolicyRequest req * try (SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create()) { * Service.GetSystemPolicyRequest request = * Service.GetSystemPolicyRequest.newBuilder() - * .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + * .setName(PolicyName.ofLocationName("[LOCATION]").toString()) * .build(); * ApiFuture future = * systemPolicyV1Client.getSystemPolicyCallable().futureCall(request); diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/package-info.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/package-info.java index 4e133d04..62b205e3 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/package-info.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/package-info.java @@ -53,7 +53,7 @@ * // This snippet has been automatically generated for illustrative purposes only. * // It may require modifications to work in your environment. * try (SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create()) { - * PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + * PolicyName name = PolicyName.ofLocationName("[LOCATION]"); * Resources.Policy response = systemPolicyV1Client.getSystemPolicy(name); * } * } diff --git a/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1ClientTest.java b/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1ClientTest.java index f5249ac5..01d53e3b 100644 --- a/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1ClientTest.java +++ b/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1ClientTest.java @@ -82,7 +82,7 @@ public void tearDown() throws Exception { public void getSystemPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() - .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) .setDescription("description-1724546052") .addAllAdmissionWhitelistPatterns(new ArrayList()) .putAllClusterAdmissionRules(new HashMap()) @@ -94,7 +94,7 @@ public void getSystemPolicyTest() throws Exception { .build(); mockSystemPolicyV1Beta1.addResponse(expectedResponse); - PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); Policy actualResponse = client.getSystemPolicy(name); Assert.assertEquals(expectedResponse, actualResponse); @@ -116,7 +116,7 @@ public void getSystemPolicyExceptionTest() throws Exception { mockSystemPolicyV1Beta1.addException(exception); try { - PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); client.getSystemPolicy(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { @@ -128,7 +128,7 @@ public void getSystemPolicyExceptionTest() throws Exception { public void getSystemPolicyTest2() throws Exception { Policy expectedResponse = Policy.newBuilder() - .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) .setDescription("description-1724546052") .addAllAdmissionWhitelistPatterns(new ArrayList()) .putAllClusterAdmissionRules(new HashMap()) diff --git a/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1ClientTest.java b/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1ClientTest.java index 4d5904b1..4be86f68 100644 --- a/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1ClientTest.java +++ b/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1ClientTest.java @@ -82,7 +82,7 @@ public void tearDown() throws Exception { public void getSystemPolicyTest() throws Exception { Resources.Policy expectedResponse = Resources.Policy.newBuilder() - .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) .setDescription("description-1724546052") .addAllAdmissionWhitelistPatterns(new ArrayList()) .putAllClusterAdmissionRules(new HashMap()) @@ -96,7 +96,7 @@ public void getSystemPolicyTest() throws Exception { .build(); mockSystemPolicyV1.addResponse(expectedResponse); - PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); Resources.Policy actualResponse = client.getSystemPolicy(name); Assert.assertEquals(expectedResponse, actualResponse); @@ -119,7 +119,7 @@ public void getSystemPolicyExceptionTest() throws Exception { mockSystemPolicyV1.addException(exception); try { - PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); client.getSystemPolicy(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { @@ -131,7 +131,7 @@ public void getSystemPolicyExceptionTest() throws Exception { public void getSystemPolicyTest2() throws Exception { Resources.Policy expectedResponse = Resources.Policy.newBuilder() - .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) .setDescription("description-1724546052") .addAllAdmissionWhitelistPatterns(new ArrayList()) .putAllClusterAdmissionRules(new HashMap()) From 3b87721e496edf026fc5b5914c459eee3e73b24b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 14 Jun 2022 21:22:20 +0000 Subject: [PATCH 05/14] chore: skip formatting generated samples (#1456) (#224) Source-Link: https://github.com/googleapis/synthtool/commit/625c20e6b9e195986595e56f60cba04e99c1951a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:58ccd4737212f64a7dd4b3063d447447acf71a2b9d409eab19fc7a00b18eadc0 --- .github/.OwlBot.lock.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index a79f0627..68f2b159 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:2567a120ce90fadb6201999b87d649d9f67459de28815ad239bce9ebfaa18a74 -# created: 2022-05-19T15:12:45.278246753Z + digest: sha256:58ccd4737212f64a7dd4b3063d447447acf71a2b9d409eab19fc7a00b18eadc0 +# created: 2022-06-10T19:20:11.004014696Z From d8fddd93593269ff53794565337601f9f8ffc836 Mon Sep 17 00:00:00 2001 From: Emily Ball Date: Tue, 14 Jun 2022 21:40:21 +0000 Subject: [PATCH 06/14] chore: include generated samples dir (#225) --- .github/.OwlBot.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index 21a244ba..34ce36f5 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -16,6 +16,7 @@ docker: image: "gcr.io/cloud-devrel-public-resources/owlbot-java:latest" deep-remove-regex: +- "/samples/snippets/generated" - "/grpc-google-.*/src" - "/proto-google-.*/src" - "/google-.*/src" @@ -26,4 +27,6 @@ deep-copy-regex: - source: "/google/cloud/binaryauthorization/(v.*)/.*-java/grpc-google-.*/src" dest: "/owl-bot-staging/$1/grpc-google-cloud-binary-authorization-$1/src" - source: "/google/cloud/binaryauthorization/(v.*)/.*-java/gapic-google-.*/src" - dest: "/owl-bot-staging/$1/google-cloud-binary-authorization/src" \ No newline at end of file + dest: "/owl-bot-staging/$1/google-cloud-binary-authorization/src" +- source: "/google/cloud/binaryauthorization/(v.*)/.*-java/samples/snippets/generated" + dest: "/owl-bot-staging/$1/samples/snippets/generated" From 4755125936bcf5931ea01e01e9fc6af3a7c1c309 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 21 Jun 2022 16:22:21 +0000 Subject: [PATCH 07/14] feat: Adds a pod_namespace field to pod events created by Continuous Validation, to distinguish pods with the same name that run in different namespaces (#227) - [ ] Regenerate this pull request now. Committer: @tswift242 PiperOrigin-RevId: 455380856 Source-Link: https://github.com/googleapis/googleapis/commit/1cbacff2f2fe932f91a39d7c1538cb1afc50bd89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/cb47adfa214e798ee1cb736b52ad386101b096e0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I0N2FkZmEyMTRlNzk4ZWUxY2I3MzZiNTJhZDM4NjEwMWIwOTZlMCJ9 --- .../v1beta1/ContinuousValidationEvent.java | 204 ++++++++++++++++++ .../ContinuousValidationLoggingProto.java | 64 +++--- .../continuous_validation_logging.proto | 21 +- .../SyncCreateSetCredentialsProvider.java | 42 ++++ .../create/SyncCreateSetEndpoint.java | 39 ++++ .../createattestor/AsyncCreateAttestor.java | 50 +++++ .../createattestor/SyncCreateAttestor.java | 46 ++++ ...eateAttestorProjectnameStringAttestor.java | 43 ++++ ...yncCreateAttestorStringStringAttestor.java | 43 ++++ .../deleteattestor/AsyncDeleteAttestor.java | 48 +++++ .../deleteattestor/SyncDeleteAttestor.java | 44 ++++ .../SyncDeleteAttestorAttestorname.java | 40 ++++ .../SyncDeleteAttestorString.java | 40 ++++ .../getattestor/AsyncGetAttestor.java | 48 +++++ .../getattestor/SyncGetAttestor.java | 44 ++++ .../SyncGetAttestorAttestorname.java | 40 ++++ .../getattestor/SyncGetAttestorString.java | 40 ++++ .../getpolicy/AsyncGetPolicy.java | 48 +++++ .../getpolicy/SyncGetPolicy.java | 44 ++++ .../getpolicy/SyncGetPolicyPolicyname.java | 40 ++++ .../getpolicy/SyncGetPolicyString.java | 40 ++++ .../listattestors/AsyncListAttestors.java | 52 +++++ .../AsyncListAttestorsPaged.java | 60 ++++++ .../listattestors/SyncListAttestors.java | 49 +++++ .../SyncListAttestorsProjectname.java | 43 ++++ .../SyncListAttestorsString.java | 43 ++++ .../updateattestor/AsyncUpdateAttestor.java | 45 ++++ .../updateattestor/SyncUpdateAttestor.java | 41 ++++ .../SyncUpdateAttestorAttestor.java | 39 ++++ .../updatepolicy/AsyncUpdatePolicy.java | 45 ++++ .../updatepolicy/SyncUpdatePolicy.java | 41 ++++ .../updatepolicy/SyncUpdatePolicyPolicy.java | 39 ++++ .../getpolicy/SyncGetPolicy.java | 48 +++++ .../getpolicy/SyncGetPolicy.java | 48 +++++ .../getsystempolicy/SyncGetSystemPolicy.java | 47 ++++ .../SyncCreateSetCredentialsProvider.java | 42 ++++ .../create/SyncCreateSetEndpoint.java | 39 ++++ .../getsystempolicy/AsyncGetSystemPolicy.java | 47 ++++ .../getsystempolicy/SyncGetSystemPolicy.java | 43 ++++ .../SyncGetSystemPolicyPolicyname.java | 39 ++++ .../SyncGetSystemPolicyString.java | 39 ++++ .../getsystempolicy/SyncGetSystemPolicy.java | 47 ++++ .../SyncCreateSetCredentialsProvider.java | 42 ++++ .../create/SyncCreateSetEndpoint.java | 39 ++++ .../createattestor/AsyncCreateAttestor.java | 50 +++++ .../createattestor/SyncCreateAttestor.java | 46 ++++ ...torProjectnameStringResourcesattestor.java | 43 ++++ ...AttestorStringStringResourcesattestor.java | 43 ++++ .../deleteattestor/AsyncDeleteAttestor.java | 48 +++++ .../deleteattestor/SyncDeleteAttestor.java | 44 ++++ .../SyncDeleteAttestorAttestorname.java | 40 ++++ .../SyncDeleteAttestorString.java | 40 ++++ .../getattestor/AsyncGetAttestor.java | 48 +++++ .../getattestor/SyncGetAttestor.java | 44 ++++ .../SyncGetAttestorAttestorname.java | 40 ++++ .../getattestor/SyncGetAttestorString.java | 40 ++++ .../getpolicy/AsyncGetPolicy.java | 48 +++++ .../getpolicy/SyncGetPolicy.java | 44 ++++ .../getpolicy/SyncGetPolicyPolicyname.java | 40 ++++ .../getpolicy/SyncGetPolicyString.java | 40 ++++ .../listattestors/AsyncListAttestors.java | 52 +++++ .../AsyncListAttestorsPaged.java | 59 +++++ .../listattestors/SyncListAttestors.java | 49 +++++ .../SyncListAttestorsProjectname.java | 43 ++++ .../SyncListAttestorsString.java | 43 ++++ .../updateattestor/AsyncUpdateAttestor.java | 47 ++++ .../updateattestor/SyncUpdateAttestor.java | 43 ++++ .../SyncUpdateAttestorResourcesattestor.java | 39 ++++ .../updatepolicy/AsyncUpdatePolicy.java | 47 ++++ .../updatepolicy/SyncUpdatePolicy.java | 43 ++++ .../SyncUpdatePolicyResourcespolicy.java | 39 ++++ .../getpolicy/SyncGetPolicy.java | 47 ++++ .../getpolicy/SyncGetPolicy.java | 47 ++++ .../getsystempolicy/SyncGetSystemPolicy.java | 46 ++++ .../SyncValidateAttestationOccurrence.java | 47 ++++ .../SyncCreateSetCredentialsProvider.java | 41 ++++ .../create/SyncCreateSetEndpoint.java | 38 ++++ .../getsystempolicy/AsyncGetSystemPolicy.java | 47 ++++ .../getsystempolicy/SyncGetSystemPolicy.java | 43 ++++ .../SyncGetSystemPolicyPolicyname.java | 39 ++++ .../SyncGetSystemPolicyString.java | 39 ++++ .../getsystempolicy/SyncGetSystemPolicy.java | 46 ++++ .../SyncCreateSetCredentialsProvider.java | 42 ++++ .../create/SyncCreateSetEndpoint.java | 39 ++++ .../AsyncValidateAttestationOccurrence.java | 49 +++++ .../SyncValidateAttestationOccurrence.java | 46 ++++ .../SyncValidateAttestationOccurrence.java | 47 ++++ 87 files changed, 3949 insertions(+), 41 deletions(-) create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/AsyncCreateAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestorProjectnameStringAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestorStringStringAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/AsyncDeleteAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestorAttestorname.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestorString.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/AsyncGetAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestorAttestorname.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestorString.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/AsyncGetPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicyPolicyname.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicyString.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/AsyncListAttestors.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/AsyncListAttestorsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestors.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestorsProjectname.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestorsString.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/AsyncUpdateAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/SyncUpdateAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/SyncUpdateAttestorAttestor.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/AsyncUpdatePolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/SyncUpdatePolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/SyncUpdatePolicyPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1settings/getpolicy/SyncGetPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/stub/binauthzmanagementservicev1beta1stubsettings/getpolicy/SyncGetPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/stub/systempolicyv1beta1stubsettings/getsystempolicy/SyncGetSystemPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/AsyncGetSystemPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicyPolicyname.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicyString.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1settings/getsystempolicy/SyncGetSystemPolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/AsyncCreateAttestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestorProjectnameStringResourcesattestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestorStringStringResourcesattestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/AsyncDeleteAttestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestorAttestorname.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestorString.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/AsyncGetAttestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestorAttestorname.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestorString.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/AsyncGetPolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicyPolicyname.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicyString.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/AsyncListAttestors.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/AsyncListAttestorsPaged.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestors.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestorsProjectname.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestorsString.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/AsyncUpdateAttestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/SyncUpdateAttestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/SyncUpdateAttestorResourcesattestor.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/AsyncUpdatePolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/SyncUpdatePolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/SyncUpdatePolicyResourcespolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1settings/getpolicy/SyncGetPolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/binauthzmanagementservicev1stubsettings/getpolicy/SyncGetPolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/systempolicyv1stubsettings/getsystempolicy/SyncGetSystemPolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/validationhelperv1stubsettings/validateattestationoccurrence/SyncValidateAttestationOccurrence.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/AsyncGetSystemPolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicyPolicyname.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicyString.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1settings/getsystempolicy/SyncGetSystemPolicy.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/validateattestationoccurrence/AsyncValidateAttestationOccurrence.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/validateattestationoccurrence/SyncValidateAttestationOccurrence.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1settings/validateattestationoccurrence/SyncValidateAttestationOccurrence.java diff --git a/proto-google-cloud-binary-authorization-v1beta1/src/main/java/com/google/cloud/binaryauthorization/v1beta1/ContinuousValidationEvent.java b/proto-google-cloud-binary-authorization-v1beta1/src/main/java/com/google/cloud/binaryauthorization/v1beta1/ContinuousValidationEvent.java index e3511994..4f694d1f 100644 --- a/proto-google-cloud-binary-authorization-v1beta1/src/main/java/com/google/cloud/binaryauthorization/v1beta1/ContinuousValidationEvent.java +++ b/proto-google-cloud-binary-authorization-v1beta1/src/main/java/com/google/cloud/binaryauthorization/v1beta1/ContinuousValidationEvent.java @@ -163,6 +163,31 @@ public interface ContinuousValidationPodEventOrBuilder // @@protoc_insertion_point(interface_extends:google.cloud.binaryauthorization.v1beta1.ContinuousValidationEvent.ContinuousValidationPodEvent) com.google.protobuf.MessageOrBuilder { + /** + * + * + *
+     * The k8s namespace of the Pod.
+     * 
+ * + * string pod_namespace = 7; + * + * @return The podNamespace. + */ + java.lang.String getPodNamespace(); + /** + * + * + *
+     * The k8s namespace of the Pod.
+     * 
+ * + * string pod_namespace = 7; + * + * @return The bytes for podNamespace. + */ + com.google.protobuf.ByteString getPodNamespaceBytes(); + /** * * @@ -384,6 +409,7 @@ private ContinuousValidationPodEvent( } private ContinuousValidationPodEvent() { + podNamespace_ = ""; pod_ = ""; verdict_ = 0; images_ = java.util.Collections.emptyList(); @@ -479,6 +505,13 @@ private ContinuousValidationPodEvent( extensionRegistry)); break; } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + + podNamespace_ = s; + break; + } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { @@ -1977,6 +2010,55 @@ public com.google.protobuf.Parser getParserForType() { } } + public static final int POD_NAMESPACE_FIELD_NUMBER = 7; + private volatile java.lang.Object podNamespace_; + /** + * + * + *
+     * The k8s namespace of the Pod.
+     * 
+ * + * string pod_namespace = 7; + * + * @return The podNamespace. + */ + @java.lang.Override + public java.lang.String getPodNamespace() { + java.lang.Object ref = podNamespace_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + podNamespace_ = s; + return s; + } + } + /** + * + * + *
+     * The k8s namespace of the Pod.
+     * 
+ * + * string pod_namespace = 7; + * + * @return The bytes for podNamespace. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPodNamespaceBytes() { + java.lang.Object ref = podNamespace_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + podNamespace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + public static final int POD_FIELD_NUMBER = 1; private volatile java.lang.Object pod_; /** @@ -2291,6 +2373,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < images_.size(); i++) { output.writeMessage(5, images_.get(i)); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(podNamespace_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, podNamespace_); + } unknownFields.writeTo(output); } @@ -2319,6 +2404,9 @@ public int getSerializedSize() { for (int i = 0; i < images_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, images_.get(i)); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(podNamespace_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, podNamespace_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -2342,6 +2430,7 @@ public boolean equals(final java.lang.Object obj) { .ContinuousValidationPodEvent) obj; + if (!getPodNamespace().equals(other.getPodNamespace())) return false; if (!getPod().equals(other.getPod())) return false; if (hasDeployTime() != other.hasDeployTime()) return false; if (hasDeployTime()) { @@ -2364,6 +2453,8 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + POD_NAMESPACE_FIELD_NUMBER; + hash = (53 * hash) + getPodNamespace().hashCode(); hash = (37 * hash) + POD_FIELD_NUMBER; hash = (53 * hash) + getPod().hashCode(); if (hasDeployTime()) { @@ -2555,6 +2646,8 @@ private void maybeForceBuilderInitialization() { @java.lang.Override public Builder clear() { super.clear(); + podNamespace_ = ""; + pod_ = ""; if (deployTimeBuilder_ == null) { @@ -2617,6 +2710,7 @@ public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { new com.google.cloud.binaryauthorization.v1beta1.ContinuousValidationEvent .ContinuousValidationPodEvent(this); int from_bitField0_ = bitField0_; + result.podNamespace_ = podNamespace_; result.pod_ = pod_; if (deployTimeBuilder_ == null) { result.deployTime_ = deployTime_; @@ -2700,6 +2794,10 @@ public Builder mergeFrom( if (other == com.google.cloud.binaryauthorization.v1beta1.ContinuousValidationEvent .ContinuousValidationPodEvent.getDefaultInstance()) return this; + if (!other.getPodNamespace().isEmpty()) { + podNamespace_ = other.podNamespace_; + onChanged(); + } if (!other.getPod().isEmpty()) { pod_ = other.pod_; onChanged(); @@ -2776,6 +2874,112 @@ public Builder mergeFrom( private int bitField0_; + private java.lang.Object podNamespace_ = ""; + /** + * + * + *
+       * The k8s namespace of the Pod.
+       * 
+ * + * string pod_namespace = 7; + * + * @return The podNamespace. + */ + public java.lang.String getPodNamespace() { + java.lang.Object ref = podNamespace_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + podNamespace_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The k8s namespace of the Pod.
+       * 
+ * + * string pod_namespace = 7; + * + * @return The bytes for podNamespace. + */ + public com.google.protobuf.ByteString getPodNamespaceBytes() { + java.lang.Object ref = podNamespace_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + podNamespace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The k8s namespace of the Pod.
+       * 
+ * + * string pod_namespace = 7; + * + * @param value The podNamespace to set. + * @return This builder for chaining. + */ + public Builder setPodNamespace(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + podNamespace_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The k8s namespace of the Pod.
+       * 
+ * + * string pod_namespace = 7; + * + * @return This builder for chaining. + */ + public Builder clearPodNamespace() { + + podNamespace_ = getDefaultInstance().getPodNamespace(); + onChanged(); + return this; + } + /** + * + * + *
+       * The k8s namespace of the Pod.
+       * 
+ * + * string pod_namespace = 7; + * + * @param value The bytes for podNamespace to set. + * @return This builder for chaining. + */ + public Builder setPodNamespaceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + podNamespace_ = value; + onChanged(); + return this; + } + private java.lang.Object pod_ = ""; /** * diff --git a/proto-google-cloud-binary-authorization-v1beta1/src/main/java/com/google/cloud/binaryauthorization/v1beta1/ContinuousValidationLoggingProto.java b/proto-google-cloud-binary-authorization-v1beta1/src/main/java/com/google/cloud/binaryauthorization/v1beta1/ContinuousValidationLoggingProto.java index 7d29c3d0..8c94cdeb 100644 --- a/proto-google-cloud-binary-authorization-v1beta1/src/main/java/com/google/cloud/binaryauthorization/v1beta1/ContinuousValidationLoggingProto.java +++ b/proto-google-cloud-binary-authorization-v1beta1/src/main/java/com/google/cloud/binaryauthorization/v1beta1/ContinuousValidationLoggingProto.java @@ -55,43 +55,43 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "\nLgoogle/cloud/binaryauthorization/v1bet" + "a1/continuous_validation_logging.proto\022(" + "google.cloud.binaryauthorization.v1beta1" - + "\032\037google/protobuf/timestamp.proto\"\310\010\n\031Co" + + "\032\037google/protobuf/timestamp.proto\"\337\010\n\031Co" + "ntinuousValidationEvent\022u\n\tpod_event\030\001 \001" + "(\0132`.google.cloud.binaryauthorization.v1" + "beta1.ContinuousValidationEvent.Continuo" + "usValidationPodEventH\000\022~\n\030unsupported_po" + "licy_event\030\002 \001(\0132Z.google.cloud.binaryau" + "thorization.v1beta1.ContinuousValidation" - + "Event.UnsupportedPolicyEventH\000\032\366\005\n\034Conti" - + "nuousValidationPodEvent\022\013\n\003pod\030\001 \001(\t\022/\n\013" - + "deploy_time\030\002 \001(\0132\032.google.protobuf.Time" - + "stamp\022,\n\010end_time\030\003 \001(\0132\032.google.protobu" - + "f.Timestamp\022\212\001\n\007verdict\030\004 \001(\0162y.google.c" - + "loud.binaryauthorization.v1beta1.Continu" - + "ousValidationEvent.ContinuousValidationP" - + "odEvent.PolicyConformanceVerdict\022}\n\006imag" - + "es\030\005 \003(\0132m.google.cloud.binaryauthorizat" - + "ion.v1beta1.ContinuousValidationEvent.Co" - + "ntinuousValidationPodEvent.ImageDetails\032" - + "\200\002\n\014ImageDetails\022\r\n\005image\030\001 \001(\t\022\211\001\n\006resu" - + "lt\030\002 \001(\0162y.google.cloud.binaryauthorizat" - + "ion.v1beta1.ContinuousValidationEvent.Co" - + "ntinuousValidationPodEvent.ImageDetails." - + "AuditResult\022\023\n\013description\030\003 \001(\t\"@\n\013Audi" - + "tResult\022\034\n\030AUDIT_RESULT_UNSPECIFIED\020\000\022\t\n" - + "\005ALLOW\020\001\022\010\n\004DENY\020\002\"[\n\030PolicyConformanceV" - + "erdict\022*\n&POLICY_CONFORMANCE_VERDICT_UNS" - + "PECIFIED\020\000\022\023\n\017VIOLATES_POLICY\020\001\032-\n\026Unsup" - + "portedPolicyEvent\022\023\n\013description\030\001 \001(\tB\014" - + "\n\nevent_typeB\266\002\n,com.google.cloud.binary" - + "authorization.v1beta1B ContinuousValidat" - + "ionLoggingProtoP\001Z[google.golang.org/gen" - + "proto/googleapis/cloud/binaryauthorizati" - + "on/v1beta1;binaryauthorization\370\001\001\252\002(Goog" - + "le.Cloud.BinaryAuthorization.V1Beta1\312\002(G" - + "oogle\\Cloud\\BinaryAuthorization\\V1beta1\352" - + "\002+Google::Cloud::BinaryAuthorization::V1" - + "beta1b\006proto3" + + "Event.UnsupportedPolicyEventH\000\032\215\006\n\034Conti" + + "nuousValidationPodEvent\022\025\n\rpod_namespace" + + "\030\007 \001(\t\022\013\n\003pod\030\001 \001(\t\022/\n\013deploy_time\030\002 \001(\013" + + "2\032.google.protobuf.Timestamp\022,\n\010end_time" + + "\030\003 \001(\0132\032.google.protobuf.Timestamp\022\212\001\n\007v" + + "erdict\030\004 \001(\0162y.google.cloud.binaryauthor" + + "ization.v1beta1.ContinuousValidationEven" + + "t.ContinuousValidationPodEvent.PolicyCon" + + "formanceVerdict\022}\n\006images\030\005 \003(\0132m.google" + + ".cloud.binaryauthorization.v1beta1.Conti" + + "nuousValidationEvent.ContinuousValidatio" + + "nPodEvent.ImageDetails\032\200\002\n\014ImageDetails\022" + + "\r\n\005image\030\001 \001(\t\022\211\001\n\006result\030\002 \001(\0162y.google" + + ".cloud.binaryauthorization.v1beta1.Conti" + + "nuousValidationEvent.ContinuousValidatio" + + "nPodEvent.ImageDetails.AuditResult\022\023\n\013de" + + "scription\030\003 \001(\t\"@\n\013AuditResult\022\034\n\030AUDIT_" + + "RESULT_UNSPECIFIED\020\000\022\t\n\005ALLOW\020\001\022\010\n\004DENY\020" + + "\002\"[\n\030PolicyConformanceVerdict\022*\n&POLICY_" + + "CONFORMANCE_VERDICT_UNSPECIFIED\020\000\022\023\n\017VIO" + + "LATES_POLICY\020\001\032-\n\026UnsupportedPolicyEvent" + + "\022\023\n\013description\030\001 \001(\tB\014\n\nevent_typeB\266\002\n," + + "com.google.cloud.binaryauthorization.v1b" + + "eta1B ContinuousValidationLoggingProtoP\001" + + "Z[google.golang.org/genproto/googleapis/" + + "cloud/binaryauthorization/v1beta1;binary" + + "authorization\370\001\001\252\002(Google.Cloud.BinaryAu" + + "thorization.V1Beta1\312\002(Google\\Cloud\\Binar" + + "yAuthorization\\V1beta1\352\002+Google::Cloud::" + + "BinaryAuthorization::V1beta1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -115,7 +115,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_binaryauthorization_v1beta1_ContinuousValidationEvent_ContinuousValidationPodEvent_descriptor, new java.lang.String[] { - "Pod", "DeployTime", "EndTime", "Verdict", "Images", + "PodNamespace", "Pod", "DeployTime", "EndTime", "Verdict", "Images", }); internal_static_google_cloud_binaryauthorization_v1beta1_ContinuousValidationEvent_ContinuousValidationPodEvent_ImageDetails_descriptor = internal_static_google_cloud_binaryauthorization_v1beta1_ContinuousValidationEvent_ContinuousValidationPodEvent_descriptor diff --git a/proto-google-cloud-binary-authorization-v1beta1/src/main/proto/google/cloud/binaryauthorization/v1beta1/continuous_validation_logging.proto b/proto-google-cloud-binary-authorization-v1beta1/src/main/proto/google/cloud/binaryauthorization/v1beta1/continuous_validation_logging.proto index 4f7bfdd8..1666b518 100644 --- a/proto-google-cloud-binary-authorization-v1beta1/src/main/proto/google/cloud/binaryauthorization/v1beta1/continuous_validation_logging.proto +++ b/proto-google-cloud-binary-authorization-v1beta1/src/main/proto/google/cloud/binaryauthorization/v1beta1/continuous_validation_logging.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,6 +31,15 @@ option ruby_package = "Google::Cloud::BinaryAuthorization::V1beta1"; message ContinuousValidationEvent { // An auditing event for one Pod. message ContinuousValidationPodEvent { + // Audit time policy conformance verdict. + enum PolicyConformanceVerdict { + // We should always have a verdict. This is an error. + POLICY_CONFORMANCE_VERDICT_UNSPECIFIED = 0; + + // The pod violates the policy. + VIOLATES_POLICY = 1; + } + // Container image with auditing details. message ImageDetails { // Result of the audit. @@ -55,14 +64,8 @@ message ContinuousValidationEvent { string description = 3; } - // Audit time policy conformance verdict. - enum PolicyConformanceVerdict { - // We should always have a verdict. This is an error. - POLICY_CONFORMANCE_VERDICT_UNSPECIFIED = 0; - - // The pod violates the policy. - VIOLATES_POLICY = 1; - } + // The k8s namespace of the Pod. + string pod_namespace = 7; // The name of the Pod. string pod = 1; diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..c133323f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Settings; +import com.google.cloud.binaryauthorization.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1Beta1Settings binauthzManagementServiceV1Beta1Settings = + BinauthzManagementServiceV1Beta1Settings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create(binauthzManagementServiceV1Beta1Settings); + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..6148caad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_create_setendpoint_sync] +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Settings; +import com.google.cloud.binaryauthorization.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1Beta1Settings binauthzManagementServiceV1Beta1Settings = + BinauthzManagementServiceV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build(); + BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create(binauthzManagementServiceV1Beta1Settings); + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/AsyncCreateAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/AsyncCreateAttestor.java new file mode 100644 index 00000000..fe2c587f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/AsyncCreateAttestor.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_createattestor_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.CreateAttestorRequest; +import com.google.cloud.binaryauthorization.v1beta1.ProjectName; + +public class AsyncCreateAttestor { + + public static void main(String[] args) throws Exception { + asyncCreateAttestor(); + } + + public static void asyncCreateAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + CreateAttestorRequest request = + CreateAttestorRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setAttestorId("attestorId2055733027") + .setAttestor(Attestor.newBuilder().build()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Beta1Client.createAttestorCallable().futureCall(request); + // Do something. + Attestor response = future.get(); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_createattestor_async] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestor.java new file mode 100644 index 00000000..02c3d407 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestor.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_createattestor_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.CreateAttestorRequest; +import com.google.cloud.binaryauthorization.v1beta1.ProjectName; + +public class SyncCreateAttestor { + + public static void main(String[] args) throws Exception { + syncCreateAttestor(); + } + + public static void syncCreateAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + CreateAttestorRequest request = + CreateAttestorRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setAttestorId("attestorId2055733027") + .setAttestor(Attestor.newBuilder().build()) + .build(); + Attestor response = binauthzManagementServiceV1Beta1Client.createAttestor(request); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_createattestor_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestorProjectnameStringAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestorProjectnameStringAttestor.java new file mode 100644 index 00000000..e912579e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestorProjectnameStringAttestor.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_createattestor_projectnamestringattestor_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.ProjectName; + +public class SyncCreateAttestorProjectnameStringAttestor { + + public static void main(String[] args) throws Exception { + syncCreateAttestorProjectnameStringAttestor(); + } + + public static void syncCreateAttestorProjectnameStringAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + String attestorId = "attestorId2055733027"; + Attestor attestor = Attestor.newBuilder().build(); + Attestor response = + binauthzManagementServiceV1Beta1Client.createAttestor(parent, attestorId, attestor); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_createattestor_projectnamestringattestor_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestorStringStringAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestorStringStringAttestor.java new file mode 100644 index 00000000..7bb91110 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/createattestor/SyncCreateAttestorStringStringAttestor.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_createattestor_stringstringattestor_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.ProjectName; + +public class SyncCreateAttestorStringStringAttestor { + + public static void main(String[] args) throws Exception { + syncCreateAttestorStringStringAttestor(); + } + + public static void syncCreateAttestorStringStringAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + String attestorId = "attestorId2055733027"; + Attestor attestor = Attestor.newBuilder().build(); + Attestor response = + binauthzManagementServiceV1Beta1Client.createAttestor(parent, attestorId, attestor); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_createattestor_stringstringattestor_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/AsyncDeleteAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/AsyncDeleteAttestor.java new file mode 100644 index 00000000..57e6a728 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/AsyncDeleteAttestor.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_deleteattestor_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.binaryauthorization.v1beta1.AttestorName; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.DeleteAttestorRequest; +import com.google.protobuf.Empty; + +public class AsyncDeleteAttestor { + + public static void main(String[] args) throws Exception { + asyncDeleteAttestor(); + } + + public static void asyncDeleteAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + DeleteAttestorRequest request = + DeleteAttestorRequest.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Beta1Client.deleteAttestorCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_deleteattestor_async] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestor.java new file mode 100644 index 00000000..e98a4da2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestor.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_deleteattestor_sync] +import com.google.cloud.binaryauthorization.v1beta1.AttestorName; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.DeleteAttestorRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteAttestor { + + public static void main(String[] args) throws Exception { + syncDeleteAttestor(); + } + + public static void syncDeleteAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + DeleteAttestorRequest request = + DeleteAttestorRequest.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .build(); + binauthzManagementServiceV1Beta1Client.deleteAttestor(request); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_deleteattestor_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestorAttestorname.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestorAttestorname.java new file mode 100644 index 00000000..8797a77d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestorAttestorname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_deleteattestor_attestorname_sync] +import com.google.cloud.binaryauthorization.v1beta1.AttestorName; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.protobuf.Empty; + +public class SyncDeleteAttestorAttestorname { + + public static void main(String[] args) throws Exception { + syncDeleteAttestorAttestorname(); + } + + public static void syncDeleteAttestorAttestorname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + binauthzManagementServiceV1Beta1Client.deleteAttestor(name); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_deleteattestor_attestorname_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestorString.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestorString.java new file mode 100644 index 00000000..e5cee1e2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/deleteattestor/SyncDeleteAttestorString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_deleteattestor_string_sync] +import com.google.cloud.binaryauthorization.v1beta1.AttestorName; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.protobuf.Empty; + +public class SyncDeleteAttestorString { + + public static void main(String[] args) throws Exception { + syncDeleteAttestorString(); + } + + public static void syncDeleteAttestorString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + String name = AttestorName.of("[PROJECT]", "[ATTESTOR]").toString(); + binauthzManagementServiceV1Beta1Client.deleteAttestor(name); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_deleteattestor_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/AsyncGetAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/AsyncGetAttestor.java new file mode 100644 index 00000000..709b38ca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/AsyncGetAttestor.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getattestor_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.AttestorName; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.GetAttestorRequest; + +public class AsyncGetAttestor { + + public static void main(String[] args) throws Exception { + asyncGetAttestor(); + } + + public static void asyncGetAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + GetAttestorRequest request = + GetAttestorRequest.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Beta1Client.getAttestorCallable().futureCall(request); + // Do something. + Attestor response = future.get(); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getattestor_async] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestor.java new file mode 100644 index 00000000..55a763a7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestor.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getattestor_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.AttestorName; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.GetAttestorRequest; + +public class SyncGetAttestor { + + public static void main(String[] args) throws Exception { + syncGetAttestor(); + } + + public static void syncGetAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + GetAttestorRequest request = + GetAttestorRequest.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .build(); + Attestor response = binauthzManagementServiceV1Beta1Client.getAttestor(request); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getattestor_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestorAttestorname.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestorAttestorname.java new file mode 100644 index 00000000..c120c374 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestorAttestorname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getattestor_attestorname_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.AttestorName; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; + +public class SyncGetAttestorAttestorname { + + public static void main(String[] args) throws Exception { + syncGetAttestorAttestorname(); + } + + public static void syncGetAttestorAttestorname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + Attestor response = binauthzManagementServiceV1Beta1Client.getAttestor(name); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getattestor_attestorname_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestorString.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestorString.java new file mode 100644 index 00000000..b0a4417a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getattestor/SyncGetAttestorString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getattestor_string_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.AttestorName; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; + +public class SyncGetAttestorString { + + public static void main(String[] args) throws Exception { + syncGetAttestorString(); + } + + public static void syncGetAttestorString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + String name = AttestorName.of("[PROJECT]", "[ATTESTOR]").toString(); + Attestor response = binauthzManagementServiceV1Beta1Client.getAttestor(name); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getattestor_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/AsyncGetPolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/AsyncGetPolicy.java new file mode 100644 index 00000000..bccfea74 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/AsyncGetPolicy.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getpolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.GetPolicyRequest; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.PolicyName; + +public class AsyncGetPolicy { + + public static void main(String[] args) throws Exception { + asyncGetPolicy(); + } + + public static void asyncGetPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + GetPolicyRequest request = + GetPolicyRequest.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Beta1Client.getPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getpolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicy.java new file mode 100644 index 00000000..8aad9831 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicy.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getpolicy_sync] +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.GetPolicyRequest; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.PolicyName; + +public class SyncGetPolicy { + + public static void main(String[] args) throws Exception { + syncGetPolicy(); + } + + public static void syncGetPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + GetPolicyRequest request = + GetPolicyRequest.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .build(); + Policy response = binauthzManagementServiceV1Beta1Client.getPolicy(request); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicyPolicyname.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicyPolicyname.java new file mode 100644 index 00000000..57c31c38 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicyPolicyname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getpolicy_policyname_sync] +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.PolicyName; + +public class SyncGetPolicyPolicyname { + + public static void main(String[] args) throws Exception { + syncGetPolicyPolicyname(); + } + + public static void syncGetPolicyPolicyname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + Policy response = binauthzManagementServiceV1Beta1Client.getPolicy(name); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getpolicy_policyname_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicyString.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicyString.java new file mode 100644 index 00000000..9485d66d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/getpolicy/SyncGetPolicyString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getpolicy_string_sync] +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.PolicyName; + +public class SyncGetPolicyString { + + public static void main(String[] args) throws Exception { + syncGetPolicyString(); + } + + public static void syncGetPolicyString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + String name = PolicyName.ofProjectName("[PROJECT]").toString(); + Policy response = binauthzManagementServiceV1Beta1Client.getPolicy(name); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_getpolicy_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/AsyncListAttestors.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/AsyncListAttestors.java new file mode 100644 index 00000000..84f78f98 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/AsyncListAttestors.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.ListAttestorsRequest; +import com.google.cloud.binaryauthorization.v1beta1.ProjectName; + +public class AsyncListAttestors { + + public static void main(String[] args) throws Exception { + asyncListAttestors(); + } + + public static void asyncListAttestors() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + ListAttestorsRequest request = + ListAttestorsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + binauthzManagementServiceV1Beta1Client.listAttestorsPagedCallable().futureCall(request); + // Do something. + for (Attestor element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_async] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/AsyncListAttestorsPaged.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/AsyncListAttestorsPaged.java new file mode 100644 index 00000000..3539418f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/AsyncListAttestorsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_paged_async] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.ListAttestorsRequest; +import com.google.cloud.binaryauthorization.v1beta1.ListAttestorsResponse; +import com.google.cloud.binaryauthorization.v1beta1.ProjectName; +import com.google.common.base.Strings; + +public class AsyncListAttestorsPaged { + + public static void main(String[] args) throws Exception { + asyncListAttestorsPaged(); + } + + public static void asyncListAttestorsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + ListAttestorsRequest request = + ListAttestorsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListAttestorsResponse response = + binauthzManagementServiceV1Beta1Client.listAttestorsCallable().call(request); + for (Attestor element : response.getAttestorsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestors.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestors.java new file mode 100644 index 00000000..c3d0466d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestors.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.ListAttestorsRequest; +import com.google.cloud.binaryauthorization.v1beta1.ProjectName; + +public class SyncListAttestors { + + public static void main(String[] args) throws Exception { + syncListAttestors(); + } + + public static void syncListAttestors() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + ListAttestorsRequest request = + ListAttestorsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Attestor element : + binauthzManagementServiceV1Beta1Client.listAttestors(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestorsProjectname.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestorsProjectname.java new file mode 100644 index 00000000..4cce9cc4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestorsProjectname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_projectname_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.ProjectName; + +public class SyncListAttestorsProjectname { + + public static void main(String[] args) throws Exception { + syncListAttestorsProjectname(); + } + + public static void syncListAttestorsProjectname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (Attestor element : + binauthzManagementServiceV1Beta1Client.listAttestors(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_projectname_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestorsString.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestorsString.java new file mode 100644 index 00000000..843f2e63 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/listattestors/SyncListAttestorsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_string_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.ProjectName; + +public class SyncListAttestorsString { + + public static void main(String[] args) throws Exception { + syncListAttestorsString(); + } + + public static void syncListAttestorsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + for (Attestor element : + binauthzManagementServiceV1Beta1Client.listAttestors(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_listattestors_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/AsyncUpdateAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/AsyncUpdateAttestor.java new file mode 100644 index 00000000..4386ed51 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/AsyncUpdateAttestor.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updateattestor_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.UpdateAttestorRequest; + +public class AsyncUpdateAttestor { + + public static void main(String[] args) throws Exception { + asyncUpdateAttestor(); + } + + public static void asyncUpdateAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + UpdateAttestorRequest request = + UpdateAttestorRequest.newBuilder().setAttestor(Attestor.newBuilder().build()).build(); + ApiFuture future = + binauthzManagementServiceV1Beta1Client.updateAttestorCallable().futureCall(request); + // Do something. + Attestor response = future.get(); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updateattestor_async] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/SyncUpdateAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/SyncUpdateAttestor.java new file mode 100644 index 00000000..7e98ef5d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/SyncUpdateAttestor.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updateattestor_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.UpdateAttestorRequest; + +public class SyncUpdateAttestor { + + public static void main(String[] args) throws Exception { + syncUpdateAttestor(); + } + + public static void syncUpdateAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + UpdateAttestorRequest request = + UpdateAttestorRequest.newBuilder().setAttestor(Attestor.newBuilder().build()).build(); + Attestor response = binauthzManagementServiceV1Beta1Client.updateAttestor(request); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updateattestor_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/SyncUpdateAttestorAttestor.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/SyncUpdateAttestorAttestor.java new file mode 100644 index 00000000..ab2c58f3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updateattestor/SyncUpdateAttestorAttestor.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updateattestor_attestor_sync] +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; + +public class SyncUpdateAttestorAttestor { + + public static void main(String[] args) throws Exception { + syncUpdateAttestorAttestor(); + } + + public static void syncUpdateAttestorAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + Attestor attestor = Attestor.newBuilder().build(); + Attestor response = binauthzManagementServiceV1Beta1Client.updateAttestor(attestor); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updateattestor_attestor_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/AsyncUpdatePolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/AsyncUpdatePolicy.java new file mode 100644 index 00000000..4a95a964 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/AsyncUpdatePolicy.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updatepolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.UpdatePolicyRequest; + +public class AsyncUpdatePolicy { + + public static void main(String[] args) throws Exception { + asyncUpdatePolicy(); + } + + public static void asyncUpdatePolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + UpdatePolicyRequest request = + UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build(); + ApiFuture future = + binauthzManagementServiceV1Beta1Client.updatePolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updatepolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/SyncUpdatePolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/SyncUpdatePolicy.java new file mode 100644 index 00000000..36447e06 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/SyncUpdatePolicy.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updatepolicy_sync] +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.UpdatePolicyRequest; + +public class SyncUpdatePolicy { + + public static void main(String[] args) throws Exception { + syncUpdatePolicy(); + } + + public static void syncUpdatePolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + UpdatePolicyRequest request = + UpdatePolicyRequest.newBuilder().setPolicy(Policy.newBuilder().build()).build(); + Policy response = binauthzManagementServiceV1Beta1Client.updatePolicy(request); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updatepolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/SyncUpdatePolicyPolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/SyncUpdatePolicyPolicy.java new file mode 100644 index 00000000..6afce8dc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/updatepolicy/SyncUpdatePolicyPolicy.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updatepolicy_policy_sync] +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.Policy; + +public class SyncUpdatePolicyPolicy { + + public static void main(String[] args) throws Exception { + syncUpdatePolicyPolicy(); + } + + public static void syncUpdatePolicyPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create()) { + Policy policy = Policy.newBuilder().build(); + Policy response = binauthzManagementServiceV1Beta1Client.updatePolicy(policy); + } + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_updatepolicy_policy_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1settings/getpolicy/SyncGetPolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1settings/getpolicy/SyncGetPolicy.java new file mode 100644 index 00000000..5a0305e6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1settings/getpolicy/SyncGetPolicy.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1settings_getpolicy_sync] +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Settings; +import java.time.Duration; + +public class SyncGetPolicy { + + public static void main(String[] args) throws Exception { + syncGetPolicy(); + } + + public static void syncGetPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1Beta1Settings.Builder + binauthzManagementServiceV1Beta1SettingsBuilder = + BinauthzManagementServiceV1Beta1Settings.newBuilder(); + binauthzManagementServiceV1Beta1SettingsBuilder + .getPolicySettings() + .setRetrySettings( + binauthzManagementServiceV1Beta1SettingsBuilder + .getPolicySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + BinauthzManagementServiceV1Beta1Settings binauthzManagementServiceV1Beta1Settings = + binauthzManagementServiceV1Beta1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1settings_getpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/stub/binauthzmanagementservicev1beta1stubsettings/getpolicy/SyncGetPolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/stub/binauthzmanagementservicev1beta1stubsettings/getpolicy/SyncGetPolicy.java new file mode 100644 index 00000000..1d32c2b4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/stub/binauthzmanagementservicev1beta1stubsettings/getpolicy/SyncGetPolicy.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.stub.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1stubsettings_getpolicy_sync] +import com.google.cloud.binaryauthorization.v1beta1.stub.BinauthzManagementServiceV1Beta1StubSettings; +import java.time.Duration; + +public class SyncGetPolicy { + + public static void main(String[] args) throws Exception { + syncGetPolicy(); + } + + public static void syncGetPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1Beta1StubSettings.Builder + binauthzManagementServiceV1Beta1SettingsBuilder = + BinauthzManagementServiceV1Beta1StubSettings.newBuilder(); + binauthzManagementServiceV1Beta1SettingsBuilder + .getPolicySettings() + .setRetrySettings( + binauthzManagementServiceV1Beta1SettingsBuilder + .getPolicySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + BinauthzManagementServiceV1Beta1StubSettings binauthzManagementServiceV1Beta1Settings = + binauthzManagementServiceV1Beta1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1stubsettings_getpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/stub/systempolicyv1beta1stubsettings/getsystempolicy/SyncGetSystemPolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/stub/systempolicyv1beta1stubsettings/getsystempolicy/SyncGetSystemPolicy.java new file mode 100644 index 00000000..2135225b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/stub/systempolicyv1beta1stubsettings/getsystempolicy/SyncGetSystemPolicy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.stub.samples; + +// [START binaryauthorization_v1beta1_generated_systempolicyv1beta1stubsettings_getsystempolicy_sync] +import com.google.cloud.binaryauthorization.v1beta1.stub.SystemPolicyV1Beta1StubSettings; +import java.time.Duration; + +public class SyncGetSystemPolicy { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicy(); + } + + public static void syncGetSystemPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1Beta1StubSettings.Builder systemPolicyV1Beta1SettingsBuilder = + SystemPolicyV1Beta1StubSettings.newBuilder(); + systemPolicyV1Beta1SettingsBuilder + .getSystemPolicySettings() + .setRetrySettings( + systemPolicyV1Beta1SettingsBuilder + .getSystemPolicySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SystemPolicyV1Beta1StubSettings systemPolicyV1Beta1Settings = + systemPolicyV1Beta1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1beta1_generated_systempolicyv1beta1stubsettings_getsystempolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..dda6b1b3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_systempolicyv1beta1client_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Settings; +import com.google.cloud.binaryauthorization.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1Beta1Settings systemPolicyV1Beta1Settings = + SystemPolicyV1Beta1Settings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = + SystemPolicyV1Beta1Client.create(systemPolicyV1Beta1Settings); + } +} +// [END binaryauthorization_v1beta1_generated_systempolicyv1beta1client_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..e4061a8d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_systempolicyv1beta1client_create_setendpoint_sync] +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Settings; +import com.google.cloud.binaryauthorization.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1Beta1Settings systemPolicyV1Beta1Settings = + SystemPolicyV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build(); + SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = + SystemPolicyV1Beta1Client.create(systemPolicyV1Beta1Settings); + } +} +// [END binaryauthorization_v1beta1_generated_systempolicyv1beta1client_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/AsyncGetSystemPolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/AsyncGetSystemPolicy.java new file mode 100644 index 00000000..6a38cc92 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/AsyncGetSystemPolicy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_systempolicyv1beta1client_getsystempolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.binaryauthorization.v1beta1.GetSystemPolicyRequest; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.PolicyName; +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Client; + +public class AsyncGetSystemPolicy { + + public static void main(String[] args) throws Exception { + asyncGetSystemPolicy(); + } + + public static void asyncGetSystemPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.create()) { + GetSystemPolicyRequest request = + GetSystemPolicyRequest.newBuilder() + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) + .build(); + ApiFuture future = + systemPolicyV1Beta1Client.getSystemPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END binaryauthorization_v1beta1_generated_systempolicyv1beta1client_getsystempolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicy.java new file mode 100644 index 00000000..738cb1d2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicy.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_systempolicyv1beta1client_getsystempolicy_sync] +import com.google.cloud.binaryauthorization.v1beta1.GetSystemPolicyRequest; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.PolicyName; +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Client; + +public class SyncGetSystemPolicy { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicy(); + } + + public static void syncGetSystemPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.create()) { + GetSystemPolicyRequest request = + GetSystemPolicyRequest.newBuilder() + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) + .build(); + Policy response = systemPolicyV1Beta1Client.getSystemPolicy(request); + } + } +} +// [END binaryauthorization_v1beta1_generated_systempolicyv1beta1client_getsystempolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicyPolicyname.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicyPolicyname.java new file mode 100644 index 00000000..d9f74fd5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicyPolicyname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_systempolicyv1beta1client_getsystempolicy_policyname_sync] +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.PolicyName; +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Client; + +public class SyncGetSystemPolicyPolicyname { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicyPolicyname(); + } + + public static void syncGetSystemPolicyPolicyname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.create()) { + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); + Policy response = systemPolicyV1Beta1Client.getSystemPolicy(name); + } + } +} +// [END binaryauthorization_v1beta1_generated_systempolicyv1beta1client_getsystempolicy_policyname_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicyString.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicyString.java new file mode 100644 index 00000000..8732b004 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/getsystempolicy/SyncGetSystemPolicyString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_systempolicyv1beta1client_getsystempolicy_string_sync] +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.PolicyName; +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Client; + +public class SyncGetSystemPolicyString { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicyString(); + } + + public static void syncGetSystemPolicyString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = SystemPolicyV1Beta1Client.create()) { + String name = PolicyName.ofProjectName("[PROJECT]").toString(); + Policy response = systemPolicyV1Beta1Client.getSystemPolicy(name); + } + } +} +// [END binaryauthorization_v1beta1_generated_systempolicyv1beta1client_getsystempolicy_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1settings/getsystempolicy/SyncGetSystemPolicy.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1settings/getsystempolicy/SyncGetSystemPolicy.java new file mode 100644 index 00000000..b906e114 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1settings/getsystempolicy/SyncGetSystemPolicy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_systempolicyv1beta1settings_getsystempolicy_sync] +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Settings; +import java.time.Duration; + +public class SyncGetSystemPolicy { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicy(); + } + + public static void syncGetSystemPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1Beta1Settings.Builder systemPolicyV1Beta1SettingsBuilder = + SystemPolicyV1Beta1Settings.newBuilder(); + systemPolicyV1Beta1SettingsBuilder + .getSystemPolicySettings() + .setRetrySettings( + systemPolicyV1Beta1SettingsBuilder + .getSystemPolicySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SystemPolicyV1Beta1Settings systemPolicyV1Beta1Settings = + systemPolicyV1Beta1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1beta1_generated_systempolicyv1beta1settings_getsystempolicy_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..1765407d --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Settings; +import com.google.protos.google.cloud.binaryauthorization.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1Settings binauthzManagementServiceV1Settings = + BinauthzManagementServiceV1Settings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create(binauthzManagementServiceV1Settings); + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..e2b5d11f --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_create_setendpoint_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Settings; +import com.google.protos.google.cloud.binaryauthorization.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1Settings binauthzManagementServiceV1Settings = + BinauthzManagementServiceV1Settings.newBuilder().setEndpoint(myEndpoint).build(); + BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create(binauthzManagementServiceV1Settings); + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/AsyncCreateAttestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/AsyncCreateAttestor.java new file mode 100644 index 00000000..5029b0d7 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/AsyncCreateAttestor.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_createattestor_async] +import com.google.api.core.ApiFuture; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ProjectName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class AsyncCreateAttestor { + + public static void main(String[] args) throws Exception { + asyncCreateAttestor(); + } + + public static void asyncCreateAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.CreateAttestorRequest request = + Service.CreateAttestorRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setAttestorId("attestorId2055733027") + .setAttestor(Resources.Attestor.newBuilder().build()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Client.createAttestorCallable().futureCall(request); + // Do something. + Resources.Attestor response = future.get(); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_createattestor_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestor.java new file mode 100644 index 00000000..efbc973b --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestor.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_createattestor_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ProjectName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class SyncCreateAttestor { + + public static void main(String[] args) throws Exception { + syncCreateAttestor(); + } + + public static void syncCreateAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.CreateAttestorRequest request = + Service.CreateAttestorRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setAttestorId("attestorId2055733027") + .setAttestor(Resources.Attestor.newBuilder().build()) + .build(); + Resources.Attestor response = binauthzManagementServiceV1Client.createAttestor(request); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_createattestor_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestorProjectnameStringResourcesattestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestorProjectnameStringResourcesattestor.java new file mode 100644 index 00000000..6715ecc8 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestorProjectnameStringResourcesattestor.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_createattestor_projectnamestringresourcesattestor_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ProjectName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncCreateAttestorProjectnameStringResourcesattestor { + + public static void main(String[] args) throws Exception { + syncCreateAttestorProjectnameStringResourcesattestor(); + } + + public static void syncCreateAttestorProjectnameStringResourcesattestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + String attestorId = "attestorId2055733027"; + Resources.Attestor attestor = Resources.Attestor.newBuilder().build(); + Resources.Attestor response = + binauthzManagementServiceV1Client.createAttestor(parent, attestorId, attestor); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_createattestor_projectnamestringresourcesattestor_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestorStringStringResourcesattestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestorStringStringResourcesattestor.java new file mode 100644 index 00000000..8b4ce8e0 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/createattestor/SyncCreateAttestorStringStringResourcesattestor.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_createattestor_stringstringresourcesattestor_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ProjectName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncCreateAttestorStringStringResourcesattestor { + + public static void main(String[] args) throws Exception { + syncCreateAttestorStringStringResourcesattestor(); + } + + public static void syncCreateAttestorStringStringResourcesattestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + String attestorId = "attestorId2055733027"; + Resources.Attestor attestor = Resources.Attestor.newBuilder().build(); + Resources.Attestor response = + binauthzManagementServiceV1Client.createAttestor(parent, attestorId, attestor); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_createattestor_stringstringresourcesattestor_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/AsyncDeleteAttestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/AsyncDeleteAttestor.java new file mode 100644 index 00000000..e5e63a9b --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/AsyncDeleteAttestor.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_deleteattestor_async] +import com.google.api.core.ApiFuture; +import com.google.protobuf.Empty; +import com.google.protos.google.cloud.binaryauthorization.v1.AttestorName; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class AsyncDeleteAttestor { + + public static void main(String[] args) throws Exception { + asyncDeleteAttestor(); + } + + public static void asyncDeleteAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.DeleteAttestorRequest request = + Service.DeleteAttestorRequest.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Client.deleteAttestorCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_deleteattestor_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestor.java new file mode 100644 index 00000000..2d3578b9 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestor.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_deleteattestor_sync] +import com.google.protobuf.Empty; +import com.google.protos.google.cloud.binaryauthorization.v1.AttestorName; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class SyncDeleteAttestor { + + public static void main(String[] args) throws Exception { + syncDeleteAttestor(); + } + + public static void syncDeleteAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.DeleteAttestorRequest request = + Service.DeleteAttestorRequest.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .build(); + binauthzManagementServiceV1Client.deleteAttestor(request); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_deleteattestor_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestorAttestorname.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestorAttestorname.java new file mode 100644 index 00000000..b93043cc --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestorAttestorname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_deleteattestor_attestorname_sync] +import com.google.protobuf.Empty; +import com.google.protos.google.cloud.binaryauthorization.v1.AttestorName; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; + +public class SyncDeleteAttestorAttestorname { + + public static void main(String[] args) throws Exception { + syncDeleteAttestorAttestorname(); + } + + public static void syncDeleteAttestorAttestorname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + binauthzManagementServiceV1Client.deleteAttestor(name); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_deleteattestor_attestorname_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestorString.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestorString.java new file mode 100644 index 00000000..ce17ef3f --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/deleteattestor/SyncDeleteAttestorString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_deleteattestor_string_sync] +import com.google.protobuf.Empty; +import com.google.protos.google.cloud.binaryauthorization.v1.AttestorName; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; + +public class SyncDeleteAttestorString { + + public static void main(String[] args) throws Exception { + syncDeleteAttestorString(); + } + + public static void syncDeleteAttestorString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + String name = AttestorName.of("[PROJECT]", "[ATTESTOR]").toString(); + binauthzManagementServiceV1Client.deleteAttestor(name); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_deleteattestor_string_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/AsyncGetAttestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/AsyncGetAttestor.java new file mode 100644 index 00000000..cdf2a792 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/AsyncGetAttestor.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_getattestor_async] +import com.google.api.core.ApiFuture; +import com.google.protos.google.cloud.binaryauthorization.v1.AttestorName; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class AsyncGetAttestor { + + public static void main(String[] args) throws Exception { + asyncGetAttestor(); + } + + public static void asyncGetAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.GetAttestorRequest request = + Service.GetAttestorRequest.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Client.getAttestorCallable().futureCall(request); + // Do something. + Resources.Attestor response = future.get(); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_getattestor_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestor.java new file mode 100644 index 00000000..f3f8d332 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestor.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_getattestor_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.AttestorName; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class SyncGetAttestor { + + public static void main(String[] args) throws Exception { + syncGetAttestor(); + } + + public static void syncGetAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.GetAttestorRequest request = + Service.GetAttestorRequest.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .build(); + Resources.Attestor response = binauthzManagementServiceV1Client.getAttestor(request); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_getattestor_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestorAttestorname.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestorAttestorname.java new file mode 100644 index 00000000..b27bef94 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestorAttestorname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_getattestor_attestorname_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.AttestorName; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncGetAttestorAttestorname { + + public static void main(String[] args) throws Exception { + syncGetAttestorAttestorname(); + } + + public static void syncGetAttestorAttestorname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + Resources.Attestor response = binauthzManagementServiceV1Client.getAttestor(name); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_getattestor_attestorname_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestorString.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestorString.java new file mode 100644 index 00000000..35d8b2c4 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getattestor/SyncGetAttestorString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_getattestor_string_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.AttestorName; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncGetAttestorString { + + public static void main(String[] args) throws Exception { + syncGetAttestorString(); + } + + public static void syncGetAttestorString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + String name = AttestorName.of("[PROJECT]", "[ATTESTOR]").toString(); + Resources.Attestor response = binauthzManagementServiceV1Client.getAttestor(name); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_getattestor_string_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/AsyncGetPolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/AsyncGetPolicy.java new file mode 100644 index 00000000..6859b9c4 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/AsyncGetPolicy.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_getpolicy_async] +import com.google.api.core.ApiFuture; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.PolicyName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class AsyncGetPolicy { + + public static void main(String[] args) throws Exception { + asyncGetPolicy(); + } + + public static void asyncGetPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.GetPolicyRequest request = + Service.GetPolicyRequest.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Client.getPolicyCallable().futureCall(request); + // Do something. + Resources.Policy response = future.get(); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_getpolicy_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicy.java new file mode 100644 index 00000000..ed902a51 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicy.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_getpolicy_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.PolicyName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class SyncGetPolicy { + + public static void main(String[] args) throws Exception { + syncGetPolicy(); + } + + public static void syncGetPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.GetPolicyRequest request = + Service.GetPolicyRequest.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .build(); + Resources.Policy response = binauthzManagementServiceV1Client.getPolicy(request); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_getpolicy_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicyPolicyname.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicyPolicyname.java new file mode 100644 index 00000000..09157171 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicyPolicyname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_getpolicy_policyname_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.PolicyName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncGetPolicyPolicyname { + + public static void main(String[] args) throws Exception { + syncGetPolicyPolicyname(); + } + + public static void syncGetPolicyPolicyname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + Resources.Policy response = binauthzManagementServiceV1Client.getPolicy(name); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_getpolicy_policyname_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicyString.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicyString.java new file mode 100644 index 00000000..f4e2634e --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/getpolicy/SyncGetPolicyString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_getpolicy_string_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.PolicyName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncGetPolicyString { + + public static void main(String[] args) throws Exception { + syncGetPolicyString(); + } + + public static void syncGetPolicyString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + String name = PolicyName.ofProjectName("[PROJECT]").toString(); + Resources.Policy response = binauthzManagementServiceV1Client.getPolicy(name); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_getpolicy_string_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/AsyncListAttestors.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/AsyncListAttestors.java new file mode 100644 index 00000000..63686ef4 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/AsyncListAttestors.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_async] +import com.google.api.core.ApiFuture; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ProjectName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class AsyncListAttestors { + + public static void main(String[] args) throws Exception { + asyncListAttestors(); + } + + public static void asyncListAttestors() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.ListAttestorsRequest request = + Service.ListAttestorsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + binauthzManagementServiceV1Client.listAttestorsPagedCallable().futureCall(request); + // Do something. + for (Resources.Attestor element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/AsyncListAttestorsPaged.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/AsyncListAttestorsPaged.java new file mode 100644 index 00000000..c5969466 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/AsyncListAttestorsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_paged_async] +import com.google.common.base.Strings; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ProjectName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class AsyncListAttestorsPaged { + + public static void main(String[] args) throws Exception { + asyncListAttestorsPaged(); + } + + public static void asyncListAttestorsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.ListAttestorsRequest request = + Service.ListAttestorsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + Service.ListAttestorsResponse response = + binauthzManagementServiceV1Client.listAttestorsCallable().call(request); + for (Resources.Attestor element : response.getAttestorsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_paged_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestors.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestors.java new file mode 100644 index 00000000..dd43c170 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestors.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ProjectName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class SyncListAttestors { + + public static void main(String[] args) throws Exception { + syncListAttestors(); + } + + public static void syncListAttestors() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.ListAttestorsRequest request = + Service.ListAttestorsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Resources.Attestor element : + binauthzManagementServiceV1Client.listAttestors(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestorsProjectname.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestorsProjectname.java new file mode 100644 index 00000000..15050638 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestorsProjectname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_projectname_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ProjectName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncListAttestorsProjectname { + + public static void main(String[] args) throws Exception { + syncListAttestorsProjectname(); + } + + public static void syncListAttestorsProjectname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (Resources.Attestor element : + binauthzManagementServiceV1Client.listAttestors(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_projectname_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestorsString.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestorsString.java new file mode 100644 index 00000000..808f6f71 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/listattestors/SyncListAttestorsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_string_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ProjectName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncListAttestorsString { + + public static void main(String[] args) throws Exception { + syncListAttestorsString(); + } + + public static void syncListAttestorsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + for (Resources.Attestor element : + binauthzManagementServiceV1Client.listAttestors(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_listattestors_string_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/AsyncUpdateAttestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/AsyncUpdateAttestor.java new file mode 100644 index 00000000..3758acf9 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/AsyncUpdateAttestor.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_updateattestor_async] +import com.google.api.core.ApiFuture; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class AsyncUpdateAttestor { + + public static void main(String[] args) throws Exception { + asyncUpdateAttestor(); + } + + public static void asyncUpdateAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.UpdateAttestorRequest request = + Service.UpdateAttestorRequest.newBuilder() + .setAttestor(Resources.Attestor.newBuilder().build()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Client.updateAttestorCallable().futureCall(request); + // Do something. + Resources.Attestor response = future.get(); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_updateattestor_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/SyncUpdateAttestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/SyncUpdateAttestor.java new file mode 100644 index 00000000..6dbc7752 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/SyncUpdateAttestor.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_updateattestor_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class SyncUpdateAttestor { + + public static void main(String[] args) throws Exception { + syncUpdateAttestor(); + } + + public static void syncUpdateAttestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.UpdateAttestorRequest request = + Service.UpdateAttestorRequest.newBuilder() + .setAttestor(Resources.Attestor.newBuilder().build()) + .build(); + Resources.Attestor response = binauthzManagementServiceV1Client.updateAttestor(request); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_updateattestor_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/SyncUpdateAttestorResourcesattestor.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/SyncUpdateAttestorResourcesattestor.java new file mode 100644 index 00000000..50a220e7 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updateattestor/SyncUpdateAttestorResourcesattestor.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_updateattestor_resourcesattestor_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncUpdateAttestorResourcesattestor { + + public static void main(String[] args) throws Exception { + syncUpdateAttestorResourcesattestor(); + } + + public static void syncUpdateAttestorResourcesattestor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Resources.Attestor attestor = Resources.Attestor.newBuilder().build(); + Resources.Attestor response = binauthzManagementServiceV1Client.updateAttestor(attestor); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_updateattestor_resourcesattestor_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/AsyncUpdatePolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/AsyncUpdatePolicy.java new file mode 100644 index 00000000..4687b1a8 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/AsyncUpdatePolicy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_updatepolicy_async] +import com.google.api.core.ApiFuture; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class AsyncUpdatePolicy { + + public static void main(String[] args) throws Exception { + asyncUpdatePolicy(); + } + + public static void asyncUpdatePolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.UpdatePolicyRequest request = + Service.UpdatePolicyRequest.newBuilder() + .setPolicy(Resources.Policy.newBuilder().build()) + .build(); + ApiFuture future = + binauthzManagementServiceV1Client.updatePolicyCallable().futureCall(request); + // Do something. + Resources.Policy response = future.get(); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_updatepolicy_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/SyncUpdatePolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/SyncUpdatePolicy.java new file mode 100644 index 00000000..c8d27d99 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/SyncUpdatePolicy.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_updatepolicy_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; + +public class SyncUpdatePolicy { + + public static void main(String[] args) throws Exception { + syncUpdatePolicy(); + } + + public static void syncUpdatePolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Service.UpdatePolicyRequest request = + Service.UpdatePolicyRequest.newBuilder() + .setPolicy(Resources.Policy.newBuilder().build()) + .build(); + Resources.Policy response = binauthzManagementServiceV1Client.updatePolicy(request); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_updatepolicy_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/SyncUpdatePolicyResourcespolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/SyncUpdatePolicyResourcespolicy.java new file mode 100644 index 00000000..9c3e1249 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/updatepolicy/SyncUpdatePolicyResourcespolicy.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_updatepolicy_resourcespolicy_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; + +public class SyncUpdatePolicyResourcespolicy { + + public static void main(String[] args) throws Exception { + syncUpdatePolicyResourcespolicy(); + } + + public static void syncUpdatePolicyResourcespolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create()) { + Resources.Policy policy = Resources.Policy.newBuilder().build(); + Resources.Policy response = binauthzManagementServiceV1Client.updatePolicy(policy); + } + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_updatepolicy_resourcespolicy_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1settings/getpolicy/SyncGetPolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1settings/getpolicy/SyncGetPolicy.java new file mode 100644 index 00000000..2a67ee6d --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1settings/getpolicy/SyncGetPolicy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1settings_getpolicy_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Settings; +import java.time.Duration; + +public class SyncGetPolicy { + + public static void main(String[] args) throws Exception { + syncGetPolicy(); + } + + public static void syncGetPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1Settings.Builder binauthzManagementServiceV1SettingsBuilder = + BinauthzManagementServiceV1Settings.newBuilder(); + binauthzManagementServiceV1SettingsBuilder + .getPolicySettings() + .setRetrySettings( + binauthzManagementServiceV1SettingsBuilder + .getPolicySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + BinauthzManagementServiceV1Settings binauthzManagementServiceV1Settings = + binauthzManagementServiceV1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1settings_getpolicy_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/binauthzmanagementservicev1stubsettings/getpolicy/SyncGetPolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/binauthzmanagementservicev1stubsettings/getpolicy/SyncGetPolicy.java new file mode 100644 index 00000000..5bce85cb --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/binauthzmanagementservicev1stubsettings/getpolicy/SyncGetPolicy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.stub.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1stubsettings_getpolicy_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.stub.BinauthzManagementServiceV1StubSettings; +import java.time.Duration; + +public class SyncGetPolicy { + + public static void main(String[] args) throws Exception { + syncGetPolicy(); + } + + public static void syncGetPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1StubSettings.Builder binauthzManagementServiceV1SettingsBuilder = + BinauthzManagementServiceV1StubSettings.newBuilder(); + binauthzManagementServiceV1SettingsBuilder + .getPolicySettings() + .setRetrySettings( + binauthzManagementServiceV1SettingsBuilder + .getPolicySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + BinauthzManagementServiceV1StubSettings binauthzManagementServiceV1Settings = + binauthzManagementServiceV1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1stubsettings_getpolicy_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/systempolicyv1stubsettings/getsystempolicy/SyncGetSystemPolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/systempolicyv1stubsettings/getsystempolicy/SyncGetSystemPolicy.java new file mode 100644 index 00000000..9145bf24 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/systempolicyv1stubsettings/getsystempolicy/SyncGetSystemPolicy.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.stub.samples; + +// [START binaryauthorization_v1_generated_systempolicyv1stubsettings_getsystempolicy_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.stub.SystemPolicyV1StubSettings; +import java.time.Duration; + +public class SyncGetSystemPolicy { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicy(); + } + + public static void syncGetSystemPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1StubSettings.Builder systemPolicyV1SettingsBuilder = + SystemPolicyV1StubSettings.newBuilder(); + systemPolicyV1SettingsBuilder + .getSystemPolicySettings() + .setRetrySettings( + systemPolicyV1SettingsBuilder + .getSystemPolicySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SystemPolicyV1StubSettings systemPolicyV1Settings = systemPolicyV1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1_generated_systempolicyv1stubsettings_getsystempolicy_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/validationhelperv1stubsettings/validateattestationoccurrence/SyncValidateAttestationOccurrence.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/validationhelperv1stubsettings/validateattestationoccurrence/SyncValidateAttestationOccurrence.java new file mode 100644 index 00000000..39ade354 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/stub/validationhelperv1stubsettings/validateattestationoccurrence/SyncValidateAttestationOccurrence.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.stub.samples; + +// [START binaryauthorization_v1_generated_validationhelperv1stubsettings_validateattestationoccurrence_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.stub.ValidationHelperV1StubSettings; +import java.time.Duration; + +public class SyncValidateAttestationOccurrence { + + public static void main(String[] args) throws Exception { + syncValidateAttestationOccurrence(); + } + + public static void syncValidateAttestationOccurrence() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ValidationHelperV1StubSettings.Builder validationHelperV1SettingsBuilder = + ValidationHelperV1StubSettings.newBuilder(); + validationHelperV1SettingsBuilder + .validateAttestationOccurrenceSettings() + .setRetrySettings( + validationHelperV1SettingsBuilder + .validateAttestationOccurrenceSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ValidationHelperV1StubSettings validationHelperV1Settings = + validationHelperV1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1_generated_validationhelperv1stubsettings_validateattestationoccurrence_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..7421d9e1 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_systempolicyv1client_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Settings; +import com.google.protos.google.cloud.binaryauthorization.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1Settings systemPolicyV1Settings = + SystemPolicyV1Settings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create(systemPolicyV1Settings); + } +} +// [END binaryauthorization_v1_generated_systempolicyv1client_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..e27dedbb --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_systempolicyv1client_create_setendpoint_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Settings; +import com.google.protos.google.cloud.binaryauthorization.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1Settings systemPolicyV1Settings = + SystemPolicyV1Settings.newBuilder().setEndpoint(myEndpoint).build(); + SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create(systemPolicyV1Settings); + } +} +// [END binaryauthorization_v1_generated_systempolicyv1client_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/AsyncGetSystemPolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/AsyncGetSystemPolicy.java new file mode 100644 index 00000000..a8fa3b9a --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/AsyncGetSystemPolicy.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_systempolicyv1client_getsystempolicy_async] +import com.google.api.core.ApiFuture; +import com.google.protos.google.cloud.binaryauthorization.v1.PolicyName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Client; + +public class AsyncGetSystemPolicy { + + public static void main(String[] args) throws Exception { + asyncGetSystemPolicy(); + } + + public static void asyncGetSystemPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create()) { + Service.GetSystemPolicyRequest request = + Service.GetSystemPolicyRequest.newBuilder() + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) + .build(); + ApiFuture future = + systemPolicyV1Client.getSystemPolicyCallable().futureCall(request); + // Do something. + Resources.Policy response = future.get(); + } + } +} +// [END binaryauthorization_v1_generated_systempolicyv1client_getsystempolicy_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicy.java new file mode 100644 index 00000000..e6c64fc5 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicy.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_systempolicyv1client_getsystempolicy_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.PolicyName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Client; + +public class SyncGetSystemPolicy { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicy(); + } + + public static void syncGetSystemPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create()) { + Service.GetSystemPolicyRequest request = + Service.GetSystemPolicyRequest.newBuilder() + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) + .build(); + Resources.Policy response = systemPolicyV1Client.getSystemPolicy(request); + } + } +} +// [END binaryauthorization_v1_generated_systempolicyv1client_getsystempolicy_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicyPolicyname.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicyPolicyname.java new file mode 100644 index 00000000..9332dafb --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicyPolicyname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_systempolicyv1client_getsystempolicy_policyname_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.PolicyName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Client; + +public class SyncGetSystemPolicyPolicyname { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicyPolicyname(); + } + + public static void syncGetSystemPolicyPolicyname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create()) { + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); + Resources.Policy response = systemPolicyV1Client.getSystemPolicy(name); + } + } +} +// [END binaryauthorization_v1_generated_systempolicyv1client_getsystempolicy_policyname_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicyString.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicyString.java new file mode 100644 index 00000000..1f2ccc34 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/getsystempolicy/SyncGetSystemPolicyString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_systempolicyv1client_getsystempolicy_string_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.PolicyName; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Client; + +public class SyncGetSystemPolicyString { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicyString(); + } + + public static void syncGetSystemPolicyString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create()) { + String name = PolicyName.ofProjectName("[PROJECT]").toString(); + Resources.Policy response = systemPolicyV1Client.getSystemPolicy(name); + } + } +} +// [END binaryauthorization_v1_generated_systempolicyv1client_getsystempolicy_string_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1settings/getsystempolicy/SyncGetSystemPolicy.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1settings/getsystempolicy/SyncGetSystemPolicy.java new file mode 100644 index 00000000..dcbb731c --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1settings/getsystempolicy/SyncGetSystemPolicy.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_systempolicyv1settings_getsystempolicy_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Settings; +import java.time.Duration; + +public class SyncGetSystemPolicy { + + public static void main(String[] args) throws Exception { + syncGetSystemPolicy(); + } + + public static void syncGetSystemPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1Settings.Builder systemPolicyV1SettingsBuilder = + SystemPolicyV1Settings.newBuilder(); + systemPolicyV1SettingsBuilder + .getSystemPolicySettings() + .setRetrySettings( + systemPolicyV1SettingsBuilder + .getSystemPolicySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SystemPolicyV1Settings systemPolicyV1Settings = systemPolicyV1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1_generated_systempolicyv1settings_getsystempolicy_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..472d96cb --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_validationhelperv1client_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Settings; +import com.google.protos.google.cloud.binaryauthorization.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ValidationHelperV1Settings validationHelperV1Settings = + ValidationHelperV1Settings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ValidationHelperV1Client validationHelperV1Client = + ValidationHelperV1Client.create(validationHelperV1Settings); + } +} +// [END binaryauthorization_v1_generated_validationhelperv1client_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..cb4e8914 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_validationhelperv1client_create_setendpoint_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Settings; +import com.google.protos.google.cloud.binaryauthorization.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ValidationHelperV1Settings validationHelperV1Settings = + ValidationHelperV1Settings.newBuilder().setEndpoint(myEndpoint).build(); + ValidationHelperV1Client validationHelperV1Client = + ValidationHelperV1Client.create(validationHelperV1Settings); + } +} +// [END binaryauthorization_v1_generated_validationhelperv1client_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/validateattestationoccurrence/AsyncValidateAttestationOccurrence.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/validateattestationoccurrence/AsyncValidateAttestationOccurrence.java new file mode 100644 index 00000000..fd89b8ff --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/validateattestationoccurrence/AsyncValidateAttestationOccurrence.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_validationhelperv1client_validateattestationoccurrence_async] +import com.google.api.core.ApiFuture; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Client; +import io.grafeas.v1.AttestationOccurrence; + +public class AsyncValidateAttestationOccurrence { + + public static void main(String[] args) throws Exception { + asyncValidateAttestationOccurrence(); + } + + public static void asyncValidateAttestationOccurrence() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ValidationHelperV1Client validationHelperV1Client = ValidationHelperV1Client.create()) { + Service.ValidateAttestationOccurrenceRequest request = + Service.ValidateAttestationOccurrenceRequest.newBuilder() + .setAttestor("attestor542920680") + .setAttestation(AttestationOccurrence.newBuilder().build()) + .setOccurrenceNote("occurrenceNote1722072419") + .setOccurrenceResourceUri("occurrenceResourceUri1001424877") + .build(); + ApiFuture future = + validationHelperV1Client.validateAttestationOccurrenceCallable().futureCall(request); + // Do something. + Service.ValidateAttestationOccurrenceResponse response = future.get(); + } + } +} +// [END binaryauthorization_v1_generated_validationhelperv1client_validateattestationoccurrence_async] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/validateattestationoccurrence/SyncValidateAttestationOccurrence.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/validateattestationoccurrence/SyncValidateAttestationOccurrence.java new file mode 100644 index 00000000..f2c84458 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/validateattestationoccurrence/SyncValidateAttestationOccurrence.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_validationhelperv1client_validateattestationoccurrence_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.Service; +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Client; +import io.grafeas.v1.AttestationOccurrence; + +public class SyncValidateAttestationOccurrence { + + public static void main(String[] args) throws Exception { + syncValidateAttestationOccurrence(); + } + + public static void syncValidateAttestationOccurrence() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ValidationHelperV1Client validationHelperV1Client = ValidationHelperV1Client.create()) { + Service.ValidateAttestationOccurrenceRequest request = + Service.ValidateAttestationOccurrenceRequest.newBuilder() + .setAttestor("attestor542920680") + .setAttestation(AttestationOccurrence.newBuilder().build()) + .setOccurrenceNote("occurrenceNote1722072419") + .setOccurrenceResourceUri("occurrenceResourceUri1001424877") + .build(); + Service.ValidateAttestationOccurrenceResponse response = + validationHelperV1Client.validateAttestationOccurrence(request); + } + } +} +// [END binaryauthorization_v1_generated_validationhelperv1client_validateattestationoccurrence_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1settings/validateattestationoccurrence/SyncValidateAttestationOccurrence.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1settings/validateattestationoccurrence/SyncValidateAttestationOccurrence.java new file mode 100644 index 00000000..da529e3d --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1settings/validateattestationoccurrence/SyncValidateAttestationOccurrence.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_validationhelperv1settings_validateattestationoccurrence_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Settings; +import java.time.Duration; + +public class SyncValidateAttestationOccurrence { + + public static void main(String[] args) throws Exception { + syncValidateAttestationOccurrence(); + } + + public static void syncValidateAttestationOccurrence() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ValidationHelperV1Settings.Builder validationHelperV1SettingsBuilder = + ValidationHelperV1Settings.newBuilder(); + validationHelperV1SettingsBuilder + .validateAttestationOccurrenceSettings() + .setRetrySettings( + validationHelperV1SettingsBuilder + .validateAttestationOccurrenceSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ValidationHelperV1Settings validationHelperV1Settings = + validationHelperV1SettingsBuilder.build(); + } +} +// [END binaryauthorization_v1_generated_validationhelperv1settings_validateattestationoccurrence_sync] From c5d1f103196a5d538e115d48f3873901fa0a065a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 23 Jun 2022 17:28:22 +0200 Subject: [PATCH 08/14] deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 (#229) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `2.12.0` -> `2.13.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.13.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.13.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.13.0/compatibility-slim/2.12.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.13.0/confidence-slim/2.12.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/java-shared-dependencies ### [`v2.13.0`](https://togithub.com/googleapis/java-shared-dependencies/blob/HEAD/CHANGELOG.md#​2130-httpsgithubcomgoogleapisjava-shared-dependenciescomparev2120v2130-2022-06-22) [Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v2.12.0...v2.13.0) ##### Dependencies - update dependency com.google.api-client:google-api-client-bom to v1.35.0 ([#​709](https://togithub.com/googleapis/java-shared-dependencies/issues/709)) ([239f8c3](https://togithub.com/googleapis/java-shared-dependencies/commit/239f8c33a11e233e6af79aee8c7e68cd156a0554)) - update dependency com.google.api-client:google-api-client-bom to v1.35.1 ([#​713](https://togithub.com/googleapis/java-shared-dependencies/issues/713)) ([6559b45](https://togithub.com/googleapis/java-shared-dependencies/commit/6559b45b027dba783a9525d35e32183d78773cbe)) - update dependency com.google.api:api-common to v2.2.1 ([#​710](https://togithub.com/googleapis/java-shared-dependencies/issues/710)) ([650d4c5](https://togithub.com/googleapis/java-shared-dependencies/commit/650d4c5f8c3cfce711257d47280ad773cd2e2414)) - update dependency com.google.errorprone:error_prone_annotations to v2.14.0 ([#​701](https://togithub.com/googleapis/java-shared-dependencies/issues/701)) ([d24730f](https://togithub.com/googleapis/java-shared-dependencies/commit/d24730f78669f80b109e590b903446e5552e3e36)) - update dependency com.google.http-client:google-http-client-bom to v1.42.0 ([#​711](https://togithub.com/googleapis/java-shared-dependencies/issues/711)) ([5168a18](https://togithub.com/googleapis/java-shared-dependencies/commit/5168a181722128d434a0d0d2ab5cc485686bbc78)) - update dependency com.google.oauth-client:google-oauth-client-bom to v1.34.0 ([#​708](https://togithub.com/googleapis/java-shared-dependencies/issues/708)) ([620336e](https://togithub.com/googleapis/java-shared-dependencies/commit/620336e6733e2017116e5e8a7b403b183a728bc1)) - update dependency com.google.oauth-client:google-oauth-client-bom to v1.34.1 ([#​712](https://togithub.com/googleapis/java-shared-dependencies/issues/712)) ([a2c18a5](https://togithub.com/googleapis/java-shared-dependencies/commit/a2c18a5bc4152cc9034cec691a29f54a35c38a51)) - update dependency com.google.protobuf:protobuf-bom to v3.21.0 ([#​703](https://togithub.com/googleapis/java-shared-dependencies/issues/703)) ([5f9fe12](https://togithub.com/googleapis/java-shared-dependencies/commit/5f9fe1200b4bdf4c54bf947c21bd3ed02f26f990)) - update dependency com.google.protobuf:protobuf-bom to v3.21.1 ([#​705](https://togithub.com/googleapis/java-shared-dependencies/issues/705)) ([c68edfb](https://togithub.com/googleapis/java-shared-dependencies/commit/c68edfbe7e1993e1112640b867b29aa2fbcf7579)) - update dependency io.grpc:grpc-bom to v1.47.0 ([#​707](https://togithub.com/googleapis/java-shared-dependencies/issues/707)) ([d02918a](https://togithub.com/googleapis/java-shared-dependencies/commit/d02918a0418cd65d1d247f27afb0637f1f8f5666)) - update dependency org.checkerframework:checker-qual to v3.22.1 ([#​706](https://togithub.com/googleapis/java-shared-dependencies/issues/706)) ([545843b](https://togithub.com/googleapis/java-shared-dependencies/commit/545843b492cead230b8cc72a1dae7d4922f33b39)) - update dependency org.checkerframework:checker-qual to v3.22.2 ([#​717](https://togithub.com/googleapis/java-shared-dependencies/issues/717)) ([142852a](https://togithub.com/googleapis/java-shared-dependencies/commit/142852a37140f221197f5c71aed451def353b1e0)) - update gax.version to v2.18.2 ([#​718](https://togithub.com/googleapis/java-shared-dependencies/issues/718)) ([5f8156e](https://togithub.com/googleapis/java-shared-dependencies/commit/5f8156e55c6a07b018a8c5efafa68be781b4288b)) - update google.common-protos.version to v2.9.0 ([#​714](https://togithub.com/googleapis/java-shared-dependencies/issues/714)) ([9e5591e](https://togithub.com/googleapis/java-shared-dependencies/commit/9e5591ec3035350450ecbfebd00e08216433b06c)) - update google.core.version to v2.8.0 ([#​719](https://togithub.com/googleapis/java-shared-dependencies/issues/719)) ([4023c60](https://togithub.com/googleapis/java-shared-dependencies/commit/4023c6063a2c5b5308da531df1a08c90c491965d)) - update iam.version to v1.4.0 ([#​700](https://togithub.com/googleapis/java-shared-dependencies/issues/700)) ([c1097a4](https://togithub.com/googleapis/java-shared-dependencies/commit/c1097a46ab0739b0b7234bc510e4c3d9ce2c2861)) - update iam.version to v1.4.1 ([#​716](https://togithub.com/googleapis/java-shared-dependencies/issues/716)) ([e2dc7c2](https://togithub.com/googleapis/java-shared-dependencies/commit/e2dc7c21c39e007878841e2664d548ec44a72d54))
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-binary-authorization). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 399a6e49..171674f3 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ com.google.cloud google-cloud-shared-dependencies - 2.12.0 + 2.13.0 pom import From 73745540d6187af67f8fdd1029485a860c45d7a7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 24 Jun 2022 16:58:11 +0200 Subject: [PATCH 09/14] deps: update dependency io.grafeas:grafeas to v2.3.1 (#231) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [io.grafeas:grafeas](https://togithub.com/googleapis/java-grafeas) | `2.3.0` -> `2.3.1` | [![age](https://badges.renovateapi.com/packages/maven/io.grafeas:grafeas/2.3.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/io.grafeas:grafeas/2.3.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/io.grafeas:grafeas/2.3.1/compatibility-slim/2.3.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/io.grafeas:grafeas/2.3.1/confidence-slim/2.3.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/java-grafeas ### [`v2.3.1`](https://togithub.com/googleapis/java-grafeas/blob/HEAD/CHANGELOG.md#​231-httpsgithubcomgoogleapisjava-grafeascomparev230v231-2022-06-23) [Compare Source](https://togithub.com/googleapis/java-grafeas/compare/v2.3.0...v2.3.1) ##### Dependencies - update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#​500](https://togithub.com/googleapis/java-grafeas/issues/500)) ([70c75bb](https://togithub.com/googleapis/java-grafeas/commit/70c75bbdb77e04d4c80ce057bb9382df117e6321))
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-binary-authorization). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 171674f3..341a0850 100644 --- a/pom.xml +++ b/pom.xml @@ -86,7 +86,7 @@ io.grafeas grafeas - 2.3.0 + 2.3.1 io.perfmark From 34534bcb01672284875546a0b7310d18412acc5f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 27 Jun 2022 19:26:37 +0000 Subject: [PATCH 10/14] chore: update dependencies for regapic (#1467) (#232) * chore: update dependencies for regapic * add more dependencies and trigger comment * update goldens * fix indentation * remove duplicate gax-httpjson dependency * remove duplicated dependencies Source-Link: https://github.com/googleapis/synthtool/commit/fa54eb2a78c6ee48613fd33152e2130e949dcbd9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/common.sh | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 68f2b159..f0625e4d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:58ccd4737212f64a7dd4b3063d447447acf71a2b9d409eab19fc7a00b18eadc0 -# created: 2022-06-10T19:20:11.004014696Z + digest: sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 +# created: 2022-06-27T15:01:06.405564326Z diff --git a/.kokoro/common.sh b/.kokoro/common.sh index ace89f45..f8f957af 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -55,4 +55,6 @@ function retry_with_backoff { ## Helper functionss function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } function msg() { println "$*" >&2; } -function println() { printf '%s\n' "$(now) $*"; } \ No newline at end of file +function println() { printf '%s\n' "$(now) $*"; } + +## Helper comment to trigger updated repo dependency release \ No newline at end of file From f7d69d93dffba1599c8979ba5dd308c20b54abe1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 02:18:24 +0000 Subject: [PATCH 11/14] chore: Disable CLIRR checks on releas (#1474) (#235) Source-Link: https://github.com/googleapis/synthtool/commit/7a220e27993a25ab3cda26510d5619d97b6952a9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:6d4e3a15c62cfdcb823d60e16da7521e7c6fc00eba07c8ff12e4de9924a57d28 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/release/stage.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f0625e4d..a454a61e 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 -# created: 2022-06-27T15:01:06.405564326Z + digest: sha256:6d4e3a15c62cfdcb823d60e16da7521e7c6fc00eba07c8ff12e4de9924a57d28 +# created: 2022-06-29T23:17:33.110417661Z diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh index 77dc4e8f..1dba8de1 100755 --- a/.kokoro/release/stage.sh +++ b/.kokoro/release/stage.sh @@ -32,6 +32,7 @@ retry_with_backoff 3 10 \ mvn clean deploy -B \ --settings ${MAVEN_SETTINGS_FILE} \ -DskipTests=true \ + -Dclirr.skip=true \ -DperformRelease=true \ -Dgpg.executable=gpg \ -Dgpg.passphrase=${GPG_PASSPHRASE} \ @@ -42,4 +43,4 @@ then mvn nexus-staging:release -B \ -DperformRelease=true \ --settings=settings.xml -fi \ No newline at end of file +fi From ca507e6aca8a35467d95038d7554c0c5f357315a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 18:56:18 +0000 Subject: [PATCH 12/14] feat: Enable REST transport for most of Java and Go clients (#230) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 456641589 Source-Link: https://github.com/googleapis/googleapis/commit/8a251f5225b789b2383207ffd978f6aa3d77fcf7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9 --- .kokoro/dependencies.sh | 4 +- google-cloud-binary-authorization/pom.xml | 16 + ...inauthzManagementServiceV1Beta1Client.java | 16 + ...authzManagementServiceV1Beta1Settings.java | 23 +- .../v1beta1/SystemPolicyV1Beta1Client.java | 15 + .../v1beta1/SystemPolicyV1Beta1Settings.java | 23 +- ...zManagementServiceV1Beta1StubSettings.java | 54 +- ...nagementServiceV1Beta1CallableFactory.java | 105 +++ ...nBinauthzManagementServiceV1Beta1Stub.java | 526 +++++++++++++ ...sonSystemPolicyV1Beta1CallableFactory.java | 105 +++ .../stub/HttpJsonSystemPolicyV1Beta1Stub.java | 194 +++++ .../stub/SystemPolicyV1Beta1StubSettings.java | 53 +- .../v1/BinauthzManagementServiceV1Client.java | 16 + .../BinauthzManagementServiceV1Settings.java | 23 +- .../v1/SystemPolicyV1Client.java | 14 + .../v1/SystemPolicyV1Settings.java | 23 +- .../v1/ValidationHelperV1Client.java | 15 + .../v1/ValidationHelperV1Settings.java | 23 +- ...nauthzManagementServiceV1StubSettings.java | 53 +- ...thzManagementServiceV1CallableFactory.java | 105 +++ ...tpJsonBinauthzManagementServiceV1Stub.java | 528 +++++++++++++ ...HttpJsonSystemPolicyV1CallableFactory.java | 105 +++ .../v1/stub/HttpJsonSystemPolicyV1Stub.java | 194 +++++ ...JsonValidationHelperV1CallableFactory.java | 105 +++ .../stub/HttpJsonValidationHelperV1Stub.java | 218 ++++++ .../v1/stub/SystemPolicyV1StubSettings.java | 53 +- .../stub/ValidationHelperV1StubSettings.java | 53 +- ...ementServiceV1Beta1ClientHttpJsonTest.java | 687 +++++++++++++++++ ...SystemPolicyV1Beta1ClientHttpJsonTest.java | 180 +++++ ...ManagementServiceV1ClientHttpJsonTest.java | 699 ++++++++++++++++++ .../v1/SystemPolicyV1ClientHttpJsonTest.java | 184 +++++ .../ValidationHelperV1ClientHttpJsonTest.java | 131 ++++ owlbot.py | 4 +- .../SyncCreateSetCredentialsProvider1.java | 42 ++ .../SyncCreateSetCredentialsProvider1.java | 41 + .../SyncCreateSetCredentialsProvider1.java | 42 ++ .../SyncCreateSetCredentialsProvider1.java | 40 + .../SyncCreateSetCredentialsProvider1.java | 41 + 38 files changed, 4725 insertions(+), 28 deletions(-) create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonBinauthzManagementServiceV1Beta1CallableFactory.java create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonBinauthzManagementServiceV1Beta1Stub.java create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonSystemPolicyV1Beta1CallableFactory.java create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonSystemPolicyV1Beta1Stub.java create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonBinauthzManagementServiceV1CallableFactory.java create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonBinauthzManagementServiceV1Stub.java create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonSystemPolicyV1CallableFactory.java create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonSystemPolicyV1Stub.java create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonValidationHelperV1CallableFactory.java create mode 100644 google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonValidationHelperV1Stub.java create mode 100644 google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1ClientHttpJsonTest.java create mode 100644 google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1ClientHttpJsonTest.java create mode 100644 google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1ClientHttpJsonTest.java create mode 100644 google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1ClientHttpJsonTest.java create mode 100644 google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1ClientHttpJsonTest.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetCredentialsProvider1.java diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh index d7476cfe..1351152b 100755 --- a/.kokoro/dependencies.sh +++ b/.kokoro/dependencies.sh @@ -66,11 +66,11 @@ function completenessCheck() { # This is stripped from the output as it is not present in the flattened pom. # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. msg "Generating dependency list using original pom..." - mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e 's/ --.*//' >.org-list.txt + mvn dependency:list -f pom.xml -DexcludeArtifactIds=commons-codec,commons-logging,opencensus-api,opencensus-contrib-http-util,httpclient,httpcore -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e 's/ --.*//' >.org-list.txt # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) msg "Generating dependency list using flattened pom..." - mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt + mvn dependency:list -f .flattened-pom.xml -DexcludeArtifactIds=commons-codec,commons-logging,opencensus-api,opencensus-contrib-http-util,httpclient,httpcore -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt # Compare two dependency lists msg "Comparing dependency lists..." diff --git a/google-cloud-binary-authorization/pom.xml b/google-cloud-binary-authorization/pom.xml index 7737f183..ae74ec9d 100644 --- a/google-cloud-binary-authorization/pom.xml +++ b/google-cloud-binary-authorization/pom.xml @@ -62,6 +62,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -91,12 +95,24 @@ test + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test +
diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java index ca587ae1..925ebfa0 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Client.java @@ -110,6 +110,22 @@ * BinauthzManagementServiceV1Beta1Client.create(binauthzManagementServiceV1Beta1Settings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * BinauthzManagementServiceV1Beta1Settings binauthzManagementServiceV1Beta1Settings =
+ *     BinauthzManagementServiceV1Beta1Settings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             BinauthzManagementServiceV1Beta1Settings.defaultHttpJsonTransportProviderBuilder()
+ *                 .build())
+ *         .build();
+ * BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client =
+ *     BinauthzManagementServiceV1Beta1Client.create(binauthzManagementServiceV1Beta1Settings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Settings.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Settings.java index 1628c472..46d41dfa 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Settings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1Settings.java @@ -23,6 +23,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -143,11 +144,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return BinauthzManagementServiceV1Beta1StubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return BinauthzManagementServiceV1Beta1StubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return BinauthzManagementServiceV1Beta1StubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return BinauthzManagementServiceV1Beta1StubSettings.defaultTransportChannelProvider(); } @@ -157,11 +165,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return BinauthzManagementServiceV1Beta1StubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -200,6 +214,11 @@ private static Builder createDefault() { return new Builder(BinauthzManagementServiceV1Beta1StubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(BinauthzManagementServiceV1Beta1StubSettings.newHttpJsonBuilder()); + } + public BinauthzManagementServiceV1Beta1StubSettings.Builder getStubSettingsBuilder() { return ((BinauthzManagementServiceV1Beta1StubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java index 5fb4e062..a3017bbd 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Client.java @@ -92,6 +92,21 @@ * SystemPolicyV1Beta1Client.create(systemPolicyV1Beta1Settings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * SystemPolicyV1Beta1Settings systemPolicyV1Beta1Settings =
+ *     SystemPolicyV1Beta1Settings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             SystemPolicyV1Beta1Settings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * SystemPolicyV1Beta1Client systemPolicyV1Beta1Client =
+ *     SystemPolicyV1Beta1Client.create(systemPolicyV1Beta1Settings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Settings.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Settings.java index b23db1b3..1508441e 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Settings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1Settings.java @@ -21,6 +21,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -101,11 +102,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return SystemPolicyV1Beta1StubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return SystemPolicyV1Beta1StubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SystemPolicyV1Beta1StubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return SystemPolicyV1Beta1StubSettings.defaultTransportChannelProvider(); } @@ -115,11 +123,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return SystemPolicyV1Beta1StubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -157,6 +171,11 @@ private static Builder createDefault() { return new Builder(SystemPolicyV1Beta1StubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(SystemPolicyV1Beta1StubSettings.newHttpJsonBuilder()); + } + public SystemPolicyV1Beta1StubSettings.Builder getStubSettingsBuilder() { return ((SystemPolicyV1Beta1StubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/BinauthzManagementServiceV1Beta1StubSettings.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/BinauthzManagementServiceV1Beta1StubSettings.java index 1e95f878..b600d3c5 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/BinauthzManagementServiceV1Beta1StubSettings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/BinauthzManagementServiceV1Beta1StubSettings.java @@ -27,6 +27,9 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; @@ -210,6 +213,11 @@ public BinauthzManagementServiceV1Beta1Stub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcBinauthzManagementServiceV1Beta1Stub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonBinauthzManagementServiceV1Beta1Stub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -242,18 +250,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", @@ -262,11 +277,31 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", + GaxProperties.getLibraryVersion(BinauthzManagementServiceV1Beta1StubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return BinauthzManagementServiceV1Beta1StubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -408,6 +443,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .getPolicySettings() diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonBinauthzManagementServiceV1Beta1CallableFactory.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonBinauthzManagementServiceV1Beta1CallableFactory.java new file mode 100644 index 00000000..3fdaa60f --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonBinauthzManagementServiceV1Beta1CallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the BinauthzManagementServiceV1Beta1 service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonBinauthzManagementServiceV1Beta1CallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonBinauthzManagementServiceV1Beta1Stub.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonBinauthzManagementServiceV1Beta1Stub.java new file mode 100644 index 00000000..16697201 --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonBinauthzManagementServiceV1Beta1Stub.java @@ -0,0 +1,526 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.stub; + +import static com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.binaryauthorization.v1beta1.Attestor; +import com.google.cloud.binaryauthorization.v1beta1.CreateAttestorRequest; +import com.google.cloud.binaryauthorization.v1beta1.DeleteAttestorRequest; +import com.google.cloud.binaryauthorization.v1beta1.GetAttestorRequest; +import com.google.cloud.binaryauthorization.v1beta1.GetPolicyRequest; +import com.google.cloud.binaryauthorization.v1beta1.ListAttestorsRequest; +import com.google.cloud.binaryauthorization.v1beta1.ListAttestorsResponse; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.cloud.binaryauthorization.v1beta1.UpdateAttestorRequest; +import com.google.cloud.binaryauthorization.v1beta1.UpdatePolicyRequest; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the BinauthzManagementServiceV1Beta1 service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonBinauthzManagementServiceV1Beta1Stub + extends BinauthzManagementServiceV1Beta1Stub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor getPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/GetPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/policy}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updatePolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/UpdatePolicy") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{policy.name=projects/*/policy}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "policy.name", request.getPolicy().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("policy", request.getPolicy())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createAttestorMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/CreateAttestor") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*}/attestors", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "attestorId", request.getAttestorId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("attestor", request.getAttestor())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Attestor.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getAttestorMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/GetAttestor") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/attestors/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Attestor.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateAttestorMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/UpdateAttestor") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{attestor.name=projects/*/attestors/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "attestor.name", request.getAttestor().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("attestor", request.getAttestor())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Attestor.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listAttestorsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/ListAttestors") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*}/attestors", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListAttestorsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteAttestorMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1/DeleteAttestor") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/attestors/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable getPolicyCallable; + private final UnaryCallable updatePolicyCallable; + private final UnaryCallable createAttestorCallable; + private final UnaryCallable getAttestorCallable; + private final UnaryCallable updateAttestorCallable; + private final UnaryCallable listAttestorsCallable; + private final UnaryCallable + listAttestorsPagedCallable; + private final UnaryCallable deleteAttestorCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonBinauthzManagementServiceV1Beta1Stub create( + BinauthzManagementServiceV1Beta1StubSettings settings) throws IOException { + return new HttpJsonBinauthzManagementServiceV1Beta1Stub( + settings, ClientContext.create(settings)); + } + + public static final HttpJsonBinauthzManagementServiceV1Beta1Stub create( + ClientContext clientContext) throws IOException { + return new HttpJsonBinauthzManagementServiceV1Beta1Stub( + BinauthzManagementServiceV1Beta1StubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonBinauthzManagementServiceV1Beta1Stub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonBinauthzManagementServiceV1Beta1Stub( + BinauthzManagementServiceV1Beta1StubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonBinauthzManagementServiceV1Beta1Stub, using the given + * settings. This is protected so that it is easy to make a subclass, but otherwise, the static + * factory methods should be preferred. + */ + protected HttpJsonBinauthzManagementServiceV1Beta1Stub( + BinauthzManagementServiceV1Beta1StubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonBinauthzManagementServiceV1Beta1CallableFactory()); + } + + /** + * Constructs an instance of HttpJsonBinauthzManagementServiceV1Beta1Stub, using the given + * settings. This is protected so that it is easy to make a subclass, but otherwise, the static + * factory methods should be preferred. + */ + protected HttpJsonBinauthzManagementServiceV1Beta1Stub( + BinauthzManagementServiceV1Beta1StubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings getPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updatePolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updatePolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createAttestorTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createAttestorMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getAttestorTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAttestorMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateAttestorTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAttestorMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listAttestorsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAttestorsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteAttestorTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAttestorMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.getPolicyCallable = + callableFactory.createUnaryCallable( + getPolicyTransportSettings, settings.getPolicySettings(), clientContext); + this.updatePolicyCallable = + callableFactory.createUnaryCallable( + updatePolicyTransportSettings, settings.updatePolicySettings(), clientContext); + this.createAttestorCallable = + callableFactory.createUnaryCallable( + createAttestorTransportSettings, settings.createAttestorSettings(), clientContext); + this.getAttestorCallable = + callableFactory.createUnaryCallable( + getAttestorTransportSettings, settings.getAttestorSettings(), clientContext); + this.updateAttestorCallable = + callableFactory.createUnaryCallable( + updateAttestorTransportSettings, settings.updateAttestorSettings(), clientContext); + this.listAttestorsCallable = + callableFactory.createUnaryCallable( + listAttestorsTransportSettings, settings.listAttestorsSettings(), clientContext); + this.listAttestorsPagedCallable = + callableFactory.createPagedCallable( + listAttestorsTransportSettings, settings.listAttestorsSettings(), clientContext); + this.deleteAttestorCallable = + callableFactory.createUnaryCallable( + deleteAttestorTransportSettings, settings.deleteAttestorSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(getPolicyMethodDescriptor); + methodDescriptors.add(updatePolicyMethodDescriptor); + methodDescriptors.add(createAttestorMethodDescriptor); + methodDescriptors.add(getAttestorMethodDescriptor); + methodDescriptors.add(updateAttestorMethodDescriptor); + methodDescriptors.add(listAttestorsMethodDescriptor); + methodDescriptors.add(deleteAttestorMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable getPolicyCallable() { + return getPolicyCallable; + } + + @Override + public UnaryCallable updatePolicyCallable() { + return updatePolicyCallable; + } + + @Override + public UnaryCallable createAttestorCallable() { + return createAttestorCallable; + } + + @Override + public UnaryCallable getAttestorCallable() { + return getAttestorCallable; + } + + @Override + public UnaryCallable updateAttestorCallable() { + return updateAttestorCallable; + } + + @Override + public UnaryCallable listAttestorsCallable() { + return listAttestorsCallable; + } + + @Override + public UnaryCallable + listAttestorsPagedCallable() { + return listAttestorsPagedCallable; + } + + @Override + public UnaryCallable deleteAttestorCallable() { + return deleteAttestorCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonSystemPolicyV1Beta1CallableFactory.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonSystemPolicyV1Beta1CallableFactory.java new file mode 100644 index 00000000..8f2ee604 --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonSystemPolicyV1Beta1CallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the SystemPolicyV1Beta1 service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonSystemPolicyV1Beta1CallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonSystemPolicyV1Beta1Stub.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonSystemPolicyV1Beta1Stub.java new file mode 100644 index 00000000..9dee319f --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/HttpJsonSystemPolicyV1Beta1Stub.java @@ -0,0 +1,194 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.binaryauthorization.v1beta1.GetSystemPolicyRequest; +import com.google.cloud.binaryauthorization.v1beta1.Policy; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the SystemPolicyV1Beta1 service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonSystemPolicyV1Beta1Stub extends SystemPolicyV1Beta1Stub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + getSystemPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1/GetSystemPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=locations/*/policy}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable getSystemPolicyCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSystemPolicyV1Beta1Stub create( + SystemPolicyV1Beta1StubSettings settings) throws IOException { + return new HttpJsonSystemPolicyV1Beta1Stub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSystemPolicyV1Beta1Stub create(ClientContext clientContext) + throws IOException { + return new HttpJsonSystemPolicyV1Beta1Stub( + SystemPolicyV1Beta1StubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonSystemPolicyV1Beta1Stub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSystemPolicyV1Beta1Stub( + SystemPolicyV1Beta1StubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonSystemPolicyV1Beta1Stub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonSystemPolicyV1Beta1Stub( + SystemPolicyV1Beta1StubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonSystemPolicyV1Beta1CallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSystemPolicyV1Beta1Stub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonSystemPolicyV1Beta1Stub( + SystemPolicyV1Beta1StubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings getSystemPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSystemPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.getSystemPolicyCallable = + callableFactory.createUnaryCallable( + getSystemPolicyTransportSettings, settings.getSystemPolicySettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(getSystemPolicyMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable getSystemPolicyCallable() { + return getSystemPolicyCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/SystemPolicyV1Beta1StubSettings.java b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/SystemPolicyV1Beta1StubSettings.java index a5ba7c01..2bdfab50 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/SystemPolicyV1Beta1StubSettings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/cloud/binaryauthorization/v1beta1/stub/SystemPolicyV1Beta1StubSettings.java @@ -24,6 +24,9 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; @@ -97,6 +100,11 @@ public SystemPolicyV1Beta1Stub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcSystemPolicyV1Beta1Stub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSystemPolicyV1Beta1Stub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -129,18 +137,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(SystemPolicyV1Beta1StubSettings.class)) @@ -148,11 +163,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(SystemPolicyV1Beta1StubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SystemPolicyV1Beta1StubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -230,6 +264,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .getSystemPolicySettings() diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java index dce518a8..cdff3097 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Client.java @@ -109,6 +109,22 @@ * BinauthzManagementServiceV1Client.create(binauthzManagementServiceV1Settings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * BinauthzManagementServiceV1Settings binauthzManagementServiceV1Settings =
+ *     BinauthzManagementServiceV1Settings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             BinauthzManagementServiceV1Settings.defaultHttpJsonTransportProviderBuilder()
+ *                 .build())
+ *         .build();
+ * BinauthzManagementServiceV1Client binauthzManagementServiceV1Client =
+ *     BinauthzManagementServiceV1Client.create(binauthzManagementServiceV1Settings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Settings.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Settings.java index 563d61c5..ec910fbe 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Settings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1Settings.java @@ -23,6 +23,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -139,11 +140,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return BinauthzManagementServiceV1StubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return BinauthzManagementServiceV1StubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return BinauthzManagementServiceV1StubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return BinauthzManagementServiceV1StubSettings.defaultTransportChannelProvider(); } @@ -153,11 +161,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return BinauthzManagementServiceV1StubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -196,6 +210,11 @@ private static Builder createDefault() { return new Builder(BinauthzManagementServiceV1StubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(BinauthzManagementServiceV1StubSettings.newHttpJsonBuilder()); + } + public BinauthzManagementServiceV1StubSettings.Builder getStubSettingsBuilder() { return ((BinauthzManagementServiceV1StubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java index c55d857e..44852203 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Client.java @@ -88,6 +88,20 @@ * SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create(systemPolicyV1Settings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * SystemPolicyV1Settings systemPolicyV1Settings =
+ *     SystemPolicyV1Settings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             SystemPolicyV1Settings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create(systemPolicyV1Settings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Settings.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Settings.java index 1010ea02..85a0e384 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Settings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1Settings.java @@ -21,6 +21,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -100,11 +101,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return SystemPolicyV1StubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return SystemPolicyV1StubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SystemPolicyV1StubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return SystemPolicyV1StubSettings.defaultTransportChannelProvider(); } @@ -114,11 +122,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return SystemPolicyV1StubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -156,6 +170,11 @@ private static Builder createDefault() { return new Builder(SystemPolicyV1StubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(SystemPolicyV1StubSettings.newHttpJsonBuilder()); + } + public SystemPolicyV1StubSettings.Builder getStubSettingsBuilder() { return ((SystemPolicyV1StubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Client.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Client.java index 7375f421..1e86f3ea 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Client.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Client.java @@ -98,6 +98,21 @@ * ValidationHelperV1Client.create(validationHelperV1Settings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ValidationHelperV1Settings validationHelperV1Settings =
+ *     ValidationHelperV1Settings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             ValidationHelperV1Settings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * ValidationHelperV1Client validationHelperV1Client =
+ *     ValidationHelperV1Client.create(validationHelperV1Settings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Settings.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Settings.java index d41bb953..5c02ef7c 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Settings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1Settings.java @@ -21,6 +21,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -104,11 +105,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return ValidationHelperV1StubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return ValidationHelperV1StubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ValidationHelperV1StubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return ValidationHelperV1StubSettings.defaultTransportChannelProvider(); } @@ -118,11 +126,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return ValidationHelperV1StubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -160,6 +174,11 @@ private static Builder createDefault() { return new Builder(ValidationHelperV1StubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(ValidationHelperV1StubSettings.newHttpJsonBuilder()); + } + public ValidationHelperV1StubSettings.Builder getStubSettingsBuilder() { return ((ValidationHelperV1StubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/BinauthzManagementServiceV1StubSettings.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/BinauthzManagementServiceV1StubSettings.java index 47ddca33..acf472b8 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/BinauthzManagementServiceV1StubSettings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/BinauthzManagementServiceV1StubSettings.java @@ -27,6 +27,9 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; @@ -218,6 +221,11 @@ public BinauthzManagementServiceV1Stub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcBinauthzManagementServiceV1Stub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonBinauthzManagementServiceV1Stub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -250,18 +258,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(BinauthzManagementServiceV1StubSettings.class)) @@ -269,11 +284,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(BinauthzManagementServiceV1StubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return BinauthzManagementServiceV1StubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -420,6 +454,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .getPolicySettings() diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonBinauthzManagementServiceV1CallableFactory.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonBinauthzManagementServiceV1CallableFactory.java new file mode 100644 index 00000000..256e2744 --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonBinauthzManagementServiceV1CallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the BinauthzManagementServiceV1 service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonBinauthzManagementServiceV1CallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonBinauthzManagementServiceV1Stub.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonBinauthzManagementServiceV1Stub.java new file mode 100644 index 00000000..f94a985f --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonBinauthzManagementServiceV1Stub.java @@ -0,0 +1,528 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.stub; + +import static com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client.ListAttestorsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the BinauthzManagementServiceV1 service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonBinauthzManagementServiceV1Stub extends BinauthzManagementServiceV1Stub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + getPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/GetPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/policy}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Resources.Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updatePolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/UpdatePolicy") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{policy.name=projects/*/policy}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "policy.name", request.getPolicy().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("policy", request.getPolicy())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Resources.Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createAttestorMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/CreateAttestor") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*}/attestors", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "attestorId", request.getAttestorId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("attestor", request.getAttestor())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Resources.Attestor.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getAttestorMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/GetAttestor") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/attestors/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Resources.Attestor.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateAttestorMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/UpdateAttestor") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{attestor.name=projects/*/attestors/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "attestor.name", request.getAttestor().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("attestor", request.getAttestor())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Resources.Attestor.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + Service.ListAttestorsRequest, Service.ListAttestorsResponse> + listAttestorsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/ListAttestors") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*}/attestors", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Service.ListAttestorsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteAttestorMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/DeleteAttestor") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/attestors/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable getPolicyCallable; + private final UnaryCallable updatePolicyCallable; + private final UnaryCallable + createAttestorCallable; + private final UnaryCallable getAttestorCallable; + private final UnaryCallable + updateAttestorCallable; + private final UnaryCallable + listAttestorsCallable; + private final UnaryCallable + listAttestorsPagedCallable; + private final UnaryCallable deleteAttestorCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonBinauthzManagementServiceV1Stub create( + BinauthzManagementServiceV1StubSettings settings) throws IOException { + return new HttpJsonBinauthzManagementServiceV1Stub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonBinauthzManagementServiceV1Stub create(ClientContext clientContext) + throws IOException { + return new HttpJsonBinauthzManagementServiceV1Stub( + BinauthzManagementServiceV1StubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonBinauthzManagementServiceV1Stub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonBinauthzManagementServiceV1Stub( + BinauthzManagementServiceV1StubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonBinauthzManagementServiceV1Stub, using the given settings. + * This is protected so that it is easy to make a subclass, but otherwise, the static factory + * methods should be preferred. + */ + protected HttpJsonBinauthzManagementServiceV1Stub( + BinauthzManagementServiceV1StubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonBinauthzManagementServiceV1CallableFactory()); + } + + /** + * Constructs an instance of HttpJsonBinauthzManagementServiceV1Stub, using the given settings. + * This is protected so that it is easy to make a subclass, but otherwise, the static factory + * methods should be preferred. + */ + protected HttpJsonBinauthzManagementServiceV1Stub( + BinauthzManagementServiceV1StubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings getPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updatePolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updatePolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createAttestorTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createAttestorMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getAttestorTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAttestorMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateAttestorTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAttestorMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listAttestorsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listAttestorsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteAttestorTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAttestorMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.getPolicyCallable = + callableFactory.createUnaryCallable( + getPolicyTransportSettings, settings.getPolicySettings(), clientContext); + this.updatePolicyCallable = + callableFactory.createUnaryCallable( + updatePolicyTransportSettings, settings.updatePolicySettings(), clientContext); + this.createAttestorCallable = + callableFactory.createUnaryCallable( + createAttestorTransportSettings, settings.createAttestorSettings(), clientContext); + this.getAttestorCallable = + callableFactory.createUnaryCallable( + getAttestorTransportSettings, settings.getAttestorSettings(), clientContext); + this.updateAttestorCallable = + callableFactory.createUnaryCallable( + updateAttestorTransportSettings, settings.updateAttestorSettings(), clientContext); + this.listAttestorsCallable = + callableFactory.createUnaryCallable( + listAttestorsTransportSettings, settings.listAttestorsSettings(), clientContext); + this.listAttestorsPagedCallable = + callableFactory.createPagedCallable( + listAttestorsTransportSettings, settings.listAttestorsSettings(), clientContext); + this.deleteAttestorCallable = + callableFactory.createUnaryCallable( + deleteAttestorTransportSettings, settings.deleteAttestorSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(getPolicyMethodDescriptor); + methodDescriptors.add(updatePolicyMethodDescriptor); + methodDescriptors.add(createAttestorMethodDescriptor); + methodDescriptors.add(getAttestorMethodDescriptor); + methodDescriptors.add(updateAttestorMethodDescriptor); + methodDescriptors.add(listAttestorsMethodDescriptor); + methodDescriptors.add(deleteAttestorMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable getPolicyCallable() { + return getPolicyCallable; + } + + @Override + public UnaryCallable updatePolicyCallable() { + return updatePolicyCallable; + } + + @Override + public UnaryCallable createAttestorCallable() { + return createAttestorCallable; + } + + @Override + public UnaryCallable getAttestorCallable() { + return getAttestorCallable; + } + + @Override + public UnaryCallable updateAttestorCallable() { + return updateAttestorCallable; + } + + @Override + public UnaryCallable + listAttestorsCallable() { + return listAttestorsCallable; + } + + @Override + public UnaryCallable + listAttestorsPagedCallable() { + return listAttestorsPagedCallable; + } + + @Override + public UnaryCallable deleteAttestorCallable() { + return deleteAttestorCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonSystemPolicyV1CallableFactory.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonSystemPolicyV1CallableFactory.java new file mode 100644 index 00000000..91c421ef --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonSystemPolicyV1CallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the SystemPolicyV1 service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonSystemPolicyV1CallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonSystemPolicyV1Stub.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonSystemPolicyV1Stub.java new file mode 100644 index 00000000..7d357f02 --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonSystemPolicyV1Stub.java @@ -0,0 +1,194 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.protobuf.TypeRegistry; +import com.google.protos.google.cloud.binaryauthorization.v1.Resources; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the SystemPolicyV1 service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonSystemPolicyV1Stub extends SystemPolicyV1Stub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + getSystemPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1.SystemPolicyV1/GetSystemPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=locations/*/policy}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Resources.Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable + getSystemPolicyCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSystemPolicyV1Stub create(SystemPolicyV1StubSettings settings) + throws IOException { + return new HttpJsonSystemPolicyV1Stub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSystemPolicyV1Stub create(ClientContext clientContext) + throws IOException { + return new HttpJsonSystemPolicyV1Stub( + SystemPolicyV1StubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonSystemPolicyV1Stub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSystemPolicyV1Stub( + SystemPolicyV1StubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonSystemPolicyV1Stub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonSystemPolicyV1Stub( + SystemPolicyV1StubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonSystemPolicyV1CallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSystemPolicyV1Stub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonSystemPolicyV1Stub( + SystemPolicyV1StubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + getSystemPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSystemPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.getSystemPolicyCallable = + callableFactory.createUnaryCallable( + getSystemPolicyTransportSettings, settings.getSystemPolicySettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(getSystemPolicyMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable getSystemPolicyCallable() { + return getSystemPolicyCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonValidationHelperV1CallableFactory.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonValidationHelperV1CallableFactory.java new file mode 100644 index 00000000..83c6e2e1 --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonValidationHelperV1CallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the ValidationHelperV1 service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonValidationHelperV1CallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonValidationHelperV1Stub.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonValidationHelperV1Stub.java new file mode 100644 index 00000000..4e13200b --- /dev/null +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/HttpJsonValidationHelperV1Stub.java @@ -0,0 +1,218 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.protobuf.TypeRegistry; +import com.google.protos.google.cloud.binaryauthorization.v1.Service; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the ValidationHelperV1 service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonValidationHelperV1Stub extends ValidationHelperV1Stub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor< + Service.ValidateAttestationOccurrenceRequest, + Service.ValidateAttestationOccurrenceResponse> + validateAttestationOccurrenceMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.binaryauthorization.v1.ValidationHelperV1/ValidateAttestationOccurrence") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{attestor=projects/*/attestors/*}:validateAttestationOccurrence", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "attestor", request.getAttestor()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearAttestor().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser + .newBuilder() + .setDefaultInstance( + Service.ValidateAttestationOccurrenceResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable< + Service.ValidateAttestationOccurrenceRequest, + Service.ValidateAttestationOccurrenceResponse> + validateAttestationOccurrenceCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonValidationHelperV1Stub create(ValidationHelperV1StubSettings settings) + throws IOException { + return new HttpJsonValidationHelperV1Stub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonValidationHelperV1Stub create(ClientContext clientContext) + throws IOException { + return new HttpJsonValidationHelperV1Stub( + ValidationHelperV1StubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonValidationHelperV1Stub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonValidationHelperV1Stub( + ValidationHelperV1StubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonValidationHelperV1Stub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonValidationHelperV1Stub( + ValidationHelperV1StubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonValidationHelperV1CallableFactory()); + } + + /** + * Constructs an instance of HttpJsonValidationHelperV1Stub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonValidationHelperV1Stub( + ValidationHelperV1StubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings< + Service.ValidateAttestationOccurrenceRequest, + Service.ValidateAttestationOccurrenceResponse> + validateAttestationOccurrenceTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(validateAttestationOccurrenceMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.validateAttestationOccurrenceCallable = + callableFactory.createUnaryCallable( + validateAttestationOccurrenceTransportSettings, + settings.validateAttestationOccurrenceSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(validateAttestationOccurrenceMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable< + Service.ValidateAttestationOccurrenceRequest, + Service.ValidateAttestationOccurrenceResponse> + validateAttestationOccurrenceCallable() { + return validateAttestationOccurrenceCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/SystemPolicyV1StubSettings.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/SystemPolicyV1StubSettings.java index 5c459673..7989f862 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/SystemPolicyV1StubSettings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/SystemPolicyV1StubSettings.java @@ -24,6 +24,9 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; @@ -97,6 +100,11 @@ public SystemPolicyV1Stub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcSystemPolicyV1Stub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSystemPolicyV1Stub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -129,18 +137,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(SystemPolicyV1StubSettings.class)) @@ -148,11 +163,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(SystemPolicyV1StubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SystemPolicyV1StubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -230,6 +264,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .getSystemPolicySettings() diff --git a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/ValidationHelperV1StubSettings.java b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/ValidationHelperV1StubSettings.java index 27c3f45e..b73b6fb9 100644 --- a/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/ValidationHelperV1StubSettings.java +++ b/google-cloud-binary-authorization/src/main/java/com/google/protos/google/cloud/binaryauthorization/v1/stub/ValidationHelperV1StubSettings.java @@ -24,6 +24,9 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; @@ -101,6 +104,11 @@ public ValidationHelperV1Stub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcValidationHelperV1Stub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonValidationHelperV1Stub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -133,18 +141,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(ValidationHelperV1StubSettings.class)) @@ -152,11 +167,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ValidationHelperV1StubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ValidationHelperV1StubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -239,6 +273,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .validateAttestationOccurrenceSettings() diff --git a/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1ClientHttpJsonTest.java b/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1ClientHttpJsonTest.java new file mode 100644 index 00000000..baa6615d --- /dev/null +++ b/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/BinauthzManagementServiceV1Beta1ClientHttpJsonTest.java @@ -0,0 +1,687 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1; + +import static com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client.ListAttestorsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.binaryauthorization.v1beta1.stub.HttpJsonBinauthzManagementServiceV1Beta1Stub; +import com.google.common.collect.Lists; +import com.google.protobuf.Empty; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class BinauthzManagementServiceV1Beta1ClientHttpJsonTest { + private static MockHttpService mockService; + private static BinauthzManagementServiceV1Beta1Client client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonBinauthzManagementServiceV1Beta1Stub.getMethodDescriptors(), + BinauthzManagementServiceV1Beta1Settings.getDefaultEndpoint()); + BinauthzManagementServiceV1Beta1Settings settings = + BinauthzManagementServiceV1Beta1Settings.newHttpJsonBuilder() + .setTransportChannelProvider( + BinauthzManagementServiceV1Beta1Settings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = BinauthzManagementServiceV1Beta1Client.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void getPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules(new HashMap()) + .putAllIstioServiceIdentityAdmissionRules(new HashMap()) + .setDefaultAdmissionRule(AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + + Policy actualResponse = client.getPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + client.getPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules(new HashMap()) + .putAllIstioServiceIdentityAdmissionRules(new HashMap()) + .setDefaultAdmissionRule(AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-415/policy"; + + Policy actualResponse = client.getPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-415/policy"; + client.getPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updatePolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules(new HashMap()) + .putAllIstioServiceIdentityAdmissionRules(new HashMap()) + .setDefaultAdmissionRule(AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + Policy policy = + Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules(new HashMap()) + .putAllIstioServiceIdentityAdmissionRules(new HashMap()) + .setDefaultAdmissionRule(AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + + Policy actualResponse = client.updatePolicy(policy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updatePolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Policy policy = + Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules(new HashMap()) + .putAllIstioServiceIdentityAdmissionRules(new HashMap()) + .setDefaultAdmissionRule(AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + client.updatePolicy(policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createAttestorTest() throws Exception { + Attestor expectedResponse = + Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + String attestorId = "attestorId2055733027"; + Attestor attestor = Attestor.newBuilder().build(); + + Attestor actualResponse = client.createAttestor(parent, attestorId, attestor); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAttestorExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + String attestorId = "attestorId2055733027"; + Attestor attestor = Attestor.newBuilder().build(); + client.createAttestor(parent, attestorId, attestor); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createAttestorTest2() throws Exception { + Attestor expectedResponse = + Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + String attestorId = "attestorId2055733027"; + Attestor attestor = Attestor.newBuilder().build(); + + Attestor actualResponse = client.createAttestor(parent, attestorId, attestor); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAttestorExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2353"; + String attestorId = "attestorId2055733027"; + Attestor attestor = Attestor.newBuilder().build(); + client.createAttestor(parent, attestorId, attestor); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAttestorTest() throws Exception { + Attestor expectedResponse = + Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + + Attestor actualResponse = client.getAttestor(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAttestorExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + client.getAttestor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAttestorTest2() throws Exception { + Attestor expectedResponse = + Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2729/attestors/attestor-2729"; + + Attestor actualResponse = client.getAttestor(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAttestorExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2729/attestors/attestor-2729"; + client.getAttestor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateAttestorTest() throws Exception { + Attestor expectedResponse = + Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + Attestor attestor = + Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + + Attestor actualResponse = client.updateAttestor(attestor); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateAttestorExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Attestor attestor = + Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + client.updateAttestor(attestor); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAttestorsTest() throws Exception { + Attestor responsesElement = Attestor.newBuilder().build(); + ListAttestorsResponse expectedResponse = + ListAttestorsResponse.newBuilder() + .setNextPageToken("") + .addAllAttestors(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListAttestorsPagedResponse pagedListResponse = client.listAttestors(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAttestorsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAttestorsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + client.listAttestors(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAttestorsTest2() throws Exception { + Attestor responsesElement = Attestor.newBuilder().build(); + ListAttestorsResponse expectedResponse = + ListAttestorsResponse.newBuilder() + .setNextPageToken("") + .addAllAttestors(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + + ListAttestorsPagedResponse pagedListResponse = client.listAttestors(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAttestorsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAttestorsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2353"; + client.listAttestors(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAttestorTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + + client.deleteAttestor(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAttestorExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + client.deleteAttestor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAttestorTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2729/attestors/attestor-2729"; + + client.deleteAttestor(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAttestorExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2729/attestors/attestor-2729"; + client.deleteAttestor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1ClientHttpJsonTest.java b/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1ClientHttpJsonTest.java new file mode 100644 index 00000000..fb1cb04d --- /dev/null +++ b/google-cloud-binary-authorization/src/test/java/com/google/cloud/binaryauthorization/v1beta1/SystemPolicyV1Beta1ClientHttpJsonTest.java @@ -0,0 +1,180 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.binaryauthorization.v1beta1.stub.HttpJsonSystemPolicyV1Beta1Stub; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class SystemPolicyV1Beta1ClientHttpJsonTest { + private static MockHttpService mockService; + private static SystemPolicyV1Beta1Client client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonSystemPolicyV1Beta1Stub.getMethodDescriptors(), + SystemPolicyV1Beta1Settings.getDefaultEndpoint()); + SystemPolicyV1Beta1Settings settings = + SystemPolicyV1Beta1Settings.newHttpJsonBuilder() + .setTransportChannelProvider( + SystemPolicyV1Beta1Settings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SystemPolicyV1Beta1Client.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void getSystemPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules(new HashMap()) + .putAllIstioServiceIdentityAdmissionRules(new HashMap()) + .setDefaultAdmissionRule(AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); + + Policy actualResponse = client.getSystemPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSystemPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); + client.getSystemPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSystemPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules(new HashMap()) + .putAllIstioServiceIdentityAdmissionRules(new HashMap()) + .setDefaultAdmissionRule(AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "locations/location-9731/policy"; + + Policy actualResponse = client.getSystemPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSystemPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "locations/location-9731/policy"; + client.getSystemPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1ClientHttpJsonTest.java b/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1ClientHttpJsonTest.java new file mode 100644 index 00000000..6284517d --- /dev/null +++ b/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/BinauthzManagementServiceV1ClientHttpJsonTest.java @@ -0,0 +1,699 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1; + +import static com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client.ListAttestorsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.common.collect.Lists; +import com.google.protobuf.Empty; +import com.google.protobuf.Timestamp; +import com.google.protos.google.cloud.binaryauthorization.v1.stub.HttpJsonBinauthzManagementServiceV1Stub; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class BinauthzManagementServiceV1ClientHttpJsonTest { + private static MockHttpService mockService; + private static BinauthzManagementServiceV1Client client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonBinauthzManagementServiceV1Stub.getMethodDescriptors(), + BinauthzManagementServiceV1Settings.getDefaultEndpoint()); + BinauthzManagementServiceV1Settings settings = + BinauthzManagementServiceV1Settings.newHttpJsonBuilder() + .setTransportChannelProvider( + BinauthzManagementServiceV1Settings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = BinauthzManagementServiceV1Client.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void getPolicyTest() throws Exception { + Resources.Policy expectedResponse = + Resources.Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules( + new HashMap()) + .putAllIstioServiceIdentityAdmissionRules( + new HashMap()) + .setDefaultAdmissionRule(Resources.AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + + Resources.Policy actualResponse = client.getPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PolicyName name = PolicyName.ofProjectName("[PROJECT]"); + client.getPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPolicyTest2() throws Exception { + Resources.Policy expectedResponse = + Resources.Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules( + new HashMap()) + .putAllIstioServiceIdentityAdmissionRules( + new HashMap()) + .setDefaultAdmissionRule(Resources.AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-415/policy"; + + Resources.Policy actualResponse = client.getPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-415/policy"; + client.getPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updatePolicyTest() throws Exception { + Resources.Policy expectedResponse = + Resources.Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules( + new HashMap()) + .putAllIstioServiceIdentityAdmissionRules( + new HashMap()) + .setDefaultAdmissionRule(Resources.AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + Resources.Policy policy = + Resources.Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules( + new HashMap()) + .putAllIstioServiceIdentityAdmissionRules( + new HashMap()) + .setDefaultAdmissionRule(Resources.AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + + Resources.Policy actualResponse = client.updatePolicy(policy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updatePolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Resources.Policy policy = + Resources.Policy.newBuilder() + .setName(PolicyName.ofProjectName("[PROJECT]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns( + new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules( + new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules( + new HashMap()) + .putAllIstioServiceIdentityAdmissionRules( + new HashMap()) + .setDefaultAdmissionRule(Resources.AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + client.updatePolicy(policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createAttestorTest() throws Exception { + Resources.Attestor expectedResponse = + Resources.Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + String attestorId = "attestorId2055733027"; + Resources.Attestor attestor = Resources.Attestor.newBuilder().build(); + + Resources.Attestor actualResponse = client.createAttestor(parent, attestorId, attestor); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAttestorExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + String attestorId = "attestorId2055733027"; + Resources.Attestor attestor = Resources.Attestor.newBuilder().build(); + client.createAttestor(parent, attestorId, attestor); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createAttestorTest2() throws Exception { + Resources.Attestor expectedResponse = + Resources.Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + String attestorId = "attestorId2055733027"; + Resources.Attestor attestor = Resources.Attestor.newBuilder().build(); + + Resources.Attestor actualResponse = client.createAttestor(parent, attestorId, attestor); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAttestorExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2353"; + String attestorId = "attestorId2055733027"; + Resources.Attestor attestor = Resources.Attestor.newBuilder().build(); + client.createAttestor(parent, attestorId, attestor); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAttestorTest() throws Exception { + Resources.Attestor expectedResponse = + Resources.Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + + Resources.Attestor actualResponse = client.getAttestor(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAttestorExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + client.getAttestor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAttestorTest2() throws Exception { + Resources.Attestor expectedResponse = + Resources.Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2729/attestors/attestor-2729"; + + Resources.Attestor actualResponse = client.getAttestor(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAttestorExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2729/attestors/attestor-2729"; + client.getAttestor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateAttestorTest() throws Exception { + Resources.Attestor expectedResponse = + Resources.Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + Resources.Attestor attestor = + Resources.Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + + Resources.Attestor actualResponse = client.updateAttestor(attestor); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateAttestorExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Resources.Attestor attestor = + Resources.Attestor.newBuilder() + .setName(AttestorName.of("[PROJECT]", "[ATTESTOR]").toString()) + .setDescription("description-1724546052") + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + client.updateAttestor(attestor); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAttestorsTest() throws Exception { + Resources.Attestor responsesElement = Resources.Attestor.newBuilder().build(); + Service.ListAttestorsResponse expectedResponse = + Service.ListAttestorsResponse.newBuilder() + .setNextPageToken("") + .addAllAttestors(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListAttestorsPagedResponse pagedListResponse = client.listAttestors(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAttestorsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAttestorsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + client.listAttestors(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAttestorsTest2() throws Exception { + Resources.Attestor responsesElement = Resources.Attestor.newBuilder().build(); + Service.ListAttestorsResponse expectedResponse = + Service.ListAttestorsResponse.newBuilder() + .setNextPageToken("") + .addAllAttestors(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + + ListAttestorsPagedResponse pagedListResponse = client.listAttestors(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAttestorsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAttestorsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2353"; + client.listAttestors(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAttestorTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + + client.deleteAttestor(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAttestorExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AttestorName name = AttestorName.of("[PROJECT]", "[ATTESTOR]"); + client.deleteAttestor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAttestorTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2729/attestors/attestor-2729"; + + client.deleteAttestor(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAttestorExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2729/attestors/attestor-2729"; + client.deleteAttestor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1ClientHttpJsonTest.java b/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1ClientHttpJsonTest.java new file mode 100644 index 00000000..da870efb --- /dev/null +++ b/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/SystemPolicyV1ClientHttpJsonTest.java @@ -0,0 +1,184 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.protobuf.Timestamp; +import com.google.protos.google.cloud.binaryauthorization.v1.stub.HttpJsonSystemPolicyV1Stub; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class SystemPolicyV1ClientHttpJsonTest { + private static MockHttpService mockService; + private static SystemPolicyV1Client client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonSystemPolicyV1Stub.getMethodDescriptors(), + SystemPolicyV1Settings.getDefaultEndpoint()); + SystemPolicyV1Settings settings = + SystemPolicyV1Settings.newHttpJsonBuilder() + .setTransportChannelProvider( + SystemPolicyV1Settings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SystemPolicyV1Client.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void getSystemPolicyTest() throws Exception { + Resources.Policy expectedResponse = + Resources.Policy.newBuilder() + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules( + new HashMap()) + .putAllIstioServiceIdentityAdmissionRules( + new HashMap()) + .setDefaultAdmissionRule(Resources.AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); + + Resources.Policy actualResponse = client.getSystemPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSystemPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PolicyName name = PolicyName.ofLocationName("[LOCATION]"); + client.getSystemPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSystemPolicyTest2() throws Exception { + Resources.Policy expectedResponse = + Resources.Policy.newBuilder() + .setName(PolicyName.ofLocationName("[LOCATION]").toString()) + .setDescription("description-1724546052") + .addAllAdmissionWhitelistPatterns(new ArrayList()) + .putAllClusterAdmissionRules(new HashMap()) + .putAllKubernetesNamespaceAdmissionRules(new HashMap()) + .putAllKubernetesServiceAccountAdmissionRules( + new HashMap()) + .putAllIstioServiceIdentityAdmissionRules( + new HashMap()) + .setDefaultAdmissionRule(Resources.AdmissionRule.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "locations/location-9731/policy"; + + Resources.Policy actualResponse = client.getSystemPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSystemPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "locations/location-9731/policy"; + client.getSystemPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1ClientHttpJsonTest.java b/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1ClientHttpJsonTest.java new file mode 100644 index 00000000..52258265 --- /dev/null +++ b/google-cloud-binary-authorization/src/test/java/com/google/protos/google/cloud/binaryauthorization/v1/ValidationHelperV1ClientHttpJsonTest.java @@ -0,0 +1,131 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.protos.google.cloud.binaryauthorization.v1.stub.HttpJsonValidationHelperV1Stub; +import io.grafeas.v1.AttestationOccurrence; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ValidationHelperV1ClientHttpJsonTest { + private static MockHttpService mockService; + private static ValidationHelperV1Client client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonValidationHelperV1Stub.getMethodDescriptors(), + ValidationHelperV1Settings.getDefaultEndpoint()); + ValidationHelperV1Settings settings = + ValidationHelperV1Settings.newHttpJsonBuilder() + .setTransportChannelProvider( + ValidationHelperV1Settings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ValidationHelperV1Client.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void validateAttestationOccurrenceTest() throws Exception { + Service.ValidateAttestationOccurrenceResponse expectedResponse = + Service.ValidateAttestationOccurrenceResponse.newBuilder() + .setDenialReason("denialReason-966999989") + .build(); + mockService.addResponse(expectedResponse); + + Service.ValidateAttestationOccurrenceRequest request = + Service.ValidateAttestationOccurrenceRequest.newBuilder() + .setAttestor("projects/project-380/attestors/attestor-380") + .setAttestation(AttestationOccurrence.newBuilder().build()) + .setOccurrenceNote("occurrenceNote1722072419") + .setOccurrenceResourceUri("occurrenceResourceUri1001424877") + .build(); + + Service.ValidateAttestationOccurrenceResponse actualResponse = + client.validateAttestationOccurrence(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void validateAttestationOccurrenceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Service.ValidateAttestationOccurrenceRequest request = + Service.ValidateAttestationOccurrenceRequest.newBuilder() + .setAttestor("projects/project-380/attestors/attestor-380") + .setAttestation(AttestationOccurrence.newBuilder().build()) + .setOccurrenceNote("occurrenceNote1722072419") + .setOccurrenceResourceUri("occurrenceResourceUri1001424877") + .build(); + client.validateAttestationOccurrence(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/owlbot.py b/owlbot.py index 77243461..27106a3c 100644 --- a/owlbot.py +++ b/owlbot.py @@ -21,4 +21,6 @@ s.move(library) s.remove_staging_dirs() -java.common_templates() \ No newline at end of file +java.common_templates(excludes=[ + '.kokoro/dependencies.sh', + ]) \ No newline at end of file diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..8d448f7a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/binauthzmanagementservicev1beta1client/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_create_setcredentialsprovider1_sync] +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1Settings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1Beta1Settings binauthzManagementServiceV1Beta1Settings = + BinauthzManagementServiceV1Beta1Settings.newBuilder() + .setTransportChannelProvider( + BinauthzManagementServiceV1Beta1Settings.defaultHttpJsonTransportProviderBuilder() + .build()) + .build(); + BinauthzManagementServiceV1Beta1Client binauthzManagementServiceV1Beta1Client = + BinauthzManagementServiceV1Beta1Client.create(binauthzManagementServiceV1Beta1Settings); + } +} +// [END binaryauthorization_v1beta1_generated_binauthzmanagementservicev1beta1client_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..7cbf949f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/binaryauthorization/v1beta1/systempolicyv1beta1client/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.binaryauthorization.v1beta1.samples; + +// [START binaryauthorization_v1beta1_generated_systempolicyv1beta1client_create_setcredentialsprovider1_sync] +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Client; +import com.google.cloud.binaryauthorization.v1beta1.SystemPolicyV1Beta1Settings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1Beta1Settings systemPolicyV1Beta1Settings = + SystemPolicyV1Beta1Settings.newBuilder() + .setTransportChannelProvider( + SystemPolicyV1Beta1Settings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + SystemPolicyV1Beta1Client systemPolicyV1Beta1Client = + SystemPolicyV1Beta1Client.create(systemPolicyV1Beta1Settings); + } +} +// [END binaryauthorization_v1beta1_generated_systempolicyv1beta1client_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..3c5264bb --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/binauthzmanagementservicev1client/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_binauthzmanagementservicev1client_create_setcredentialsprovider1_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Settings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + BinauthzManagementServiceV1Settings binauthzManagementServiceV1Settings = + BinauthzManagementServiceV1Settings.newBuilder() + .setTransportChannelProvider( + BinauthzManagementServiceV1Settings.defaultHttpJsonTransportProviderBuilder() + .build()) + .build(); + BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = + BinauthzManagementServiceV1Client.create(binauthzManagementServiceV1Settings); + } +} +// [END binaryauthorization_v1_generated_binauthzmanagementservicev1client_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..c89e1b96 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/systempolicyv1client/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_systempolicyv1client_create_setcredentialsprovider1_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1Settings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SystemPolicyV1Settings systemPolicyV1Settings = + SystemPolicyV1Settings.newBuilder() + .setTransportChannelProvider( + SystemPolicyV1Settings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + SystemPolicyV1Client systemPolicyV1Client = SystemPolicyV1Client.create(systemPolicyV1Settings); + } +} +// [END binaryauthorization_v1_generated_systempolicyv1client_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..20675342 --- /dev/null +++ b/samples/snippets/generated/com/google/protos/google/cloud/binaryauthorization/v1/validationhelperv1client/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.protos.google.cloud.binaryauthorization.v1.samples; + +// [START binaryauthorization_v1_generated_validationhelperv1client_create_setcredentialsprovider1_sync] +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Client; +import com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1Settings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ValidationHelperV1Settings validationHelperV1Settings = + ValidationHelperV1Settings.newBuilder() + .setTransportChannelProvider( + ValidationHelperV1Settings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + ValidationHelperV1Client validationHelperV1Client = + ValidationHelperV1Client.create(validationHelperV1Settings); + } +} +// [END binaryauthorization_v1_generated_validationhelperv1client_create_setcredentialsprovider1_sync] From e80b0a710d3d3710ab377d28d8cc68cb32b16223 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 1 Jul 2022 10:34:19 -0400 Subject: [PATCH 13/14] ci: removing clirr from required checks (#234) Making CLIRR not required. The version bumps are now controlled by the Release Please and OwlBot. The CL authors create appropriate change description to control major version bumps. --- .github/sync-repo-settings.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 6f09d695..dd5626f3 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -11,7 +11,6 @@ branchProtectionRules: - dependencies (8) - dependencies (11) - lint - - clirr - units (8) - units (11) - 'Kokoro - Test: Integration' @@ -26,7 +25,6 @@ branchProtectionRules: - dependencies (8) - dependencies (11) - lint - - clirr - units (7) - units (8) - units (11) From cb08e2cfb96e56e7e456e28929ae6109fd89c3ed Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 1 Jul 2022 17:32:11 +0000 Subject: [PATCH 14/14] chore(main): release 1.2.0 (#228) :robot: I have created a release *beep* *boop* --- ## [1.2.0](https://github.com/googleapis/java-binary-authorization/compare/v1.1.1...v1.2.0) (2022-07-01) ### Features * Adds a pod_namespace field to pod events created by Continuous Validation, to distinguish pods with the same name that run in different namespaces ([#227](https://github.com/googleapis/java-binary-authorization/issues/227)) ([4755125](https://github.com/googleapis/java-binary-authorization/commit/4755125936bcf5931ea01e01e9fc6af3a7c1c309)) * Enable REST transport for most of Java and Go clients ([#230](https://github.com/googleapis/java-binary-authorization/issues/230)) ([ca507e6](https://github.com/googleapis/java-binary-authorization/commit/ca507e6aca8a35467d95038d7554c0c5f357315a)) ### Dependencies * update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#229](https://github.com/googleapis/java-binary-authorization/issues/229)) ([c5d1f10](https://github.com/googleapis/java-binary-authorization/commit/c5d1f103196a5d538e115d48f3873901fa0a065a)) * update dependency io.grafeas:grafeas to v2.3.1 ([#231](https://github.com/googleapis/java-binary-authorization/issues/231)) ([7374554](https://github.com/googleapis/java-binary-authorization/commit/73745540d6187af67f8fdd1029485a860c45d7a7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 14 ++++++++++++++ google-cloud-binary-authorization-bom/pom.xml | 12 ++++++------ google-cloud-binary-authorization/pom.xml | 4 ++-- grpc-google-cloud-binary-authorization-v1/pom.xml | 4 ++-- .../pom.xml | 4 ++-- pom.xml | 12 ++++++------ proto-google-cloud-binary-authorization-v1/pom.xml | 4 ++-- .../pom.xml | 4 ++-- versions.txt | 10 +++++----- 9 files changed, 41 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2515b5cb..b89b5b49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.2.0](https://github.com/googleapis/java-binary-authorization/compare/v1.1.1...v1.2.0) (2022-07-01) + + +### Features + +* Adds a pod_namespace field to pod events created by Continuous Validation, to distinguish pods with the same name that run in different namespaces ([#227](https://github.com/googleapis/java-binary-authorization/issues/227)) ([4755125](https://github.com/googleapis/java-binary-authorization/commit/4755125936bcf5931ea01e01e9fc6af3a7c1c309)) +* Enable REST transport for most of Java and Go clients ([#230](https://github.com/googleapis/java-binary-authorization/issues/230)) ([ca507e6](https://github.com/googleapis/java-binary-authorization/commit/ca507e6aca8a35467d95038d7554c0c5f357315a)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#229](https://github.com/googleapis/java-binary-authorization/issues/229)) ([c5d1f10](https://github.com/googleapis/java-binary-authorization/commit/c5d1f103196a5d538e115d48f3873901fa0a065a)) +* update dependency io.grafeas:grafeas to v2.3.1 ([#231](https://github.com/googleapis/java-binary-authorization/issues/231)) ([7374554](https://github.com/googleapis/java-binary-authorization/commit/73745540d6187af67f8fdd1029485a860c45d7a7)) + ### [1.1.1](https://github.com/googleapis/java-binary-authorization/compare/v1.1.0...v1.1.1) (2022-05-26) diff --git a/google-cloud-binary-authorization-bom/pom.xml b/google-cloud-binary-authorization-bom/pom.xml index 09588b87..12a5f7f6 100644 --- a/google-cloud-binary-authorization-bom/pom.xml +++ b/google-cloud-binary-authorization-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-binary-authorization-bom - 1.1.2-SNAPSHOT + 1.2.0 pom com.google.cloud @@ -56,27 +56,27 @@ com.google.cloud google-cloud-binary-authorization - 1.1.2-SNAPSHOT + 1.2.0 com.google.api.grpc grpc-google-cloud-binary-authorization-v1beta1 - 0.6.2-SNAPSHOT + 0.7.0 com.google.api.grpc grpc-google-cloud-binary-authorization-v1 - 1.1.2-SNAPSHOT + 1.2.0 com.google.api.grpc proto-google-cloud-binary-authorization-v1beta1 - 0.6.2-SNAPSHOT + 0.7.0 com.google.api.grpc proto-google-cloud-binary-authorization-v1 - 1.1.2-SNAPSHOT + 1.2.0 diff --git a/google-cloud-binary-authorization/pom.xml b/google-cloud-binary-authorization/pom.xml index ae74ec9d..233252ae 100644 --- a/google-cloud-binary-authorization/pom.xml +++ b/google-cloud-binary-authorization/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-binary-authorization - 1.1.2-SNAPSHOT + 1.2.0 jar Google Binary Authorization https://github.com/googleapis/java-binary-authorization @@ -11,7 +11,7 @@ com.google.cloud google-cloud-binary-authorization-parent - 1.1.2-SNAPSHOT + 1.2.0 google-cloud-binary-authorization diff --git a/grpc-google-cloud-binary-authorization-v1/pom.xml b/grpc-google-cloud-binary-authorization-v1/pom.xml index f6818d00..41a44572 100644 --- a/grpc-google-cloud-binary-authorization-v1/pom.xml +++ b/grpc-google-cloud-binary-authorization-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-binary-authorization-v1 - 1.1.2-SNAPSHOT + 1.2.0 grpc-google-cloud-binary-authorization-v1 GRPC library for google-cloud-binary-authorization com.google.cloud google-cloud-binary-authorization-parent - 1.1.2-SNAPSHOT + 1.2.0 diff --git a/grpc-google-cloud-binary-authorization-v1beta1/pom.xml b/grpc-google-cloud-binary-authorization-v1beta1/pom.xml index 14db1ddc..7ad7d7e5 100644 --- a/grpc-google-cloud-binary-authorization-v1beta1/pom.xml +++ b/grpc-google-cloud-binary-authorization-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-binary-authorization-v1beta1 - 0.6.2-SNAPSHOT + 0.7.0 grpc-google-cloud-binary-authorization-v1beta1 GRPC library for google-cloud-binary-authorization com.google.cloud google-cloud-binary-authorization-parent - 1.1.2-SNAPSHOT + 1.2.0 diff --git a/pom.xml b/pom.xml index 341a0850..4c741d2f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-binary-authorization-parent pom - 1.1.2-SNAPSHOT + 1.2.0 Google Binary Authorization Parent https://github.com/googleapis/java-binary-authorization @@ -60,27 +60,27 @@ com.google.cloud google-cloud-binary-authorization - 1.1.2-SNAPSHOT + 1.2.0 com.google.api.grpc proto-google-cloud-binary-authorization-v1 - 1.1.2-SNAPSHOT + 1.2.0 com.google.api.grpc grpc-google-cloud-binary-authorization-v1 - 1.1.2-SNAPSHOT + 1.2.0 com.google.api.grpc grpc-google-cloud-binary-authorization-v1beta1 - 0.6.2-SNAPSHOT + 0.7.0 com.google.api.grpc proto-google-cloud-binary-authorization-v1beta1 - 0.6.2-SNAPSHOT + 0.7.0 diff --git a/proto-google-cloud-binary-authorization-v1/pom.xml b/proto-google-cloud-binary-authorization-v1/pom.xml index ad4c99e9..3fba69a9 100644 --- a/proto-google-cloud-binary-authorization-v1/pom.xml +++ b/proto-google-cloud-binary-authorization-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-binary-authorization-v1 - 1.1.2-SNAPSHOT + 1.2.0 proto-google-cloud-binary-authorization-v1 Proto library for google-cloud-binary-authorization com.google.cloud google-cloud-binary-authorization-parent - 1.1.2-SNAPSHOT + 1.2.0 diff --git a/proto-google-cloud-binary-authorization-v1beta1/pom.xml b/proto-google-cloud-binary-authorization-v1beta1/pom.xml index 1da4d587..c05a06a7 100644 --- a/proto-google-cloud-binary-authorization-v1beta1/pom.xml +++ b/proto-google-cloud-binary-authorization-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-binary-authorization-v1beta1 - 0.6.2-SNAPSHOT + 0.7.0 proto-google-cloud-binary-authorization-v1beta1 Proto library for google-cloud-binary-authorization com.google.cloud google-cloud-binary-authorization-parent - 1.1.2-SNAPSHOT + 1.2.0 diff --git a/versions.txt b/versions.txt index 967742ed..d19e67ba 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -google-cloud-binary-authorization:1.1.1:1.1.2-SNAPSHOT -grpc-google-cloud-binary-authorization-v1beta1:0.6.1:0.6.2-SNAPSHOT -grpc-google-cloud-binary-authorization-v1:1.1.1:1.1.2-SNAPSHOT -proto-google-cloud-binary-authorization-v1beta1:0.6.1:0.6.2-SNAPSHOT -proto-google-cloud-binary-authorization-v1:1.1.1:1.1.2-SNAPSHOT +google-cloud-binary-authorization:1.2.0:1.2.0 +grpc-google-cloud-binary-authorization-v1beta1:0.7.0:0.7.0 +grpc-google-cloud-binary-authorization-v1:1.2.0:1.2.0 +proto-google-cloud-binary-authorization-v1beta1:0.7.0:0.7.0 +proto-google-cloud-binary-authorization-v1:1.2.0:1.2.0