From 0f141fcd813dccb05b790ee5ceee54a74966a72e Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 23:10:21 +0000 Subject: [PATCH 01/14] chore(main): release 2.4.4-SNAPSHOT (#480) :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-os-config-bom/pom.xml | 16 ++++++++-------- google-cloud-os-config/pom.xml | 4 ++-- grpc-google-cloud-os-config-v1/pom.xml | 4 ++-- grpc-google-cloud-os-config-v1alpha/pom.xml | 4 ++-- grpc-google-cloud-os-config-v1beta/pom.xml | 4 ++-- pom.xml | 16 ++++++++-------- proto-google-cloud-os-config-v1/pom.xml | 4 ++-- proto-google-cloud-os-config-v1alpha/pom.xml | 4 ++-- proto-google-cloud-os-config-v1beta/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 14 +++++++------- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/google-cloud-os-config-bom/pom.xml b/google-cloud-os-config-bom/pom.xml index aec63925..ebc884a5 100644 --- a/google-cloud-os-config-bom/pom.xml +++ b/google-cloud-os-config-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-os-config-bom - 2.4.3 + 2.4.4-SNAPSHOT pom com.google.cloud @@ -52,37 +52,37 @@ com.google.cloud google-cloud-os-config - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc grpc-google-cloud-os-config-v1 - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc grpc-google-cloud-os-config-v1beta - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc grpc-google-cloud-os-config-v1alpha - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc proto-google-cloud-os-config-v1 - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc proto-google-cloud-os-config-v1alpha - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc proto-google-cloud-os-config-v1beta - 2.4.3 + 2.4.4-SNAPSHOT diff --git a/google-cloud-os-config/pom.xml b/google-cloud-os-config/pom.xml index 52e97711..06a53b8c 100644 --- a/google-cloud-os-config/pom.xml +++ b/google-cloud-os-config/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-os-config - 2.4.3 + 2.4.4-SNAPSHOT jar Google OS Config API https://github.com/googleapis/java-os-config @@ -11,7 +11,7 @@ com.google.cloud google-cloud-os-config-parent - 2.4.3 + 2.4.4-SNAPSHOT google-cloud-os-config diff --git a/grpc-google-cloud-os-config-v1/pom.xml b/grpc-google-cloud-os-config-v1/pom.xml index 4fb70bf9..5e04b4a8 100644 --- a/grpc-google-cloud-os-config-v1/pom.xml +++ b/grpc-google-cloud-os-config-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-os-config-v1 - 2.4.3 + 2.4.4-SNAPSHOT grpc-google-cloud-os-config-v1 GRPC library for grpc-google-cloud-os-config-v1 com.google.cloud google-cloud-os-config-parent - 2.4.3 + 2.4.4-SNAPSHOT diff --git a/grpc-google-cloud-os-config-v1alpha/pom.xml b/grpc-google-cloud-os-config-v1alpha/pom.xml index a535213f..38eaf3c4 100644 --- a/grpc-google-cloud-os-config-v1alpha/pom.xml +++ b/grpc-google-cloud-os-config-v1alpha/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-os-config-v1alpha - 2.4.3 + 2.4.4-SNAPSHOT grpc-google-cloud-os-config-v1alpha GRPC library for google-cloud-os-config com.google.cloud google-cloud-os-config-parent - 2.4.3 + 2.4.4-SNAPSHOT diff --git a/grpc-google-cloud-os-config-v1beta/pom.xml b/grpc-google-cloud-os-config-v1beta/pom.xml index 743cf3e1..00d71ee9 100644 --- a/grpc-google-cloud-os-config-v1beta/pom.xml +++ b/grpc-google-cloud-os-config-v1beta/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-os-config-v1beta - 2.4.3 + 2.4.4-SNAPSHOT grpc-google-cloud-os-config-v1beta GRPC library for google-cloud-os-config com.google.cloud google-cloud-os-config-parent - 2.4.3 + 2.4.4-SNAPSHOT diff --git a/pom.xml b/pom.xml index 6b4057b2..9572698a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-os-config-parent pom - 2.4.3 + 2.4.4-SNAPSHOT Google OS Config API Parent https://github.com/googleapis/java-os-config @@ -61,37 +61,37 @@ com.google.cloud google-cloud-os-config - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc proto-google-cloud-os-config-v1beta - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc proto-google-cloud-os-config-v1alpha - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc grpc-google-cloud-os-config-v1alpha - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc grpc-google-cloud-os-config-v1beta - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc proto-google-cloud-os-config-v1 - 2.4.3 + 2.4.4-SNAPSHOT com.google.api.grpc grpc-google-cloud-os-config-v1 - 2.4.3 + 2.4.4-SNAPSHOT diff --git a/proto-google-cloud-os-config-v1/pom.xml b/proto-google-cloud-os-config-v1/pom.xml index 73596748..487b1fd9 100644 --- a/proto-google-cloud-os-config-v1/pom.xml +++ b/proto-google-cloud-os-config-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-os-config-v1 - 2.4.3 + 2.4.4-SNAPSHOT proto-google-cloud-os-config-v1 PROTO library for proto-google-cloud-os-config-v1 com.google.cloud google-cloud-os-config-parent - 2.4.3 + 2.4.4-SNAPSHOT diff --git a/proto-google-cloud-os-config-v1alpha/pom.xml b/proto-google-cloud-os-config-v1alpha/pom.xml index 4142ad5d..e29f99db 100644 --- a/proto-google-cloud-os-config-v1alpha/pom.xml +++ b/proto-google-cloud-os-config-v1alpha/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-os-config-v1alpha - 2.4.3 + 2.4.4-SNAPSHOT proto-google-cloud-os-config-v1alpha Proto library for google-cloud-os-config com.google.cloud google-cloud-os-config-parent - 2.4.3 + 2.4.4-SNAPSHOT diff --git a/proto-google-cloud-os-config-v1beta/pom.xml b/proto-google-cloud-os-config-v1beta/pom.xml index 39a0684c..0ba89e08 100644 --- a/proto-google-cloud-os-config-v1beta/pom.xml +++ b/proto-google-cloud-os-config-v1beta/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-os-config-v1beta - 2.4.3 + 2.4.4-SNAPSHOT proto-google-cloud-os-config-v1beta Proto library for google-cloud-os-config com.google.cloud google-cloud-os-config-parent - 2.4.3 + 2.4.4-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 63810638..eef0bc7a 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-os-config - 2.4.3 + 2.4.4-SNAPSHOT diff --git a/versions.txt b/versions.txt index b473bd93..7a107d94 100644 --- a/versions.txt +++ b/versions.txt @@ -1,10 +1,10 @@ # Format: # module:released-version:current-version -google-cloud-os-config:2.4.3:2.4.3 -grpc-google-cloud-os-config-v1:2.4.3:2.4.3 -grpc-google-cloud-os-config-v1beta:2.4.3:2.4.3 -grpc-google-cloud-os-config-v1alpha:2.4.3:2.4.3 -proto-google-cloud-os-config-v1:2.4.3:2.4.3 -proto-google-cloud-os-config-v1alpha:2.4.3:2.4.3 -proto-google-cloud-os-config-v1beta:2.4.3:2.4.3 +google-cloud-os-config:2.4.3:2.4.4-SNAPSHOT +grpc-google-cloud-os-config-v1:2.4.3:2.4.4-SNAPSHOT +grpc-google-cloud-os-config-v1beta:2.4.3:2.4.4-SNAPSHOT +grpc-google-cloud-os-config-v1alpha:2.4.3:2.4.4-SNAPSHOT +proto-google-cloud-os-config-v1:2.4.3:2.4.4-SNAPSHOT +proto-google-cloud-os-config-v1alpha:2.4.3:2.4.4-SNAPSHOT +proto-google-cloud-os-config-v1beta:2.4.3:2.4.4-SNAPSHOT From 461e3a89c6eb16dedefc8b84e6f07babb489cb73 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 20 May 2022 05:52:19 +0200 Subject: [PATCH 02/14] chore(deps): update dependency com.google.cloud:google-cloud-os-config to v2.4.3 (#481) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource 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-os-config](https://togithub.com/googleapis/java-os-config) | `2.4.2` -> `2.4.3` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-os-config/2.4.3/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-os-config/2.4.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-os-config/2.4.3/compatibility-slim/2.4.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-os-config/2.4.3/confidence-slim/2.4.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/java-os-config ### [`v2.4.3`](https://togithub.com/googleapis/java-os-config/blob/HEAD/CHANGELOG.md#​243-httpsgithubcomgoogleapisjava-os-configcomparev242v243-2022-05-19) [Compare Source](https://togithub.com/googleapis/java-os-config/compare/v2.4.2...v2.4.3)
--- ### Configuration 📅 **Schedule**: 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 [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-os-config). --- README.md | 6 +++--- samples/snippets/pom.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a602f55f..128e0b4e 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-os-config - 2.4.2 + 2.4.3 ``` If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-os-config:2.4.2' +implementation 'com.google.cloud:google-cloud-os-config:2.4.3' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-os-config" % "2.4.2" +libraryDependencies += "com.google.cloud" % "google-cloud-os-config" % "2.4.3" ``` ## Authentication diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 1a6cf0d1..983af3f6 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-os-config - 2.4.2 + 2.4.3 From 0891ed6362b9592b7fcca6bfd9299e24653a9f3d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 26 May 2022 13:25:32 -0400 Subject: [PATCH 03/14] feat: add build scripts for native image testing in Java 17 (#1440) (#477) Source-Link: https://github.com/googleapis/synthtool/commit/505ce5a7edb58bf6d9d4de10b4bb4e81000ae324 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:2567a120ce90fadb6201999b87d649d9f67459de28815ad239bce9ebfaa18a74 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 +-- .kokoro/build.sh | 5 ++++ .kokoro/presubmit/graalvm-native-17.cfg | 33 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 .kokoro/presubmit/graalvm-native-17.cfg diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f60d7749..a79f0627 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:fc52b202aa298a50a12c64efd04fea3884d867947effe2fa85382a246c09e813 -# created: 2022-04-06T16:30:03.627422514Z + digest: sha256:2567a120ce90fadb6201999b87d649d9f67459de28815ad239bce9ebfaa18a74 +# created: 2022-05-19T15:12:45.278246753Z diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 06fb8017..2ee9ea2f 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -74,6 +74,11 @@ graalvm) mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test RETURN_CODE=$? ;; +graalvm17) + # Run Unit and Integration Tests with Native Image + mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test + RETURN_CODE=$? + ;; samples) SAMPLES_DIR=samples # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg new file mode 100644 index 00000000..a3f7fb9d --- /dev/null +++ b/.kokoro/presubmit/graalvm-native-17.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17" +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm17" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} \ No newline at end of file From adc1a7b5c2084e44ed49c8f4f9408e49fb2214c0 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 04:12:20 +0000 Subject: [PATCH 04/14] chore(deps): upgrade gapic-generator-java to 2.8.0 and update gax-java to 2.18.1 (#482) - [ ] 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 --- .../com/google/cloud/osconfig/v1/OsConfigServiceClient.java | 4 ---- .../google/cloud/osconfig/v1/OsConfigZonalServiceClient.java | 4 ---- .../cloud/osconfig/v1/stub/OsConfigServiceStubSettings.java | 1 - .../osconfig/v1/stub/OsConfigZonalServiceStubSettings.java | 1 - .../cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java | 3 --- .../v1alpha/stub/OsConfigZonalServiceStubSettings.java | 1 - .../google/cloud/osconfig/v1beta/OsConfigServiceClient.java | 3 --- .../osconfig/v1beta/stub/OsConfigServiceStubSettings.java | 1 - 8 files changed, 18 deletions(-) diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java index 79ba3983..85807324 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.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; @@ -140,7 +139,6 @@ public static final OsConfigServiceClient create(OsConfigServiceSettings setting * Constructs an instance of OsConfigServiceClient, using the given stub for making calls. This is * for advanced usage - prefer using create(OsConfigServiceSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final OsConfigServiceClient create(OsConfigServiceStub stub) { return new OsConfigServiceClient(stub); } @@ -155,7 +153,6 @@ protected OsConfigServiceClient(OsConfigServiceSettings settings) throws IOExcep this.stub = ((OsConfigServiceStubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected OsConfigServiceClient(OsConfigServiceStub stub) { this.settings = null; this.stub = stub; @@ -165,7 +162,6 @@ public final OsConfigServiceSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public OsConfigServiceStub getStub() { return stub; } diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java index 6f927c3b..ac8d0d11 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.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.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; @@ -137,7 +136,6 @@ public static final OsConfigZonalServiceClient create(OsConfigZonalServiceSettin * Constructs an instance of OsConfigZonalServiceClient, using the given stub for making calls. * This is for advanced usage - prefer using create(OsConfigZonalServiceSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final OsConfigZonalServiceClient create(OsConfigZonalServiceStub stub) { return new OsConfigZonalServiceClient(stub); } @@ -153,7 +151,6 @@ protected OsConfigZonalServiceClient(OsConfigZonalServiceSettings settings) thro this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected OsConfigZonalServiceClient(OsConfigZonalServiceStub stub) { this.settings = null; this.stub = stub; @@ -164,7 +161,6 @@ public final OsConfigZonalServiceSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public OsConfigZonalServiceStub getStub() { return stub; } diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigServiceStubSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigServiceStubSettings.java index f0cc2542..1b9e64cf 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigServiceStubSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigServiceStubSettings.java @@ -449,7 +449,6 @@ public UnaryCallSettings getPa return resumePatchDeploymentSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public OsConfigServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStubSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStubSettings.java index cd142873..0b08206a 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStubSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStubSettings.java @@ -639,7 +639,6 @@ public UnaryCallSettings getInventorySettings() return listVulnerabilityReportsSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public OsConfigZonalServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java index aedc2cdf..b5190c66 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java @@ -138,7 +138,6 @@ public static final OsConfigZonalServiceClient create(OsConfigZonalServiceSettin * Constructs an instance of OsConfigZonalServiceClient, using the given stub for making calls. * This is for advanced usage - prefer using create(OsConfigZonalServiceSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final OsConfigZonalServiceClient create(OsConfigZonalServiceStub stub) { return new OsConfigZonalServiceClient(stub); } @@ -154,7 +153,6 @@ protected OsConfigZonalServiceClient(OsConfigZonalServiceSettings settings) thro this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected OsConfigZonalServiceClient(OsConfigZonalServiceStub stub) { this.settings = null; this.stub = stub; @@ -165,7 +163,6 @@ public final OsConfigZonalServiceSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public OsConfigZonalServiceStub getStub() { return stub; } diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStubSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStubSettings.java index 10d76ffa..16e8b622 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStubSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStubSettings.java @@ -760,7 +760,6 @@ public UnaryCallSettings getInventorySettings() return listVulnerabilityReportsSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public OsConfigZonalServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java index 37109aa1..848bd01c 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java @@ -141,7 +141,6 @@ public static final OsConfigServiceClient create(OsConfigServiceSettings setting * Constructs an instance of OsConfigServiceClient, using the given stub for making calls. This is * for advanced usage - prefer using create(OsConfigServiceSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final OsConfigServiceClient create(OsConfigServiceStub stub) { return new OsConfigServiceClient(stub); } @@ -156,7 +155,6 @@ protected OsConfigServiceClient(OsConfigServiceSettings settings) throws IOExcep this.stub = ((OsConfigServiceStubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected OsConfigServiceClient(OsConfigServiceStub stub) { this.settings = null; this.stub = stub; @@ -166,7 +164,6 @@ public final OsConfigServiceSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public OsConfigServiceStub getStub() { return stub; } diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/OsConfigServiceStubSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/OsConfigServiceStubSettings.java index 44d93fa7..bf1745b0 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/OsConfigServiceStubSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/OsConfigServiceStubSettings.java @@ -586,7 +586,6 @@ public UnaryCallSettings getPa return lookupEffectiveGuestPolicySettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public OsConfigServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() From bf1e92409e9b1a0ce21cd7795e517dc3254dae74 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 13 Jun 2022 19:10:14 +0200 Subject: [PATCH 05/14] build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.5.0 (#487) 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/) | --- ### Release Notes
googleapis/java-shared-config ### [`v1.5.0`](https://togithub.com/googleapis/java-shared-config/blob/HEAD/CHANGELOG.md#​150-httpsgithubcomgoogleapisjava-shared-configcomparev140v150-2022-06-10) [Compare Source](https://togithub.com/googleapis/java-shared-config/compare/v1.4.0...v1.5.0) ##### Features - add build scripts for native image testing in Java 17 ([#​1440](https://togithub.com/googleapis/java-shared-config/issues/1440)) ([#​475](https://togithub.com/googleapis/java-shared-config/issues/475)) ([e4dfc1b](https://togithub.com/googleapis/java-shared-config/commit/e4dfc1ba29295158c78c8fcf94467d2a6a33538a)) - to produce Java 8 compatible bytecode when using JDK 9+ ([2468276](https://togithub.com/googleapis/java-shared-config/commit/2468276145cdfe1ca911b52f765e026e77661a09)) ##### Dependencies - update surefire.version to v3.0.0-m7 ([bbfe663](https://togithub.com/googleapis/java-shared-config/commit/bbfe66393af3e49612c9c1e4334ba39c133ea1d0))
--- ### 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-os-config). --- google-cloud-os-config-bom/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-os-config-bom/pom.xml b/google-cloud-os-config-bom/pom.xml index ebc884a5..f12491ce 100644 --- a/google-cloud-os-config-bom/pom.xml +++ b/google-cloud-os-config-bom/pom.xml @@ -8,7 +8,7 @@ com.google.cloud google-cloud-shared-config - 1.4.0 + 1.5.0 Google OS Config API BOM diff --git a/pom.xml b/pom.xml index 9572698a..6cf990f3 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 14357312b389acf7e40f07f1d3f54eae362b9aef 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:30 +0000 Subject: [PATCH 06/14] chore: Integrate new gapic-generator-java and rules_gapic (#485) - [ ] 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 --- .../osconfig/v1/OsConfigServiceClient.java | 7 ++-- .../v1/OsConfigZonalServiceClient.java | 32 +++++++++++-------- .../v1alpha/OsConfigZonalServiceClient.java | 13 ++++---- .../v1beta/OsConfigServiceClient.java | 9 +++--- .../v1/OsConfigZonalServiceClientTest.java | 8 ++--- 5 files changed, 39 insertions(+), 30 deletions(-) diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java index 85807324..107dc0c9 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java @@ -522,7 +522,7 @@ public final ListPatchJobsPagedResponse listPatchJobs(PatchJobs.ListPatchJobsReq * while (true) { * PatchJobs.ListPatchJobsResponse response = * osConfigServiceClient.listPatchJobsCallable().call(request); - * for (PatchJobs.PatchJob element : response.getResponsesList()) { + * for (PatchJobs.PatchJob element : response.getPatchJobsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -683,7 +683,8 @@ public final ListPatchJobInstanceDetailsPagedResponse listPatchJobInstanceDetail * while (true) { * PatchJobs.ListPatchJobInstanceDetailsResponse response = * osConfigServiceClient.listPatchJobInstanceDetailsCallable().call(request); - * for (PatchJobs.PatchJobInstanceDetails element : response.getResponsesList()) { + * for (PatchJobs.PatchJobInstanceDetails element : + * response.getPatchJobInstanceDetailsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1095,7 +1096,7 @@ public final ListPatchDeploymentsPagedResponse listPatchDeployments( * while (true) { * PatchDeployments.ListPatchDeploymentsResponse response = * osConfigServiceClient.listPatchDeploymentsCallable().call(request); - * for (PatchDeployments.PatchDeployment element : response.getResponsesList()) { + * for (PatchDeployments.PatchDeployment element : response.getPatchDeploymentsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java index ac8d0d11..dbcb9aef 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java @@ -833,7 +833,7 @@ public final ListOSPolicyAssignmentsPagedResponse listOSPolicyAssignments( * while (true) { * ListOSPolicyAssignmentsResponse response = * osConfigZonalServiceClient.listOSPolicyAssignmentsCallable().call(request); - * for (OSPolicyAssignment element : response.getResponsesList()) { + * for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1005,7 +1005,7 @@ public final ListOSPolicyAssignmentRevisionsPagedResponse listOSPolicyAssignment * while (true) { * ListOSPolicyAssignmentRevisionsResponse response = * osConfigZonalServiceClient.listOSPolicyAssignmentRevisionsCallable().call(request); - * for (OSPolicyAssignment element : response.getResponsesList()) { + * for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1546,7 +1546,7 @@ public final ListOSPolicyAssignmentReportsPagedResponse listOSPolicyAssignmentRe * while (true) { * ListOSPolicyAssignmentReportsResponse response = * osConfigZonalServiceClient.listOSPolicyAssignmentReportsCallable().call(request); - * for (OSPolicyAssignmentReport element : response.getResponsesList()) { + * for (OSPolicyAssignmentReport element : response.getOsPolicyAssignmentReportsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1690,7 +1690,7 @@ public final UnaryCallable getInventoryCallable( * try (OsConfigZonalServiceClient osConfigZonalServiceClient = * OsConfigZonalServiceClient.create()) { * InstanceName parent = - * InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]"); + * InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); * for (Inventory element : osConfigZonalServiceClient.listInventories(parent).iterateAll()) { * // doThingsWith(element); * } @@ -1753,7 +1753,8 @@ public final ListInventoriesPagedResponse listInventories(String parent) { * ListInventoriesRequest request = * ListInventoriesRequest.newBuilder() * .setParent( - * InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]") + * InstanceName.ofProjectLocationInstanceName( + * "[PROJECT]", "[LOCATION]", "[INSTANCE]") * .toString()) * .setView(InventoryView.forNumber(0)) * .setPageSize(883849137) @@ -1787,7 +1788,8 @@ public final ListInventoriesPagedResponse listInventories(ListInventoriesRequest * ListInventoriesRequest request = * ListInventoriesRequest.newBuilder() * .setParent( - * InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]") + * InstanceName.ofProjectLocationInstanceName( + * "[PROJECT]", "[LOCATION]", "[INSTANCE]") * .toString()) * .setView(InventoryView.forNumber(0)) * .setPageSize(883849137) @@ -1822,7 +1824,8 @@ public final ListInventoriesPagedResponse listInventories(ListInventoriesRequest * ListInventoriesRequest request = * ListInventoriesRequest.newBuilder() * .setParent( - * InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]") + * InstanceName.ofProjectLocationInstanceName( + * "[PROJECT]", "[LOCATION]", "[INSTANCE]") * .toString()) * .setView(InventoryView.forNumber(0)) * .setPageSize(883849137) @@ -1832,7 +1835,7 @@ public final ListInventoriesPagedResponse listInventories(ListInventoriesRequest * while (true) { * ListInventoriesResponse response = * osConfigZonalServiceClient.listInventoriesCallable().call(request); - * for (Inventory element : response.getResponsesList()) { + * for (Inventory element : response.getInventoriesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1982,7 +1985,7 @@ public final VulnerabilityReport getVulnerabilityReport(GetVulnerabilityReportRe * try (OsConfigZonalServiceClient osConfigZonalServiceClient = * OsConfigZonalServiceClient.create()) { * InstanceName parent = - * InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]"); + * InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); * for (VulnerabilityReport element : * osConfigZonalServiceClient.listVulnerabilityReports(parent).iterateAll()) { * // doThingsWith(element); @@ -2048,7 +2051,8 @@ public final ListVulnerabilityReportsPagedResponse listVulnerabilityReports(Stri * ListVulnerabilityReportsRequest request = * ListVulnerabilityReportsRequest.newBuilder() * .setParent( - * InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]") + * InstanceName.ofProjectLocationInstanceName( + * "[PROJECT]", "[LOCATION]", "[INSTANCE]") * .toString()) * .setPageSize(883849137) * .setPageToken("pageToken873572522") @@ -2083,7 +2087,8 @@ public final ListVulnerabilityReportsPagedResponse listVulnerabilityReports( * ListVulnerabilityReportsRequest request = * ListVulnerabilityReportsRequest.newBuilder() * .setParent( - * InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]") + * InstanceName.ofProjectLocationInstanceName( + * "[PROJECT]", "[LOCATION]", "[INSTANCE]") * .toString()) * .setPageSize(883849137) * .setPageToken("pageToken873572522") @@ -2117,7 +2122,8 @@ public final ListVulnerabilityReportsPagedResponse listVulnerabilityReports( * ListVulnerabilityReportsRequest request = * ListVulnerabilityReportsRequest.newBuilder() * .setParent( - * InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]") + * InstanceName.ofProjectLocationInstanceName( + * "[PROJECT]", "[LOCATION]", "[INSTANCE]") * .toString()) * .setPageSize(883849137) * .setPageToken("pageToken873572522") @@ -2126,7 +2132,7 @@ public final ListVulnerabilityReportsPagedResponse listVulnerabilityReports( * while (true) { * ListVulnerabilityReportsResponse response = * osConfigZonalServiceClient.listVulnerabilityReportsCallable().call(request); - * for (VulnerabilityReport element : response.getResponsesList()) { + * for (VulnerabilityReport element : response.getVulnerabilityReportsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java index b5190c66..1dd4b878 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java @@ -835,7 +835,7 @@ public final ListOSPolicyAssignmentsPagedResponse listOSPolicyAssignments( * while (true) { * ListOSPolicyAssignmentsResponse response = * osConfigZonalServiceClient.listOSPolicyAssignmentsCallable().call(request); - * for (OSPolicyAssignment element : response.getResponsesList()) { + * for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1007,7 +1007,7 @@ public final ListOSPolicyAssignmentRevisionsPagedResponse listOSPolicyAssignment * while (true) { * ListOSPolicyAssignmentRevisionsResponse response = * osConfigZonalServiceClient.listOSPolicyAssignmentRevisionsCallable().call(request); - * for (OSPolicyAssignment element : response.getResponsesList()) { + * for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1522,7 +1522,8 @@ public final ListInstanceOSPoliciesCompliancesPagedResponse listInstanceOSPolici * while (true) { * ListInstanceOSPoliciesCompliancesResponse response = * osConfigZonalServiceClient.listInstanceOSPoliciesCompliancesCallable().call(request); - * for (InstanceOSPoliciesCompliance element : response.getResponsesList()) { + * for (InstanceOSPoliciesCompliance element : + * response.getInstanceOsPoliciesCompliancesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1865,7 +1866,7 @@ public final ListOSPolicyAssignmentReportsPagedResponse listOSPolicyAssignmentRe * while (true) { * ListOSPolicyAssignmentReportsResponse response = * osConfigZonalServiceClient.listOSPolicyAssignmentReportsCallable().call(request); - * for (OSPolicyAssignmentReport element : response.getResponsesList()) { + * for (OSPolicyAssignmentReport element : response.getOsPolicyAssignmentReportsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -2143,7 +2144,7 @@ public final ListInventoriesPagedResponse listInventories(ListInventoriesRequest * while (true) { * ListInventoriesResponse response = * osConfigZonalServiceClient.listInventoriesCallable().call(request); - * for (Inventory element : response.getResponsesList()) { + * for (Inventory element : response.getInventoriesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -2429,7 +2430,7 @@ public final ListVulnerabilityReportsPagedResponse listVulnerabilityReports( * while (true) { * ListVulnerabilityReportsResponse response = * osConfigZonalServiceClient.listVulnerabilityReportsCallable().call(request); - * for (VulnerabilityReport element : response.getResponsesList()) { + * for (VulnerabilityReport element : response.getVulnerabilityReportsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java index 848bd01c..8e1f953a 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java @@ -410,7 +410,7 @@ public final ListPatchJobsPagedResponse listPatchJobs(PatchJobs.ListPatchJobsReq * while (true) { * PatchJobs.ListPatchJobsResponse response = * osConfigServiceClient.listPatchJobsCallable().call(request); - * for (PatchJobs.PatchJob element : response.getResponsesList()) { + * for (PatchJobs.PatchJob element : response.getPatchJobsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -540,7 +540,8 @@ public final ListPatchJobInstanceDetailsPagedResponse listPatchJobInstanceDetail * while (true) { * PatchJobs.ListPatchJobInstanceDetailsResponse response = * osConfigServiceClient.listPatchJobInstanceDetailsCallable().call(request); - * for (PatchJobs.PatchJobInstanceDetails element : response.getResponsesList()) { + * for (PatchJobs.PatchJobInstanceDetails element : + * response.getPatchJobInstanceDetailsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -748,7 +749,7 @@ public final ListPatchDeploymentsPagedResponse listPatchDeployments( * while (true) { * PatchDeployments.ListPatchDeploymentsResponse response = * osConfigServiceClient.listPatchDeploymentsCallable().call(request); - * for (PatchDeployments.PatchDeployment element : response.getResponsesList()) { + * for (PatchDeployments.PatchDeployment element : response.getPatchDeploymentsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1486,7 +1487,7 @@ public final ListGuestPoliciesPagedResponse listGuestPolicies( * while (true) { * GuestPolicies.ListGuestPoliciesResponse response = * osConfigServiceClient.listGuestPoliciesCallable().call(request); - * for (GuestPolicies.GuestPolicy element : response.getResponsesList()) { + * for (GuestPolicies.GuestPolicy element : response.getGuestPoliciesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); diff --git a/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClientTest.java b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClientTest.java index e39265d1..18a97c47 100644 --- a/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClientTest.java +++ b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClientTest.java @@ -961,7 +961,7 @@ public void listInventoriesTest() throws Exception { mockOsConfigZonalService.addResponse(expectedResponse); InstanceName parent = - InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); ListInventoriesPagedResponse pagedListResponse = client.listInventories(parent); @@ -988,7 +988,7 @@ public void listInventoriesExceptionTest() throws Exception { try { InstanceName parent = - InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); client.listInventories(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { @@ -1135,7 +1135,7 @@ public void listVulnerabilityReportsTest() throws Exception { mockOsConfigZonalService.addResponse(expectedResponse); InstanceName parent = - InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); ListVulnerabilityReportsPagedResponse pagedListResponse = client.listVulnerabilityReports(parent); @@ -1164,7 +1164,7 @@ public void listVulnerabilityReportsExceptionTest() throws Exception { try { InstanceName parent = - InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]"); + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); client.listVulnerabilityReports(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { From 2cdc87341e18b1ef34403021881acca497cbefd5 Mon Sep 17 00:00:00 2001 From: Emily Ball Date: Tue, 14 Jun 2022 21:36:26 +0000 Subject: [PATCH 07/14] chore: include generated samples dir (#486) --- .github/.OwlBot.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index 31d961ac..b11618d9 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" @@ -27,3 +28,5 @@ deep-copy-regex: dest: "/owl-bot-staging/$1/grpc-google-cloud-os-config-$1/src" - source: "/google/cloud/osconfig/(v.*)/.*-java/gapic-google-.*/src" dest: "/owl-bot-staging/$1/google-cloud-os-config/src" +- source: "/google/cloud/osconfig/(v.*)/.*-java/samples/snippets/generated" + dest: "/owl-bot-staging/$1/samples/snippets/generated" From 876c3b20dbb4d279d658dce2e27ce0459515175c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 23 Jun 2022 17:34:38 +0200 Subject: [PATCH 08/14] deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 (#488) 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-os-config). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6cf990f3..58b80a41 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ com.google.cloud google-cloud-shared-dependencies - 2.12.0 + 2.13.0 pom import From 2be3336b765ddd818093d536fe5755a00ca08b30 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 23 Jun 2022 21:32:18 +0000 Subject: [PATCH 09/14] feat: Enable REST transport for most of Java and Go clients (#489) - [ ] 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 --- google-cloud-os-config/pom.xml | 16 + .../osconfig/v1/OsConfigServiceClient.java | 15 + .../osconfig/v1/OsConfigServiceSettings.java | 23 +- .../v1/OsConfigZonalServiceClient.java | 38 +- .../v1/OsConfigZonalServiceSettings.java | 23 +- ...ttpJsonOsConfigServiceCallableFactory.java | 105 ++ .../v1/stub/HttpJsonOsConfigServiceStub.java | 930 ++++++++++ ...onOsConfigZonalServiceCallableFactory.java | 105 ++ .../HttpJsonOsConfigZonalServiceStub.java | 1004 +++++++++++ .../v1/stub/OsConfigServiceStubSettings.java | 53 +- .../v1/stub/OsConfigZonalServiceStub.java | 6 +- .../OsConfigZonalServiceStubSettings.java | 53 +- .../v1alpha/OsConfigZonalServiceClient.java | 38 +- .../v1alpha/OsConfigZonalServiceSettings.java | 23 +- ...onOsConfigZonalServiceCallableFactory.java | 105 ++ .../HttpJsonOsConfigZonalServiceStub.java | 1150 ++++++++++++ .../stub/OsConfigZonalServiceStub.java | 6 +- .../OsConfigZonalServiceStubSettings.java | 53 +- .../v1beta/OsConfigServiceClient.java | 15 + .../v1beta/OsConfigServiceSettings.java | 23 +- ...ttpJsonOsConfigServiceCallableFactory.java | 105 ++ .../stub/HttpJsonOsConfigServiceStub.java | 1311 ++++++++++++++ .../stub/OsConfigServiceStubSettings.java | 53 +- .../v1/OsConfigServiceClientHttpJsonTest.java | 1242 +++++++++++++ ...sConfigZonalServiceClientHttpJsonTest.java | 1359 ++++++++++++++ ...sConfigZonalServiceClientHttpJsonTest.java | 1576 +++++++++++++++++ .../OsConfigServiceClientHttpJsonTest.java | 1447 +++++++++++++++ .../cancelpatchjob/AsyncCancelPatchJob.java | 46 + .../cancelpatchjob/SyncCancelPatchJob.java | 42 + .../SyncCreateSetCredentialsProvider.java | 42 + .../SyncCreateSetCredentialsProvider1.java | 41 + .../create/SyncCreateSetEndpoint.java | 39 + .../AsyncCreatePatchDeployment.java | 48 + .../SyncCreatePatchDeployment.java | 45 + ...PatchdeploymentspatchdeploymentString.java | 46 + ...PatchdeploymentspatchdeploymentString.java | 46 + .../AsyncDeletePatchDeployment.java | 47 + .../SyncDeletePatchDeployment.java | 42 + ...etePatchDeploymentPatchdeploymentname.java | 39 + .../SyncDeletePatchDeploymentString.java | 38 + .../executepatchjob/AsyncExecutePatchJob.java | 54 + .../executepatchjob/SyncExecutePatchJob.java | 50 + .../AsyncGetPatchDeployment.java | 46 + .../SyncGetPatchDeployment.java | 42 + ...GetPatchDeploymentPatchdeploymentname.java | 39 + .../SyncGetPatchDeploymentString.java | 39 + .../getpatchjob/AsyncGetPatchJob.java | 46 + .../getpatchjob/SyncGetPatchJob.java | 42 + .../SyncGetPatchJobPatchjobname.java | 39 + .../getpatchjob/SyncGetPatchJobString.java | 39 + .../AsyncListPatchDeployments.java | 50 + .../AsyncListPatchDeploymentsPaged.java | 57 + .../SyncListPatchDeployments.java | 47 + .../SyncListPatchDeploymentsProjectname.java | 42 + .../SyncListPatchDeploymentsString.java | 42 + .../AsyncListPatchJobInstanceDetails.java | 51 + ...AsyncListPatchJobInstanceDetailsPaged.java | 59 + .../SyncListPatchJobInstanceDetails.java | 48 + ...stPatchJobInstanceDetailsPatchjobname.java | 42 + ...SyncListPatchJobInstanceDetailsString.java | 42 + .../listpatchjobs/AsyncListPatchJobs.java | 51 + .../AsyncListPatchJobsPaged.java | 58 + .../listpatchjobs/SyncListPatchJobs.java | 47 + .../SyncListPatchJobsProjectname.java | 41 + .../SyncListPatchJobsString.java | 41 + .../AsyncPausePatchDeployment.java | 46 + .../SyncPausePatchDeployment.java | 43 + ...usePatchDeploymentPatchdeploymentname.java | 39 + .../SyncPausePatchDeploymentString.java | 39 + .../AsyncResumePatchDeployment.java | 46 + .../SyncResumePatchDeployment.java | 43 + ...umePatchDeploymentPatchdeploymentname.java | 40 + .../SyncResumePatchDeploymentString.java | 39 + .../AsyncUpdatePatchDeployment.java | 47 + .../SyncUpdatePatchDeployment.java | 44 + ...chdeploymentspatchdeploymentFieldmask.java | 45 + .../executepatchjob/SyncExecutePatchJob.java | 46 + .../SyncCreateSetCredentialsProvider.java | 42 + .../SyncCreateSetCredentialsProvider1.java | 41 + .../create/SyncCreateSetEndpoint.java | 39 + .../AsyncCreateOSPolicyAssignment.java | 51 + .../AsyncCreateOSPolicyAssignmentLRO.java | 53 + .../SyncCreateOSPolicyAssignment.java | 47 + ...tLocationnameOspolicyassignmentString.java | 48 + ...ignmentStringOspolicyassignmentString.java | 47 + .../AsyncDeleteOSPolicyAssignment.java | 50 + .../AsyncDeleteOSPolicyAssignmentLRO.java | 53 + .../SyncDeleteOSPolicyAssignment.java | 45 + ...olicyAssignmentOspolicyassignmentname.java | 42 + .../SyncDeleteOSPolicyAssignmentString.java | 40 + .../getinventory/AsyncGetInventory.java | 50 + .../getinventory/SyncGetInventory.java | 46 + .../SyncGetInventoryInventoryname.java | 40 + .../getinventory/SyncGetInventoryString.java | 40 + .../AsyncGetOSPolicyAssignment.java | 50 + .../SyncGetOSPolicyAssignment.java | 46 + ...olicyAssignmentOspolicyassignmentname.java | 43 + .../SyncGetOSPolicyAssignmentString.java | 41 + .../AsyncGetOSPolicyAssignmentReport.java | 51 + .../SyncGetOSPolicyAssignmentReport.java | 48 + ...entReportOspolicyassignmentreportname.java | 45 + ...SyncGetOSPolicyAssignmentReportString.java | 43 + .../AsyncGetVulnerabilityReport.java | 49 + .../SyncGetVulnerabilityReport.java | 45 + .../SyncGetVulnerabilityReportString.java | 40 + ...rabilityReportVulnerabilityreportname.java | 43 + .../listinventories/AsyncListInventories.java | 58 + .../AsyncListInventoriesPaged.java | 66 + .../listinventories/SyncListInventories.java | 54 + .../SyncListInventoriesInstancename.java | 43 + .../SyncListInventoriesString.java | 43 + .../AsyncListOSPolicyAssignmentReports.java | 58 + ...yncListOSPolicyAssignmentReportsPaged.java | 65 + .../SyncListOSPolicyAssignmentReports.java | 53 + ...ReportsInstanceospolicyassignmentname.java | 48 + ...ncListOSPolicyAssignmentReportsString.java | 46 + .../AsyncListOSPolicyAssignmentRevisions.java | 56 + ...cListOSPolicyAssignmentRevisionsPaged.java | 64 + .../SyncListOSPolicyAssignmentRevisions.java | 51 + ...gnmentRevisionsOspolicyassignmentname.java | 46 + ...ListOSPolicyAssignmentRevisionsString.java | 46 + .../AsyncListOSPolicyAssignments.java | 52 + .../AsyncListOSPolicyAssignmentsPaged.java | 60 + .../SyncListOSPolicyAssignments.java | 49 + ...ncListOSPolicyAssignmentsLocationname.java | 44 + .../SyncListOSPolicyAssignmentsString.java | 43 + .../AsyncListVulnerabilityReports.java | 56 + .../AsyncListVulnerabilityReportsPaged.java | 64 + .../SyncListVulnerabilityReports.java | 53 + ...cListVulnerabilityReportsInstancename.java | 45 + .../SyncListVulnerabilityReportsString.java | 44 + .../AsyncUpdateOSPolicyAssignment.java | 50 + .../AsyncUpdateOSPolicyAssignmentLRO.java | 52 + .../SyncUpdateOSPolicyAssignment.java | 46 + ...AssignmentOspolicyassignmentFieldmask.java | 46 + .../SyncGetOSPolicyAssignment.java | 47 + .../executepatchjob/SyncExecutePatchJob.java | 46 + .../SyncGetOSPolicyAssignment.java | 47 + .../SyncCreateSetCredentialsProvider.java | 42 + .../SyncCreateSetCredentialsProvider1.java | 41 + .../create/SyncCreateSetEndpoint.java | 39 + .../AsyncCreateOSPolicyAssignment.java | 51 + .../AsyncCreateOSPolicyAssignmentLRO.java | 53 + .../SyncCreateOSPolicyAssignment.java | 47 + ...tLocationnameOspolicyassignmentString.java | 48 + ...ignmentStringOspolicyassignmentString.java | 47 + .../AsyncDeleteOSPolicyAssignment.java | 50 + .../AsyncDeleteOSPolicyAssignmentLRO.java | 53 + .../SyncDeleteOSPolicyAssignment.java | 45 + ...olicyAssignmentOspolicyassignmentname.java | 42 + .../SyncDeleteOSPolicyAssignmentString.java | 41 + .../AsyncGetInstanceOSPoliciesCompliance.java | 51 + .../SyncGetInstanceOSPoliciesCompliance.java | 48 + ...ianceInstanceospoliciescompliancename.java | 45 + ...GetInstanceOSPoliciesComplianceString.java | 44 + .../getinventory/AsyncGetInventory.java | 50 + .../getinventory/SyncGetInventory.java | 46 + .../SyncGetInventoryInventoryname.java | 40 + .../getinventory/SyncGetInventoryString.java | 40 + .../AsyncGetOSPolicyAssignment.java | 50 + .../SyncGetOSPolicyAssignment.java | 46 + ...olicyAssignmentOspolicyassignmentname.java | 43 + .../SyncGetOSPolicyAssignmentString.java | 41 + .../AsyncGetOSPolicyAssignmentReport.java | 51 + .../SyncGetOSPolicyAssignmentReport.java | 48 + ...entReportOspolicyassignmentreportname.java | 45 + ...SyncGetOSPolicyAssignmentReportString.java | 45 + .../AsyncGetVulnerabilityReport.java | 49 + .../SyncGetVulnerabilityReport.java | 45 + .../SyncGetVulnerabilityReportString.java | 40 + ...rabilityReportVulnerabilityreportname.java | 43 + ...syncListInstanceOSPoliciesCompliances.java | 57 + ...istInstanceOSPoliciesCompliancesPaged.java | 64 + ...SyncListInstanceOSPoliciesCompliances.java | 52 + ...anceOSPoliciesCompliancesLocationname.java | 45 + ...stInstanceOSPoliciesCompliancesString.java | 45 + .../listinventories/AsyncListInventories.java | 55 + .../AsyncListInventoriesPaged.java | 63 + .../listinventories/SyncListInventories.java | 51 + .../SyncListInventoriesInstancename.java | 42 + .../SyncListInventoriesString.java | 42 + .../AsyncListOSPolicyAssignmentReports.java | 58 + ...yncListOSPolicyAssignmentReportsPaged.java | 66 + .../SyncListOSPolicyAssignmentReports.java | 53 + ...ReportsInstanceospolicyassignmentname.java | 48 + ...ncListOSPolicyAssignmentReportsString.java | 47 + .../AsyncListOSPolicyAssignmentRevisions.java | 57 + ...cListOSPolicyAssignmentRevisionsPaged.java | 64 + .../SyncListOSPolicyAssignmentRevisions.java | 52 + ...gnmentRevisionsOspolicyassignmentname.java | 46 + ...ListOSPolicyAssignmentRevisionsString.java | 46 + .../AsyncListOSPolicyAssignments.java | 52 + .../AsyncListOSPolicyAssignmentsPaged.java | 60 + .../SyncListOSPolicyAssignments.java | 49 + ...ncListOSPolicyAssignmentsLocationname.java | 45 + .../SyncListOSPolicyAssignmentsString.java | 43 + .../AsyncListVulnerabilityReports.java | 53 + .../AsyncListVulnerabilityReportsPaged.java | 62 + .../SyncListVulnerabilityReports.java | 50 + ...cListVulnerabilityReportsInstancename.java | 45 + .../SyncListVulnerabilityReportsString.java | 44 + .../AsyncUpdateOSPolicyAssignment.java | 50 + .../AsyncUpdateOSPolicyAssignmentLRO.java | 52 + .../SyncUpdateOSPolicyAssignment.java | 46 + ...AssignmentOspolicyassignmentFieldmask.java | 46 + .../SyncGetOSPolicyAssignment.java | 47 + .../SyncGetOSPolicyAssignment.java | 47 + .../cancelpatchjob/AsyncCancelPatchJob.java | 43 + .../cancelpatchjob/SyncCancelPatchJob.java | 39 + .../SyncCreateSetCredentialsProvider.java | 42 + .../SyncCreateSetCredentialsProvider1.java | 41 + .../create/SyncCreateSetEndpoint.java | 39 + .../AsyncCreateGuestPolicy.java | 48 + .../SyncCreateGuestPolicy.java | 44 + ...cyProjectnameGuestpoliciesguestpolicy.java | 43 + ...tPolicyStringGuestpoliciesguestpolicy.java | 43 + .../AsyncCreatePatchDeployment.java | 47 + .../SyncCreatePatchDeployment.java | 44 + .../AsyncDeleteGuestPolicy.java | 47 + .../SyncDeleteGuestPolicy.java | 42 + .../SyncDeleteGuestPolicyGuestpolicyname.java | 38 + .../SyncDeleteGuestPolicyString.java | 38 + .../AsyncDeletePatchDeployment.java | 44 + .../SyncDeletePatchDeployment.java | 39 + .../executepatchjob/AsyncExecutePatchJob.java | 53 + .../executepatchjob/SyncExecutePatchJob.java | 49 + .../getguestpolicy/AsyncGetGuestPolicy.java | 46 + .../getguestpolicy/SyncGetGuestPolicy.java | 42 + .../SyncGetGuestPolicyGuestpolicyname.java | 39 + .../SyncGetGuestPolicyString.java | 39 + .../AsyncGetPatchDeployment.java | 43 + .../SyncGetPatchDeployment.java | 39 + .../getpatchjob/AsyncGetPatchJob.java | 43 + .../getpatchjob/SyncGetPatchJob.java | 39 + .../AsyncListGuestPolicies.java | 50 + .../AsyncListGuestPoliciesPaged.java | 57 + .../SyncListGuestPolicies.java | 47 + .../SyncListGuestPoliciesProjectname.java | 42 + .../SyncListGuestPoliciesString.java | 42 + .../AsyncListPatchDeployments.java | 49 + .../AsyncListPatchDeploymentsPaged.java | 56 + .../SyncListPatchDeployments.java | 46 + .../AsyncListPatchJobInstanceDetails.java | 50 + ...AsyncListPatchJobInstanceDetailsPaged.java | 58 + .../SyncListPatchJobInstanceDetails.java | 47 + ...SyncListPatchJobInstanceDetailsString.java | 41 + .../listpatchjobs/AsyncListPatchJobs.java | 50 + .../AsyncListPatchJobsPaged.java | 57 + .../listpatchjobs/SyncListPatchJobs.java | 46 + .../AsyncLookupEffectiveGuestPolicy.java | 48 + .../SyncLookupEffectiveGuestPolicy.java | 45 + .../AsyncPausePatchDeployment.java | 46 + .../SyncPausePatchDeployment.java | 43 + ...usePatchDeploymentPatchdeploymentname.java | 41 + .../SyncPausePatchDeploymentString.java | 39 + .../AsyncResumePatchDeployment.java | 46 + .../SyncResumePatchDeployment.java | 43 + ...umePatchDeploymentPatchdeploymentname.java | 41 + .../SyncResumePatchDeploymentString.java | 39 + .../AsyncUpdateGuestPolicy.java | 47 + .../SyncUpdateGuestPolicy.java | 43 + ...licyGuestpoliciesguestpolicyFieldmask.java | 43 + .../AsyncUpdatePatchDeployment.java | 47 + .../SyncUpdatePatchDeployment.java | 44 + ...chdeploymentspatchdeploymentFieldmask.java | 45 + .../executepatchjob/SyncExecutePatchJob.java | 46 + .../executepatchjob/SyncExecutePatchJob.java | 46 + 267 files changed, 22072 insertions(+), 32 deletions(-) create mode 100644 google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigServiceCallableFactory.java create mode 100644 google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigServiceStub.java create mode 100644 google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigZonalServiceCallableFactory.java create mode 100644 google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigZonalServiceStub.java create mode 100644 google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/HttpJsonOsConfigZonalServiceCallableFactory.java create mode 100644 google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/HttpJsonOsConfigZonalServiceStub.java create mode 100644 google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/HttpJsonOsConfigServiceCallableFactory.java create mode 100644 google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/HttpJsonOsConfigServiceStub.java create mode 100644 google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigServiceClientHttpJsonTest.java create mode 100644 google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClientHttpJsonTest.java create mode 100644 google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClientHttpJsonTest.java create mode 100644 google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClientHttpJsonTest.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/cancelpatchjob/AsyncCancelPatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/cancelpatchjob/SyncCancelPatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/AsyncCreatePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/AsyncDeletePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentPatchdeploymentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/executepatchjob/AsyncExecutePatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/executepatchjob/SyncExecutePatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/AsyncGetPatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeploymentPatchdeploymentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeploymentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/AsyncGetPatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJobPatchjobname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJobString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeployments.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeploymentsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeployments.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeploymentsProjectname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeploymentsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetails.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetailsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetails.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsPatchjobname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/AsyncListPatchJobs.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/AsyncListPatchJobsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobs.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobsProjectname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/AsyncPausePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/AsyncResumePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/AsyncUpdatePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigservicesettings/executepatchjob/SyncExecutePatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignmentLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignmentLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/AsyncGetInventory.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventory.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventoryInventoryname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventoryString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/AsyncGetOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/AsyncGetOSPolicyAssignmentReport.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReport.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/AsyncGetVulnerabilityReport.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReport.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/AsyncListInventories.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/AsyncListInventoriesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventories.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventoriesInstancename.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventoriesString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReports.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReports.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignments.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignmentsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignments.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReports.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReports.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignmentLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalservicesettings/getospolicyassignment/SyncGetOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/stub/osconfigservicestubsettings/executepatchjob/SyncExecutePatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1/stub/osconfigzonalservicestubsettings/getospolicyassignment/SyncGetOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignmentLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignmentLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/AsyncGetInstanceOSPoliciesCompliance.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesCompliance.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/AsyncGetInventory.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventory.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventoryInventoryname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventoryString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/AsyncGetOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/AsyncGetOSPolicyAssignmentReport.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReport.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/AsyncGetVulnerabilityReport.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReport.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliances.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliancesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliances.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/AsyncListInventories.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/AsyncListInventoriesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventories.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventoriesInstancename.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventoriesString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReports.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReports.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignments.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignmentsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignments.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReports.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReports.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignmentLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalservicesettings/getospolicyassignment/SyncGetOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1alpha/stub/osconfigzonalservicestubsettings/getospolicyassignment/SyncGetOSPolicyAssignment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/cancelpatchjob/AsyncCancelPatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/cancelpatchjob/SyncCancelPatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/AsyncCreateGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyStringGuestpoliciesguestpolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createpatchdeployment/AsyncCreatePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/AsyncDeleteGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyGuestpolicyname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/AsyncDeletePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/executepatchjob/AsyncExecutePatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/executepatchjob/SyncExecutePatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/AsyncGetGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicyGuestpolicyname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicyString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchdeployment/AsyncGetPatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchjob/AsyncGetPatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchjob/SyncGetPatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/AsyncListGuestPolicies.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/AsyncListGuestPoliciesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPolicies.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPoliciesProjectname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPoliciesString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeployments.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeploymentsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/SyncListPatchDeployments.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetails.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetailsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetails.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/AsyncListPatchJobs.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/AsyncListPatchJobsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/SyncListPatchJobs.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/lookupeffectiveguestpolicy/AsyncLookupEffectiveGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/lookupeffectiveguestpolicy/SyncLookupEffectiveGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/AsyncPausePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/AsyncResumePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentString.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/AsyncUpdateGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/AsyncUpdatePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeployment.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigservicesettings/executepatchjob/SyncExecutePatchJob.java create mode 100644 samples/snippets/generated/com/google/cloud/osconfig/v1beta/stub/osconfigservicestubsettings/executepatchjob/SyncExecutePatchJob.java diff --git a/google-cloud-os-config/pom.xml b/google-cloud-os-config/pom.xml index 06a53b8c..743227ab 100644 --- a/google-cloud-os-config/pom.xml +++ b/google-cloud-os-config/pom.xml @@ -66,6 +66,10 @@ com.google.api gax-grpc
+ + com.google.api + gax-httpjson + org.threeten threetenbp @@ -93,12 +97,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-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java index 107dc0c9..3312e93e 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java @@ -114,6 +114,21 @@ * OsConfigServiceClient.create(osConfigServiceSettings); * } * + *

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.
+ * OsConfigServiceSettings osConfigServiceSettings =
+ *     OsConfigServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             OsConfigServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * OsConfigServiceClient osConfigServiceClient =
+ *     OsConfigServiceClient.create(osConfigServiceSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceSettings.java index e61e2143..d984e7eb 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceSettings.java @@ -25,6 +25,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; @@ -184,11 +185,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return OsConfigServiceStubSettings.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 OsConfigServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return OsConfigServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return OsConfigServiceStubSettings.defaultTransportChannelProvider(); } @@ -198,11 +206,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return OsConfigServiceStubSettings.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); @@ -240,6 +254,11 @@ private static Builder createDefault() { return new Builder(OsConfigServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(OsConfigServiceStubSettings.newHttpJsonBuilder()); + } + public OsConfigServiceStubSettings.Builder getStubSettingsBuilder() { return ((OsConfigServiceStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java index dbcb9aef..779813c4 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java @@ -19,6 +19,7 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -30,7 +31,6 @@ import com.google.cloud.osconfig.v1.stub.OsConfigZonalServiceStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -110,13 +110,29 @@ * OsConfigZonalServiceClient.create(osConfigZonalServiceSettings); * } * + *

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.
+ * OsConfigZonalServiceSettings osConfigZonalServiceSettings =
+ *     OsConfigZonalServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             OsConfigZonalServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * OsConfigZonalServiceClient osConfigZonalServiceClient =
+ *     OsConfigZonalServiceClient.create(osConfigZonalServiceSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class OsConfigZonalServiceClient implements BackgroundResource { private final OsConfigZonalServiceSettings settings; private final OsConfigZonalServiceStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of OsConfigZonalServiceClient with default settings. */ public static final OsConfigZonalServiceClient create() throws IOException { @@ -148,13 +164,17 @@ public static final OsConfigZonalServiceClient create(OsConfigZonalServiceStub s protected OsConfigZonalServiceClient(OsConfigZonalServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((OsConfigZonalServiceStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected OsConfigZonalServiceClient(OsConfigZonalServiceStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final OsConfigZonalServiceSettings getSettings() { @@ -169,10 +189,18 @@ public OsConfigZonalServiceStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create an OS policy assignment. diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceSettings.java index a9f89186..31ebc4cc 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceSettings.java @@ -27,6 +27,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; @@ -219,11 +220,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return OsConfigZonalServiceStubSettings.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 OsConfigZonalServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return OsConfigZonalServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return OsConfigZonalServiceStubSettings.defaultTransportChannelProvider(); } @@ -233,11 +241,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return OsConfigZonalServiceStubSettings.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); @@ -276,6 +290,11 @@ private static Builder createDefault() { return new Builder(OsConfigZonalServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(OsConfigZonalServiceStubSettings.newHttpJsonBuilder()); + } + public OsConfigZonalServiceStubSettings.Builder getStubSettingsBuilder() { return ((OsConfigZonalServiceStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigServiceCallableFactory.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigServiceCallableFactory.java new file mode 100644 index 00000000..878cde9b --- /dev/null +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigServiceCallableFactory.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.osconfig.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 OsConfigService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonOsConfigServiceCallableFactory + 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-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigServiceStub.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigServiceStub.java new file mode 100644 index 00000000..29c595e6 --- /dev/null +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigServiceStub.java @@ -0,0 +1,930 @@ +/* + * 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.osconfig.v1.stub; + +import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchDeploymentsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchJobsPagedResponse; + +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.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.PatchJobs; +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 OsConfigService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonOsConfigServiceStub extends OsConfigServiceStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + executePatchJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/ExecutePatchJob") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*}/patchJobs:execute", + 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(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchJobs.PatchJob.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getPatchJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/GetPatchJob") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/patchJobs/*}", + 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(PatchJobs.PatchJob.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + cancelPatchJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/CancelPatchJob") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/patchJobs/*}:cancel", + 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 -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchJobs.PatchJob.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchJobs.ListPatchJobsRequest, PatchJobs.ListPatchJobsResponse> + listPatchJobsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/ListPatchJobs") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*}/patchJobs", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchJobs.ListPatchJobsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchJobs.ListPatchJobInstanceDetailsRequest, + PatchJobs.ListPatchJobInstanceDetailsResponse> + listPatchJobInstanceDetailsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigService/ListPatchJobInstanceDetails") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{parent=projects/*/patchJobs/*}/instanceDetails", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser + .newBuilder() + .setDefaultInstance( + PatchJobs.ListPatchJobInstanceDetailsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + createPatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/CreatePatchDeployment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{parent=projects/*}/patchDeployments", + 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, "patchDeploymentId", request.getPatchDeploymentId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("patchDeployment", request.getPatchDeployment())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment> + getPatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/GetPatchDeployment") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{name=projects/*/patchDeployments/*}", + 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(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.ListPatchDeploymentsRequest, + PatchDeployments.ListPatchDeploymentsResponse> + listPatchDeploymentsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/ListPatchDeployments") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{parent=projects/*}/patchDeployments", + 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( + PatchDeployments.ListPatchDeploymentsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deletePatchDeploymentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/DeletePatchDeployment") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{name=projects/*/patchDeployments/*}", + 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 static final ApiMethodDescriptor< + PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + updatePatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/UpdatePatchDeployment") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{patchDeployment.name=projects/*/patchDeployments/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "patchDeployment.name", + request.getPatchDeployment().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("patchDeployment", request.getPatchDeployment())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment> + pausePatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/PausePatchDeployment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{name=projects/*/patchDeployments/*}:pause", + 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 -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment> + resumePatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigService/ResumePatchDeployment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1/{name=projects/*/patchDeployments/*}:resume", + 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 -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable + executePatchJobCallable; + private final UnaryCallable getPatchJobCallable; + private final UnaryCallable + cancelPatchJobCallable; + private final UnaryCallable + listPatchJobsCallable; + private final UnaryCallable + listPatchJobsPagedCallable; + private final UnaryCallable< + PatchJobs.ListPatchJobInstanceDetailsRequest, + PatchJobs.ListPatchJobInstanceDetailsResponse> + listPatchJobInstanceDetailsCallable; + private final UnaryCallable< + PatchJobs.ListPatchJobInstanceDetailsRequest, ListPatchJobInstanceDetailsPagedResponse> + listPatchJobInstanceDetailsPagedCallable; + private final UnaryCallable< + PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + createPatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment> + getPatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.ListPatchDeploymentsRequest, + PatchDeployments.ListPatchDeploymentsResponse> + listPatchDeploymentsCallable; + private final UnaryCallable< + PatchDeployments.ListPatchDeploymentsRequest, ListPatchDeploymentsPagedResponse> + listPatchDeploymentsPagedCallable; + private final UnaryCallable + deletePatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + updatePatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment> + pausePatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment> + resumePatchDeploymentCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonOsConfigServiceStub create(OsConfigServiceStubSettings settings) + throws IOException { + return new HttpJsonOsConfigServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonOsConfigServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonOsConfigServiceStub( + OsConfigServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonOsConfigServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonOsConfigServiceStub( + OsConfigServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonOsConfigServiceStub, 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 HttpJsonOsConfigServiceStub( + OsConfigServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonOsConfigServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonOsConfigServiceStub, 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 HttpJsonOsConfigServiceStub( + OsConfigServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + executePatchJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(executePatchJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getPatchJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPatchJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + cancelPatchJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(cancelPatchJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listPatchJobsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listPatchJobsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchJobs.ListPatchJobInstanceDetailsRequest, + PatchJobs.ListPatchJobInstanceDetailsResponse> + listPatchJobInstanceDetailsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listPatchJobInstanceDetailsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + createPatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(createPatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment> + getPatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(getPatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.ListPatchDeploymentsRequest, + PatchDeployments.ListPatchDeploymentsResponse> + listPatchDeploymentsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listPatchDeploymentsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deletePatchDeploymentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deletePatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + updatePatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(updatePatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment> + pausePatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(pausePatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment> + resumePatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(resumePatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.executePatchJobCallable = + callableFactory.createUnaryCallable( + executePatchJobTransportSettings, settings.executePatchJobSettings(), clientContext); + this.getPatchJobCallable = + callableFactory.createUnaryCallable( + getPatchJobTransportSettings, settings.getPatchJobSettings(), clientContext); + this.cancelPatchJobCallable = + callableFactory.createUnaryCallable( + cancelPatchJobTransportSettings, settings.cancelPatchJobSettings(), clientContext); + this.listPatchJobsCallable = + callableFactory.createUnaryCallable( + listPatchJobsTransportSettings, settings.listPatchJobsSettings(), clientContext); + this.listPatchJobsPagedCallable = + callableFactory.createPagedCallable( + listPatchJobsTransportSettings, settings.listPatchJobsSettings(), clientContext); + this.listPatchJobInstanceDetailsCallable = + callableFactory.createUnaryCallable( + listPatchJobInstanceDetailsTransportSettings, + settings.listPatchJobInstanceDetailsSettings(), + clientContext); + this.listPatchJobInstanceDetailsPagedCallable = + callableFactory.createPagedCallable( + listPatchJobInstanceDetailsTransportSettings, + settings.listPatchJobInstanceDetailsSettings(), + clientContext); + this.createPatchDeploymentCallable = + callableFactory.createUnaryCallable( + createPatchDeploymentTransportSettings, + settings.createPatchDeploymentSettings(), + clientContext); + this.getPatchDeploymentCallable = + callableFactory.createUnaryCallable( + getPatchDeploymentTransportSettings, + settings.getPatchDeploymentSettings(), + clientContext); + this.listPatchDeploymentsCallable = + callableFactory.createUnaryCallable( + listPatchDeploymentsTransportSettings, + settings.listPatchDeploymentsSettings(), + clientContext); + this.listPatchDeploymentsPagedCallable = + callableFactory.createPagedCallable( + listPatchDeploymentsTransportSettings, + settings.listPatchDeploymentsSettings(), + clientContext); + this.deletePatchDeploymentCallable = + callableFactory.createUnaryCallable( + deletePatchDeploymentTransportSettings, + settings.deletePatchDeploymentSettings(), + clientContext); + this.updatePatchDeploymentCallable = + callableFactory.createUnaryCallable( + updatePatchDeploymentTransportSettings, + settings.updatePatchDeploymentSettings(), + clientContext); + this.pausePatchDeploymentCallable = + callableFactory.createUnaryCallable( + pausePatchDeploymentTransportSettings, + settings.pausePatchDeploymentSettings(), + clientContext); + this.resumePatchDeploymentCallable = + callableFactory.createUnaryCallable( + resumePatchDeploymentTransportSettings, + settings.resumePatchDeploymentSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(executePatchJobMethodDescriptor); + methodDescriptors.add(getPatchJobMethodDescriptor); + methodDescriptors.add(cancelPatchJobMethodDescriptor); + methodDescriptors.add(listPatchJobsMethodDescriptor); + methodDescriptors.add(listPatchJobInstanceDetailsMethodDescriptor); + methodDescriptors.add(createPatchDeploymentMethodDescriptor); + methodDescriptors.add(getPatchDeploymentMethodDescriptor); + methodDescriptors.add(listPatchDeploymentsMethodDescriptor); + methodDescriptors.add(deletePatchDeploymentMethodDescriptor); + methodDescriptors.add(updatePatchDeploymentMethodDescriptor); + methodDescriptors.add(pausePatchDeploymentMethodDescriptor); + methodDescriptors.add(resumePatchDeploymentMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable + executePatchJobCallable() { + return executePatchJobCallable; + } + + @Override + public UnaryCallable getPatchJobCallable() { + return getPatchJobCallable; + } + + @Override + public UnaryCallable + cancelPatchJobCallable() { + return cancelPatchJobCallable; + } + + @Override + public UnaryCallable + listPatchJobsCallable() { + return listPatchJobsCallable; + } + + @Override + public UnaryCallable + listPatchJobsPagedCallable() { + return listPatchJobsPagedCallable; + } + + @Override + public UnaryCallable< + PatchJobs.ListPatchJobInstanceDetailsRequest, + PatchJobs.ListPatchJobInstanceDetailsResponse> + listPatchJobInstanceDetailsCallable() { + return listPatchJobInstanceDetailsCallable; + } + + @Override + public UnaryCallable< + PatchJobs.ListPatchJobInstanceDetailsRequest, ListPatchJobInstanceDetailsPagedResponse> + listPatchJobInstanceDetailsPagedCallable() { + return listPatchJobInstanceDetailsPagedCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + createPatchDeploymentCallable() { + return createPatchDeploymentCallable; + } + + @Override + public UnaryCallable + getPatchDeploymentCallable() { + return getPatchDeploymentCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.ListPatchDeploymentsRequest, + PatchDeployments.ListPatchDeploymentsResponse> + listPatchDeploymentsCallable() { + return listPatchDeploymentsCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.ListPatchDeploymentsRequest, ListPatchDeploymentsPagedResponse> + listPatchDeploymentsPagedCallable() { + return listPatchDeploymentsPagedCallable; + } + + @Override + public UnaryCallable + deletePatchDeploymentCallable() { + return deletePatchDeploymentCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + updatePatchDeploymentCallable() { + return updatePatchDeploymentCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment> + pausePatchDeploymentCallable() { + return pausePatchDeploymentCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment> + resumePatchDeploymentCallable() { + return resumePatchDeploymentCallable; + } + + @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-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigZonalServiceCallableFactory.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigZonalServiceCallableFactory.java new file mode 100644 index 00000000..d5b8ad33 --- /dev/null +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigZonalServiceCallableFactory.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.osconfig.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 OsConfigZonalService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonOsConfigZonalServiceCallableFactory + 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-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigZonalServiceStub.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigZonalServiceStub.java new file mode 100644 index 00000000..dcb753e2 --- /dev/null +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/HttpJsonOsConfigZonalServiceStub.java @@ -0,0 +1,1004 @@ +/* + * 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.osconfig.v1.stub; + +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListInventoriesPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse; + +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.HttpJsonOperationSnapshot; +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.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.osconfig.v1.CreateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.DeleteOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.GetInventoryRequest; +import com.google.cloud.osconfig.v1.GetOSPolicyAssignmentReportRequest; +import com.google.cloud.osconfig.v1.GetOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.GetVulnerabilityReportRequest; +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.ListInventoriesRequest; +import com.google.cloud.osconfig.v1.ListInventoriesResponse; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsRequest; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsResponse; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsRequest; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsResponse; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentsRequest; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentsResponse; +import com.google.cloud.osconfig.v1.ListVulnerabilityReportsRequest; +import com.google.cloud.osconfig.v1.ListVulnerabilityReportsResponse; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.UpdateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.VulnerabilityReport; +import com.google.longrunning.Operation; +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 OsConfigZonalService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonOsConfigZonalServiceStub extends OsConfigZonalServiceStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(OSPolicyAssignmentOperationMetadata.getDescriptor()) + .add(OSPolicyAssignment.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + createOSPolicyAssignmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/CreateOSPolicyAssignment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/osPolicyAssignments", + 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, "osPolicyAssignmentId", request.getOsPolicyAssignmentId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("osPolicyAssignment", request.getOsPolicyAssignment())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateOSPolicyAssignmentRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateOSPolicyAssignmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/UpdateOSPolicyAssignment") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{osPolicyAssignment.name=projects/*/locations/*/osPolicyAssignments/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "osPolicyAssignment.name", + request.getOsPolicyAssignment().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("osPolicyAssignment", request.getOsPolicyAssignment())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateOSPolicyAssignmentRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getOSPolicyAssignmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/GetOSPolicyAssignment") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}", + 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(OSPolicyAssignment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListOSPolicyAssignmentsRequest, ListOSPolicyAssignmentsResponse> + listOSPolicyAssignmentsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/ListOSPolicyAssignments") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/osPolicyAssignments", + 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(ListOSPolicyAssignmentsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> + listOSPolicyAssignmentRevisionsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/ListOSPolicyAssignmentRevisions") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}:listRevisions", + 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(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + ListOSPolicyAssignmentRevisionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteOSPolicyAssignmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/DeleteOSPolicyAssignment") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}", + 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(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteOSPolicyAssignmentRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + GetOSPolicyAssignmentReportRequest, OSPolicyAssignmentReport> + getOSPolicyAssignmentReportMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/GetOSPolicyAssignmentReport") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/instances/*/osPolicyAssignments/*/report}", + 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(OSPolicyAssignmentReport.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsResponse> + listOSPolicyAssignmentReportsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/ListOSPolicyAssignmentReports") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/instances/*/osPolicyAssignments/*}/reports", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + ListOSPolicyAssignmentReportsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getInventoryMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigZonalService/GetInventory") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/instances/*/inventory}", + 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(); + serializer.putQueryParam(fields, "view", request.getView()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Inventory.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listInventoriesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1.OsConfigZonalService/ListInventories") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/instances/*}/inventories", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "view", request.getView()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListInventoriesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getVulnerabilityReportMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/GetVulnerabilityReport") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/instances/*/vulnerabilityReport}", + 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(VulnerabilityReport.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListVulnerabilityReportsRequest, ListVulnerabilityReportsResponse> + listVulnerabilityReportsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1.OsConfigZonalService/ListVulnerabilityReports") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/instances/*}/vulnerabilityReports", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListVulnerabilityReportsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable + createOSPolicyAssignmentCallable; + private final OperationCallable< + CreateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> + createOSPolicyAssignmentOperationCallable; + private final UnaryCallable + updateOSPolicyAssignmentCallable; + private final OperationCallable< + UpdateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> + updateOSPolicyAssignmentOperationCallable; + private final UnaryCallable + getOSPolicyAssignmentCallable; + private final UnaryCallable + listOSPolicyAssignmentsCallable; + private final UnaryCallable + listOSPolicyAssignmentsPagedCallable; + private final UnaryCallable< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> + listOSPolicyAssignmentRevisionsCallable; + private final UnaryCallable< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsPagedResponse> + listOSPolicyAssignmentRevisionsPagedCallable; + private final UnaryCallable + deleteOSPolicyAssignmentCallable; + private final OperationCallable< + DeleteOSPolicyAssignmentRequest, Empty, OSPolicyAssignmentOperationMetadata> + deleteOSPolicyAssignmentOperationCallable; + private final UnaryCallable + getOSPolicyAssignmentReportCallable; + private final UnaryCallable< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsResponse> + listOSPolicyAssignmentReportsCallable; + private final UnaryCallable< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsPagedResponse> + listOSPolicyAssignmentReportsPagedCallable; + private final UnaryCallable getInventoryCallable; + private final UnaryCallable + listInventoriesCallable; + private final UnaryCallable + listInventoriesPagedCallable; + private final UnaryCallable + getVulnerabilityReportCallable; + private final UnaryCallable + listVulnerabilityReportsCallable; + private final UnaryCallable< + ListVulnerabilityReportsRequest, ListVulnerabilityReportsPagedResponse> + listVulnerabilityReportsPagedCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonOsConfigZonalServiceStub create( + OsConfigZonalServiceStubSettings settings) throws IOException { + return new HttpJsonOsConfigZonalServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonOsConfigZonalServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonOsConfigZonalServiceStub( + OsConfigZonalServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonOsConfigZonalServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonOsConfigZonalServiceStub( + OsConfigZonalServiceStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonOsConfigZonalServiceStub, 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 HttpJsonOsConfigZonalServiceStub( + OsConfigZonalServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonOsConfigZonalServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonOsConfigZonalServiceStub, 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 HttpJsonOsConfigZonalServiceStub( + OsConfigZonalServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + createOSPolicyAssignmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createOSPolicyAssignmentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateOSPolicyAssignmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateOSPolicyAssignmentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getOSPolicyAssignmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getOSPolicyAssignmentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listOSPolicyAssignmentsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listOSPolicyAssignmentsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> + listOSPolicyAssignmentRevisionsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listOSPolicyAssignmentRevisionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteOSPolicyAssignmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteOSPolicyAssignmentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getOSPolicyAssignmentReportTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getOSPolicyAssignmentReportMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsResponse> + listOSPolicyAssignmentReportsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listOSPolicyAssignmentReportsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getInventoryTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getInventoryMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listInventoriesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listInventoriesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getVulnerabilityReportTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getVulnerabilityReportMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listVulnerabilityReportsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listVulnerabilityReportsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createOSPolicyAssignmentCallable = + callableFactory.createUnaryCallable( + createOSPolicyAssignmentTransportSettings, + settings.createOSPolicyAssignmentSettings(), + clientContext); + this.createOSPolicyAssignmentOperationCallable = + callableFactory.createOperationCallable( + createOSPolicyAssignmentTransportSettings, + settings.createOSPolicyAssignmentOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateOSPolicyAssignmentCallable = + callableFactory.createUnaryCallable( + updateOSPolicyAssignmentTransportSettings, + settings.updateOSPolicyAssignmentSettings(), + clientContext); + this.updateOSPolicyAssignmentOperationCallable = + callableFactory.createOperationCallable( + updateOSPolicyAssignmentTransportSettings, + settings.updateOSPolicyAssignmentOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getOSPolicyAssignmentCallable = + callableFactory.createUnaryCallable( + getOSPolicyAssignmentTransportSettings, + settings.getOSPolicyAssignmentSettings(), + clientContext); + this.listOSPolicyAssignmentsCallable = + callableFactory.createUnaryCallable( + listOSPolicyAssignmentsTransportSettings, + settings.listOSPolicyAssignmentsSettings(), + clientContext); + this.listOSPolicyAssignmentsPagedCallable = + callableFactory.createPagedCallable( + listOSPolicyAssignmentsTransportSettings, + settings.listOSPolicyAssignmentsSettings(), + clientContext); + this.listOSPolicyAssignmentRevisionsCallable = + callableFactory.createUnaryCallable( + listOSPolicyAssignmentRevisionsTransportSettings, + settings.listOSPolicyAssignmentRevisionsSettings(), + clientContext); + this.listOSPolicyAssignmentRevisionsPagedCallable = + callableFactory.createPagedCallable( + listOSPolicyAssignmentRevisionsTransportSettings, + settings.listOSPolicyAssignmentRevisionsSettings(), + clientContext); + this.deleteOSPolicyAssignmentCallable = + callableFactory.createUnaryCallable( + deleteOSPolicyAssignmentTransportSettings, + settings.deleteOSPolicyAssignmentSettings(), + clientContext); + this.deleteOSPolicyAssignmentOperationCallable = + callableFactory.createOperationCallable( + deleteOSPolicyAssignmentTransportSettings, + settings.deleteOSPolicyAssignmentOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getOSPolicyAssignmentReportCallable = + callableFactory.createUnaryCallable( + getOSPolicyAssignmentReportTransportSettings, + settings.getOSPolicyAssignmentReportSettings(), + clientContext); + this.listOSPolicyAssignmentReportsCallable = + callableFactory.createUnaryCallable( + listOSPolicyAssignmentReportsTransportSettings, + settings.listOSPolicyAssignmentReportsSettings(), + clientContext); + this.listOSPolicyAssignmentReportsPagedCallable = + callableFactory.createPagedCallable( + listOSPolicyAssignmentReportsTransportSettings, + settings.listOSPolicyAssignmentReportsSettings(), + clientContext); + this.getInventoryCallable = + callableFactory.createUnaryCallable( + getInventoryTransportSettings, settings.getInventorySettings(), clientContext); + this.listInventoriesCallable = + callableFactory.createUnaryCallable( + listInventoriesTransportSettings, settings.listInventoriesSettings(), clientContext); + this.listInventoriesPagedCallable = + callableFactory.createPagedCallable( + listInventoriesTransportSettings, settings.listInventoriesSettings(), clientContext); + this.getVulnerabilityReportCallable = + callableFactory.createUnaryCallable( + getVulnerabilityReportTransportSettings, + settings.getVulnerabilityReportSettings(), + clientContext); + this.listVulnerabilityReportsCallable = + callableFactory.createUnaryCallable( + listVulnerabilityReportsTransportSettings, + settings.listVulnerabilityReportsSettings(), + clientContext); + this.listVulnerabilityReportsPagedCallable = + callableFactory.createPagedCallable( + listVulnerabilityReportsTransportSettings, + settings.listVulnerabilityReportsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createOSPolicyAssignmentMethodDescriptor); + methodDescriptors.add(updateOSPolicyAssignmentMethodDescriptor); + methodDescriptors.add(getOSPolicyAssignmentMethodDescriptor); + methodDescriptors.add(listOSPolicyAssignmentsMethodDescriptor); + methodDescriptors.add(listOSPolicyAssignmentRevisionsMethodDescriptor); + methodDescriptors.add(deleteOSPolicyAssignmentMethodDescriptor); + methodDescriptors.add(getOSPolicyAssignmentReportMethodDescriptor); + methodDescriptors.add(listOSPolicyAssignmentReportsMethodDescriptor); + methodDescriptors.add(getInventoryMethodDescriptor); + methodDescriptors.add(listInventoriesMethodDescriptor); + methodDescriptors.add(getVulnerabilityReportMethodDescriptor); + methodDescriptors.add(listVulnerabilityReportsMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable + createOSPolicyAssignmentCallable() { + return createOSPolicyAssignmentCallable; + } + + @Override + public OperationCallable< + CreateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> + createOSPolicyAssignmentOperationCallable() { + return createOSPolicyAssignmentOperationCallable; + } + + @Override + public UnaryCallable + updateOSPolicyAssignmentCallable() { + return updateOSPolicyAssignmentCallable; + } + + @Override + public OperationCallable< + UpdateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> + updateOSPolicyAssignmentOperationCallable() { + return updateOSPolicyAssignmentOperationCallable; + } + + @Override + public UnaryCallable + getOSPolicyAssignmentCallable() { + return getOSPolicyAssignmentCallable; + } + + @Override + public UnaryCallable + listOSPolicyAssignmentsCallable() { + return listOSPolicyAssignmentsCallable; + } + + @Override + public UnaryCallable + listOSPolicyAssignmentsPagedCallable() { + return listOSPolicyAssignmentsPagedCallable; + } + + @Override + public UnaryCallable< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> + listOSPolicyAssignmentRevisionsCallable() { + return listOSPolicyAssignmentRevisionsCallable; + } + + @Override + public UnaryCallable< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsPagedResponse> + listOSPolicyAssignmentRevisionsPagedCallable() { + return listOSPolicyAssignmentRevisionsPagedCallable; + } + + @Override + public UnaryCallable + deleteOSPolicyAssignmentCallable() { + return deleteOSPolicyAssignmentCallable; + } + + @Override + public OperationCallable< + DeleteOSPolicyAssignmentRequest, Empty, OSPolicyAssignmentOperationMetadata> + deleteOSPolicyAssignmentOperationCallable() { + return deleteOSPolicyAssignmentOperationCallable; + } + + @Override + public UnaryCallable + getOSPolicyAssignmentReportCallable() { + return getOSPolicyAssignmentReportCallable; + } + + @Override + public UnaryCallable + listOSPolicyAssignmentReportsCallable() { + return listOSPolicyAssignmentReportsCallable; + } + + @Override + public UnaryCallable< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsPagedResponse> + listOSPolicyAssignmentReportsPagedCallable() { + return listOSPolicyAssignmentReportsPagedCallable; + } + + @Override + public UnaryCallable getInventoryCallable() { + return getInventoryCallable; + } + + @Override + public UnaryCallable listInventoriesCallable() { + return listInventoriesCallable; + } + + @Override + public UnaryCallable + listInventoriesPagedCallable() { + return listInventoriesPagedCallable; + } + + @Override + public UnaryCallable + getVulnerabilityReportCallable() { + return getVulnerabilityReportCallable; + } + + @Override + public UnaryCallable + listVulnerabilityReportsCallable() { + return listVulnerabilityReportsCallable; + } + + @Override + public UnaryCallable + listVulnerabilityReportsPagedCallable() { + return listVulnerabilityReportsPagedCallable; + } + + @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-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigServiceStubSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigServiceStubSettings.java index 1b9e64cf..b3bc7fbe 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigServiceStubSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigServiceStubSettings.java @@ -29,6 +29,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; @@ -455,6 +458,11 @@ public OsConfigServiceStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcOsConfigServiceStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonOsConfigServiceStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -487,18 +495,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(OsConfigServiceStubSettings.class)) @@ -506,11 +521,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(OsConfigServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return OsConfigServiceStubSettings.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); @@ -696,6 +730,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 .executePatchJobSettings() diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStub.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStub.java index 9a2a1ba7..5ea80e63 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStub.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStub.java @@ -62,7 +62,11 @@ public abstract class OsConfigZonalServiceStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public OperationCallable< diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStubSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStubSettings.java index 0b08206a..d424cef3 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStubSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/stub/OsConfigZonalServiceStubSettings.java @@ -32,6 +32,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +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.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -645,6 +648,11 @@ public OsConfigZonalServiceStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcOsConfigZonalServiceStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonOsConfigZonalServiceStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -677,18 +685,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(OsConfigZonalServiceStubSettings.class)) @@ -696,11 +711,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(OsConfigZonalServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return OsConfigZonalServiceStubSettings.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); @@ -920,6 +954,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 .createOSPolicyAssignmentSettings() diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java index 1dd4b878..195a5deb 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.osconfig.v1alpha.stub.OsConfigZonalServiceStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -111,6 +111,21 @@ * OsConfigZonalServiceClient.create(osConfigZonalServiceSettings); * } * + *

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.
+ * OsConfigZonalServiceSettings osConfigZonalServiceSettings =
+ *     OsConfigZonalServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             OsConfigZonalServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * OsConfigZonalServiceClient osConfigZonalServiceClient =
+ *     OsConfigZonalServiceClient.create(osConfigZonalServiceSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @@ -118,7 +133,8 @@ public class OsConfigZonalServiceClient implements BackgroundResource { private final OsConfigZonalServiceSettings settings; private final OsConfigZonalServiceStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of OsConfigZonalServiceClient with default settings. */ public static final OsConfigZonalServiceClient create() throws IOException { @@ -150,13 +166,17 @@ public static final OsConfigZonalServiceClient create(OsConfigZonalServiceStub s protected OsConfigZonalServiceClient(OsConfigZonalServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((OsConfigZonalServiceStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected OsConfigZonalServiceClient(OsConfigZonalServiceStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final OsConfigZonalServiceSettings getSettings() { @@ -171,10 +191,18 @@ public OsConfigZonalServiceStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create an OS policy assignment. diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceSettings.java index 6104e552..6fab56d7 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceSettings.java @@ -28,6 +28,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; @@ -248,11 +249,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return OsConfigZonalServiceStubSettings.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 OsConfigZonalServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return OsConfigZonalServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return OsConfigZonalServiceStubSettings.defaultTransportChannelProvider(); } @@ -262,11 +270,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return OsConfigZonalServiceStubSettings.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); @@ -305,6 +319,11 @@ private static Builder createDefault() { return new Builder(OsConfigZonalServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(OsConfigZonalServiceStubSettings.newHttpJsonBuilder()); + } + public OsConfigZonalServiceStubSettings.Builder getStubSettingsBuilder() { return ((OsConfigZonalServiceStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/HttpJsonOsConfigZonalServiceCallableFactory.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/HttpJsonOsConfigZonalServiceCallableFactory.java new file mode 100644 index 00000000..3713cf21 --- /dev/null +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/HttpJsonOsConfigZonalServiceCallableFactory.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.osconfig.v1alpha.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 OsConfigZonalService service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonOsConfigZonalServiceCallableFactory + 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-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/HttpJsonOsConfigZonalServiceStub.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/HttpJsonOsConfigZonalServiceStub.java new file mode 100644 index 00000000..31ff24fd --- /dev/null +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/HttpJsonOsConfigZonalServiceStub.java @@ -0,0 +1,1150 @@ +/* + * 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.osconfig.v1alpha.stub; + +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListInventoriesPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse; + +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.HttpJsonOperationSnapshot; +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.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.osconfig.v1alpha.CreateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.DeleteOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.GetInstanceOSPoliciesComplianceRequest; +import com.google.cloud.osconfig.v1alpha.GetInventoryRequest; +import com.google.cloud.osconfig.v1alpha.GetOSPolicyAssignmentReportRequest; +import com.google.cloud.osconfig.v1alpha.GetOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.GetVulnerabilityReportRequest; +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesRequest; +import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesResponse; +import com.google.cloud.osconfig.v1alpha.ListInventoriesRequest; +import com.google.cloud.osconfig.v1alpha.ListInventoriesResponse; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentReportsRequest; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentReportsResponse; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsRequest; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsResponse; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentsRequest; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentsResponse; +import com.google.cloud.osconfig.v1alpha.ListVulnerabilityReportsRequest; +import com.google.cloud.osconfig.v1alpha.ListVulnerabilityReportsResponse; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentOperationMetadata; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.UpdateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; +import com.google.longrunning.Operation; +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 OsConfigZonalService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonOsConfigZonalServiceStub extends OsConfigZonalServiceStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(OSPolicyAssignmentOperationMetadata.getDescriptor()) + .add(OSPolicyAssignment.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + createOSPolicyAssignmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/CreateOSPolicyAssignment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=projects/*/locations/*}/osPolicyAssignments", + 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, "osPolicyAssignmentId", request.getOsPolicyAssignmentId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("osPolicyAssignment", request.getOsPolicyAssignment())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateOSPolicyAssignmentRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateOSPolicyAssignmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/UpdateOSPolicyAssignment") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{osPolicyAssignment.name=projects/*/locations/*/osPolicyAssignments/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "osPolicyAssignment.name", + request.getOsPolicyAssignment().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("osPolicyAssignment", request.getOsPolicyAssignment())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateOSPolicyAssignmentRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getOSPolicyAssignmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/GetOSPolicyAssignment") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=projects/*/locations/*/osPolicyAssignments/*}", + 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(OSPolicyAssignment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListOSPolicyAssignmentsRequest, ListOSPolicyAssignmentsResponse> + listOSPolicyAssignmentsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/ListOSPolicyAssignments") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=projects/*/locations/*}/osPolicyAssignments", + 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(ListOSPolicyAssignmentsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> + listOSPolicyAssignmentRevisionsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/ListOSPolicyAssignmentRevisions") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=projects/*/locations/*/osPolicyAssignments/*}:listRevisions", + 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(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + ListOSPolicyAssignmentRevisionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteOSPolicyAssignmentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/DeleteOSPolicyAssignment") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=projects/*/locations/*/osPolicyAssignments/*}", + 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(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteOSPolicyAssignmentRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + GetInstanceOSPoliciesComplianceRequest, InstanceOSPoliciesCompliance> + getInstanceOSPoliciesComplianceMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/GetInstanceOSPoliciesCompliance") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=projects/*/locations/*/instanceOSPoliciesCompliances/*}", + 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(InstanceOSPoliciesCompliance.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListInstanceOSPoliciesCompliancesRequest, ListInstanceOSPoliciesCompliancesResponse> + listInstanceOSPoliciesCompliancesMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/ListInstanceOSPoliciesCompliances") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{parent=projects/*/locations/*}/instanceOSPoliciesCompliances", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + ListInstanceOSPoliciesCompliancesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GetOSPolicyAssignmentReportRequest, OSPolicyAssignmentReport> + getOSPolicyAssignmentReportMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/GetOSPolicyAssignmentReport") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=projects/*/locations/*/instances/*/osPolicyAssignments/*/report}", + 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(OSPolicyAssignmentReport.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsResponse> + listOSPolicyAssignmentReportsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/ListOSPolicyAssignmentReports") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=projects/*/locations/*/instances/*/osPolicyAssignments/*}/reports", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + ListOSPolicyAssignmentReportsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getInventoryMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1alpha.OsConfigZonalService/GetInventory") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=projects/*/locations/*/instances/*/inventory}", + 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(); + serializer.putQueryParam(fields, "view", request.getView()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Inventory.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listInventoriesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/ListInventories") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=projects/*/locations/*/instances/*}/inventories", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "view", request.getView()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListInventoriesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getVulnerabilityReportMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/GetVulnerabilityReport") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=projects/*/locations/*/instances/*/vulnerabilityReport}", + 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(VulnerabilityReport.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListVulnerabilityReportsRequest, ListVulnerabilityReportsResponse> + listVulnerabilityReportsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1alpha.OsConfigZonalService/ListVulnerabilityReports") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=projects/*/locations/*/instances/*}/vulnerabilityReports", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListVulnerabilityReportsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable + createOSPolicyAssignmentCallable; + private final OperationCallable< + CreateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> + createOSPolicyAssignmentOperationCallable; + private final UnaryCallable + updateOSPolicyAssignmentCallable; + private final OperationCallable< + UpdateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> + updateOSPolicyAssignmentOperationCallable; + private final UnaryCallable + getOSPolicyAssignmentCallable; + private final UnaryCallable + listOSPolicyAssignmentsCallable; + private final UnaryCallable + listOSPolicyAssignmentsPagedCallable; + private final UnaryCallable< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> + listOSPolicyAssignmentRevisionsCallable; + private final UnaryCallable< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsPagedResponse> + listOSPolicyAssignmentRevisionsPagedCallable; + private final UnaryCallable + deleteOSPolicyAssignmentCallable; + private final OperationCallable< + DeleteOSPolicyAssignmentRequest, Empty, OSPolicyAssignmentOperationMetadata> + deleteOSPolicyAssignmentOperationCallable; + private final UnaryCallable + getInstanceOSPoliciesComplianceCallable; + private final UnaryCallable< + ListInstanceOSPoliciesCompliancesRequest, ListInstanceOSPoliciesCompliancesResponse> + listInstanceOSPoliciesCompliancesCallable; + private final UnaryCallable< + ListInstanceOSPoliciesCompliancesRequest, ListInstanceOSPoliciesCompliancesPagedResponse> + listInstanceOSPoliciesCompliancesPagedCallable; + private final UnaryCallable + getOSPolicyAssignmentReportCallable; + private final UnaryCallable< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsResponse> + listOSPolicyAssignmentReportsCallable; + private final UnaryCallable< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsPagedResponse> + listOSPolicyAssignmentReportsPagedCallable; + private final UnaryCallable getInventoryCallable; + private final UnaryCallable + listInventoriesCallable; + private final UnaryCallable + listInventoriesPagedCallable; + private final UnaryCallable + getVulnerabilityReportCallable; + private final UnaryCallable + listVulnerabilityReportsCallable; + private final UnaryCallable< + ListVulnerabilityReportsRequest, ListVulnerabilityReportsPagedResponse> + listVulnerabilityReportsPagedCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonOsConfigZonalServiceStub create( + OsConfigZonalServiceStubSettings settings) throws IOException { + return new HttpJsonOsConfigZonalServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonOsConfigZonalServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonOsConfigZonalServiceStub( + OsConfigZonalServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonOsConfigZonalServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonOsConfigZonalServiceStub( + OsConfigZonalServiceStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonOsConfigZonalServiceStub, 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 HttpJsonOsConfigZonalServiceStub( + OsConfigZonalServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonOsConfigZonalServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonOsConfigZonalServiceStub, 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 HttpJsonOsConfigZonalServiceStub( + OsConfigZonalServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + createOSPolicyAssignmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createOSPolicyAssignmentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateOSPolicyAssignmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateOSPolicyAssignmentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getOSPolicyAssignmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getOSPolicyAssignmentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listOSPolicyAssignmentsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listOSPolicyAssignmentsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> + listOSPolicyAssignmentRevisionsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listOSPolicyAssignmentRevisionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteOSPolicyAssignmentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteOSPolicyAssignmentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getInstanceOSPoliciesComplianceTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getInstanceOSPoliciesComplianceMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListInstanceOSPoliciesCompliancesRequest, ListInstanceOSPoliciesCompliancesResponse> + listInstanceOSPoliciesCompliancesTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listInstanceOSPoliciesCompliancesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getOSPolicyAssignmentReportTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getOSPolicyAssignmentReportMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsResponse> + listOSPolicyAssignmentReportsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listOSPolicyAssignmentReportsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getInventoryTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getInventoryMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listInventoriesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listInventoriesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getVulnerabilityReportTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getVulnerabilityReportMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listVulnerabilityReportsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listVulnerabilityReportsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createOSPolicyAssignmentCallable = + callableFactory.createUnaryCallable( + createOSPolicyAssignmentTransportSettings, + settings.createOSPolicyAssignmentSettings(), + clientContext); + this.createOSPolicyAssignmentOperationCallable = + callableFactory.createOperationCallable( + createOSPolicyAssignmentTransportSettings, + settings.createOSPolicyAssignmentOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateOSPolicyAssignmentCallable = + callableFactory.createUnaryCallable( + updateOSPolicyAssignmentTransportSettings, + settings.updateOSPolicyAssignmentSettings(), + clientContext); + this.updateOSPolicyAssignmentOperationCallable = + callableFactory.createOperationCallable( + updateOSPolicyAssignmentTransportSettings, + settings.updateOSPolicyAssignmentOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getOSPolicyAssignmentCallable = + callableFactory.createUnaryCallable( + getOSPolicyAssignmentTransportSettings, + settings.getOSPolicyAssignmentSettings(), + clientContext); + this.listOSPolicyAssignmentsCallable = + callableFactory.createUnaryCallable( + listOSPolicyAssignmentsTransportSettings, + settings.listOSPolicyAssignmentsSettings(), + clientContext); + this.listOSPolicyAssignmentsPagedCallable = + callableFactory.createPagedCallable( + listOSPolicyAssignmentsTransportSettings, + settings.listOSPolicyAssignmentsSettings(), + clientContext); + this.listOSPolicyAssignmentRevisionsCallable = + callableFactory.createUnaryCallable( + listOSPolicyAssignmentRevisionsTransportSettings, + settings.listOSPolicyAssignmentRevisionsSettings(), + clientContext); + this.listOSPolicyAssignmentRevisionsPagedCallable = + callableFactory.createPagedCallable( + listOSPolicyAssignmentRevisionsTransportSettings, + settings.listOSPolicyAssignmentRevisionsSettings(), + clientContext); + this.deleteOSPolicyAssignmentCallable = + callableFactory.createUnaryCallable( + deleteOSPolicyAssignmentTransportSettings, + settings.deleteOSPolicyAssignmentSettings(), + clientContext); + this.deleteOSPolicyAssignmentOperationCallable = + callableFactory.createOperationCallable( + deleteOSPolicyAssignmentTransportSettings, + settings.deleteOSPolicyAssignmentOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getInstanceOSPoliciesComplianceCallable = + callableFactory.createUnaryCallable( + getInstanceOSPoliciesComplianceTransportSettings, + settings.getInstanceOSPoliciesComplianceSettings(), + clientContext); + this.listInstanceOSPoliciesCompliancesCallable = + callableFactory.createUnaryCallable( + listInstanceOSPoliciesCompliancesTransportSettings, + settings.listInstanceOSPoliciesCompliancesSettings(), + clientContext); + this.listInstanceOSPoliciesCompliancesPagedCallable = + callableFactory.createPagedCallable( + listInstanceOSPoliciesCompliancesTransportSettings, + settings.listInstanceOSPoliciesCompliancesSettings(), + clientContext); + this.getOSPolicyAssignmentReportCallable = + callableFactory.createUnaryCallable( + getOSPolicyAssignmentReportTransportSettings, + settings.getOSPolicyAssignmentReportSettings(), + clientContext); + this.listOSPolicyAssignmentReportsCallable = + callableFactory.createUnaryCallable( + listOSPolicyAssignmentReportsTransportSettings, + settings.listOSPolicyAssignmentReportsSettings(), + clientContext); + this.listOSPolicyAssignmentReportsPagedCallable = + callableFactory.createPagedCallable( + listOSPolicyAssignmentReportsTransportSettings, + settings.listOSPolicyAssignmentReportsSettings(), + clientContext); + this.getInventoryCallable = + callableFactory.createUnaryCallable( + getInventoryTransportSettings, settings.getInventorySettings(), clientContext); + this.listInventoriesCallable = + callableFactory.createUnaryCallable( + listInventoriesTransportSettings, settings.listInventoriesSettings(), clientContext); + this.listInventoriesPagedCallable = + callableFactory.createPagedCallable( + listInventoriesTransportSettings, settings.listInventoriesSettings(), clientContext); + this.getVulnerabilityReportCallable = + callableFactory.createUnaryCallable( + getVulnerabilityReportTransportSettings, + settings.getVulnerabilityReportSettings(), + clientContext); + this.listVulnerabilityReportsCallable = + callableFactory.createUnaryCallable( + listVulnerabilityReportsTransportSettings, + settings.listVulnerabilityReportsSettings(), + clientContext); + this.listVulnerabilityReportsPagedCallable = + callableFactory.createPagedCallable( + listVulnerabilityReportsTransportSettings, + settings.listVulnerabilityReportsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createOSPolicyAssignmentMethodDescriptor); + methodDescriptors.add(updateOSPolicyAssignmentMethodDescriptor); + methodDescriptors.add(getOSPolicyAssignmentMethodDescriptor); + methodDescriptors.add(listOSPolicyAssignmentsMethodDescriptor); + methodDescriptors.add(listOSPolicyAssignmentRevisionsMethodDescriptor); + methodDescriptors.add(deleteOSPolicyAssignmentMethodDescriptor); + methodDescriptors.add(getInstanceOSPoliciesComplianceMethodDescriptor); + methodDescriptors.add(listInstanceOSPoliciesCompliancesMethodDescriptor); + methodDescriptors.add(getOSPolicyAssignmentReportMethodDescriptor); + methodDescriptors.add(listOSPolicyAssignmentReportsMethodDescriptor); + methodDescriptors.add(getInventoryMethodDescriptor); + methodDescriptors.add(listInventoriesMethodDescriptor); + methodDescriptors.add(getVulnerabilityReportMethodDescriptor); + methodDescriptors.add(listVulnerabilityReportsMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable + createOSPolicyAssignmentCallable() { + return createOSPolicyAssignmentCallable; + } + + @Override + public OperationCallable< + CreateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> + createOSPolicyAssignmentOperationCallable() { + return createOSPolicyAssignmentOperationCallable; + } + + @Override + public UnaryCallable + updateOSPolicyAssignmentCallable() { + return updateOSPolicyAssignmentCallable; + } + + @Override + public OperationCallable< + UpdateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> + updateOSPolicyAssignmentOperationCallable() { + return updateOSPolicyAssignmentOperationCallable; + } + + @Override + public UnaryCallable + getOSPolicyAssignmentCallable() { + return getOSPolicyAssignmentCallable; + } + + @Override + public UnaryCallable + listOSPolicyAssignmentsCallable() { + return listOSPolicyAssignmentsCallable; + } + + @Override + public UnaryCallable + listOSPolicyAssignmentsPagedCallable() { + return listOSPolicyAssignmentsPagedCallable; + } + + @Override + public UnaryCallable< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> + listOSPolicyAssignmentRevisionsCallable() { + return listOSPolicyAssignmentRevisionsCallable; + } + + @Override + public UnaryCallable< + ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsPagedResponse> + listOSPolicyAssignmentRevisionsPagedCallable() { + return listOSPolicyAssignmentRevisionsPagedCallable; + } + + @Override + public UnaryCallable + deleteOSPolicyAssignmentCallable() { + return deleteOSPolicyAssignmentCallable; + } + + @Override + public OperationCallable< + DeleteOSPolicyAssignmentRequest, Empty, OSPolicyAssignmentOperationMetadata> + deleteOSPolicyAssignmentOperationCallable() { + return deleteOSPolicyAssignmentOperationCallable; + } + + @Override + public UnaryCallable + getInstanceOSPoliciesComplianceCallable() { + return getInstanceOSPoliciesComplianceCallable; + } + + @Override + public UnaryCallable< + ListInstanceOSPoliciesCompliancesRequest, ListInstanceOSPoliciesCompliancesResponse> + listInstanceOSPoliciesCompliancesCallable() { + return listInstanceOSPoliciesCompliancesCallable; + } + + @Override + public UnaryCallable< + ListInstanceOSPoliciesCompliancesRequest, ListInstanceOSPoliciesCompliancesPagedResponse> + listInstanceOSPoliciesCompliancesPagedCallable() { + return listInstanceOSPoliciesCompliancesPagedCallable; + } + + @Override + public UnaryCallable + getOSPolicyAssignmentReportCallable() { + return getOSPolicyAssignmentReportCallable; + } + + @Override + public UnaryCallable + listOSPolicyAssignmentReportsCallable() { + return listOSPolicyAssignmentReportsCallable; + } + + @Override + public UnaryCallable< + ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsPagedResponse> + listOSPolicyAssignmentReportsPagedCallable() { + return listOSPolicyAssignmentReportsPagedCallable; + } + + @Override + public UnaryCallable getInventoryCallable() { + return getInventoryCallable; + } + + @Override + public UnaryCallable listInventoriesCallable() { + return listInventoriesCallable; + } + + @Override + public UnaryCallable + listInventoriesPagedCallable() { + return listInventoriesPagedCallable; + } + + @Override + public UnaryCallable + getVulnerabilityReportCallable() { + return getVulnerabilityReportCallable; + } + + @Override + public UnaryCallable + listVulnerabilityReportsCallable() { + return listVulnerabilityReportsCallable; + } + + @Override + public UnaryCallable + listVulnerabilityReportsPagedCallable() { + return listVulnerabilityReportsPagedCallable; + } + + @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-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStub.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStub.java index adf31c79..62b2aebe 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStub.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStub.java @@ -69,7 +69,11 @@ public abstract class OsConfigZonalServiceStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public OperationCallable< diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStubSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStubSettings.java index 16e8b622..02d35ba7 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStubSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/stub/OsConfigZonalServiceStubSettings.java @@ -33,6 +33,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +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.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -766,6 +769,11 @@ public OsConfigZonalServiceStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcOsConfigZonalServiceStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonOsConfigZonalServiceStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -798,18 +806,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(OsConfigZonalServiceStubSettings.class)) @@ -817,11 +832,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(OsConfigZonalServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return OsConfigZonalServiceStubSettings.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); @@ -1064,6 +1098,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 .createOSPolicyAssignmentSettings() diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java index 8e1f953a..bbf2fb0e 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClient.java @@ -115,6 +115,21 @@ * OsConfigServiceClient.create(osConfigServiceSettings); * } * + *

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.
+ * OsConfigServiceSettings osConfigServiceSettings =
+ *     OsConfigServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             OsConfigServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * OsConfigServiceClient osConfigServiceClient =
+ *     OsConfigServiceClient.create(osConfigServiceSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceSettings.java index 9fe9edc9..6d712455 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/OsConfigServiceSettings.java @@ -26,6 +26,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; @@ -226,11 +227,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return OsConfigServiceStubSettings.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 OsConfigServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return OsConfigServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return OsConfigServiceStubSettings.defaultTransportChannelProvider(); } @@ -240,11 +248,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return OsConfigServiceStubSettings.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); @@ -282,6 +296,11 @@ private static Builder createDefault() { return new Builder(OsConfigServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(OsConfigServiceStubSettings.newHttpJsonBuilder()); + } + public OsConfigServiceStubSettings.Builder getStubSettingsBuilder() { return ((OsConfigServiceStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/HttpJsonOsConfigServiceCallableFactory.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/HttpJsonOsConfigServiceCallableFactory.java new file mode 100644 index 00000000..c1333332 --- /dev/null +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/HttpJsonOsConfigServiceCallableFactory.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.osconfig.v1beta.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 OsConfigService service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonOsConfigServiceCallableFactory + 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-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/HttpJsonOsConfigServiceStub.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/HttpJsonOsConfigServiceStub.java new file mode 100644 index 00000000..0e810d0c --- /dev/null +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/HttpJsonOsConfigServiceStub.java @@ -0,0 +1,1311 @@ +/* + * 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.osconfig.v1beta.stub; + +import static com.google.cloud.osconfig.v1beta.OsConfigServiceClient.ListGuestPoliciesPagedResponse; +import static com.google.cloud.osconfig.v1beta.OsConfigServiceClient.ListPatchDeploymentsPagedResponse; +import static com.google.cloud.osconfig.v1beta.OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse; +import static com.google.cloud.osconfig.v1beta.OsConfigServiceClient.ListPatchJobsPagedResponse; + +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.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.PatchDeployments; +import com.google.cloud.osconfig.v1beta.PatchJobs; +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 OsConfigService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonOsConfigServiceStub extends OsConfigServiceStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + executePatchJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/ExecutePatchJob") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta/{parent=projects/*}/patchJobs:execute", + 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(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchJobs.PatchJob.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getPatchJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/GetPatchJob") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta/{name=projects/*/patchJobs/*}", + 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(PatchJobs.PatchJob.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + cancelPatchJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/CancelPatchJob") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta/{name=projects/*/patchJobs/*}:cancel", + 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 -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchJobs.PatchJob.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchJobs.ListPatchJobsRequest, PatchJobs.ListPatchJobsResponse> + listPatchJobsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/ListPatchJobs") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta/{parent=projects/*}/patchJobs", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchJobs.ListPatchJobsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchJobs.ListPatchJobInstanceDetailsRequest, + PatchJobs.ListPatchJobInstanceDetailsResponse> + listPatchJobInstanceDetailsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1beta.OsConfigService/ListPatchJobInstanceDetails") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta/{parent=projects/*/patchJobs/*}/instanceDetails", + 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, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser + .newBuilder() + .setDefaultInstance( + PatchJobs.ListPatchJobInstanceDetailsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + createPatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1beta.OsConfigService/CreatePatchDeployment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta/{parent=projects/*}/patchDeployments", + 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, "patchDeploymentId", request.getPatchDeploymentId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("patchDeployment", request.getPatchDeployment())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment> + getPatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/GetPatchDeployment") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta/{name=projects/*/patchDeployments/*}", + 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(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.ListPatchDeploymentsRequest, + PatchDeployments.ListPatchDeploymentsResponse> + listPatchDeploymentsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1beta.OsConfigService/ListPatchDeployments") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta/{parent=projects/*}/patchDeployments", + 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( + PatchDeployments.ListPatchDeploymentsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deletePatchDeploymentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1beta.OsConfigService/DeletePatchDeployment") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta/{name=projects/*/patchDeployments/*}", + 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 static final ApiMethodDescriptor< + PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + updatePatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1beta.OsConfigService/UpdatePatchDeployment") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta/{patchDeployment.name=projects/*/patchDeployments/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "patchDeployment.name", + request.getPatchDeployment().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("patchDeployment", request.getPatchDeployment())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment> + pausePatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1beta.OsConfigService/PausePatchDeployment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta/{name=projects/*/patchDeployments/*}:pause", + 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 -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment> + resumePatchDeploymentMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1beta.OsConfigService/ResumePatchDeployment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta/{name=projects/*/patchDeployments/*}:resume", + 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 -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PatchDeployments.PatchDeployment.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GuestPolicies.CreateGuestPolicyRequest, GuestPolicies.GuestPolicy> + createGuestPolicyMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/CreateGuestPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta/{parent=projects/*}/guestPolicies", + 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, "guestPolicyId", request.getGuestPolicyId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("guestPolicy", request.getGuestPolicy())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GuestPolicies.GuestPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GuestPolicies.GetGuestPolicyRequest, GuestPolicies.GuestPolicy> + getGuestPolicyMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/GetGuestPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta/{name=projects/*/guestPolicies/*}", + 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(GuestPolicies.GuestPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GuestPolicies.ListGuestPoliciesRequest, GuestPolicies.ListGuestPoliciesResponse> + listGuestPoliciesMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/ListGuestPolicies") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta/{parent=projects/*}/guestPolicies", + 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( + GuestPolicies.ListGuestPoliciesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GuestPolicies.UpdateGuestPolicyRequest, GuestPolicies.GuestPolicy> + updateGuestPolicyMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/UpdateGuestPolicy") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta/{guestPolicy.name=projects/*/guestPolicies/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "guestPolicy.name", request.getGuestPolicy().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("guestPolicy", request.getGuestPolicy())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GuestPolicies.GuestPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteGuestPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.osconfig.v1beta.OsConfigService/DeleteGuestPolicy") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta/{name=projects/*/guestPolicies/*}", + 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 static final ApiMethodDescriptor< + GuestPolicies.LookupEffectiveGuestPolicyRequest, GuestPolicies.EffectiveGuestPolicy> + lookupEffectiveGuestPolicyMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.osconfig.v1beta.OsConfigService/LookupEffectiveGuestPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta/{instance=projects/*/zones/*/instances/*}:lookupEffectiveGuestPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "instance", request.getInstance()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearInstance().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GuestPolicies.EffectiveGuestPolicy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable + executePatchJobCallable; + private final UnaryCallable getPatchJobCallable; + private final UnaryCallable + cancelPatchJobCallable; + private final UnaryCallable + listPatchJobsCallable; + private final UnaryCallable + listPatchJobsPagedCallable; + private final UnaryCallable< + PatchJobs.ListPatchJobInstanceDetailsRequest, + PatchJobs.ListPatchJobInstanceDetailsResponse> + listPatchJobInstanceDetailsCallable; + private final UnaryCallable< + PatchJobs.ListPatchJobInstanceDetailsRequest, ListPatchJobInstanceDetailsPagedResponse> + listPatchJobInstanceDetailsPagedCallable; + private final UnaryCallable< + PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + createPatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment> + getPatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.ListPatchDeploymentsRequest, + PatchDeployments.ListPatchDeploymentsResponse> + listPatchDeploymentsCallable; + private final UnaryCallable< + PatchDeployments.ListPatchDeploymentsRequest, ListPatchDeploymentsPagedResponse> + listPatchDeploymentsPagedCallable; + private final UnaryCallable + deletePatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + updatePatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment> + pausePatchDeploymentCallable; + private final UnaryCallable< + PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment> + resumePatchDeploymentCallable; + private final UnaryCallable + createGuestPolicyCallable; + private final UnaryCallable + getGuestPolicyCallable; + private final UnaryCallable< + GuestPolicies.ListGuestPoliciesRequest, GuestPolicies.ListGuestPoliciesResponse> + listGuestPoliciesCallable; + private final UnaryCallable< + GuestPolicies.ListGuestPoliciesRequest, ListGuestPoliciesPagedResponse> + listGuestPoliciesPagedCallable; + private final UnaryCallable + updateGuestPolicyCallable; + private final UnaryCallable + deleteGuestPolicyCallable; + private final UnaryCallable< + GuestPolicies.LookupEffectiveGuestPolicyRequest, GuestPolicies.EffectiveGuestPolicy> + lookupEffectiveGuestPolicyCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonOsConfigServiceStub create(OsConfigServiceStubSettings settings) + throws IOException { + return new HttpJsonOsConfigServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonOsConfigServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonOsConfigServiceStub( + OsConfigServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonOsConfigServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonOsConfigServiceStub( + OsConfigServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonOsConfigServiceStub, 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 HttpJsonOsConfigServiceStub( + OsConfigServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonOsConfigServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonOsConfigServiceStub, 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 HttpJsonOsConfigServiceStub( + OsConfigServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + executePatchJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(executePatchJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getPatchJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPatchJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + cancelPatchJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(cancelPatchJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listPatchJobsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listPatchJobsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchJobs.ListPatchJobInstanceDetailsRequest, + PatchJobs.ListPatchJobInstanceDetailsResponse> + listPatchJobInstanceDetailsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listPatchJobInstanceDetailsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + createPatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(createPatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment> + getPatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(getPatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.ListPatchDeploymentsRequest, + PatchDeployments.ListPatchDeploymentsResponse> + listPatchDeploymentsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listPatchDeploymentsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deletePatchDeploymentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deletePatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + updatePatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(updatePatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment> + pausePatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(pausePatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment> + resumePatchDeploymentTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(resumePatchDeploymentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createGuestPolicyTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(createGuestPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getGuestPolicyTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getGuestPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + GuestPolicies.ListGuestPoliciesRequest, GuestPolicies.ListGuestPoliciesResponse> + listGuestPoliciesTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listGuestPoliciesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateGuestPolicyTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(updateGuestPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteGuestPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteGuestPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + GuestPolicies.LookupEffectiveGuestPolicyRequest, GuestPolicies.EffectiveGuestPolicy> + lookupEffectiveGuestPolicyTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(lookupEffectiveGuestPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.executePatchJobCallable = + callableFactory.createUnaryCallable( + executePatchJobTransportSettings, settings.executePatchJobSettings(), clientContext); + this.getPatchJobCallable = + callableFactory.createUnaryCallable( + getPatchJobTransportSettings, settings.getPatchJobSettings(), clientContext); + this.cancelPatchJobCallable = + callableFactory.createUnaryCallable( + cancelPatchJobTransportSettings, settings.cancelPatchJobSettings(), clientContext); + this.listPatchJobsCallable = + callableFactory.createUnaryCallable( + listPatchJobsTransportSettings, settings.listPatchJobsSettings(), clientContext); + this.listPatchJobsPagedCallable = + callableFactory.createPagedCallable( + listPatchJobsTransportSettings, settings.listPatchJobsSettings(), clientContext); + this.listPatchJobInstanceDetailsCallable = + callableFactory.createUnaryCallable( + listPatchJobInstanceDetailsTransportSettings, + settings.listPatchJobInstanceDetailsSettings(), + clientContext); + this.listPatchJobInstanceDetailsPagedCallable = + callableFactory.createPagedCallable( + listPatchJobInstanceDetailsTransportSettings, + settings.listPatchJobInstanceDetailsSettings(), + clientContext); + this.createPatchDeploymentCallable = + callableFactory.createUnaryCallable( + createPatchDeploymentTransportSettings, + settings.createPatchDeploymentSettings(), + clientContext); + this.getPatchDeploymentCallable = + callableFactory.createUnaryCallable( + getPatchDeploymentTransportSettings, + settings.getPatchDeploymentSettings(), + clientContext); + this.listPatchDeploymentsCallable = + callableFactory.createUnaryCallable( + listPatchDeploymentsTransportSettings, + settings.listPatchDeploymentsSettings(), + clientContext); + this.listPatchDeploymentsPagedCallable = + callableFactory.createPagedCallable( + listPatchDeploymentsTransportSettings, + settings.listPatchDeploymentsSettings(), + clientContext); + this.deletePatchDeploymentCallable = + callableFactory.createUnaryCallable( + deletePatchDeploymentTransportSettings, + settings.deletePatchDeploymentSettings(), + clientContext); + this.updatePatchDeploymentCallable = + callableFactory.createUnaryCallable( + updatePatchDeploymentTransportSettings, + settings.updatePatchDeploymentSettings(), + clientContext); + this.pausePatchDeploymentCallable = + callableFactory.createUnaryCallable( + pausePatchDeploymentTransportSettings, + settings.pausePatchDeploymentSettings(), + clientContext); + this.resumePatchDeploymentCallable = + callableFactory.createUnaryCallable( + resumePatchDeploymentTransportSettings, + settings.resumePatchDeploymentSettings(), + clientContext); + this.createGuestPolicyCallable = + callableFactory.createUnaryCallable( + createGuestPolicyTransportSettings, + settings.createGuestPolicySettings(), + clientContext); + this.getGuestPolicyCallable = + callableFactory.createUnaryCallable( + getGuestPolicyTransportSettings, settings.getGuestPolicySettings(), clientContext); + this.listGuestPoliciesCallable = + callableFactory.createUnaryCallable( + listGuestPoliciesTransportSettings, + settings.listGuestPoliciesSettings(), + clientContext); + this.listGuestPoliciesPagedCallable = + callableFactory.createPagedCallable( + listGuestPoliciesTransportSettings, + settings.listGuestPoliciesSettings(), + clientContext); + this.updateGuestPolicyCallable = + callableFactory.createUnaryCallable( + updateGuestPolicyTransportSettings, + settings.updateGuestPolicySettings(), + clientContext); + this.deleteGuestPolicyCallable = + callableFactory.createUnaryCallable( + deleteGuestPolicyTransportSettings, + settings.deleteGuestPolicySettings(), + clientContext); + this.lookupEffectiveGuestPolicyCallable = + callableFactory.createUnaryCallable( + lookupEffectiveGuestPolicyTransportSettings, + settings.lookupEffectiveGuestPolicySettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(executePatchJobMethodDescriptor); + methodDescriptors.add(getPatchJobMethodDescriptor); + methodDescriptors.add(cancelPatchJobMethodDescriptor); + methodDescriptors.add(listPatchJobsMethodDescriptor); + methodDescriptors.add(listPatchJobInstanceDetailsMethodDescriptor); + methodDescriptors.add(createPatchDeploymentMethodDescriptor); + methodDescriptors.add(getPatchDeploymentMethodDescriptor); + methodDescriptors.add(listPatchDeploymentsMethodDescriptor); + methodDescriptors.add(deletePatchDeploymentMethodDescriptor); + methodDescriptors.add(updatePatchDeploymentMethodDescriptor); + methodDescriptors.add(pausePatchDeploymentMethodDescriptor); + methodDescriptors.add(resumePatchDeploymentMethodDescriptor); + methodDescriptors.add(createGuestPolicyMethodDescriptor); + methodDescriptors.add(getGuestPolicyMethodDescriptor); + methodDescriptors.add(listGuestPoliciesMethodDescriptor); + methodDescriptors.add(updateGuestPolicyMethodDescriptor); + methodDescriptors.add(deleteGuestPolicyMethodDescriptor); + methodDescriptors.add(lookupEffectiveGuestPolicyMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable + executePatchJobCallable() { + return executePatchJobCallable; + } + + @Override + public UnaryCallable getPatchJobCallable() { + return getPatchJobCallable; + } + + @Override + public UnaryCallable + cancelPatchJobCallable() { + return cancelPatchJobCallable; + } + + @Override + public UnaryCallable + listPatchJobsCallable() { + return listPatchJobsCallable; + } + + @Override + public UnaryCallable + listPatchJobsPagedCallable() { + return listPatchJobsPagedCallable; + } + + @Override + public UnaryCallable< + PatchJobs.ListPatchJobInstanceDetailsRequest, + PatchJobs.ListPatchJobInstanceDetailsResponse> + listPatchJobInstanceDetailsCallable() { + return listPatchJobInstanceDetailsCallable; + } + + @Override + public UnaryCallable< + PatchJobs.ListPatchJobInstanceDetailsRequest, ListPatchJobInstanceDetailsPagedResponse> + listPatchJobInstanceDetailsPagedCallable() { + return listPatchJobInstanceDetailsPagedCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + createPatchDeploymentCallable() { + return createPatchDeploymentCallable; + } + + @Override + public UnaryCallable + getPatchDeploymentCallable() { + return getPatchDeploymentCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.ListPatchDeploymentsRequest, + PatchDeployments.ListPatchDeploymentsResponse> + listPatchDeploymentsCallable() { + return listPatchDeploymentsCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.ListPatchDeploymentsRequest, ListPatchDeploymentsPagedResponse> + listPatchDeploymentsPagedCallable() { + return listPatchDeploymentsPagedCallable; + } + + @Override + public UnaryCallable + deletePatchDeploymentCallable() { + return deletePatchDeploymentCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment> + updatePatchDeploymentCallable() { + return updatePatchDeploymentCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment> + pausePatchDeploymentCallable() { + return pausePatchDeploymentCallable; + } + + @Override + public UnaryCallable< + PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment> + resumePatchDeploymentCallable() { + return resumePatchDeploymentCallable; + } + + @Override + public UnaryCallable + createGuestPolicyCallable() { + return createGuestPolicyCallable; + } + + @Override + public UnaryCallable + getGuestPolicyCallable() { + return getGuestPolicyCallable; + } + + @Override + public UnaryCallable< + GuestPolicies.ListGuestPoliciesRequest, GuestPolicies.ListGuestPoliciesResponse> + listGuestPoliciesCallable() { + return listGuestPoliciesCallable; + } + + @Override + public UnaryCallable + listGuestPoliciesPagedCallable() { + return listGuestPoliciesPagedCallable; + } + + @Override + public UnaryCallable + updateGuestPolicyCallable() { + return updateGuestPolicyCallable; + } + + @Override + public UnaryCallable deleteGuestPolicyCallable() { + return deleteGuestPolicyCallable; + } + + @Override + public UnaryCallable< + GuestPolicies.LookupEffectiveGuestPolicyRequest, GuestPolicies.EffectiveGuestPolicy> + lookupEffectiveGuestPolicyCallable() { + return lookupEffectiveGuestPolicyCallable; + } + + @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-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/OsConfigServiceStubSettings.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/OsConfigServiceStubSettings.java index bf1745b0..75c7b861 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/OsConfigServiceStubSettings.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1beta/stub/OsConfigServiceStubSettings.java @@ -30,6 +30,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; @@ -592,6 +595,11 @@ public OsConfigServiceStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcOsConfigServiceStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonOsConfigServiceStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -624,18 +632,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(OsConfigServiceStubSettings.class)) @@ -643,11 +658,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(OsConfigServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return OsConfigServiceStubSettings.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); @@ -883,6 +917,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 .executePatchJobSettings() diff --git a/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigServiceClientHttpJsonTest.java b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigServiceClientHttpJsonTest.java new file mode 100644 index 00000000..739cb860 --- /dev/null +++ b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigServiceClientHttpJsonTest.java @@ -0,0 +1,1242 @@ +/* + * 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.osconfig.v1; + +import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchDeploymentsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchJobsPagedResponse; + +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.osconfig.v1.stub.HttpJsonOsConfigServiceStub; +import com.google.common.collect.Lists; +import com.google.protobuf.Duration; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.Arrays; +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 OsConfigServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static OsConfigServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonOsConfigServiceStub.getMethodDescriptors(), + OsConfigServiceSettings.getDefaultEndpoint()); + OsConfigServiceSettings settings = + OsConfigServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + OsConfigServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = OsConfigServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void executePatchJobTest() throws Exception { + PatchJobs.PatchJob expectedResponse = + PatchJobs.PatchJob.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setInstanceDetailsSummary( + PatchJobs.PatchJob.InstanceDetailsSummary.newBuilder().build()) + .setDryRun(true) + .setErrorMessage("errorMessage1203236063") + .setPercentComplete(-1960969229) + .setPatchDeployment( + PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchJobs.ExecutePatchJobRequest request = + PatchJobs.ExecutePatchJobRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setDryRun(true) + .setDisplayName("displayName1714148973") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + + PatchJobs.PatchJob actualResponse = client.executePatchJob(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 executePatchJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchJobs.ExecutePatchJobRequest request = + PatchJobs.ExecutePatchJobRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setDryRun(true) + .setDisplayName("displayName1714148973") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + client.executePatchJob(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPatchJobTest() throws Exception { + PatchJobs.PatchJob expectedResponse = + PatchJobs.PatchJob.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setInstanceDetailsSummary( + PatchJobs.PatchJob.InstanceDetailsSummary.newBuilder().build()) + .setDryRun(true) + .setErrorMessage("errorMessage1203236063") + .setPercentComplete(-1960969229) + .setPatchDeployment( + PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchJobName name = PatchJobName.of("[PROJECT]", "[PATCH_JOB]"); + + PatchJobs.PatchJob actualResponse = client.getPatchJob(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 getPatchJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchJobName name = PatchJobName.of("[PROJECT]", "[PATCH_JOB]"); + client.getPatchJob(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPatchJobTest2() throws Exception { + PatchJobs.PatchJob expectedResponse = + PatchJobs.PatchJob.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setInstanceDetailsSummary( + PatchJobs.PatchJob.InstanceDetailsSummary.newBuilder().build()) + .setDryRun(true) + .setErrorMessage("errorMessage1203236063") + .setPercentComplete(-1960969229) + .setPatchDeployment( + PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3014/patchJobs/patchJob-3014"; + + PatchJobs.PatchJob actualResponse = client.getPatchJob(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 getPatchJobExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3014/patchJobs/patchJob-3014"; + client.getPatchJob(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void cancelPatchJobTest() throws Exception { + PatchJobs.PatchJob expectedResponse = + PatchJobs.PatchJob.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setInstanceDetailsSummary( + PatchJobs.PatchJob.InstanceDetailsSummary.newBuilder().build()) + .setDryRun(true) + .setErrorMessage("errorMessage1203236063") + .setPercentComplete(-1960969229) + .setPatchDeployment( + PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchJobs.CancelPatchJobRequest request = + PatchJobs.CancelPatchJobRequest.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .build(); + + PatchJobs.PatchJob actualResponse = client.cancelPatchJob(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 cancelPatchJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchJobs.CancelPatchJobRequest request = + PatchJobs.CancelPatchJobRequest.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .build(); + client.cancelPatchJob(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPatchJobsTest() throws Exception { + PatchJobs.PatchJob responsesElement = PatchJobs.PatchJob.newBuilder().build(); + PatchJobs.ListPatchJobsResponse expectedResponse = + PatchJobs.ListPatchJobsResponse.newBuilder() + .setNextPageToken("") + .addAllPatchJobs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListPatchJobsPagedResponse pagedListResponse = client.listPatchJobs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPatchJobsList().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 listPatchJobsExceptionTest() 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.listPatchJobs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPatchJobsTest2() throws Exception { + PatchJobs.PatchJob responsesElement = PatchJobs.PatchJob.newBuilder().build(); + PatchJobs.ListPatchJobsResponse expectedResponse = + PatchJobs.ListPatchJobsResponse.newBuilder() + .setNextPageToken("") + .addAllPatchJobs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + + ListPatchJobsPagedResponse pagedListResponse = client.listPatchJobs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPatchJobsList().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 listPatchJobsExceptionTest2() 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.listPatchJobs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPatchJobInstanceDetailsTest() throws Exception { + PatchJobs.PatchJobInstanceDetails responsesElement = + PatchJobs.PatchJobInstanceDetails.newBuilder().build(); + PatchJobs.ListPatchJobInstanceDetailsResponse expectedResponse = + PatchJobs.ListPatchJobInstanceDetailsResponse.newBuilder() + .setNextPageToken("") + .addAllPatchJobInstanceDetails(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PatchJobName parent = PatchJobName.of("[PROJECT]", "[PATCH_JOB]"); + + ListPatchJobInstanceDetailsPagedResponse pagedListResponse = + client.listPatchJobInstanceDetails(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPatchJobInstanceDetailsList().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 listPatchJobInstanceDetailsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchJobName parent = PatchJobName.of("[PROJECT]", "[PATCH_JOB]"); + client.listPatchJobInstanceDetails(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPatchJobInstanceDetailsTest2() throws Exception { + PatchJobs.PatchJobInstanceDetails responsesElement = + PatchJobs.PatchJobInstanceDetails.newBuilder().build(); + PatchJobs.ListPatchJobInstanceDetailsResponse expectedResponse = + PatchJobs.ListPatchJobInstanceDetailsResponse.newBuilder() + .setNextPageToken("") + .addAllPatchJobInstanceDetails(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-1881/patchJobs/patchJob-1881"; + + ListPatchJobInstanceDetailsPagedResponse pagedListResponse = + client.listPatchJobInstanceDetails(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPatchJobInstanceDetailsList().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 listPatchJobInstanceDetailsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-1881/patchJobs/patchJob-1881"; + client.listPatchJobInstanceDetails(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder().build(); + String patchDeploymentId = "patchDeploymentId-1180405976"; + + PatchDeployments.PatchDeployment actualResponse = + client.createPatchDeployment(parent, patchDeployment, patchDeploymentId); + 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 createPatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder().build(); + String patchDeploymentId = "patchDeploymentId-1180405976"; + client.createPatchDeployment(parent, patchDeployment, patchDeploymentId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPatchDeploymentTest2() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder().build(); + String patchDeploymentId = "patchDeploymentId-1180405976"; + + PatchDeployments.PatchDeployment actualResponse = + client.createPatchDeployment(parent, patchDeployment, patchDeploymentId); + 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 createPatchDeploymentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2353"; + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder().build(); + String patchDeploymentId = "patchDeploymentId-1180405976"; + client.createPatchDeployment(parent, patchDeployment, patchDeploymentId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + + PatchDeployments.PatchDeployment actualResponse = client.getPatchDeployment(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 getPatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + client.getPatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPatchDeploymentTest2() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + + PatchDeployments.PatchDeployment actualResponse = client.getPatchDeployment(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 getPatchDeploymentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + client.getPatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPatchDeploymentsTest() throws Exception { + PatchDeployments.PatchDeployment responsesElement = + PatchDeployments.PatchDeployment.newBuilder().build(); + PatchDeployments.ListPatchDeploymentsResponse expectedResponse = + PatchDeployments.ListPatchDeploymentsResponse.newBuilder() + .setNextPageToken("") + .addAllPatchDeployments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListPatchDeploymentsPagedResponse pagedListResponse = client.listPatchDeployments(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPatchDeploymentsList().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 listPatchDeploymentsExceptionTest() 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.listPatchDeployments(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPatchDeploymentsTest2() throws Exception { + PatchDeployments.PatchDeployment responsesElement = + PatchDeployments.PatchDeployment.newBuilder().build(); + PatchDeployments.ListPatchDeploymentsResponse expectedResponse = + PatchDeployments.ListPatchDeploymentsResponse.newBuilder() + .setNextPageToken("") + .addAllPatchDeployments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + + ListPatchDeploymentsPagedResponse pagedListResponse = client.listPatchDeployments(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPatchDeploymentsList().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 listPatchDeploymentsExceptionTest2() 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.listPatchDeployments(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePatchDeploymentTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + + client.deletePatchDeployment(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 deletePatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + client.deletePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePatchDeploymentTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + + client.deletePatchDeployment(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 deletePatchDeploymentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + client.deletePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updatePatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + PatchDeployments.PatchDeployment actualResponse = + client.updatePatchDeployment(patchDeployment, updateMask); + 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 updatePatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updatePatchDeployment(patchDeployment, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pausePatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + + PatchDeployments.PatchDeployment actualResponse = client.pausePatchDeployment(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 pausePatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + client.pausePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pausePatchDeploymentTest2() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + + PatchDeployments.PatchDeployment actualResponse = client.pausePatchDeployment(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 pausePatchDeploymentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + client.pausePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resumePatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + + PatchDeployments.PatchDeployment actualResponse = client.resumePatchDeployment(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 resumePatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + client.resumePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resumePatchDeploymentTest2() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + + PatchDeployments.PatchDeployment actualResponse = client.resumePatchDeployment(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 resumePatchDeploymentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + client.resumePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClientHttpJsonTest.java b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClientHttpJsonTest.java new file mode 100644 index 00000000..3f589023 --- /dev/null +++ b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClientHttpJsonTest.java @@ -0,0 +1,1359 @@ +/* + * 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.osconfig.v1; + +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListInventoriesPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse; +import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse; + +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.osconfig.v1.stub.HttpJsonOsConfigZonalServiceStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +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 java.util.concurrent.ExecutionException; +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 OsConfigZonalServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static OsConfigZonalServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonOsConfigZonalServiceStub.getMethodDescriptors(), + OsConfigZonalServiceSettings.getDefaultEndpoint()); + OsConfigZonalServiceSettings settings = + OsConfigZonalServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + OsConfigZonalServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = OsConfigZonalServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createOSPolicyAssignmentTest() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + + OSPolicyAssignment actualResponse = + client + .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId) + .get(); + 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 createOSPolicyAssignmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + client.createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createOSPolicyAssignmentTest2() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + + OSPolicyAssignment actualResponse = + client + .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId) + .get(); + 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 createOSPolicyAssignmentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + client.createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateOSPolicyAssignmentTest() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + OSPolicyAssignment osPolicyAssignment = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + OSPolicyAssignment actualResponse = + client.updateOSPolicyAssignmentAsync(osPolicyAssignment, updateMask).get(); + 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 updateOSPolicyAssignmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignment osPolicyAssignment = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateOSPolicyAssignmentAsync(osPolicyAssignment, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getOSPolicyAssignmentTest() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + mockService.addResponse(expectedResponse); + + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + + OSPolicyAssignment actualResponse = client.getOSPolicyAssignment(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 getOSPolicyAssignmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + client.getOSPolicyAssignment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getOSPolicyAssignmentTest2() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + + OSPolicyAssignment actualResponse = client.getOSPolicyAssignment(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 getOSPolicyAssignmentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + client.getOSPolicyAssignment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentsTest() throws Exception { + OSPolicyAssignment responsesElement = OSPolicyAssignment.newBuilder().build(); + ListOSPolicyAssignmentsResponse expectedResponse = + ListOSPolicyAssignmentsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListOSPolicyAssignmentsPagedResponse pagedListResponse = client.listOSPolicyAssignments(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOsPolicyAssignmentsList().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 listOSPolicyAssignmentsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listOSPolicyAssignments(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentsTest2() throws Exception { + OSPolicyAssignment responsesElement = OSPolicyAssignment.newBuilder().build(); + ListOSPolicyAssignmentsResponse expectedResponse = + ListOSPolicyAssignmentsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListOSPolicyAssignmentsPagedResponse pagedListResponse = client.listOSPolicyAssignments(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOsPolicyAssignmentsList().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 listOSPolicyAssignmentsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listOSPolicyAssignments(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentRevisionsTest() throws Exception { + OSPolicyAssignment responsesElement = OSPolicyAssignment.newBuilder().build(); + ListOSPolicyAssignmentRevisionsResponse expectedResponse = + ListOSPolicyAssignmentRevisionsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + + ListOSPolicyAssignmentRevisionsPagedResponse pagedListResponse = + client.listOSPolicyAssignmentRevisions(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOsPolicyAssignmentsList().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 listOSPolicyAssignmentRevisionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + client.listOSPolicyAssignmentRevisions(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentRevisionsTest2() throws Exception { + OSPolicyAssignment responsesElement = OSPolicyAssignment.newBuilder().build(); + ListOSPolicyAssignmentRevisionsResponse expectedResponse = + ListOSPolicyAssignmentRevisionsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + + ListOSPolicyAssignmentRevisionsPagedResponse pagedListResponse = + client.listOSPolicyAssignmentRevisions(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOsPolicyAssignmentsList().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 listOSPolicyAssignmentRevisionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + client.listOSPolicyAssignmentRevisions(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteOSPolicyAssignmentTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + + client.deleteOSPolicyAssignmentAsync(name).get(); + + 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 deleteOSPolicyAssignmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + client.deleteOSPolicyAssignmentAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteOSPolicyAssignmentTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + + client.deleteOSPolicyAssignmentAsync(name).get(); + + 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 deleteOSPolicyAssignmentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + client.deleteOSPolicyAssignmentAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getOSPolicyAssignmentReportTest() throws Exception { + OSPolicyAssignmentReport expectedResponse = + OSPolicyAssignmentReport.newBuilder() + .setName( + OSPolicyAssignmentReportName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setInstance("instance555127957") + .setOsPolicyAssignment( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .addAllOsPolicyCompliances(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunId("lastRunId2001336336") + .build(); + mockService.addResponse(expectedResponse); + + OSPolicyAssignmentReportName name = + OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + + OSPolicyAssignmentReport actualResponse = client.getOSPolicyAssignmentReport(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 getOSPolicyAssignmentReportExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignmentReportName name = + OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + client.getOSPolicyAssignmentReport(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getOSPolicyAssignmentReportTest2() throws Exception { + OSPolicyAssignmentReport expectedResponse = + OSPolicyAssignmentReport.newBuilder() + .setName( + OSPolicyAssignmentReportName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setInstance("instance555127957") + .setOsPolicyAssignment( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .addAllOsPolicyCompliances(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunId("lastRunId2001336336") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-6771/locations/location-6771/instances/instance-6771/osPolicyAssignments/osPolicyAssignment-6771/report"; + + OSPolicyAssignmentReport actualResponse = client.getOSPolicyAssignmentReport(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 getOSPolicyAssignmentReportExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6771/locations/location-6771/instances/instance-6771/osPolicyAssignments/osPolicyAssignment-6771/report"; + client.getOSPolicyAssignmentReport(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentReportsTest() throws Exception { + OSPolicyAssignmentReport responsesElement = OSPolicyAssignmentReport.newBuilder().build(); + ListOSPolicyAssignmentReportsResponse expectedResponse = + ListOSPolicyAssignmentReportsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignmentReports(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + InstanceOSPolicyAssignmentName parent = + InstanceOSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + + ListOSPolicyAssignmentReportsPagedResponse pagedListResponse = + client.listOSPolicyAssignmentReports(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getOsPolicyAssignmentReportsList().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 listOSPolicyAssignmentReportsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceOSPolicyAssignmentName parent = + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + client.listOSPolicyAssignmentReports(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentReportsTest2() throws Exception { + OSPolicyAssignmentReport responsesElement = OSPolicyAssignmentReport.newBuilder().build(); + ListOSPolicyAssignmentReportsResponse expectedResponse = + ListOSPolicyAssignmentReportsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignmentReports(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-6863/locations/location-6863/instances/instance-6863/osPolicyAssignments/osPolicyAssignment-6863"; + + ListOSPolicyAssignmentReportsPagedResponse pagedListResponse = + client.listOSPolicyAssignmentReports(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getOsPolicyAssignmentReportsList().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 listOSPolicyAssignmentReportsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-6863/locations/location-6863/instances/instance-6863/osPolicyAssignments/osPolicyAssignment-6863"; + client.listOSPolicyAssignmentReports(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getInventoryTest() throws Exception { + Inventory expectedResponse = + Inventory.newBuilder() + .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setOsInfo(Inventory.OsInfo.newBuilder().build()) + .putAllItems(new HashMap()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + InventoryName name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + Inventory actualResponse = client.getInventory(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 getInventoryExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InventoryName name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + client.getInventory(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getInventoryTest2() throws Exception { + Inventory expectedResponse = + Inventory.newBuilder() + .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setOsInfo(Inventory.OsInfo.newBuilder().build()) + .putAllItems(new HashMap()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-943/locations/location-943/instances/instance-943/inventory"; + + Inventory actualResponse = client.getInventory(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 getInventoryExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-943/locations/location-943/instances/instance-943/inventory"; + client.getInventory(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInventoriesTest() throws Exception { + Inventory responsesElement = Inventory.newBuilder().build(); + ListInventoriesResponse expectedResponse = + ListInventoriesResponse.newBuilder() + .setNextPageToken("") + .addAllInventories(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + InstanceName parent = + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + ListInventoriesPagedResponse pagedListResponse = client.listInventories(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInventoriesList().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 listInventoriesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceName parent = + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + client.listInventories(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInventoriesTest2() throws Exception { + Inventory responsesElement = Inventory.newBuilder().build(); + ListInventoriesResponse expectedResponse = + ListInventoriesResponse.newBuilder() + .setNextPageToken("") + .addAllInventories(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5197/locations/location-5197/instances/instance-5197"; + + ListInventoriesPagedResponse pagedListResponse = client.listInventories(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInventoriesList().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 listInventoriesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5197/locations/location-5197/instances/instance-5197"; + client.listInventories(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getVulnerabilityReportTest() throws Exception { + VulnerabilityReport expectedResponse = + VulnerabilityReport.newBuilder() + .setName(VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .addAllVulnerabilities(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + VulnerabilityReportName name = + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + VulnerabilityReport actualResponse = client.getVulnerabilityReport(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 getVulnerabilityReportExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + VulnerabilityReportName name = + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + client.getVulnerabilityReport(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getVulnerabilityReportTest2() throws Exception { + VulnerabilityReport expectedResponse = + VulnerabilityReport.newBuilder() + .setName(VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .addAllVulnerabilities(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-2379/locations/location-2379/instances/instance-2379/vulnerabilityReport"; + + VulnerabilityReport actualResponse = client.getVulnerabilityReport(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 getVulnerabilityReportExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-2379/locations/location-2379/instances/instance-2379/vulnerabilityReport"; + client.getVulnerabilityReport(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listVulnerabilityReportsTest() throws Exception { + VulnerabilityReport responsesElement = VulnerabilityReport.newBuilder().build(); + ListVulnerabilityReportsResponse expectedResponse = + ListVulnerabilityReportsResponse.newBuilder() + .setNextPageToken("") + .addAllVulnerabilityReports(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + InstanceName parent = + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + ListVulnerabilityReportsPagedResponse pagedListResponse = + client.listVulnerabilityReports(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getVulnerabilityReportsList().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 listVulnerabilityReportsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceName parent = + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + client.listVulnerabilityReports(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listVulnerabilityReportsTest2() throws Exception { + VulnerabilityReport responsesElement = VulnerabilityReport.newBuilder().build(); + ListVulnerabilityReportsResponse expectedResponse = + ListVulnerabilityReportsResponse.newBuilder() + .setNextPageToken("") + .addAllVulnerabilityReports(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5197/locations/location-5197/instances/instance-5197"; + + ListVulnerabilityReportsPagedResponse pagedListResponse = + client.listVulnerabilityReports(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getVulnerabilityReportsList().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 listVulnerabilityReportsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5197/locations/location-5197/instances/instance-5197"; + client.listVulnerabilityReports(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClientHttpJsonTest.java b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClientHttpJsonTest.java new file mode 100644 index 00000000..44e3bfba --- /dev/null +++ b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClientHttpJsonTest.java @@ -0,0 +1,1576 @@ +/* + * 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.osconfig.v1alpha; + +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListInventoriesPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse; +import static com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse; + +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.osconfig.v1alpha.stub.HttpJsonOsConfigZonalServiceStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +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 java.util.concurrent.ExecutionException; +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 OsConfigZonalServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static OsConfigZonalServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonOsConfigZonalServiceStub.getMethodDescriptors(), + OsConfigZonalServiceSettings.getDefaultEndpoint()); + OsConfigZonalServiceSettings settings = + OsConfigZonalServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + OsConfigZonalServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = OsConfigZonalServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createOSPolicyAssignmentTest() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + + OSPolicyAssignment actualResponse = + client + .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId) + .get(); + 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 createOSPolicyAssignmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + client.createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createOSPolicyAssignmentTest2() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + + OSPolicyAssignment actualResponse = + client + .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId) + .get(); + 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 createOSPolicyAssignmentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + client.createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateOSPolicyAssignmentTest() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + OSPolicyAssignment osPolicyAssignment = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + OSPolicyAssignment actualResponse = + client.updateOSPolicyAssignmentAsync(osPolicyAssignment, updateMask).get(); + 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 updateOSPolicyAssignmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignment osPolicyAssignment = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateOSPolicyAssignmentAsync(osPolicyAssignment, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getOSPolicyAssignmentTest() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + mockService.addResponse(expectedResponse); + + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + + OSPolicyAssignment actualResponse = client.getOSPolicyAssignment(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 getOSPolicyAssignmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + client.getOSPolicyAssignment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getOSPolicyAssignmentTest2() throws Exception { + OSPolicyAssignment expectedResponse = + OSPolicyAssignment.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setDescription("description-1724546052") + .addAllOsPolicies(new ArrayList()) + .setInstanceFilter(OSPolicyAssignment.InstanceFilter.newBuilder().build()) + .setRollout(OSPolicyAssignment.Rollout.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setEtag("etag3123477") + .setBaseline(true) + .setDeleted(true) + .setReconciling(true) + .setUid("uid115792") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + + OSPolicyAssignment actualResponse = client.getOSPolicyAssignment(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 getOSPolicyAssignmentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + client.getOSPolicyAssignment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentsTest() throws Exception { + OSPolicyAssignment responsesElement = OSPolicyAssignment.newBuilder().build(); + ListOSPolicyAssignmentsResponse expectedResponse = + ListOSPolicyAssignmentsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListOSPolicyAssignmentsPagedResponse pagedListResponse = client.listOSPolicyAssignments(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOsPolicyAssignmentsList().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 listOSPolicyAssignmentsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listOSPolicyAssignments(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentsTest2() throws Exception { + OSPolicyAssignment responsesElement = OSPolicyAssignment.newBuilder().build(); + ListOSPolicyAssignmentsResponse expectedResponse = + ListOSPolicyAssignmentsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListOSPolicyAssignmentsPagedResponse pagedListResponse = client.listOSPolicyAssignments(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOsPolicyAssignmentsList().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 listOSPolicyAssignmentsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listOSPolicyAssignments(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentRevisionsTest() throws Exception { + OSPolicyAssignment responsesElement = OSPolicyAssignment.newBuilder().build(); + ListOSPolicyAssignmentRevisionsResponse expectedResponse = + ListOSPolicyAssignmentRevisionsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + + ListOSPolicyAssignmentRevisionsPagedResponse pagedListResponse = + client.listOSPolicyAssignmentRevisions(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOsPolicyAssignmentsList().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 listOSPolicyAssignmentRevisionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + client.listOSPolicyAssignmentRevisions(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentRevisionsTest2() throws Exception { + OSPolicyAssignment responsesElement = OSPolicyAssignment.newBuilder().build(); + ListOSPolicyAssignmentRevisionsResponse expectedResponse = + ListOSPolicyAssignmentRevisionsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + + ListOSPolicyAssignmentRevisionsPagedResponse pagedListResponse = + client.listOSPolicyAssignmentRevisions(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOsPolicyAssignmentsList().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 listOSPolicyAssignmentRevisionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + client.listOSPolicyAssignmentRevisions(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteOSPolicyAssignmentTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + + client.deleteOSPolicyAssignmentAsync(name).get(); + + 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 deleteOSPolicyAssignmentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + client.deleteOSPolicyAssignmentAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteOSPolicyAssignmentTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteOSPolicyAssignmentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + + client.deleteOSPolicyAssignmentAsync(name).get(); + + 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 deleteOSPolicyAssignmentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-1862/locations/location-1862/osPolicyAssignments/osPolicyAssignment-1862"; + client.deleteOSPolicyAssignmentAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getInstanceOSPoliciesComplianceTest() throws Exception { + InstanceOSPoliciesCompliance expectedResponse = + InstanceOSPoliciesCompliance.newBuilder() + .setName( + InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .setInstance("instance555127957") + .setState(OSPolicyComplianceState.forNumber(0)) + .setDetailedState("detailedState1829498305") + .setDetailedStateReason("detailedStateReason-790407323") + .addAllOsPolicyCompliances( + new ArrayList()) + .setLastComplianceCheckTime(Timestamp.newBuilder().build()) + .setLastComplianceRunId("lastComplianceRunId168782901") + .build(); + mockService.addResponse(expectedResponse); + + InstanceOSPoliciesComplianceName name = + InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + InstanceOSPoliciesCompliance actualResponse = client.getInstanceOSPoliciesCompliance(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 getInstanceOSPoliciesComplianceExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceOSPoliciesComplianceName name = + InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + client.getInstanceOSPoliciesCompliance(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getInstanceOSPoliciesComplianceTest2() throws Exception { + InstanceOSPoliciesCompliance expectedResponse = + InstanceOSPoliciesCompliance.newBuilder() + .setName( + InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .setInstance("instance555127957") + .setState(OSPolicyComplianceState.forNumber(0)) + .setDetailedState("detailedState1829498305") + .setDetailedStateReason("detailedStateReason-790407323") + .addAllOsPolicyCompliances( + new ArrayList()) + .setLastComplianceCheckTime(Timestamp.newBuilder().build()) + .setLastComplianceRunId("lastComplianceRunId168782901") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-1829/locations/location-1829/instanceOSPoliciesCompliances/instanceOSPoliciesCompliance-1829"; + + InstanceOSPoliciesCompliance actualResponse = client.getInstanceOSPoliciesCompliance(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 getInstanceOSPoliciesComplianceExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-1829/locations/location-1829/instanceOSPoliciesCompliances/instanceOSPoliciesCompliance-1829"; + client.getInstanceOSPoliciesCompliance(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInstanceOSPoliciesCompliancesTest() throws Exception { + InstanceOSPoliciesCompliance responsesElement = + InstanceOSPoliciesCompliance.newBuilder().build(); + ListInstanceOSPoliciesCompliancesResponse expectedResponse = + ListInstanceOSPoliciesCompliancesResponse.newBuilder() + .setNextPageToken("") + .addAllInstanceOsPoliciesCompliances(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListInstanceOSPoliciesCompliancesPagedResponse pagedListResponse = + client.listInstanceOSPoliciesCompliances(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getInstanceOsPoliciesCompliancesList().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 listInstanceOSPoliciesCompliancesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listInstanceOSPoliciesCompliances(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInstanceOSPoliciesCompliancesTest2() throws Exception { + InstanceOSPoliciesCompliance responsesElement = + InstanceOSPoliciesCompliance.newBuilder().build(); + ListInstanceOSPoliciesCompliancesResponse expectedResponse = + ListInstanceOSPoliciesCompliancesResponse.newBuilder() + .setNextPageToken("") + .addAllInstanceOsPoliciesCompliances(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListInstanceOSPoliciesCompliancesPagedResponse pagedListResponse = + client.listInstanceOSPoliciesCompliances(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getInstanceOsPoliciesCompliancesList().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 listInstanceOSPoliciesCompliancesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listInstanceOSPoliciesCompliances(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getOSPolicyAssignmentReportTest() throws Exception { + OSPolicyAssignmentReport expectedResponse = + OSPolicyAssignmentReport.newBuilder() + .setName( + OSPolicyAssignmentReportName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setInstance("instance555127957") + .setOsPolicyAssignment( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .addAllOsPolicyCompliances(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunId("lastRunId2001336336") + .build(); + mockService.addResponse(expectedResponse); + + OSPolicyAssignmentReportName name = + OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + + OSPolicyAssignmentReport actualResponse = client.getOSPolicyAssignmentReport(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 getOSPolicyAssignmentReportExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + OSPolicyAssignmentReportName name = + OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + client.getOSPolicyAssignmentReport(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getOSPolicyAssignmentReportTest2() throws Exception { + OSPolicyAssignmentReport expectedResponse = + OSPolicyAssignmentReport.newBuilder() + .setName( + OSPolicyAssignmentReportName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setInstance("instance555127957") + .setOsPolicyAssignment( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .addAllOsPolicyCompliances(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastRunId("lastRunId2001336336") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-6771/locations/location-6771/instances/instance-6771/osPolicyAssignments/osPolicyAssignment-6771/report"; + + OSPolicyAssignmentReport actualResponse = client.getOSPolicyAssignmentReport(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 getOSPolicyAssignmentReportExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6771/locations/location-6771/instances/instance-6771/osPolicyAssignments/osPolicyAssignment-6771/report"; + client.getOSPolicyAssignmentReport(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentReportsTest() throws Exception { + OSPolicyAssignmentReport responsesElement = OSPolicyAssignmentReport.newBuilder().build(); + ListOSPolicyAssignmentReportsResponse expectedResponse = + ListOSPolicyAssignmentReportsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignmentReports(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + InstanceOSPolicyAssignmentName parent = + InstanceOSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + + ListOSPolicyAssignmentReportsPagedResponse pagedListResponse = + client.listOSPolicyAssignmentReports(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getOsPolicyAssignmentReportsList().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 listOSPolicyAssignmentReportsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceOSPolicyAssignmentName parent = + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + client.listOSPolicyAssignmentReports(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listOSPolicyAssignmentReportsTest2() throws Exception { + OSPolicyAssignmentReport responsesElement = OSPolicyAssignmentReport.newBuilder().build(); + ListOSPolicyAssignmentReportsResponse expectedResponse = + ListOSPolicyAssignmentReportsResponse.newBuilder() + .setNextPageToken("") + .addAllOsPolicyAssignmentReports(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-6863/locations/location-6863/instances/instance-6863/osPolicyAssignments/osPolicyAssignment-6863"; + + ListOSPolicyAssignmentReportsPagedResponse pagedListResponse = + client.listOSPolicyAssignmentReports(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getOsPolicyAssignmentReportsList().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 listOSPolicyAssignmentReportsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-6863/locations/location-6863/instances/instance-6863/osPolicyAssignments/osPolicyAssignment-6863"; + client.listOSPolicyAssignmentReports(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getInventoryTest() throws Exception { + Inventory expectedResponse = + Inventory.newBuilder() + .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setOsInfo(Inventory.OsInfo.newBuilder().build()) + .putAllItems(new HashMap()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + InventoryName name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + Inventory actualResponse = client.getInventory(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 getInventoryExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InventoryName name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + client.getInventory(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getInventoryTest2() throws Exception { + Inventory expectedResponse = + Inventory.newBuilder() + .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setOsInfo(Inventory.OsInfo.newBuilder().build()) + .putAllItems(new HashMap()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-943/locations/location-943/instances/instance-943/inventory"; + + Inventory actualResponse = client.getInventory(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 getInventoryExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-943/locations/location-943/instances/instance-943/inventory"; + client.getInventory(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInventoriesTest() throws Exception { + Inventory responsesElement = Inventory.newBuilder().build(); + ListInventoriesResponse expectedResponse = + ListInventoriesResponse.newBuilder() + .setNextPageToken("") + .addAllInventories(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + ListInventoriesPagedResponse pagedListResponse = client.listInventories(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInventoriesList().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 listInventoriesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + client.listInventories(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInventoriesTest2() throws Exception { + Inventory responsesElement = Inventory.newBuilder().build(); + ListInventoriesResponse expectedResponse = + ListInventoriesResponse.newBuilder() + .setNextPageToken("") + .addAllInventories(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5197/locations/location-5197/instances/instance-5197"; + + ListInventoriesPagedResponse pagedListResponse = client.listInventories(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInventoriesList().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 listInventoriesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5197/locations/location-5197/instances/instance-5197"; + client.listInventories(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getVulnerabilityReportTest() throws Exception { + VulnerabilityReport expectedResponse = + VulnerabilityReport.newBuilder() + .setName(VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .addAllVulnerabilities(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + VulnerabilityReportName name = + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + VulnerabilityReport actualResponse = client.getVulnerabilityReport(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 getVulnerabilityReportExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + VulnerabilityReportName name = + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + client.getVulnerabilityReport(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getVulnerabilityReportTest2() throws Exception { + VulnerabilityReport expectedResponse = + VulnerabilityReport.newBuilder() + .setName(VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .addAllVulnerabilities(new ArrayList()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-2379/locations/location-2379/instances/instance-2379/vulnerabilityReport"; + + VulnerabilityReport actualResponse = client.getVulnerabilityReport(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 getVulnerabilityReportExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-2379/locations/location-2379/instances/instance-2379/vulnerabilityReport"; + client.getVulnerabilityReport(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listVulnerabilityReportsTest() throws Exception { + VulnerabilityReport responsesElement = VulnerabilityReport.newBuilder().build(); + ListVulnerabilityReportsResponse expectedResponse = + ListVulnerabilityReportsResponse.newBuilder() + .setNextPageToken("") + .addAllVulnerabilityReports(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + ListVulnerabilityReportsPagedResponse pagedListResponse = + client.listVulnerabilityReports(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getVulnerabilityReportsList().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 listVulnerabilityReportsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + client.listVulnerabilityReports(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listVulnerabilityReportsTest2() throws Exception { + VulnerabilityReport responsesElement = VulnerabilityReport.newBuilder().build(); + ListVulnerabilityReportsResponse expectedResponse = + ListVulnerabilityReportsResponse.newBuilder() + .setNextPageToken("") + .addAllVulnerabilityReports(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5197/locations/location-5197/instances/instance-5197"; + + ListVulnerabilityReportsPagedResponse pagedListResponse = + client.listVulnerabilityReports(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getVulnerabilityReportsList().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 listVulnerabilityReportsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5197/locations/location-5197/instances/instance-5197"; + client.listVulnerabilityReports(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClientHttpJsonTest.java b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClientHttpJsonTest.java new file mode 100644 index 00000000..bd55af09 --- /dev/null +++ b/google-cloud-os-config/src/test/java/com/google/cloud/osconfig/v1beta/OsConfigServiceClientHttpJsonTest.java @@ -0,0 +1,1447 @@ +/* + * 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.osconfig.v1beta; + +import static com.google.cloud.osconfig.v1beta.OsConfigServiceClient.ListGuestPoliciesPagedResponse; +import static com.google.cloud.osconfig.v1beta.OsConfigServiceClient.ListPatchDeploymentsPagedResponse; +import static com.google.cloud.osconfig.v1beta.OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse; +import static com.google.cloud.osconfig.v1beta.OsConfigServiceClient.ListPatchJobsPagedResponse; + +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.osconfig.v1beta.stub.HttpJsonOsConfigServiceStub; +import com.google.common.collect.Lists; +import com.google.protobuf.Duration; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +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 OsConfigServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static OsConfigServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonOsConfigServiceStub.getMethodDescriptors(), + OsConfigServiceSettings.getDefaultEndpoint()); + OsConfigServiceSettings settings = + OsConfigServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + OsConfigServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = OsConfigServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void executePatchJobTest() throws Exception { + PatchJobs.PatchJob expectedResponse = + PatchJobs.PatchJob.newBuilder() + .setName("name3373707") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setInstanceDetailsSummary( + PatchJobs.PatchJob.InstanceDetailsSummary.newBuilder().build()) + .setDryRun(true) + .setErrorMessage("errorMessage1203236063") + .setPercentComplete(-1960969229) + .setPatchDeployment("patchDeployment1500445997") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchJobs.ExecutePatchJobRequest request = + PatchJobs.ExecutePatchJobRequest.newBuilder() + .setParent("projects/project-2353") + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setDryRun(true) + .setDisplayName("displayName1714148973") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + + PatchJobs.PatchJob actualResponse = client.executePatchJob(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 executePatchJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchJobs.ExecutePatchJobRequest request = + PatchJobs.ExecutePatchJobRequest.newBuilder() + .setParent("projects/project-2353") + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setDryRun(true) + .setDisplayName("displayName1714148973") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + client.executePatchJob(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPatchJobTest() throws Exception { + PatchJobs.PatchJob expectedResponse = + PatchJobs.PatchJob.newBuilder() + .setName("name3373707") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setInstanceDetailsSummary( + PatchJobs.PatchJob.InstanceDetailsSummary.newBuilder().build()) + .setDryRun(true) + .setErrorMessage("errorMessage1203236063") + .setPercentComplete(-1960969229) + .setPatchDeployment("patchDeployment1500445997") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchJobs.GetPatchJobRequest request = + PatchJobs.GetPatchJobRequest.newBuilder() + .setName("projects/project-3014/patchJobs/patchJob-3014") + .build(); + + PatchJobs.PatchJob actualResponse = client.getPatchJob(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 getPatchJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchJobs.GetPatchJobRequest request = + PatchJobs.GetPatchJobRequest.newBuilder() + .setName("projects/project-3014/patchJobs/patchJob-3014") + .build(); + client.getPatchJob(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void cancelPatchJobTest() throws Exception { + PatchJobs.PatchJob expectedResponse = + PatchJobs.PatchJob.newBuilder() + .setName("name3373707") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setInstanceDetailsSummary( + PatchJobs.PatchJob.InstanceDetailsSummary.newBuilder().build()) + .setDryRun(true) + .setErrorMessage("errorMessage1203236063") + .setPercentComplete(-1960969229) + .setPatchDeployment("patchDeployment1500445997") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchJobs.CancelPatchJobRequest request = + PatchJobs.CancelPatchJobRequest.newBuilder() + .setName("projects/project-3014/patchJobs/patchJob-3014") + .build(); + + PatchJobs.PatchJob actualResponse = client.cancelPatchJob(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 cancelPatchJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchJobs.CancelPatchJobRequest request = + PatchJobs.CancelPatchJobRequest.newBuilder() + .setName("projects/project-3014/patchJobs/patchJob-3014") + .build(); + client.cancelPatchJob(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPatchJobsTest() throws Exception { + PatchJobs.PatchJob responsesElement = PatchJobs.PatchJob.newBuilder().build(); + PatchJobs.ListPatchJobsResponse expectedResponse = + PatchJobs.ListPatchJobsResponse.newBuilder() + .setNextPageToken("") + .addAllPatchJobs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PatchJobs.ListPatchJobsRequest request = + PatchJobs.ListPatchJobsRequest.newBuilder() + .setParent("projects/project-2353") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + + ListPatchJobsPagedResponse pagedListResponse = client.listPatchJobs(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPatchJobsList().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 listPatchJobsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchJobs.ListPatchJobsRequest request = + PatchJobs.ListPatchJobsRequest.newBuilder() + .setParent("projects/project-2353") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + client.listPatchJobs(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPatchJobInstanceDetailsTest() throws Exception { + PatchJobs.PatchJobInstanceDetails responsesElement = + PatchJobs.PatchJobInstanceDetails.newBuilder().build(); + PatchJobs.ListPatchJobInstanceDetailsResponse expectedResponse = + PatchJobs.ListPatchJobInstanceDetailsResponse.newBuilder() + .setNextPageToken("") + .addAllPatchJobInstanceDetails(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-1881/patchJobs/patchJob-1881"; + + ListPatchJobInstanceDetailsPagedResponse pagedListResponse = + client.listPatchJobInstanceDetails(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPatchJobInstanceDetailsList().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 listPatchJobInstanceDetailsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-1881/patchJobs/patchJob-1881"; + client.listPatchJobInstanceDetails(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeployments.CreatePatchDeploymentRequest request = + PatchDeployments.CreatePatchDeploymentRequest.newBuilder() + .setParent("projects/project-2353") + .setPatchDeploymentId("patchDeploymentId-1180405976") + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .build(); + + PatchDeployments.PatchDeployment actualResponse = client.createPatchDeployment(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 createPatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeployments.CreatePatchDeploymentRequest request = + PatchDeployments.CreatePatchDeploymentRequest.newBuilder() + .setParent("projects/project-2353") + .setPatchDeploymentId("patchDeploymentId-1180405976") + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .build(); + client.createPatchDeployment(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeployments.GetPatchDeploymentRequest request = + PatchDeployments.GetPatchDeploymentRequest.newBuilder() + .setName("projects/project-2608/patchDeployments/patchDeployment-2608") + .build(); + + PatchDeployments.PatchDeployment actualResponse = client.getPatchDeployment(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 getPatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeployments.GetPatchDeploymentRequest request = + PatchDeployments.GetPatchDeploymentRequest.newBuilder() + .setName("projects/project-2608/patchDeployments/patchDeployment-2608") + .build(); + client.getPatchDeployment(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPatchDeploymentsTest() throws Exception { + PatchDeployments.PatchDeployment responsesElement = + PatchDeployments.PatchDeployment.newBuilder().build(); + PatchDeployments.ListPatchDeploymentsResponse expectedResponse = + PatchDeployments.ListPatchDeploymentsResponse.newBuilder() + .setNextPageToken("") + .addAllPatchDeployments(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeployments.ListPatchDeploymentsRequest request = + PatchDeployments.ListPatchDeploymentsRequest.newBuilder() + .setParent("projects/project-2353") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListPatchDeploymentsPagedResponse pagedListResponse = client.listPatchDeployments(request); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPatchDeploymentsList().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 listPatchDeploymentsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeployments.ListPatchDeploymentsRequest request = + PatchDeployments.ListPatchDeploymentsRequest.newBuilder() + .setParent("projects/project-2353") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listPatchDeployments(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePatchDeploymentTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + PatchDeployments.DeletePatchDeploymentRequest request = + PatchDeployments.DeletePatchDeploymentRequest.newBuilder() + .setName("projects/project-2608/patchDeployments/patchDeployment-2608") + .build(); + + client.deletePatchDeployment(request); + + 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 deletePatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeployments.DeletePatchDeploymentRequest request = + PatchDeployments.DeletePatchDeploymentRequest.newBuilder() + .setName("projects/project-2608/patchDeployments/patchDeployment-2608") + .build(); + client.deletePatchDeployment(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updatePatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + PatchDeployments.PatchDeployment actualResponse = + client.updatePatchDeployment(patchDeployment, updateMask); + 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 updatePatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updatePatchDeployment(patchDeployment, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pausePatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + + PatchDeployments.PatchDeployment actualResponse = client.pausePatchDeployment(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 pausePatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + client.pausePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pausePatchDeploymentTest2() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + + PatchDeployments.PatchDeployment actualResponse = client.pausePatchDeployment(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 pausePatchDeploymentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + client.pausePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resumePatchDeploymentTest() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + + PatchDeployments.PatchDeployment actualResponse = client.resumePatchDeployment(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 resumePatchDeploymentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + client.resumePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void resumePatchDeploymentTest2() throws Exception { + PatchDeployments.PatchDeployment expectedResponse = + PatchDeployments.PatchDeployment.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLastExecuteTime(Timestamp.newBuilder().build()) + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + + PatchDeployments.PatchDeployment actualResponse = client.resumePatchDeployment(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 resumePatchDeploymentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2608/patchDeployments/patchDeployment-2608"; + client.resumePatchDeployment(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createGuestPolicyTest() throws Exception { + GuestPolicies.GuestPolicy expectedResponse = + GuestPolicies.GuestPolicy.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setAssignment(GuestPolicies.Assignment.newBuilder().build()) + .addAllPackages(new ArrayList()) + .addAllPackageRepositories(new ArrayList()) + .addAllRecipes(new ArrayList()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); + + GuestPolicies.GuestPolicy actualResponse = client.createGuestPolicy(parent, guestPolicy); + 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 createGuestPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); + client.createGuestPolicy(parent, guestPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createGuestPolicyTest2() throws Exception { + GuestPolicies.GuestPolicy expectedResponse = + GuestPolicies.GuestPolicy.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setAssignment(GuestPolicies.Assignment.newBuilder().build()) + .addAllPackages(new ArrayList()) + .addAllPackageRepositories(new ArrayList()) + .addAllRecipes(new ArrayList()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); + + GuestPolicies.GuestPolicy actualResponse = client.createGuestPolicy(parent, guestPolicy); + 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 createGuestPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2353"; + GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); + client.createGuestPolicy(parent, guestPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getGuestPolicyTest() throws Exception { + GuestPolicies.GuestPolicy expectedResponse = + GuestPolicies.GuestPolicy.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setAssignment(GuestPolicies.Assignment.newBuilder().build()) + .addAllPackages(new ArrayList()) + .addAllPackageRepositories(new ArrayList()) + .addAllRecipes(new ArrayList()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + GuestPolicyName name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]"); + + GuestPolicies.GuestPolicy actualResponse = client.getGuestPolicy(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 getGuestPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GuestPolicyName name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]"); + client.getGuestPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getGuestPolicyTest2() throws Exception { + GuestPolicies.GuestPolicy expectedResponse = + GuestPolicies.GuestPolicy.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setAssignment(GuestPolicies.Assignment.newBuilder().build()) + .addAllPackages(new ArrayList()) + .addAllPackageRepositories(new ArrayList()) + .addAllRecipes(new ArrayList()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-6612/guestPolicies/guestPolicie-6612"; + + GuestPolicies.GuestPolicy actualResponse = client.getGuestPolicy(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 getGuestPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-6612/guestPolicies/guestPolicie-6612"; + client.getGuestPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listGuestPoliciesTest() throws Exception { + GuestPolicies.GuestPolicy responsesElement = GuestPolicies.GuestPolicy.newBuilder().build(); + GuestPolicies.ListGuestPoliciesResponse expectedResponse = + GuestPolicies.ListGuestPoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllGuestPolicies(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListGuestPoliciesPagedResponse pagedListResponse = client.listGuestPolicies(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getGuestPoliciesList().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 listGuestPoliciesExceptionTest() 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.listGuestPolicies(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listGuestPoliciesTest2() throws Exception { + GuestPolicies.GuestPolicy responsesElement = GuestPolicies.GuestPolicy.newBuilder().build(); + GuestPolicies.ListGuestPoliciesResponse expectedResponse = + GuestPolicies.ListGuestPoliciesResponse.newBuilder() + .setNextPageToken("") + .addAllGuestPolicies(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + + ListGuestPoliciesPagedResponse pagedListResponse = client.listGuestPolicies(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getGuestPoliciesList().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 listGuestPoliciesExceptionTest2() 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.listGuestPolicies(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateGuestPolicyTest() throws Exception { + GuestPolicies.GuestPolicy expectedResponse = + GuestPolicies.GuestPolicy.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setAssignment(GuestPolicies.Assignment.newBuilder().build()) + .addAllPackages(new ArrayList()) + .addAllPackageRepositories(new ArrayList()) + .addAllRecipes(new ArrayList()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + GuestPolicies.GuestPolicy guestPolicy = + GuestPolicies.GuestPolicy.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setAssignment(GuestPolicies.Assignment.newBuilder().build()) + .addAllPackages(new ArrayList()) + .addAllPackageRepositories(new ArrayList()) + .addAllRecipes(new ArrayList()) + .setEtag("etag3123477") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + GuestPolicies.GuestPolicy actualResponse = client.updateGuestPolicy(guestPolicy, updateMask); + 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 updateGuestPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GuestPolicies.GuestPolicy guestPolicy = + GuestPolicies.GuestPolicy.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setAssignment(GuestPolicies.Assignment.newBuilder().build()) + .addAllPackages(new ArrayList()) + .addAllPackageRepositories(new ArrayList()) + .addAllRecipes(new ArrayList()) + .setEtag("etag3123477") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateGuestPolicy(guestPolicy, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteGuestPolicyTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + GuestPolicyName name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]"); + + client.deleteGuestPolicy(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 deleteGuestPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GuestPolicyName name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]"); + client.deleteGuestPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteGuestPolicyTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-6612/guestPolicies/guestPolicie-6612"; + + client.deleteGuestPolicy(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 deleteGuestPolicyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-6612/guestPolicies/guestPolicie-6612"; + client.deleteGuestPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void lookupEffectiveGuestPolicyTest() throws Exception { + GuestPolicies.EffectiveGuestPolicy expectedResponse = + GuestPolicies.EffectiveGuestPolicy.newBuilder() + .addAllPackages(new ArrayList()) + .addAllPackageRepositories( + new ArrayList()) + .addAllSoftwareRecipes( + new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + GuestPolicies.LookupEffectiveGuestPolicyRequest request = + GuestPolicies.LookupEffectiveGuestPolicyRequest.newBuilder() + .setInstance("projects/project-4489/zones/zone-4489/instances/instance-4489") + .setOsShortName("osShortName1253394339") + .setOsVersion("osVersion1812004436") + .setOsArchitecture("osArchitecture1339954519") + .build(); + + GuestPolicies.EffectiveGuestPolicy actualResponse = client.lookupEffectiveGuestPolicy(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 lookupEffectiveGuestPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GuestPolicies.LookupEffectiveGuestPolicyRequest request = + GuestPolicies.LookupEffectiveGuestPolicyRequest.newBuilder() + .setInstance("projects/project-4489/zones/zone-4489/instances/instance-4489") + .setOsShortName("osShortName1253394339") + .setOsVersion("osVersion1812004436") + .setOsArchitecture("osArchitecture1339954519") + .build(); + client.lookupEffectiveGuestPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/cancelpatchjob/AsyncCancelPatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/cancelpatchjob/AsyncCancelPatchJob.java new file mode 100644 index 00000000..934a9470 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/cancelpatchjob/AsyncCancelPatchJob.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_cancelpatchjob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class AsyncCancelPatchJob { + + public static void main(String[] args) throws Exception { + asyncCancelPatchJob(); + } + + public static void asyncCancelPatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.CancelPatchJobRequest request = + PatchJobs.CancelPatchJobRequest.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.cancelPatchJobCallable().futureCall(request); + // Do something. + PatchJobs.PatchJob response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_cancelpatchjob_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/cancelpatchjob/SyncCancelPatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/cancelpatchjob/SyncCancelPatchJob.java new file mode 100644 index 00000000..6c80b7ca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/cancelpatchjob/SyncCancelPatchJob.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_cancelpatchjob_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class SyncCancelPatchJob { + + public static void main(String[] args) throws Exception { + syncCancelPatchJob(); + } + + public static void syncCancelPatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.CancelPatchJobRequest request = + PatchJobs.CancelPatchJobRequest.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .build(); + PatchJobs.PatchJob response = osConfigServiceClient.cancelPatchJob(request); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_cancelpatchjob_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..7668a0a0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.OsConfigServiceSettings; +import com.google.cloud.osconfig.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. + OsConfigServiceSettings osConfigServiceSettings = + OsConfigServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + OsConfigServiceClient osConfigServiceClient = + OsConfigServiceClient.create(osConfigServiceSettings); + } +} +// [END osconfig_v1_generated_osconfigserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..d450bea3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.OsConfigServiceSettings; + +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. + OsConfigServiceSettings osConfigServiceSettings = + OsConfigServiceSettings.newBuilder() + .setTransportChannelProvider( + OsConfigServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + OsConfigServiceClient osConfigServiceClient = + OsConfigServiceClient.create(osConfigServiceSettings); + } +} +// [END osconfig_v1_generated_osconfigserviceclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..fcca9285 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_create_setendpoint_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.OsConfigServiceSettings; +import com.google.cloud.osconfig.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. + OsConfigServiceSettings osConfigServiceSettings = + OsConfigServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + OsConfigServiceClient osConfigServiceClient = + OsConfigServiceClient.create(osConfigServiceSettings); + } +} +// [END osconfig_v1_generated_osconfigserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/AsyncCreatePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/AsyncCreatePatchDeployment.java new file mode 100644 index 00000000..39b9b03f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/AsyncCreatePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.ProjectName; + +public class AsyncCreatePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncCreatePatchDeployment(); + } + + public static void asyncCreatePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.CreatePatchDeploymentRequest request = + PatchDeployments.CreatePatchDeploymentRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPatchDeploymentId("patchDeploymentId-1180405976") + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .build(); + ApiFuture future = + osConfigServiceClient.createPatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeployment.java new file mode 100644 index 00000000..ac0268aa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.ProjectName; + +public class SyncCreatePatchDeployment { + + public static void main(String[] args) throws Exception { + syncCreatePatchDeployment(); + } + + public static void syncCreatePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.CreatePatchDeploymentRequest request = + PatchDeployments.CreatePatchDeploymentRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPatchDeploymentId("patchDeploymentId-1180405976") + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.createPatchDeployment(request); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString.java new file mode 100644 index 00000000..193fc069 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_projectnamepatchdeploymentspatchdeploymentstring_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.ProjectName; + +public class SyncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString { + + public static void main(String[] args) throws Exception { + syncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString(); + } + + public static void syncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder().build(); + String patchDeploymentId = "patchDeploymentId-1180405976"; + PatchDeployments.PatchDeployment response = + osConfigServiceClient.createPatchDeployment(parent, patchDeployment, patchDeploymentId); + } + } +} +// [END +// osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_projectnamepatchdeploymentspatchdeploymentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString.java new file mode 100644 index 00000000..815c08b9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_stringpatchdeploymentspatchdeploymentstring_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.ProjectName; + +public class SyncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString { + + public static void main(String[] args) throws Exception { + syncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString(); + } + + public static void syncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder().build(); + String patchDeploymentId = "patchDeploymentId-1180405976"; + PatchDeployments.PatchDeployment response = + osConfigServiceClient.createPatchDeployment(parent, patchDeployment, patchDeploymentId); + } + } +} +// [END +// osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_stringpatchdeploymentspatchdeploymentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/AsyncDeletePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/AsyncDeletePatchDeployment.java new file mode 100644 index 00000000..17464655 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/AsyncDeletePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.protobuf.Empty; + +public class AsyncDeletePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncDeletePatchDeployment(); + } + + public static void asyncDeletePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.DeletePatchDeploymentRequest request = + PatchDeployments.DeletePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.deletePatchDeploymentCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java new file mode 100644 index 00000000..43f40e4b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncDeletePatchDeployment { + + public static void main(String[] args) throws Exception { + syncDeletePatchDeployment(); + } + + public static void syncDeletePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.DeletePatchDeploymentRequest request = + PatchDeployments.DeletePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + osConfigServiceClient.deletePatchDeployment(request); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentPatchdeploymentname.java new file mode 100644 index 00000000..689acfb3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentPatchdeploymentname.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_patchdeploymentname_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; + +public class SyncDeletePatchDeploymentPatchdeploymentname { + + public static void main(String[] args) throws Exception { + syncDeletePatchDeploymentPatchdeploymentname(); + } + + public static void syncDeletePatchDeploymentPatchdeploymentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + osConfigServiceClient.deletePatchDeployment(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_patchdeploymentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentString.java new file mode 100644 index 00000000..f0598470 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentString.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.cloud.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_string_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; + +public class SyncDeletePatchDeploymentString { + + public static void main(String[] args) throws Exception { + syncDeletePatchDeploymentString(); + } + + public static void syncDeletePatchDeploymentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString(); + osConfigServiceClient.deletePatchDeployment(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/executepatchjob/AsyncExecutePatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/executepatchjob/AsyncExecutePatchJob.java new file mode 100644 index 00000000..99e1d521 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/executepatchjob/AsyncExecutePatchJob.java @@ -0,0 +1,54 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_executepatchjob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobs; +import com.google.cloud.osconfig.v1.ProjectName; +import com.google.protobuf.Duration; + +public class AsyncExecutePatchJob { + + public static void main(String[] args) throws Exception { + asyncExecutePatchJob(); + } + + public static void asyncExecutePatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ExecutePatchJobRequest request = + PatchJobs.ExecutePatchJobRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setDryRun(true) + .setDisplayName("displayName1714148973") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + ApiFuture future = + osConfigServiceClient.executePatchJobCallable().futureCall(request); + // Do something. + PatchJobs.PatchJob response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_executepatchjob_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/executepatchjob/SyncExecutePatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/executepatchjob/SyncExecutePatchJob.java new file mode 100644 index 00000000..f01e3d0d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/executepatchjob/SyncExecutePatchJob.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_executepatchjob_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobs; +import com.google.cloud.osconfig.v1.ProjectName; +import com.google.protobuf.Duration; + +public class SyncExecutePatchJob { + + public static void main(String[] args) throws Exception { + syncExecutePatchJob(); + } + + public static void syncExecutePatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ExecutePatchJobRequest request = + PatchJobs.ExecutePatchJobRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setDryRun(true) + .setDisplayName("displayName1714148973") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + PatchJobs.PatchJob response = osConfigServiceClient.executePatchJob(request); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_executepatchjob_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/AsyncGetPatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/AsyncGetPatchDeployment.java new file mode 100644 index 00000000..f2566ae9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/AsyncGetPatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_getpatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class AsyncGetPatchDeployment { + + public static void main(String[] args) throws Exception { + asyncGetPatchDeployment(); + } + + public static void asyncGetPatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.GetPatchDeploymentRequest request = + PatchDeployments.GetPatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.getPatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_getpatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeployment.java new file mode 100644 index 00000000..9730eb8a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_getpatchdeployment_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncGetPatchDeployment { + + public static void main(String[] args) throws Exception { + syncGetPatchDeployment(); + } + + public static void syncGetPatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.GetPatchDeploymentRequest request = + PatchDeployments.GetPatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + PatchDeployments.PatchDeployment response = osConfigServiceClient.getPatchDeployment(request); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_getpatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeploymentPatchdeploymentname.java new file mode 100644 index 00000000..e8b7086e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeploymentPatchdeploymentname.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_getpatchdeployment_patchdeploymentname_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncGetPatchDeploymentPatchdeploymentname { + + public static void main(String[] args) throws Exception { + syncGetPatchDeploymentPatchdeploymentname(); + } + + public static void syncGetPatchDeploymentPatchdeploymentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + PatchDeployments.PatchDeployment response = osConfigServiceClient.getPatchDeployment(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_getpatchdeployment_patchdeploymentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeploymentString.java new file mode 100644 index 00000000..544cc078 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeploymentString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_getpatchdeployment_string_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncGetPatchDeploymentString { + + public static void main(String[] args) throws Exception { + syncGetPatchDeploymentString(); + } + + public static void syncGetPatchDeploymentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString(); + PatchDeployments.PatchDeployment response = osConfigServiceClient.getPatchDeployment(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_getpatchdeployment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/AsyncGetPatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/AsyncGetPatchJob.java new file mode 100644 index 00000000..9898a322 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/AsyncGetPatchJob.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_getpatchjob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class AsyncGetPatchJob { + + public static void main(String[] args) throws Exception { + asyncGetPatchJob(); + } + + public static void asyncGetPatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.GetPatchJobRequest request = + PatchJobs.GetPatchJobRequest.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.getPatchJobCallable().futureCall(request); + // Do something. + PatchJobs.PatchJob response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_getpatchjob_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJob.java new file mode 100644 index 00000000..d230cb8a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJob.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_getpatchjob_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class SyncGetPatchJob { + + public static void main(String[] args) throws Exception { + syncGetPatchJob(); + } + + public static void syncGetPatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.GetPatchJobRequest request = + PatchJobs.GetPatchJobRequest.newBuilder() + .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .build(); + PatchJobs.PatchJob response = osConfigServiceClient.getPatchJob(request); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_getpatchjob_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJobPatchjobname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJobPatchjobname.java new file mode 100644 index 00000000..d82c0808 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJobPatchjobname.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_getpatchjob_patchjobname_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class SyncGetPatchJobPatchjobname { + + public static void main(String[] args) throws Exception { + syncGetPatchJobPatchjobname(); + } + + public static void syncGetPatchJobPatchjobname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobName name = PatchJobName.of("[PROJECT]", "[PATCH_JOB]"); + PatchJobs.PatchJob response = osConfigServiceClient.getPatchJob(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_getpatchjob_patchjobname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJobString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJobString.java new file mode 100644 index 00000000..d0906ecd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/getpatchjob/SyncGetPatchJobString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_getpatchjob_string_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class SyncGetPatchJobString { + + public static void main(String[] args) throws Exception { + syncGetPatchJobString(); + } + + public static void syncGetPatchJobString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String name = PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString(); + PatchJobs.PatchJob response = osConfigServiceClient.getPatchJob(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_getpatchjob_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeployments.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeployments.java new file mode 100644 index 00000000..713f2d2e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeployments.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.ProjectName; + +public class AsyncListPatchDeployments { + + public static void main(String[] args) throws Exception { + asyncListPatchDeployments(); + } + + public static void asyncListPatchDeployments() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ListPatchDeploymentsRequest request = + PatchDeployments.ListPatchDeploymentsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + osConfigServiceClient.listPatchDeploymentsPagedCallable().futureCall(request); + // Do something. + for (PatchDeployments.PatchDeployment element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeploymentsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeploymentsPaged.java new file mode 100644 index 00000000..bbdc4fca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeploymentsPaged.java @@ -0,0 +1,57 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_paged_async] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.ProjectName; +import com.google.common.base.Strings; + +public class AsyncListPatchDeploymentsPaged { + + public static void main(String[] args) throws Exception { + asyncListPatchDeploymentsPaged(); + } + + public static void asyncListPatchDeploymentsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ListPatchDeploymentsRequest request = + PatchDeployments.ListPatchDeploymentsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + PatchDeployments.ListPatchDeploymentsResponse response = + osConfigServiceClient.listPatchDeploymentsCallable().call(request); + for (PatchDeployments.PatchDeployment element : response.getPatchDeploymentsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeployments.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeployments.java new file mode 100644 index 00000000..fe538800 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeployments.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.ProjectName; + +public class SyncListPatchDeployments { + + public static void main(String[] args) throws Exception { + syncListPatchDeployments(); + } + + public static void syncListPatchDeployments() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ListPatchDeploymentsRequest request = + PatchDeployments.ListPatchDeploymentsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (PatchDeployments.PatchDeployment element : + osConfigServiceClient.listPatchDeployments(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeploymentsProjectname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeploymentsProjectname.java new file mode 100644 index 00000000..06763d3c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeploymentsProjectname.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_projectname_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.ProjectName; + +public class SyncListPatchDeploymentsProjectname { + + public static void main(String[] args) throws Exception { + syncListPatchDeploymentsProjectname(); + } + + public static void syncListPatchDeploymentsProjectname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (PatchDeployments.PatchDeployment element : + osConfigServiceClient.listPatchDeployments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_projectname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeploymentsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeploymentsString.java new file mode 100644 index 00000000..5c2d21e9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchdeployments/SyncListPatchDeploymentsString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_string_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.cloud.osconfig.v1.ProjectName; + +public class SyncListPatchDeploymentsString { + + public static void main(String[] args) throws Exception { + syncListPatchDeploymentsString(); + } + + public static void syncListPatchDeploymentsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + for (PatchDeployments.PatchDeployment element : + osConfigServiceClient.listPatchDeployments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchdeployments_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetails.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetails.java new file mode 100644 index 00000000..3c98250c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetails.java @@ -0,0 +1,51 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class AsyncListPatchJobInstanceDetails { + + public static void main(String[] args) throws Exception { + asyncListPatchJobInstanceDetails(); + } + + public static void asyncListPatchJobInstanceDetails() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobInstanceDetailsRequest request = + PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder() + .setParent(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + osConfigServiceClient.listPatchJobInstanceDetailsPagedCallable().futureCall(request); + // Do something. + for (PatchJobs.PatchJobInstanceDetails element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetailsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetailsPaged.java new file mode 100644 index 00000000..11b15482 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetailsPaged.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.cloud.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_paged_async] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; +import com.google.common.base.Strings; + +public class AsyncListPatchJobInstanceDetailsPaged { + + public static void main(String[] args) throws Exception { + asyncListPatchJobInstanceDetailsPaged(); + } + + public static void asyncListPatchJobInstanceDetailsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobInstanceDetailsRequest request = + PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder() + .setParent(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + PatchJobs.ListPatchJobInstanceDetailsResponse response = + osConfigServiceClient.listPatchJobInstanceDetailsCallable().call(request); + for (PatchJobs.PatchJobInstanceDetails element : + response.getPatchJobInstanceDetailsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetails.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetails.java new file mode 100644 index 00000000..a8369c41 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetails.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class SyncListPatchJobInstanceDetails { + + public static void main(String[] args) throws Exception { + syncListPatchJobInstanceDetails(); + } + + public static void syncListPatchJobInstanceDetails() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobInstanceDetailsRequest request = + PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder() + .setParent(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (PatchJobs.PatchJobInstanceDetails element : + osConfigServiceClient.listPatchJobInstanceDetails(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsPatchjobname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsPatchjobname.java new file mode 100644 index 00000000..721de14c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsPatchjobname.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_patchjobname_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class SyncListPatchJobInstanceDetailsPatchjobname { + + public static void main(String[] args) throws Exception { + syncListPatchJobInstanceDetailsPatchjobname(); + } + + public static void syncListPatchJobInstanceDetailsPatchjobname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobName parent = PatchJobName.of("[PROJECT]", "[PATCH_JOB]"); + for (PatchJobs.PatchJobInstanceDetails element : + osConfigServiceClient.listPatchJobInstanceDetails(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_patchjobname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsString.java new file mode 100644 index 00000000..f8c62abd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_string_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobName; +import com.google.cloud.osconfig.v1.PatchJobs; + +public class SyncListPatchJobInstanceDetailsString { + + public static void main(String[] args) throws Exception { + syncListPatchJobInstanceDetailsString(); + } + + public static void syncListPatchJobInstanceDetailsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String parent = PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString(); + for (PatchJobs.PatchJobInstanceDetails element : + osConfigServiceClient.listPatchJobInstanceDetails(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobinstancedetails_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/AsyncListPatchJobs.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/AsyncListPatchJobs.java new file mode 100644 index 00000000..903aaa26 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/AsyncListPatchJobs.java @@ -0,0 +1,51 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobs; +import com.google.cloud.osconfig.v1.ProjectName; + +public class AsyncListPatchJobs { + + public static void main(String[] args) throws Exception { + asyncListPatchJobs(); + } + + public static void asyncListPatchJobs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobsRequest request = + PatchJobs.ListPatchJobsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + osConfigServiceClient.listPatchJobsPagedCallable().futureCall(request); + // Do something. + for (PatchJobs.PatchJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobs_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/AsyncListPatchJobsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/AsyncListPatchJobsPaged.java new file mode 100644 index 00000000..a983ff62 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/AsyncListPatchJobsPaged.java @@ -0,0 +1,58 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobs_paged_async] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobs; +import com.google.cloud.osconfig.v1.ProjectName; +import com.google.common.base.Strings; + +public class AsyncListPatchJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListPatchJobsPaged(); + } + + public static void asyncListPatchJobsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobsRequest request = + PatchJobs.ListPatchJobsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + PatchJobs.ListPatchJobsResponse response = + osConfigServiceClient.listPatchJobsCallable().call(request); + for (PatchJobs.PatchJob element : response.getPatchJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobs_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobs.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobs.java new file mode 100644 index 00000000..c65234d5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobs.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobs_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobs; +import com.google.cloud.osconfig.v1.ProjectName; + +public class SyncListPatchJobs { + + public static void main(String[] args) throws Exception { + syncListPatchJobs(); + } + + public static void syncListPatchJobs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobsRequest request = + PatchJobs.ListPatchJobsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (PatchJobs.PatchJob element : osConfigServiceClient.listPatchJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobs_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobsProjectname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobsProjectname.java new file mode 100644 index 00000000..c6b6d977 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobsProjectname.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobs_projectname_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobs; +import com.google.cloud.osconfig.v1.ProjectName; + +public class SyncListPatchJobsProjectname { + + public static void main(String[] args) throws Exception { + syncListPatchJobsProjectname(); + } + + public static void syncListPatchJobsProjectname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (PatchJobs.PatchJob element : osConfigServiceClient.listPatchJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobs_projectname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobsString.java new file mode 100644 index 00000000..93e9250f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/listpatchjobs/SyncListPatchJobsString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_listpatchjobs_string_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchJobs; +import com.google.cloud.osconfig.v1.ProjectName; + +public class SyncListPatchJobsString { + + public static void main(String[] args) throws Exception { + syncListPatchJobsString(); + } + + public static void syncListPatchJobsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + for (PatchJobs.PatchJob element : osConfigServiceClient.listPatchJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_listpatchjobs_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/AsyncPausePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/AsyncPausePatchDeployment.java new file mode 100644 index 00000000..afc3ea19 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/AsyncPausePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_pausepatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class AsyncPausePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncPausePatchDeployment(); + } + + public static void asyncPausePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.PausePatchDeploymentRequest request = + PatchDeployments.PausePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.pausePatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_pausepatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeployment.java new file mode 100644 index 00000000..bc0399c3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_pausepatchdeployment_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncPausePatchDeployment { + + public static void main(String[] args) throws Exception { + syncPausePatchDeployment(); + } + + public static void syncPausePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.PausePatchDeploymentRequest request = + PatchDeployments.PausePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.pausePatchDeployment(request); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_pausepatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java new file mode 100644 index 00000000..a92d2955 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_pausepatchdeployment_patchdeploymentname_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncPausePatchDeploymentPatchdeploymentname { + + public static void main(String[] args) throws Exception { + syncPausePatchDeploymentPatchdeploymentname(); + } + + public static void syncPausePatchDeploymentPatchdeploymentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + PatchDeployments.PatchDeployment response = osConfigServiceClient.pausePatchDeployment(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_pausepatchdeployment_patchdeploymentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentString.java new file mode 100644 index 00000000..d7a30e34 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_pausepatchdeployment_string_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncPausePatchDeploymentString { + + public static void main(String[] args) throws Exception { + syncPausePatchDeploymentString(); + } + + public static void syncPausePatchDeploymentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString(); + PatchDeployments.PatchDeployment response = osConfigServiceClient.pausePatchDeployment(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_pausepatchdeployment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/AsyncResumePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/AsyncResumePatchDeployment.java new file mode 100644 index 00000000..939fdc4a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/AsyncResumePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class AsyncResumePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncResumePatchDeployment(); + } + + public static void asyncResumePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ResumePatchDeploymentRequest request = + PatchDeployments.ResumePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.resumePatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeployment.java new file mode 100644 index 00000000..0238f217 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncResumePatchDeployment { + + public static void main(String[] args) throws Exception { + syncResumePatchDeployment(); + } + + public static void syncResumePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ResumePatchDeploymentRequest request = + PatchDeployments.ResumePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.resumePatchDeployment(request); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java new file mode 100644 index 00000000..20aae25d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncResumePatchDeploymentPatchdeploymentname { + + public static void main(String[] args) throws Exception { + syncResumePatchDeploymentPatchdeploymentname(); + } + + public static void syncResumePatchDeploymentPatchdeploymentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + PatchDeployments.PatchDeployment response = osConfigServiceClient.resumePatchDeployment(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentString.java new file mode 100644 index 00000000..350233d7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_string_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.cloud.osconfig.v1.PatchDeployments; + +public class SyncResumePatchDeploymentString { + + public static void main(String[] args) throws Exception { + syncResumePatchDeploymentString(); + } + + public static void syncResumePatchDeploymentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString(); + PatchDeployments.PatchDeployment response = osConfigServiceClient.resumePatchDeployment(name); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/AsyncUpdatePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/AsyncUpdatePatchDeployment.java new file mode 100644 index 00000000..e395bcfe --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/AsyncUpdatePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.protobuf.FieldMask; + +public class AsyncUpdatePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncUpdatePatchDeployment(); + } + + public static void asyncUpdatePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.UpdatePatchDeploymentRequest request = + PatchDeployments.UpdatePatchDeploymentRequest.newBuilder() + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + osConfigServiceClient.updatePatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeployment.java new file mode 100644 index 00000000..87ec085c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeployment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.protobuf.FieldMask; + +public class SyncUpdatePatchDeployment { + + public static void main(String[] args) throws Exception { + syncUpdatePatchDeployment(); + } + + public static void syncUpdatePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.UpdatePatchDeploymentRequest request = + PatchDeployments.UpdatePatchDeploymentRequest.newBuilder() + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.updatePatchDeployment(request); + } + } +} +// [END osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java new file mode 100644 index 00000000..d00293fd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceClient; +import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.protobuf.FieldMask; + +public class SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask(); + } + + public static void syncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.updatePatchDeployment(patchDeployment, updateMask); + } + } +} +// [END +// osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigservicesettings/executepatchjob/SyncExecutePatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigservicesettings/executepatchjob/SyncExecutePatchJob.java new file mode 100644 index 00000000..a94e2601 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigservicesettings/executepatchjob/SyncExecutePatchJob.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigservicesettings_executepatchjob_sync] +import com.google.cloud.osconfig.v1.OsConfigServiceSettings; +import java.time.Duration; + +public class SyncExecutePatchJob { + + public static void main(String[] args) throws Exception { + syncExecutePatchJob(); + } + + public static void syncExecutePatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + OsConfigServiceSettings.Builder osConfigServiceSettingsBuilder = + OsConfigServiceSettings.newBuilder(); + osConfigServiceSettingsBuilder + .executePatchJobSettings() + .setRetrySettings( + osConfigServiceSettingsBuilder + .executePatchJobSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + OsConfigServiceSettings osConfigServiceSettings = osConfigServiceSettingsBuilder.build(); + } +} +// [END osconfig_v1_generated_osconfigservicesettings_executepatchjob_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..ab5bad56 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceSettings; +import com.google.cloud.osconfig.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. + OsConfigZonalServiceSettings osConfigZonalServiceSettings = + OsConfigZonalServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create(osConfigZonalServiceSettings); + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..7b15dcea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceSettings; + +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. + OsConfigZonalServiceSettings osConfigZonalServiceSettings = + OsConfigZonalServiceSettings.newBuilder() + .setTransportChannelProvider( + OsConfigZonalServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create(osConfigZonalServiceSettings); + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..20560c38 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_create_setendpoint_sync] +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceSettings; +import com.google.cloud.osconfig.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. + OsConfigZonalServiceSettings osConfigZonalServiceSettings = + OsConfigZonalServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create(osConfigZonalServiceSettings); + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignment.java new file mode 100644 index 00000000..b29015de --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignment.java @@ -0,0 +1,51 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.CreateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + asyncCreateOSPolicyAssignment(); + } + + public static void asyncCreateOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + CreateOSPolicyAssignmentRequest request = + CreateOSPolicyAssignmentRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setOsPolicyAssignmentId("osPolicyAssignmentId-44079074") + .build(); + ApiFuture future = + osConfigZonalServiceClient.createOSPolicyAssignmentCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignmentLRO.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignmentLRO.java new file mode 100644 index 00000000..3eee2c27 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignmentLRO.java @@ -0,0 +1,53 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.osconfig.v1.CreateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class AsyncCreateOSPolicyAssignmentLRO { + + public static void main(String[] args) throws Exception { + asyncCreateOSPolicyAssignmentLRO(); + } + + public static void asyncCreateOSPolicyAssignmentLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + CreateOSPolicyAssignmentRequest request = + CreateOSPolicyAssignmentRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setOsPolicyAssignmentId("osPolicyAssignmentId-44079074") + .build(); + OperationFuture future = + osConfigZonalServiceClient + .createOSPolicyAssignmentOperationCallable() + .futureCall(request); + // Do something. + OSPolicyAssignment response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignment.java new file mode 100644 index 00000000..5ab163db --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_sync] +import com.google.cloud.osconfig.v1.CreateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncCreateOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncCreateOSPolicyAssignment(); + } + + public static void syncCreateOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + CreateOSPolicyAssignmentRequest request = + CreateOSPolicyAssignmentRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setOsPolicyAssignmentId("osPolicyAssignmentId-44079074") + .build(); + OSPolicyAssignment response = + osConfigZonalServiceClient.createOSPolicyAssignmentAsync(request).get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java new file mode 100644 index 00000000..b0f03617 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString { + + public static void main(String[] args) throws Exception { + syncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString(); + } + + public static void syncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + OSPolicyAssignment response = + osConfigZonalServiceClient + .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId) + .get(); + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java new file mode 100644 index 00000000..a6b01a70 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncCreateOSPolicyAssignmentStringOspolicyassignmentString { + + public static void main(String[] args) throws Exception { + syncCreateOSPolicyAssignmentStringOspolicyassignmentString(); + } + + public static void syncCreateOSPolicyAssignmentStringOspolicyassignmentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + OSPolicyAssignment response = + osConfigZonalServiceClient + .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId) + .get(); + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignment.java new file mode 100644 index 00000000..dc5706d4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.DeleteOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + asyncDeleteOSPolicyAssignment(); + } + + public static void asyncDeleteOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + DeleteOSPolicyAssignmentRequest request = + DeleteOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.deleteOSPolicyAssignmentCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignmentLRO.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignmentLRO.java new file mode 100644 index 00000000..f156c32c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignmentLRO.java @@ -0,0 +1,53 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.osconfig.v1.DeleteOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteOSPolicyAssignmentLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteOSPolicyAssignmentLRO(); + } + + public static void asyncDeleteOSPolicyAssignmentLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + DeleteOSPolicyAssignmentRequest request = + DeleteOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + OperationFuture future = + osConfigZonalServiceClient + .deleteOSPolicyAssignmentOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java new file mode 100644 index 00000000..0fa8ef79 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_sync] +import com.google.cloud.osconfig.v1.DeleteOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncDeleteOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncDeleteOSPolicyAssignment(); + } + + public static void syncDeleteOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + DeleteOSPolicyAssignmentRequest request = + DeleteOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(request).get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java new file mode 100644 index 00000000..1e9be5cd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncDeleteOSPolicyAssignmentOspolicyassignmentname { + + public static void main(String[] args) throws Exception { + syncDeleteOSPolicyAssignmentOspolicyassignmentname(); + } + + public static void syncDeleteOSPolicyAssignmentOspolicyassignmentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(name).get(); + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java new file mode 100644 index 00000000..0304f623 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_string_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncDeleteOSPolicyAssignmentString { + + public static void main(String[] args) throws Exception { + syncDeleteOSPolicyAssignmentString(); + } + + public static void syncDeleteOSPolicyAssignmentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString(); + osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(name).get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/AsyncGetInventory.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/AsyncGetInventory.java new file mode 100644 index 00000000..fa59f18e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/AsyncGetInventory.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getinventory_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.GetInventoryRequest; +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.InventoryName; +import com.google.cloud.osconfig.v1.InventoryView; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class AsyncGetInventory { + + public static void main(String[] args) throws Exception { + asyncGetInventory(); + } + + public static void asyncGetInventory() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetInventoryRequest request = + GetInventoryRequest.newBuilder() + .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setView(InventoryView.forNumber(0)) + .build(); + ApiFuture future = + osConfigZonalServiceClient.getInventoryCallable().futureCall(request); + // Do something. + Inventory response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getinventory_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventory.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventory.java new file mode 100644 index 00000000..9062f4d6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventory.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getinventory_sync] +import com.google.cloud.osconfig.v1.GetInventoryRequest; +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.InventoryName; +import com.google.cloud.osconfig.v1.InventoryView; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncGetInventory { + + public static void main(String[] args) throws Exception { + syncGetInventory(); + } + + public static void syncGetInventory() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetInventoryRequest request = + GetInventoryRequest.newBuilder() + .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setView(InventoryView.forNumber(0)) + .build(); + Inventory response = osConfigZonalServiceClient.getInventory(request); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getinventory_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventoryInventoryname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventoryInventoryname.java new file mode 100644 index 00000000..32f45585 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventoryInventoryname.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getinventory_inventoryname_sync] +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.InventoryName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncGetInventoryInventoryname { + + public static void main(String[] args) throws Exception { + syncGetInventoryInventoryname(); + } + + public static void syncGetInventoryInventoryname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + InventoryName name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + Inventory response = osConfigZonalServiceClient.getInventory(name); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getinventory_inventoryname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventoryString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventoryString.java new file mode 100644 index 00000000..85e4f87d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getinventory/SyncGetInventoryString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getinventory_string_sync] +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.InventoryName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncGetInventoryString { + + public static void main(String[] args) throws Exception { + syncGetInventoryString(); + } + + public static void syncGetInventoryString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + Inventory response = osConfigZonalServiceClient.getInventory(name); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getinventory_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/AsyncGetOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/AsyncGetOSPolicyAssignment.java new file mode 100644 index 00000000..ca2dec87 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/AsyncGetOSPolicyAssignment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.GetOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class AsyncGetOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + asyncGetOSPolicyAssignment(); + } + + public static void asyncGetOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetOSPolicyAssignmentRequest request = + GetOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.getOSPolicyAssignmentCallable().futureCall(request); + // Do something. + OSPolicyAssignment response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignment.java new file mode 100644 index 00000000..6bbf46e2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_sync] +import com.google.cloud.osconfig.v1.GetOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignment(); + } + + public static void syncGetOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetOSPolicyAssignmentRequest request = + GetOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(request); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java new file mode 100644 index 00000000..90531eaf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentOspolicyassignmentname { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentOspolicyassignmentname(); + } + + public static void syncGetOSPolicyAssignmentOspolicyassignmentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name); + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentString.java new file mode 100644 index 00000000..2904b57e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_string_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentString { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentString(); + } + + public static void syncGetOSPolicyAssignmentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString(); + OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/AsyncGetOSPolicyAssignmentReport.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/AsyncGetOSPolicyAssignmentReport.java new file mode 100644 index 00000000..f88f717a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/AsyncGetOSPolicyAssignmentReport.java @@ -0,0 +1,51 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.GetOSPolicyAssignmentReportRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReportName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class AsyncGetOSPolicyAssignmentReport { + + public static void main(String[] args) throws Exception { + asyncGetOSPolicyAssignmentReport(); + } + + public static void asyncGetOSPolicyAssignmentReport() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetOSPolicyAssignmentReportRequest request = + GetOSPolicyAssignmentReportRequest.newBuilder() + .setName( + OSPolicyAssignmentReportName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.getOSPolicyAssignmentReportCallable().futureCall(request); + // Do something. + OSPolicyAssignmentReport response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReport.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReport.java new file mode 100644 index 00000000..59fce3ba --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReport.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_sync] +import com.google.cloud.osconfig.v1.GetOSPolicyAssignmentReportRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReportName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentReport { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentReport(); + } + + public static void syncGetOSPolicyAssignmentReport() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetOSPolicyAssignmentReportRequest request = + GetOSPolicyAssignmentReportRequest.newBuilder() + .setName( + OSPolicyAssignmentReportName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .build(); + OSPolicyAssignmentReport response = + osConfigZonalServiceClient.getOSPolicyAssignmentReport(request); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java new file mode 100644 index 00000000..0b0b82d8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReportName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentReportOspolicyassignmentreportname(); + } + + public static void syncGetOSPolicyAssignmentReportOspolicyassignmentreportname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignmentReportName name = + OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + OSPolicyAssignmentReport response = + osConfigZonalServiceClient.getOSPolicyAssignmentReport(name); + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java new file mode 100644 index 00000000..2f823797 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_string_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReportName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentReportString { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentReportString(); + } + + public static void syncGetOSPolicyAssignmentReportString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = + OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString(); + OSPolicyAssignmentReport response = + osConfigZonalServiceClient.getOSPolicyAssignmentReport(name); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/AsyncGetVulnerabilityReport.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/AsyncGetVulnerabilityReport.java new file mode 100644 index 00000000..fff8c732 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/AsyncGetVulnerabilityReport.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.GetVulnerabilityReportRequest; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.VulnerabilityReport; +import com.google.cloud.osconfig.v1.VulnerabilityReportName; + +public class AsyncGetVulnerabilityReport { + + public static void main(String[] args) throws Exception { + asyncGetVulnerabilityReport(); + } + + public static void asyncGetVulnerabilityReport() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetVulnerabilityReportRequest request = + GetVulnerabilityReportRequest.newBuilder() + .setName( + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.getVulnerabilityReportCallable().futureCall(request); + // Do something. + VulnerabilityReport response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReport.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReport.java new file mode 100644 index 00000000..1ebdcfd3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReport.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_sync] +import com.google.cloud.osconfig.v1.GetVulnerabilityReportRequest; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.VulnerabilityReport; +import com.google.cloud.osconfig.v1.VulnerabilityReportName; + +public class SyncGetVulnerabilityReport { + + public static void main(String[] args) throws Exception { + syncGetVulnerabilityReport(); + } + + public static void syncGetVulnerabilityReport() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetVulnerabilityReportRequest request = + GetVulnerabilityReportRequest.newBuilder() + .setName( + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .build(); + VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(request); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportString.java new file mode 100644 index 00000000..15ab78a0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_string_sync] +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.VulnerabilityReport; +import com.google.cloud.osconfig.v1.VulnerabilityReportName; + +public class SyncGetVulnerabilityReportString { + + public static void main(String[] args) throws Exception { + syncGetVulnerabilityReportString(); + } + + public static void syncGetVulnerabilityReportString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(name); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java new file mode 100644 index 00000000..7638d792 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.VulnerabilityReport; +import com.google.cloud.osconfig.v1.VulnerabilityReportName; + +public class SyncGetVulnerabilityReportVulnerabilityreportname { + + public static void main(String[] args) throws Exception { + syncGetVulnerabilityReportVulnerabilityreportname(); + } + + public static void syncGetVulnerabilityReportVulnerabilityreportname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + VulnerabilityReportName name = + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(name); + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/AsyncListInventories.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/AsyncListInventories.java new file mode 100644 index 00000000..e2baa96e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/AsyncListInventories.java @@ -0,0 +1,58 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listinventories_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.InventoryView; +import com.google.cloud.osconfig.v1.ListInventoriesRequest; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class AsyncListInventories { + + public static void main(String[] args) throws Exception { + asyncListInventories(); + } + + public static void asyncListInventories() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListInventoriesRequest request = + ListInventoriesRequest.newBuilder() + .setParent( + InstanceName.ofProjectLocationInstanceName( + "[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .setView(InventoryView.forNumber(0)) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + osConfigZonalServiceClient.listInventoriesPagedCallable().futureCall(request); + // Do something. + for (Inventory element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listinventories_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/AsyncListInventoriesPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/AsyncListInventoriesPaged.java new file mode 100644 index 00000000..65e89726 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/AsyncListInventoriesPaged.java @@ -0,0 +1,66 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listinventories_paged_async] +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.InventoryView; +import com.google.cloud.osconfig.v1.ListInventoriesRequest; +import com.google.cloud.osconfig.v1.ListInventoriesResponse; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.common.base.Strings; + +public class AsyncListInventoriesPaged { + + public static void main(String[] args) throws Exception { + asyncListInventoriesPaged(); + } + + public static void asyncListInventoriesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListInventoriesRequest request = + ListInventoriesRequest.newBuilder() + .setParent( + InstanceName.ofProjectLocationInstanceName( + "[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .setView(InventoryView.forNumber(0)) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListInventoriesResponse response = + osConfigZonalServiceClient.listInventoriesCallable().call(request); + for (Inventory element : response.getInventoriesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listinventories_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventories.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventories.java new file mode 100644 index 00000000..41eb7381 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventories.java @@ -0,0 +1,54 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listinventories_sync] +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.InventoryView; +import com.google.cloud.osconfig.v1.ListInventoriesRequest; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListInventories { + + public static void main(String[] args) throws Exception { + syncListInventories(); + } + + public static void syncListInventories() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListInventoriesRequest request = + ListInventoriesRequest.newBuilder() + .setParent( + InstanceName.ofProjectLocationInstanceName( + "[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .setView(InventoryView.forNumber(0)) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Inventory element : osConfigZonalServiceClient.listInventories(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listinventories_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventoriesInstancename.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventoriesInstancename.java new file mode 100644 index 00000000..bf915c60 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventoriesInstancename.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listinventories_instancename_sync] +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListInventoriesInstancename { + + public static void main(String[] args) throws Exception { + syncListInventoriesInstancename(); + } + + public static void syncListInventoriesInstancename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + InstanceName parent = + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + for (Inventory element : osConfigZonalServiceClient.listInventories(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listinventories_instancename_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventoriesString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventoriesString.java new file mode 100644 index 00000000..4a98b8a1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listinventories/SyncListInventoriesString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listinventories_string_sync] +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.Inventory; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListInventoriesString { + + public static void main(String[] args) throws Exception { + syncListInventoriesString(); + } + + public static void syncListInventoriesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = + InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]").toString(); + for (Inventory element : osConfigZonalServiceClient.listInventories(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listinventories_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReports.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReports.java new file mode 100644 index 00000000..dc56c210 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReports.java @@ -0,0 +1,58 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class AsyncListOSPolicyAssignmentReports { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentReports(); + } + + public static void asyncListOSPolicyAssignmentReports() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentReportsRequest request = + ListOSPolicyAssignmentReportsRequest.newBuilder() + .setParent( + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + osConfigZonalServiceClient + .listOSPolicyAssignmentReportsPagedCallable() + .futureCall(request); + // Do something. + for (OSPolicyAssignmentReport element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java new file mode 100644 index 00000000..35b0b685 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java @@ -0,0 +1,65 @@ +/* + * 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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] +import com.google.cloud.osconfig.v1.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsRequest; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsResponse; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.common.base.Strings; + +public class AsyncListOSPolicyAssignmentReportsPaged { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentReportsPaged(); + } + + public static void asyncListOSPolicyAssignmentReportsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentReportsRequest request = + ListOSPolicyAssignmentReportsRequest.newBuilder() + .setParent( + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListOSPolicyAssignmentReportsResponse response = + osConfigZonalServiceClient.listOSPolicyAssignmentReportsCallable().call(request); + for (OSPolicyAssignmentReport element : response.getOsPolicyAssignmentReportsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReports.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReports.java new file mode 100644 index 00000000..c7025b2d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReports.java @@ -0,0 +1,53 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_sync] +import com.google.cloud.osconfig.v1.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentReports { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentReports(); + } + + public static void syncListOSPolicyAssignmentReports() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentReportsRequest request = + ListOSPolicyAssignmentReportsRequest.newBuilder() + .setParent( + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .build(); + for (OSPolicyAssignmentReport element : + osConfigZonalServiceClient.listOSPolicyAssignmentReports(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java new file mode 100644 index 00000000..dda8e0a7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] +import com.google.cloud.osconfig.v1.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentReportsInstanceospolicyassignmentname(); + } + + public static void syncListOSPolicyAssignmentReportsInstanceospolicyassignmentname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + InstanceOSPolicyAssignmentName parent = + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + for (OSPolicyAssignmentReport element : + osConfigZonalServiceClient.listOSPolicyAssignmentReports(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java new file mode 100644 index 00000000..fad41b55 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] +import com.google.cloud.osconfig.v1.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentReportsString { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentReportsString(); + } + + public static void syncListOSPolicyAssignmentReportsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = + InstanceOSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString(); + for (OSPolicyAssignmentReport element : + osConfigZonalServiceClient.listOSPolicyAssignmentReports(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java new file mode 100644 index 00000000..53493bb0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java @@ -0,0 +1,56 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class AsyncListOSPolicyAssignmentRevisions { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentRevisions(); + } + + public static void asyncListOSPolicyAssignmentRevisions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentRevisionsRequest request = + ListOSPolicyAssignmentRevisionsRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + osConfigZonalServiceClient + .listOSPolicyAssignmentRevisionsPagedCallable() + .futureCall(request); + // Do something. + for (OSPolicyAssignment element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java new file mode 100644 index 00000000..b60bac66 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java @@ -0,0 +1,64 @@ +/* + * 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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsRequest; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsResponse; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.common.base.Strings; + +public class AsyncListOSPolicyAssignmentRevisionsPaged { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentRevisionsPaged(); + } + + public static void asyncListOSPolicyAssignmentRevisionsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentRevisionsRequest request = + ListOSPolicyAssignmentRevisionsRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListOSPolicyAssignmentRevisionsResponse response = + osConfigZonalServiceClient.listOSPolicyAssignmentRevisionsCallable().call(request); + for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java new file mode 100644 index 00000000..8c9a9a7b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java @@ -0,0 +1,51 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_sync] +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsRequest; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentRevisions { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentRevisions(); + } + + public static void syncListOSPolicyAssignmentRevisions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentRevisionsRequest request = + ListOSPolicyAssignmentRevisionsRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java new file mode 100644 index 00000000..4fb3d1de --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentRevisionsOspolicyassignmentname(); + } + + public static void syncListOSPolicyAssignmentRevisionsOspolicyassignmentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java new file mode 100644 index 00000000..a30c74b1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentRevisionsString { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentRevisionsString(); + } + + public static void syncListOSPolicyAssignmentRevisionsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString(); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignments.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignments.java new file mode 100644 index 00000000..bec84cdd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignments.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentsRequest; +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class AsyncListOSPolicyAssignments { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignments(); + } + + public static void asyncListOSPolicyAssignments() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentsRequest request = + ListOSPolicyAssignmentsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + osConfigZonalServiceClient.listOSPolicyAssignmentsPagedCallable().futureCall(request); + // Do something. + for (OSPolicyAssignment element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignmentsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignmentsPaged.java new file mode 100644 index 00000000..f0cfedb7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignmentsPaged.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_paged_async] +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentsRequest; +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentsResponse; +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.common.base.Strings; + +public class AsyncListOSPolicyAssignmentsPaged { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentsPaged(); + } + + public static void asyncListOSPolicyAssignmentsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentsRequest request = + ListOSPolicyAssignmentsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListOSPolicyAssignmentsResponse response = + osConfigZonalServiceClient.listOSPolicyAssignmentsCallable().call(request); + for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignments.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignments.java new file mode 100644 index 00000000..c91c2aac --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignments.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_sync] +import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentsRequest; +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignments { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignments(); + } + + public static void syncListOSPolicyAssignments() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentsRequest request = + ListOSPolicyAssignmentsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignments(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java new file mode 100644 index 00000000..9e47c418 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentsLocationname { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentsLocationname(); + } + + public static void syncListOSPolicyAssignmentsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsString.java new file mode 100644 index 00000000..69a3e35e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_string_sync] +import com.google.cloud.osconfig.v1.LocationName; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentsString { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentsString(); + } + + public static void syncListOSPolicyAssignmentsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReports.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReports.java new file mode 100644 index 00000000..5407771c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReports.java @@ -0,0 +1,56 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.ListVulnerabilityReportsRequest; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.VulnerabilityReport; + +public class AsyncListVulnerabilityReports { + + public static void main(String[] args) throws Exception { + asyncListVulnerabilityReports(); + } + + public static void asyncListVulnerabilityReports() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListVulnerabilityReportsRequest request = + ListVulnerabilityReportsRequest.newBuilder() + .setParent( + InstanceName.ofProjectLocationInstanceName( + "[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + osConfigZonalServiceClient.listVulnerabilityReportsPagedCallable().futureCall(request); + // Do something. + for (VulnerabilityReport element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java new file mode 100644 index 00000000..6c21d435 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java @@ -0,0 +1,64 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_paged_async] +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.ListVulnerabilityReportsRequest; +import com.google.cloud.osconfig.v1.ListVulnerabilityReportsResponse; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.VulnerabilityReport; +import com.google.common.base.Strings; + +public class AsyncListVulnerabilityReportsPaged { + + public static void main(String[] args) throws Exception { + asyncListVulnerabilityReportsPaged(); + } + + public static void asyncListVulnerabilityReportsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListVulnerabilityReportsRequest request = + ListVulnerabilityReportsRequest.newBuilder() + .setParent( + InstanceName.ofProjectLocationInstanceName( + "[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListVulnerabilityReportsResponse response = + osConfigZonalServiceClient.listVulnerabilityReportsCallable().call(request); + for (VulnerabilityReport element : response.getVulnerabilityReportsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReports.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReports.java new file mode 100644 index 00000000..3c68ceca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReports.java @@ -0,0 +1,53 @@ +/* + * 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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_sync] +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.ListVulnerabilityReportsRequest; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.VulnerabilityReport; + +public class SyncListVulnerabilityReports { + + public static void main(String[] args) throws Exception { + syncListVulnerabilityReports(); + } + + public static void syncListVulnerabilityReports() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListVulnerabilityReportsRequest request = + ListVulnerabilityReportsRequest.newBuilder() + .setParent( + InstanceName.ofProjectLocationInstanceName( + "[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (VulnerabilityReport element : + osConfigZonalServiceClient.listVulnerabilityReports(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java new file mode 100644 index 00000000..d33ed443 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.VulnerabilityReport; + +public class SyncListVulnerabilityReportsInstancename { + + public static void main(String[] args) throws Exception { + syncListVulnerabilityReportsInstancename(); + } + + public static void syncListVulnerabilityReportsInstancename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + InstanceName parent = + InstanceName.ofProjectLocationInstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + for (VulnerabilityReport element : + osConfigZonalServiceClient.listVulnerabilityReports(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java new file mode 100644 index 00000000..a2418dab --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_string_sync] +import com.google.cloud.osconfig.v1.InstanceName; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.VulnerabilityReport; + +public class SyncListVulnerabilityReportsString { + + public static void main(String[] args) throws Exception { + syncListVulnerabilityReportsString(); + } + + public static void syncListVulnerabilityReportsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = + InstanceName.ofProjectZoneInstanceName("[PROJECT]", "[ZONE]", "[INSTANCE]").toString(); + for (VulnerabilityReport element : + osConfigZonalServiceClient.listVulnerabilityReports(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignment.java new file mode 100644 index 00000000..3e133eca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.UpdateOSPolicyAssignmentRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + asyncUpdateOSPolicyAssignment(); + } + + public static void asyncUpdateOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + UpdateOSPolicyAssignmentRequest request = + UpdateOSPolicyAssignmentRequest.newBuilder() + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.updateOSPolicyAssignmentCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignmentLRO.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignmentLRO.java new file mode 100644 index 00000000..72ddeacf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignmentLRO.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.UpdateOSPolicyAssignmentRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateOSPolicyAssignmentLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateOSPolicyAssignmentLRO(); + } + + public static void asyncUpdateOSPolicyAssignmentLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + UpdateOSPolicyAssignmentRequest request = + UpdateOSPolicyAssignmentRequest.newBuilder() + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + osConfigZonalServiceClient + .updateOSPolicyAssignmentOperationCallable() + .futureCall(request); + // Do something. + OSPolicyAssignment response = future.get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignment.java new file mode 100644 index 00000000..0ce43a41 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1.UpdateOSPolicyAssignmentRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncUpdateOSPolicyAssignment(); + } + + public static void syncUpdateOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + UpdateOSPolicyAssignmentRequest request = + UpdateOSPolicyAssignmentRequest.newBuilder() + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OSPolicyAssignment response = + osConfigZonalServiceClient.updateOSPolicyAssignmentAsync(request).get(); + } + } +} +// [END osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java new file mode 100644 index 00000000..f577b162 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.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.osconfig.v1.samples; + +// [START +// osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] +import com.google.cloud.osconfig.v1.OSPolicyAssignment; +import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask(); + } + + public static void syncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + OSPolicyAssignment response = + osConfigZonalServiceClient + .updateOSPolicyAssignmentAsync(osPolicyAssignment, updateMask) + .get(); + } + } +} +// [END +// osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalservicesettings/getospolicyassignment/SyncGetOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalservicesettings/getospolicyassignment/SyncGetOSPolicyAssignment.java new file mode 100644 index 00000000..9152ef9b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalservicesettings/getospolicyassignment/SyncGetOSPolicyAssignment.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.osconfig.v1.samples; + +// [START osconfig_v1_generated_osconfigzonalservicesettings_getospolicyassignment_sync] +import com.google.cloud.osconfig.v1.OsConfigZonalServiceSettings; +import java.time.Duration; + +public class SyncGetOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignment(); + } + + public static void syncGetOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + OsConfigZonalServiceSettings.Builder osConfigZonalServiceSettingsBuilder = + OsConfigZonalServiceSettings.newBuilder(); + osConfigZonalServiceSettingsBuilder + .getOSPolicyAssignmentSettings() + .setRetrySettings( + osConfigZonalServiceSettingsBuilder + .getOSPolicyAssignmentSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + OsConfigZonalServiceSettings osConfigZonalServiceSettings = + osConfigZonalServiceSettingsBuilder.build(); + } +} +// [END osconfig_v1_generated_osconfigzonalservicesettings_getospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/stub/osconfigservicestubsettings/executepatchjob/SyncExecutePatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/stub/osconfigservicestubsettings/executepatchjob/SyncExecutePatchJob.java new file mode 100644 index 00000000..d66d1429 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/stub/osconfigservicestubsettings/executepatchjob/SyncExecutePatchJob.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.osconfig.v1.stub.samples; + +// [START osconfig_v1_generated_osconfigservicestubsettings_executepatchjob_sync] +import com.google.cloud.osconfig.v1.stub.OsConfigServiceStubSettings; +import java.time.Duration; + +public class SyncExecutePatchJob { + + public static void main(String[] args) throws Exception { + syncExecutePatchJob(); + } + + public static void syncExecutePatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + OsConfigServiceStubSettings.Builder osConfigServiceSettingsBuilder = + OsConfigServiceStubSettings.newBuilder(); + osConfigServiceSettingsBuilder + .executePatchJobSettings() + .setRetrySettings( + osConfigServiceSettingsBuilder + .executePatchJobSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + OsConfigServiceStubSettings osConfigServiceSettings = osConfigServiceSettingsBuilder.build(); + } +} +// [END osconfig_v1_generated_osconfigservicestubsettings_executepatchjob_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/stub/osconfigzonalservicestubsettings/getospolicyassignment/SyncGetOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/stub/osconfigzonalservicestubsettings/getospolicyassignment/SyncGetOSPolicyAssignment.java new file mode 100644 index 00000000..a48d9f0b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/stub/osconfigzonalservicestubsettings/getospolicyassignment/SyncGetOSPolicyAssignment.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.osconfig.v1.stub.samples; + +// [START osconfig_v1_generated_osconfigzonalservicestubsettings_getospolicyassignment_sync] +import com.google.cloud.osconfig.v1.stub.OsConfigZonalServiceStubSettings; +import java.time.Duration; + +public class SyncGetOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignment(); + } + + public static void syncGetOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + OsConfigZonalServiceStubSettings.Builder osConfigZonalServiceSettingsBuilder = + OsConfigZonalServiceStubSettings.newBuilder(); + osConfigZonalServiceSettingsBuilder + .getOSPolicyAssignmentSettings() + .setRetrySettings( + osConfigZonalServiceSettingsBuilder + .getOSPolicyAssignmentSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + OsConfigZonalServiceStubSettings osConfigZonalServiceSettings = + osConfigZonalServiceSettingsBuilder.build(); + } +} +// [END osconfig_v1_generated_osconfigzonalservicestubsettings_getospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..740d76ca --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceSettings; +import com.google.cloud.osconfig.v1alpha.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. + OsConfigZonalServiceSettings osConfigZonalServiceSettings = + OsConfigZonalServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create(osConfigZonalServiceSettings); + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..52061043 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceSettings; + +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. + OsConfigZonalServiceSettings osConfigZonalServiceSettings = + OsConfigZonalServiceSettings.newBuilder() + .setTransportChannelProvider( + OsConfigZonalServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create(osConfigZonalServiceSettings); + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..fa7b736a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_create_setendpoint_sync] +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceSettings; +import com.google.cloud.osconfig.v1alpha.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. + OsConfigZonalServiceSettings osConfigZonalServiceSettings = + OsConfigZonalServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create(osConfigZonalServiceSettings); + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignment.java new file mode 100644 index 00000000..950ce351 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignment.java @@ -0,0 +1,51 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.CreateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.longrunning.Operation; + +public class AsyncCreateOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + asyncCreateOSPolicyAssignment(); + } + + public static void asyncCreateOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + CreateOSPolicyAssignmentRequest request = + CreateOSPolicyAssignmentRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setOsPolicyAssignmentId("osPolicyAssignmentId-44079074") + .build(); + ApiFuture future = + osConfigZonalServiceClient.createOSPolicyAssignmentCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignmentLRO.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignmentLRO.java new file mode 100644 index 00000000..c3a26189 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/AsyncCreateOSPolicyAssignmentLRO.java @@ -0,0 +1,53 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.osconfig.v1alpha.CreateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentOperationMetadata; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncCreateOSPolicyAssignmentLRO { + + public static void main(String[] args) throws Exception { + asyncCreateOSPolicyAssignmentLRO(); + } + + public static void asyncCreateOSPolicyAssignmentLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + CreateOSPolicyAssignmentRequest request = + CreateOSPolicyAssignmentRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setOsPolicyAssignmentId("osPolicyAssignmentId-44079074") + .build(); + OperationFuture future = + osConfigZonalServiceClient + .createOSPolicyAssignmentOperationCallable() + .futureCall(request); + // Do something. + OSPolicyAssignment response = future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignment.java new file mode 100644 index 00000000..02b79c0e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignment.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_sync] +import com.google.cloud.osconfig.v1alpha.CreateOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncCreateOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncCreateOSPolicyAssignment(); + } + + public static void syncCreateOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + CreateOSPolicyAssignmentRequest request = + CreateOSPolicyAssignmentRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setOsPolicyAssignmentId("osPolicyAssignmentId-44079074") + .build(); + OSPolicyAssignment response = + osConfigZonalServiceClient.createOSPolicyAssignmentAsync(request).get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java new file mode 100644 index 00000000..1480ca20 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString { + + public static void main(String[] args) throws Exception { + syncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString(); + } + + public static void syncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + OSPolicyAssignment response = + osConfigZonalServiceClient + .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId) + .get(); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java new file mode 100644 index 00000000..0aa6db02 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncCreateOSPolicyAssignmentStringOspolicyassignmentString { + + public static void main(String[] args) throws Exception { + syncCreateOSPolicyAssignmentStringOspolicyassignmentString(); + } + + public static void syncCreateOSPolicyAssignmentStringOspolicyassignmentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + String osPolicyAssignmentId = "osPolicyAssignmentId-44079074"; + OSPolicyAssignment response = + osConfigZonalServiceClient + .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId) + .get(); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignment.java new file mode 100644 index 00000000..63629f8c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignment.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.DeleteOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + asyncDeleteOSPolicyAssignment(); + } + + public static void asyncDeleteOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + DeleteOSPolicyAssignmentRequest request = + DeleteOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.deleteOSPolicyAssignmentCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignmentLRO.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignmentLRO.java new file mode 100644 index 00000000..c679b07b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/AsyncDeleteOSPolicyAssignmentLRO.java @@ -0,0 +1,53 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.osconfig.v1alpha.DeleteOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentOperationMetadata; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteOSPolicyAssignmentLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteOSPolicyAssignmentLRO(); + } + + public static void asyncDeleteOSPolicyAssignmentLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + DeleteOSPolicyAssignmentRequest request = + DeleteOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + OperationFuture future = + osConfigZonalServiceClient + .deleteOSPolicyAssignmentOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java new file mode 100644 index 00000000..195092c9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_sync] +import com.google.cloud.osconfig.v1alpha.DeleteOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncDeleteOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncDeleteOSPolicyAssignment(); + } + + public static void syncDeleteOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + DeleteOSPolicyAssignmentRequest request = + DeleteOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(request).get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java new file mode 100644 index 00000000..ba0612c9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncDeleteOSPolicyAssignmentOspolicyassignmentname { + + public static void main(String[] args) throws Exception { + syncDeleteOSPolicyAssignmentOspolicyassignmentname(); + } + + public static void syncDeleteOSPolicyAssignmentOspolicyassignmentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(name).get(); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java new file mode 100644 index 00000000..ac532038 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_string_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncDeleteOSPolicyAssignmentString { + + public static void main(String[] args) throws Exception { + syncDeleteOSPolicyAssignmentString(); + } + + public static void syncDeleteOSPolicyAssignmentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString(); + osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(name).get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/AsyncGetInstanceOSPoliciesCompliance.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/AsyncGetInstanceOSPoliciesCompliance.java new file mode 100644 index 00000000..720a6181 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/AsyncGetInstanceOSPoliciesCompliance.java @@ -0,0 +1,51 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.GetInstanceOSPoliciesComplianceRequest; +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesComplianceName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncGetInstanceOSPoliciesCompliance { + + public static void main(String[] args) throws Exception { + asyncGetInstanceOSPoliciesCompliance(); + } + + public static void asyncGetInstanceOSPoliciesCompliance() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetInstanceOSPoliciesComplianceRequest request = + GetInstanceOSPoliciesComplianceRequest.newBuilder() + .setName( + InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.getInstanceOSPoliciesComplianceCallable().futureCall(request); + // Do something. + InstanceOSPoliciesCompliance response = future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesCompliance.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesCompliance.java new file mode 100644 index 00000000..2ff82be0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesCompliance.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_sync] +import com.google.cloud.osconfig.v1alpha.GetInstanceOSPoliciesComplianceRequest; +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesComplianceName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetInstanceOSPoliciesCompliance { + + public static void main(String[] args) throws Exception { + syncGetInstanceOSPoliciesCompliance(); + } + + public static void syncGetInstanceOSPoliciesCompliance() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetInstanceOSPoliciesComplianceRequest request = + GetInstanceOSPoliciesComplianceRequest.newBuilder() + .setName( + InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]") + .toString()) + .build(); + InstanceOSPoliciesCompliance response = + osConfigZonalServiceClient.getInstanceOSPoliciesCompliance(request); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename.java new file mode 100644 index 00000000..5e6fc842 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_instanceospoliciescompliancename_sync] +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesComplianceName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename { + + public static void main(String[] args) throws Exception { + syncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename(); + } + + public static void syncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + InstanceOSPoliciesComplianceName name = + InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + InstanceOSPoliciesCompliance response = + osConfigZonalServiceClient.getInstanceOSPoliciesCompliance(name); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_instanceospoliciescompliancename_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceString.java new file mode 100644 index 00000000..54a435e9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceString.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_string_sync] +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesComplianceName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetInstanceOSPoliciesComplianceString { + + public static void main(String[] args) throws Exception { + syncGetInstanceOSPoliciesComplianceString(); + } + + public static void syncGetInstanceOSPoliciesComplianceString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = + InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + InstanceOSPoliciesCompliance response = + osConfigZonalServiceClient.getInstanceOSPoliciesCompliance(name); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/AsyncGetInventory.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/AsyncGetInventory.java new file mode 100644 index 00000000..ba16ee04 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/AsyncGetInventory.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getinventory_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.GetInventoryRequest; +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.InventoryName; +import com.google.cloud.osconfig.v1alpha.InventoryView; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncGetInventory { + + public static void main(String[] args) throws Exception { + asyncGetInventory(); + } + + public static void asyncGetInventory() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetInventoryRequest request = + GetInventoryRequest.newBuilder() + .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setView(InventoryView.forNumber(0)) + .build(); + ApiFuture future = + osConfigZonalServiceClient.getInventoryCallable().futureCall(request); + // Do something. + Inventory response = future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getinventory_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventory.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventory.java new file mode 100644 index 00000000..39437914 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventory.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getinventory_sync] +import com.google.cloud.osconfig.v1alpha.GetInventoryRequest; +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.InventoryName; +import com.google.cloud.osconfig.v1alpha.InventoryView; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetInventory { + + public static void main(String[] args) throws Exception { + syncGetInventory(); + } + + public static void syncGetInventory() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetInventoryRequest request = + GetInventoryRequest.newBuilder() + .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setView(InventoryView.forNumber(0)) + .build(); + Inventory response = osConfigZonalServiceClient.getInventory(request); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getinventory_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventoryInventoryname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventoryInventoryname.java new file mode 100644 index 00000000..d99d53d4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventoryInventoryname.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getinventory_inventoryname_sync] +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.InventoryName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetInventoryInventoryname { + + public static void main(String[] args) throws Exception { + syncGetInventoryInventoryname(); + } + + public static void syncGetInventoryInventoryname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + InventoryName name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + Inventory response = osConfigZonalServiceClient.getInventory(name); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getinventory_inventoryname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventoryString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventoryString.java new file mode 100644 index 00000000..c6d43ff8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinventory/SyncGetInventoryString.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getinventory_string_sync] +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.InventoryName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetInventoryString { + + public static void main(String[] args) throws Exception { + syncGetInventoryString(); + } + + public static void syncGetInventoryString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + Inventory response = osConfigZonalServiceClient.getInventory(name); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getinventory_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/AsyncGetOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/AsyncGetOSPolicyAssignment.java new file mode 100644 index 00000000..6c786812 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/AsyncGetOSPolicyAssignment.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.GetOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncGetOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + asyncGetOSPolicyAssignment(); + } + + public static void asyncGetOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetOSPolicyAssignmentRequest request = + GetOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.getOSPolicyAssignmentCallable().futureCall(request); + // Do something. + OSPolicyAssignment response = future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignment.java new file mode 100644 index 00000000..e638df35 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignment.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_sync] +import com.google.cloud.osconfig.v1alpha.GetOSPolicyAssignmentRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignment(); + } + + public static void syncGetOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetOSPolicyAssignmentRequest request = + GetOSPolicyAssignmentRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .build(); + OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(request); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java new file mode 100644 index 00000000..bdec1ece --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentOspolicyassignmentname { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentOspolicyassignmentname(); + } + + public static void syncGetOSPolicyAssignmentOspolicyassignmentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentString.java new file mode 100644 index 00000000..90d3d5d2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentString.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_string_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentString { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentString(); + } + + public static void syncGetOSPolicyAssignmentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString(); + OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/AsyncGetOSPolicyAssignmentReport.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/AsyncGetOSPolicyAssignmentReport.java new file mode 100644 index 00000000..b48602f2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/AsyncGetOSPolicyAssignmentReport.java @@ -0,0 +1,51 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.GetOSPolicyAssignmentReportRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReportName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncGetOSPolicyAssignmentReport { + + public static void main(String[] args) throws Exception { + asyncGetOSPolicyAssignmentReport(); + } + + public static void asyncGetOSPolicyAssignmentReport() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetOSPolicyAssignmentReportRequest request = + GetOSPolicyAssignmentReportRequest.newBuilder() + .setName( + OSPolicyAssignmentReportName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.getOSPolicyAssignmentReportCallable().futureCall(request); + // Do something. + OSPolicyAssignmentReport response = future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReport.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReport.java new file mode 100644 index 00000000..a13fe619 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReport.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_sync] +import com.google.cloud.osconfig.v1alpha.GetOSPolicyAssignmentReportRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReportName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentReport { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentReport(); + } + + public static void syncGetOSPolicyAssignmentReport() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetOSPolicyAssignmentReportRequest request = + GetOSPolicyAssignmentReportRequest.newBuilder() + .setName( + OSPolicyAssignmentReportName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .build(); + OSPolicyAssignmentReport response = + osConfigZonalServiceClient.getOSPolicyAssignmentReport(request); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java new file mode 100644 index 00000000..4a99188d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReportName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentReportOspolicyassignmentreportname(); + } + + public static void syncGetOSPolicyAssignmentReportOspolicyassignmentreportname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignmentReportName name = + OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + OSPolicyAssignmentReport response = + osConfigZonalServiceClient.getOSPolicyAssignmentReport(name); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java new file mode 100644 index 00000000..e135a00d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_string_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReportName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncGetOSPolicyAssignmentReportString { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignmentReportString(); + } + + public static void syncGetOSPolicyAssignmentReportString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = + OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString(); + OSPolicyAssignmentReport response = + osConfigZonalServiceClient.getOSPolicyAssignmentReport(name); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/AsyncGetVulnerabilityReport.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/AsyncGetVulnerabilityReport.java new file mode 100644 index 00000000..84ffdda5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/AsyncGetVulnerabilityReport.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.GetVulnerabilityReportRequest; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReportName; + +public class AsyncGetVulnerabilityReport { + + public static void main(String[] args) throws Exception { + asyncGetVulnerabilityReport(); + } + + public static void asyncGetVulnerabilityReport() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetVulnerabilityReportRequest request = + GetVulnerabilityReportRequest.newBuilder() + .setName( + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.getVulnerabilityReportCallable().futureCall(request); + // Do something. + VulnerabilityReport response = future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReport.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReport.java new file mode 100644 index 00000000..d5d4d759 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReport.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_sync] +import com.google.cloud.osconfig.v1alpha.GetVulnerabilityReportRequest; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReportName; + +public class SyncGetVulnerabilityReport { + + public static void main(String[] args) throws Exception { + syncGetVulnerabilityReport(); + } + + public static void syncGetVulnerabilityReport() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + GetVulnerabilityReportRequest request = + GetVulnerabilityReportRequest.newBuilder() + .setName( + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .build(); + VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(request); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportString.java new file mode 100644 index 00000000..35cb0ff0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportString.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_string_sync] +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReportName; + +public class SyncGetVulnerabilityReportString { + + public static void main(String[] args) throws Exception { + syncGetVulnerabilityReportString(); + } + + public static void syncGetVulnerabilityReportString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(name); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java new file mode 100644 index 00000000..bdc61ef6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReportName; + +public class SyncGetVulnerabilityReportVulnerabilityreportname { + + public static void main(String[] args) throws Exception { + syncGetVulnerabilityReportVulnerabilityreportname(); + } + + public static void syncGetVulnerabilityReportVulnerabilityreportname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + VulnerabilityReportName name = + VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(name); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliances.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliances.java new file mode 100644 index 00000000..97828069 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliances.java @@ -0,0 +1,57 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesRequest; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncListInstanceOSPoliciesCompliances { + + public static void main(String[] args) throws Exception { + asyncListInstanceOSPoliciesCompliances(); + } + + public static void asyncListInstanceOSPoliciesCompliances() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListInstanceOSPoliciesCompliancesRequest request = + ListInstanceOSPoliciesCompliancesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + osConfigZonalServiceClient + .listInstanceOSPoliciesCompliancesPagedCallable() + .futureCall(request); + // Do something. + for (InstanceOSPoliciesCompliance element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliancesPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliancesPaged.java new file mode 100644 index 00000000..b609b11d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliancesPaged.java @@ -0,0 +1,64 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_paged_async] +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesRequest; +import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesResponse; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.common.base.Strings; + +public class AsyncListInstanceOSPoliciesCompliancesPaged { + + public static void main(String[] args) throws Exception { + asyncListInstanceOSPoliciesCompliancesPaged(); + } + + public static void asyncListInstanceOSPoliciesCompliancesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListInstanceOSPoliciesCompliancesRequest request = + ListInstanceOSPoliciesCompliancesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListInstanceOSPoliciesCompliancesResponse response = + osConfigZonalServiceClient.listInstanceOSPoliciesCompliancesCallable().call(request); + for (InstanceOSPoliciesCompliance element : + response.getInstanceOsPoliciesCompliancesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliances.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliances.java new file mode 100644 index 00000000..04d0f199 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliances.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_sync] +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesRequest; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListInstanceOSPoliciesCompliances { + + public static void main(String[] args) throws Exception { + syncListInstanceOSPoliciesCompliances(); + } + + public static void syncListInstanceOSPoliciesCompliances() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListInstanceOSPoliciesCompliancesRequest request = + ListInstanceOSPoliciesCompliancesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (InstanceOSPoliciesCompliance element : + osConfigZonalServiceClient.listInstanceOSPoliciesCompliances(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesLocationname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesLocationname.java new file mode 100644 index 00000000..a5df343d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesLocationname.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_locationname_sync] +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListInstanceOSPoliciesCompliancesLocationname { + + public static void main(String[] args) throws Exception { + syncListInstanceOSPoliciesCompliancesLocationname(); + } + + public static void syncListInstanceOSPoliciesCompliancesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (InstanceOSPoliciesCompliance element : + osConfigZonalServiceClient.listInstanceOSPoliciesCompliances(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesString.java new file mode 100644 index 00000000..f96eda9b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesString.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_string_sync] +import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListInstanceOSPoliciesCompliancesString { + + public static void main(String[] args) throws Exception { + syncListInstanceOSPoliciesCompliancesString(); + } + + public static void syncListInstanceOSPoliciesCompliancesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (InstanceOSPoliciesCompliance element : + osConfigZonalServiceClient.listInstanceOSPoliciesCompliances(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/AsyncListInventories.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/AsyncListInventories.java new file mode 100644 index 00000000..ba4d07f1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/AsyncListInventories.java @@ -0,0 +1,55 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.InventoryView; +import com.google.cloud.osconfig.v1alpha.ListInventoriesRequest; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncListInventories { + + public static void main(String[] args) throws Exception { + asyncListInventories(); + } + + public static void asyncListInventories() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListInventoriesRequest request = + ListInventoriesRequest.newBuilder() + .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setView(InventoryView.forNumber(0)) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + osConfigZonalServiceClient.listInventoriesPagedCallable().futureCall(request); + // Do something. + for (Inventory element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/AsyncListInventoriesPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/AsyncListInventoriesPaged.java new file mode 100644 index 00000000..dbb69423 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/AsyncListInventoriesPaged.java @@ -0,0 +1,63 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_paged_async] +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.InventoryView; +import com.google.cloud.osconfig.v1alpha.ListInventoriesRequest; +import com.google.cloud.osconfig.v1alpha.ListInventoriesResponse; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.common.base.Strings; + +public class AsyncListInventoriesPaged { + + public static void main(String[] args) throws Exception { + asyncListInventoriesPaged(); + } + + public static void asyncListInventoriesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListInventoriesRequest request = + ListInventoriesRequest.newBuilder() + .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setView(InventoryView.forNumber(0)) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListInventoriesResponse response = + osConfigZonalServiceClient.listInventoriesCallable().call(request); + for (Inventory element : response.getInventoriesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventories.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventories.java new file mode 100644 index 00000000..d1f3a353 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventories.java @@ -0,0 +1,51 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_sync] +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.InventoryView; +import com.google.cloud.osconfig.v1alpha.ListInventoriesRequest; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListInventories { + + public static void main(String[] args) throws Exception { + syncListInventories(); + } + + public static void syncListInventories() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListInventoriesRequest request = + ListInventoriesRequest.newBuilder() + .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setView(InventoryView.forNumber(0)) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Inventory element : osConfigZonalServiceClient.listInventories(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventoriesInstancename.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventoriesInstancename.java new file mode 100644 index 00000000..9740f76a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventoriesInstancename.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_instancename_sync] +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListInventoriesInstancename { + + public static void main(String[] args) throws Exception { + syncListInventoriesInstancename(); + } + + public static void syncListInventoriesInstancename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + for (Inventory element : osConfigZonalServiceClient.listInventories(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_instancename_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventoriesString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventoriesString.java new file mode 100644 index 00000000..6eec7290 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinventories/SyncListInventoriesString.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_string_sync] +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.Inventory; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListInventoriesString { + + public static void main(String[] args) throws Exception { + syncListInventoriesString(); + } + + public static void syncListInventoriesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + for (Inventory element : osConfigZonalServiceClient.listInventories(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinventories_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReports.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReports.java new file mode 100644 index 00000000..7cfd7492 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReports.java @@ -0,0 +1,58 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentReportsRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncListOSPolicyAssignmentReports { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentReports(); + } + + public static void asyncListOSPolicyAssignmentReports() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentReportsRequest request = + ListOSPolicyAssignmentReportsRequest.newBuilder() + .setParent( + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + osConfigZonalServiceClient + .listOSPolicyAssignmentReportsPagedCallable() + .futureCall(request); + // Do something. + for (OSPolicyAssignmentReport element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java new file mode 100644 index 00000000..dfd34db6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java @@ -0,0 +1,66 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] +import com.google.cloud.osconfig.v1alpha.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentReportsRequest; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentReportsResponse; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.common.base.Strings; + +public class AsyncListOSPolicyAssignmentReportsPaged { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentReportsPaged(); + } + + public static void asyncListOSPolicyAssignmentReportsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentReportsRequest request = + ListOSPolicyAssignmentReportsRequest.newBuilder() + .setParent( + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListOSPolicyAssignmentReportsResponse response = + osConfigZonalServiceClient.listOSPolicyAssignmentReportsCallable().call(request); + for (OSPolicyAssignmentReport element : response.getOsPolicyAssignmentReportsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReports.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReports.java new file mode 100644 index 00000000..905902a4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReports.java @@ -0,0 +1,53 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_sync] +import com.google.cloud.osconfig.v1alpha.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentReportsRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentReports { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentReports(); + } + + public static void syncListOSPolicyAssignmentReports() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentReportsRequest request = + ListOSPolicyAssignmentReportsRequest.newBuilder() + .setParent( + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .build(); + for (OSPolicyAssignmentReport element : + osConfigZonalServiceClient.listOSPolicyAssignmentReports(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java new file mode 100644 index 00000000..3922f6b5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] +import com.google.cloud.osconfig.v1alpha.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentReportsInstanceospolicyassignmentname(); + } + + public static void syncListOSPolicyAssignmentReportsInstanceospolicyassignmentname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + InstanceOSPolicyAssignmentName parent = + InstanceOSPolicyAssignmentName.of( + "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]"); + for (OSPolicyAssignmentReport element : + osConfigZonalServiceClient.listOSPolicyAssignmentReports(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java new file mode 100644 index 00000000..05278b79 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] +import com.google.cloud.osconfig.v1alpha.InstanceOSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentReportsString { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentReportsString(); + } + + public static void syncListOSPolicyAssignmentReportsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = + InstanceOSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]") + .toString(); + for (OSPolicyAssignmentReport element : + osConfigZonalServiceClient.listOSPolicyAssignmentReports(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java new file mode 100644 index 00000000..95579738 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java @@ -0,0 +1,57 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncListOSPolicyAssignmentRevisions { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentRevisions(); + } + + public static void asyncListOSPolicyAssignmentRevisions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentRevisionsRequest request = + ListOSPolicyAssignmentRevisionsRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + osConfigZonalServiceClient + .listOSPolicyAssignmentRevisionsPagedCallable() + .futureCall(request); + // Do something. + for (OSPolicyAssignment element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java new file mode 100644 index 00000000..f6ebaa72 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java @@ -0,0 +1,64 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsRequest; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsResponse; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.common.base.Strings; + +public class AsyncListOSPolicyAssignmentRevisionsPaged { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentRevisionsPaged(); + } + + public static void asyncListOSPolicyAssignmentRevisionsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentRevisionsRequest request = + ListOSPolicyAssignmentRevisionsRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListOSPolicyAssignmentRevisionsResponse response = + osConfigZonalServiceClient.listOSPolicyAssignmentRevisionsCallable().call(request); + for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java new file mode 100644 index 00000000..cca72e6d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_sync] +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsRequest; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentRevisions { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentRevisions(); + } + + public static void syncListOSPolicyAssignmentRevisions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentRevisionsRequest request = + ListOSPolicyAssignmentRevisionsRequest.newBuilder() + .setName( + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java new file mode 100644 index 00000000..87fa46ef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentRevisionsOspolicyassignmentname(); + } + + public static void syncListOSPolicyAssignmentRevisionsOspolicyassignmentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignmentName name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]"); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java new file mode 100644 index 00000000..f7cb4383 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentRevisionsString { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentRevisionsString(); + } + + public static void syncListOSPolicyAssignmentRevisionsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String name = + OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString(); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignments.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignments.java new file mode 100644 index 00000000..7266def9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignments.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentsRequest; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class AsyncListOSPolicyAssignments { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignments(); + } + + public static void asyncListOSPolicyAssignments() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentsRequest request = + ListOSPolicyAssignmentsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + osConfigZonalServiceClient.listOSPolicyAssignmentsPagedCallable().futureCall(request); + // Do something. + for (OSPolicyAssignment element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignmentsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignmentsPaged.java new file mode 100644 index 00000000..938c0173 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/AsyncListOSPolicyAssignmentsPaged.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_paged_async] +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentsRequest; +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentsResponse; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.common.base.Strings; + +public class AsyncListOSPolicyAssignmentsPaged { + + public static void main(String[] args) throws Exception { + asyncListOSPolicyAssignmentsPaged(); + } + + public static void asyncListOSPolicyAssignmentsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentsRequest request = + ListOSPolicyAssignmentsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListOSPolicyAssignmentsResponse response = + osConfigZonalServiceClient.listOSPolicyAssignmentsCallable().call(request); + for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignments.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignments.java new file mode 100644 index 00000000..911e0511 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignments.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_sync] +import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentsRequest; +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignments { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignments(); + } + + public static void syncListOSPolicyAssignments() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListOSPolicyAssignmentsRequest request = + ListOSPolicyAssignmentsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignments(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java new file mode 100644 index 00000000..11618fd4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentsLocationname { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentsLocationname(); + } + + public static void syncListOSPolicyAssignmentsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsString.java new file mode 100644 index 00000000..8e356bc3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsString.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_string_sync] +import com.google.cloud.osconfig.v1alpha.LocationName; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; + +public class SyncListOSPolicyAssignmentsString { + + public static void main(String[] args) throws Exception { + syncListOSPolicyAssignmentsString(); + } + + public static void syncListOSPolicyAssignmentsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (OSPolicyAssignment element : + osConfigZonalServiceClient.listOSPolicyAssignments(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReports.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReports.java new file mode 100644 index 00000000..c9500401 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReports.java @@ -0,0 +1,53 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.ListVulnerabilityReportsRequest; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; + +public class AsyncListVulnerabilityReports { + + public static void main(String[] args) throws Exception { + asyncListVulnerabilityReports(); + } + + public static void asyncListVulnerabilityReports() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListVulnerabilityReportsRequest request = + ListVulnerabilityReportsRequest.newBuilder() + .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + osConfigZonalServiceClient.listVulnerabilityReportsPagedCallable().futureCall(request); + // Do something. + for (VulnerabilityReport element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java new file mode 100644 index 00000000..0d53509d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java @@ -0,0 +1,62 @@ +/* + * 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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_paged_async] +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.ListVulnerabilityReportsRequest; +import com.google.cloud.osconfig.v1alpha.ListVulnerabilityReportsResponse; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; +import com.google.common.base.Strings; + +public class AsyncListVulnerabilityReportsPaged { + + public static void main(String[] args) throws Exception { + asyncListVulnerabilityReportsPaged(); + } + + public static void asyncListVulnerabilityReportsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListVulnerabilityReportsRequest request = + ListVulnerabilityReportsRequest.newBuilder() + .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListVulnerabilityReportsResponse response = + osConfigZonalServiceClient.listVulnerabilityReportsCallable().call(request); + for (VulnerabilityReport element : response.getVulnerabilityReportsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReports.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReports.java new file mode 100644 index 00000000..0426d265 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReports.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_sync] +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.ListVulnerabilityReportsRequest; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; + +public class SyncListVulnerabilityReports { + + public static void main(String[] args) throws Exception { + syncListVulnerabilityReports(); + } + + public static void syncListVulnerabilityReports() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + ListVulnerabilityReportsRequest request = + ListVulnerabilityReportsRequest.newBuilder() + .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (VulnerabilityReport element : + osConfigZonalServiceClient.listVulnerabilityReports(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java new file mode 100644 index 00000000..80562c70 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; + +public class SyncListVulnerabilityReportsInstancename { + + public static void main(String[] args) throws Exception { + syncListVulnerabilityReportsInstancename(); + } + + public static void syncListVulnerabilityReportsInstancename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + for (VulnerabilityReport element : + osConfigZonalServiceClient.listVulnerabilityReports(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java new file mode 100644 index 00000000..b5de96ba --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_string_sync] +import com.google.cloud.osconfig.v1alpha.InstanceName; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; + +public class SyncListVulnerabilityReportsString { + + public static void main(String[] args) throws Exception { + syncListVulnerabilityReportsString(); + } + + public static void syncListVulnerabilityReportsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + String parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + for (VulnerabilityReport element : + osConfigZonalServiceClient.listVulnerabilityReports(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignment.java new file mode 100644 index 00000000..bd66e5b5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignment.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.UpdateOSPolicyAssignmentRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + asyncUpdateOSPolicyAssignment(); + } + + public static void asyncUpdateOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + UpdateOSPolicyAssignmentRequest request = + UpdateOSPolicyAssignmentRequest.newBuilder() + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + osConfigZonalServiceClient.updateOSPolicyAssignmentCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignmentLRO.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignmentLRO.java new file mode 100644 index 00000000..b910f093 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/AsyncUpdateOSPolicyAssignmentLRO.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentOperationMetadata; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.UpdateOSPolicyAssignmentRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateOSPolicyAssignmentLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateOSPolicyAssignmentLRO(); + } + + public static void asyncUpdateOSPolicyAssignmentLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + UpdateOSPolicyAssignmentRequest request = + UpdateOSPolicyAssignmentRequest.newBuilder() + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + osConfigZonalServiceClient + .updateOSPolicyAssignmentOperationCallable() + .futureCall(request); + // Do something. + OSPolicyAssignment response = future.get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignment.java new file mode 100644 index 00000000..bef50cac --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignment.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.cloud.osconfig.v1alpha.UpdateOSPolicyAssignmentRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncUpdateOSPolicyAssignment(); + } + + public static void syncUpdateOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + UpdateOSPolicyAssignmentRequest request = + UpdateOSPolicyAssignmentRequest.newBuilder() + .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OSPolicyAssignment response = + osConfigZonalServiceClient.updateOSPolicyAssignmentAsync(request).get(); + } + } +} +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java new file mode 100644 index 00000000..d92979e3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.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.osconfig.v1alpha.samples; + +// [START +// osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] +import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask(); + } + + public static void syncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigZonalServiceClient osConfigZonalServiceClient = + OsConfigZonalServiceClient.create()) { + OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + OSPolicyAssignment response = + osConfigZonalServiceClient + .updateOSPolicyAssignmentAsync(osPolicyAssignment, updateMask) + .get(); + } + } +} +// [END +// osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalservicesettings/getospolicyassignment/SyncGetOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalservicesettings/getospolicyassignment/SyncGetOSPolicyAssignment.java new file mode 100644 index 00000000..8d9a8a6f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalservicesettings/getospolicyassignment/SyncGetOSPolicyAssignment.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.osconfig.v1alpha.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalservicesettings_getospolicyassignment_sync] +import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceSettings; +import java.time.Duration; + +public class SyncGetOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignment(); + } + + public static void syncGetOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + OsConfigZonalServiceSettings.Builder osConfigZonalServiceSettingsBuilder = + OsConfigZonalServiceSettings.newBuilder(); + osConfigZonalServiceSettingsBuilder + .getOSPolicyAssignmentSettings() + .setRetrySettings( + osConfigZonalServiceSettingsBuilder + .getOSPolicyAssignmentSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + OsConfigZonalServiceSettings osConfigZonalServiceSettings = + osConfigZonalServiceSettingsBuilder.build(); + } +} +// [END osconfig_v1alpha_generated_osconfigzonalservicesettings_getospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/stub/osconfigzonalservicestubsettings/getospolicyassignment/SyncGetOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/stub/osconfigzonalservicestubsettings/getospolicyassignment/SyncGetOSPolicyAssignment.java new file mode 100644 index 00000000..d4de76d3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/stub/osconfigzonalservicestubsettings/getospolicyassignment/SyncGetOSPolicyAssignment.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.osconfig.v1alpha.stub.samples; + +// [START osconfig_v1alpha_generated_osconfigzonalservicestubsettings_getospolicyassignment_sync] +import com.google.cloud.osconfig.v1alpha.stub.OsConfigZonalServiceStubSettings; +import java.time.Duration; + +public class SyncGetOSPolicyAssignment { + + public static void main(String[] args) throws Exception { + syncGetOSPolicyAssignment(); + } + + public static void syncGetOSPolicyAssignment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + OsConfigZonalServiceStubSettings.Builder osConfigZonalServiceSettingsBuilder = + OsConfigZonalServiceStubSettings.newBuilder(); + osConfigZonalServiceSettingsBuilder + .getOSPolicyAssignmentSettings() + .setRetrySettings( + osConfigZonalServiceSettingsBuilder + .getOSPolicyAssignmentSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + OsConfigZonalServiceStubSettings osConfigZonalServiceSettings = + osConfigZonalServiceSettingsBuilder.build(); + } +} +// [END osconfig_v1alpha_generated_osconfigzonalservicestubsettings_getospolicyassignment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/cancelpatchjob/AsyncCancelPatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/cancelpatchjob/AsyncCancelPatchJob.java new file mode 100644 index 00000000..bec62b74 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/cancelpatchjob/AsyncCancelPatchJob.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_cancelpatchjob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; + +public class AsyncCancelPatchJob { + + public static void main(String[] args) throws Exception { + asyncCancelPatchJob(); + } + + public static void asyncCancelPatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.CancelPatchJobRequest request = + PatchJobs.CancelPatchJobRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + osConfigServiceClient.cancelPatchJobCallable().futureCall(request); + // Do something. + PatchJobs.PatchJob response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_cancelpatchjob_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/cancelpatchjob/SyncCancelPatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/cancelpatchjob/SyncCancelPatchJob.java new file mode 100644 index 00000000..1e1218fa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/cancelpatchjob/SyncCancelPatchJob.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_cancelpatchjob_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; + +public class SyncCancelPatchJob { + + public static void main(String[] args) throws Exception { + syncCancelPatchJob(); + } + + public static void syncCancelPatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.CancelPatchJobRequest request = + PatchJobs.CancelPatchJobRequest.newBuilder().setName("name3373707").build(); + PatchJobs.PatchJob response = osConfigServiceClient.cancelPatchJob(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_cancelpatchjob_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..e430d0df --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.OsConfigServiceSettings; +import com.google.cloud.osconfig.v1beta.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. + OsConfigServiceSettings osConfigServiceSettings = + OsConfigServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + OsConfigServiceClient osConfigServiceClient = + OsConfigServiceClient.create(osConfigServiceSettings); + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..8ecb3b52 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.OsConfigServiceSettings; + +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. + OsConfigServiceSettings osConfigServiceSettings = + OsConfigServiceSettings.newBuilder() + .setTransportChannelProvider( + OsConfigServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + OsConfigServiceClient osConfigServiceClient = + OsConfigServiceClient.create(osConfigServiceSettings); + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..1de949aa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_create_setendpoint_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.OsConfigServiceSettings; +import com.google.cloud.osconfig.v1beta.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. + OsConfigServiceSettings osConfigServiceSettings = + OsConfigServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + OsConfigServiceClient osConfigServiceClient = + OsConfigServiceClient.create(osConfigServiceSettings); + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/AsyncCreateGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/AsyncCreateGuestPolicy.java new file mode 100644 index 00000000..5df1cec4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/AsyncCreateGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.ProjectName; + +public class AsyncCreateGuestPolicy { + + public static void main(String[] args) throws Exception { + asyncCreateGuestPolicy(); + } + + public static void asyncCreateGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.CreateGuestPolicyRequest request = + GuestPolicies.CreateGuestPolicyRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setGuestPolicyId("guestPolicyId1234592741") + .setGuestPolicy(GuestPolicies.GuestPolicy.newBuilder().build()) + .build(); + ApiFuture future = + osConfigServiceClient.createGuestPolicyCallable().futureCall(request); + // Do something. + GuestPolicies.GuestPolicy response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicy.java new file mode 100644 index 00000000..77ee5cb4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.ProjectName; + +public class SyncCreateGuestPolicy { + + public static void main(String[] args) throws Exception { + syncCreateGuestPolicy(); + } + + public static void syncCreateGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.CreateGuestPolicyRequest request = + GuestPolicies.CreateGuestPolicyRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setGuestPolicyId("guestPolicyId1234592741") + .setGuestPolicy(GuestPolicies.GuestPolicy.newBuilder().build()) + .build(); + GuestPolicies.GuestPolicy response = osConfigServiceClient.createGuestPolicy(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy.java new file mode 100644 index 00000000..62cfb5ac --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy.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.osconfig.v1beta.samples; + +// [START +// osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_projectnameguestpoliciesguestpolicy_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.ProjectName; + +public class SyncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy { + + public static void main(String[] args) throws Exception { + syncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy(); + } + + public static void syncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); + GuestPolicies.GuestPolicy response = + osConfigServiceClient.createGuestPolicy(parent, guestPolicy); + } + } +} +// [END +// osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_projectnameguestpoliciesguestpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyStringGuestpoliciesguestpolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyStringGuestpoliciesguestpolicy.java new file mode 100644 index 00000000..9658580c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyStringGuestpoliciesguestpolicy.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.osconfig.v1beta.samples; + +// [START +// osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_stringguestpoliciesguestpolicy_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.ProjectName; + +public class SyncCreateGuestPolicyStringGuestpoliciesguestpolicy { + + public static void main(String[] args) throws Exception { + syncCreateGuestPolicyStringGuestpoliciesguestpolicy(); + } + + public static void syncCreateGuestPolicyStringGuestpoliciesguestpolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); + GuestPolicies.GuestPolicy response = + osConfigServiceClient.createGuestPolicy(parent, guestPolicy); + } + } +} +// [END +// osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_stringguestpoliciesguestpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createpatchdeployment/AsyncCreatePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createpatchdeployment/AsyncCreatePatchDeployment.java new file mode 100644 index 00000000..6f170922 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createpatchdeployment/AsyncCreatePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_createpatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class AsyncCreatePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncCreatePatchDeployment(); + } + + public static void asyncCreatePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.CreatePatchDeploymentRequest request = + PatchDeployments.CreatePatchDeploymentRequest.newBuilder() + .setParent("parent-995424086") + .setPatchDeploymentId("patchDeploymentId-1180405976") + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .build(); + ApiFuture future = + osConfigServiceClient.createPatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_createpatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeployment.java new file mode 100644 index 00000000..ca711368 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_createpatchdeployment_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncCreatePatchDeployment { + + public static void main(String[] args) throws Exception { + syncCreatePatchDeployment(); + } + + public static void syncCreatePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.CreatePatchDeploymentRequest request = + PatchDeployments.CreatePatchDeploymentRequest.newBuilder() + .setParent("parent-995424086") + .setPatchDeploymentId("patchDeploymentId-1180405976") + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.createPatchDeployment(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_createpatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/AsyncDeleteGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/AsyncDeleteGuestPolicy.java new file mode 100644 index 00000000..2cd9ccb2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/AsyncDeleteGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.GuestPolicyName; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteGuestPolicy { + + public static void main(String[] args) throws Exception { + asyncDeleteGuestPolicy(); + } + + public static void asyncDeleteGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.DeleteGuestPolicyRequest request = + GuestPolicies.DeleteGuestPolicyRequest.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.deleteGuestPolicyCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicy.java new file mode 100644 index 00000000..345c4ccc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.GuestPolicyName; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; + +public class SyncDeleteGuestPolicy { + + public static void main(String[] args) throws Exception { + syncDeleteGuestPolicy(); + } + + public static void syncDeleteGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.DeleteGuestPolicyRequest request = + GuestPolicies.DeleteGuestPolicyRequest.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .build(); + osConfigServiceClient.deleteGuestPolicy(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyGuestpolicyname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyGuestpolicyname.java new file mode 100644 index 00000000..42a094d5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyGuestpolicyname.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.cloud.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_guestpolicyname_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicyName; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; + +public class SyncDeleteGuestPolicyGuestpolicyname { + + public static void main(String[] args) throws Exception { + syncDeleteGuestPolicyGuestpolicyname(); + } + + public static void syncDeleteGuestPolicyGuestpolicyname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicyName name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]"); + osConfigServiceClient.deleteGuestPolicy(name); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_guestpolicyname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyString.java new file mode 100644 index 00000000..f86dd5a4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyString.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.cloud.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_string_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicyName; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; + +public class SyncDeleteGuestPolicyString { + + public static void main(String[] args) throws Exception { + syncDeleteGuestPolicyString(); + } + + public static void syncDeleteGuestPolicyString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString(); + osConfigServiceClient.deleteGuestPolicy(name); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/AsyncDeletePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/AsyncDeletePatchDeployment.java new file mode 100644 index 00000000..13d59734 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/AsyncDeletePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_deletepatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; +import com.google.protobuf.Empty; + +public class AsyncDeletePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncDeletePatchDeployment(); + } + + public static void asyncDeletePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.DeletePatchDeploymentRequest request = + PatchDeployments.DeletePatchDeploymentRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + osConfigServiceClient.deletePatchDeploymentCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_deletepatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java new file mode 100644 index 00000000..f0182bad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_deletepatchdeployment_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncDeletePatchDeployment { + + public static void main(String[] args) throws Exception { + syncDeletePatchDeployment(); + } + + public static void syncDeletePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.DeletePatchDeploymentRequest request = + PatchDeployments.DeletePatchDeploymentRequest.newBuilder().setName("name3373707").build(); + osConfigServiceClient.deletePatchDeployment(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_deletepatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/executepatchjob/AsyncExecutePatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/executepatchjob/AsyncExecutePatchJob.java new file mode 100644 index 00000000..71c0847b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/executepatchjob/AsyncExecutePatchJob.java @@ -0,0 +1,53 @@ +/* + * 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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_executepatchjob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; +import com.google.protobuf.Duration; + +public class AsyncExecutePatchJob { + + public static void main(String[] args) throws Exception { + asyncExecutePatchJob(); + } + + public static void asyncExecutePatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ExecutePatchJobRequest request = + PatchJobs.ExecutePatchJobRequest.newBuilder() + .setParent("parent-995424086") + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setDryRun(true) + .setDisplayName("displayName1714148973") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + ApiFuture future = + osConfigServiceClient.executePatchJobCallable().futureCall(request); + // Do something. + PatchJobs.PatchJob response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_executepatchjob_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/executepatchjob/SyncExecutePatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/executepatchjob/SyncExecutePatchJob.java new file mode 100644 index 00000000..fe3595a8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/executepatchjob/SyncExecutePatchJob.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_executepatchjob_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; +import com.google.protobuf.Duration; + +public class SyncExecutePatchJob { + + public static void main(String[] args) throws Exception { + syncExecutePatchJob(); + } + + public static void syncExecutePatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ExecutePatchJobRequest request = + PatchJobs.ExecutePatchJobRequest.newBuilder() + .setParent("parent-995424086") + .setDescription("description-1724546052") + .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) + .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setDryRun(true) + .setDisplayName("displayName1714148973") + .setRollout(PatchJobs.PatchRollout.newBuilder().build()) + .build(); + PatchJobs.PatchJob response = osConfigServiceClient.executePatchJob(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_executepatchjob_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/AsyncGetGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/AsyncGetGuestPolicy.java new file mode 100644 index 00000000..be78c56a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/AsyncGetGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_getguestpolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.GuestPolicyName; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; + +public class AsyncGetGuestPolicy { + + public static void main(String[] args) throws Exception { + asyncGetGuestPolicy(); + } + + public static void asyncGetGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.GetGuestPolicyRequest request = + GuestPolicies.GetGuestPolicyRequest.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.getGuestPolicyCallable().futureCall(request); + // Do something. + GuestPolicies.GuestPolicy response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_getguestpolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicy.java new file mode 100644 index 00000000..9ff2e04d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_getguestpolicy_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.GuestPolicyName; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; + +public class SyncGetGuestPolicy { + + public static void main(String[] args) throws Exception { + syncGetGuestPolicy(); + } + + public static void syncGetGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.GetGuestPolicyRequest request = + GuestPolicies.GetGuestPolicyRequest.newBuilder() + .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) + .build(); + GuestPolicies.GuestPolicy response = osConfigServiceClient.getGuestPolicy(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_getguestpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicyGuestpolicyname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicyGuestpolicyname.java new file mode 100644 index 00000000..8c633ddf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicyGuestpolicyname.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_getguestpolicy_guestpolicyname_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.GuestPolicyName; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; + +public class SyncGetGuestPolicyGuestpolicyname { + + public static void main(String[] args) throws Exception { + syncGetGuestPolicyGuestpolicyname(); + } + + public static void syncGetGuestPolicyGuestpolicyname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicyName name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]"); + GuestPolicies.GuestPolicy response = osConfigServiceClient.getGuestPolicy(name); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_getguestpolicy_guestpolicyname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicyString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicyString.java new file mode 100644 index 00000000..592a7af8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getguestpolicy/SyncGetGuestPolicyString.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_getguestpolicy_string_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.GuestPolicyName; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; + +public class SyncGetGuestPolicyString { + + public static void main(String[] args) throws Exception { + syncGetGuestPolicyString(); + } + + public static void syncGetGuestPolicyString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString(); + GuestPolicies.GuestPolicy response = osConfigServiceClient.getGuestPolicy(name); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_getguestpolicy_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchdeployment/AsyncGetPatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchdeployment/AsyncGetPatchDeployment.java new file mode 100644 index 00000000..5410a177 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchdeployment/AsyncGetPatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_getpatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class AsyncGetPatchDeployment { + + public static void main(String[] args) throws Exception { + asyncGetPatchDeployment(); + } + + public static void asyncGetPatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.GetPatchDeploymentRequest request = + PatchDeployments.GetPatchDeploymentRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + osConfigServiceClient.getPatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_getpatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeployment.java new file mode 100644 index 00000000..b3e4e847 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchdeployment/SyncGetPatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_getpatchdeployment_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncGetPatchDeployment { + + public static void main(String[] args) throws Exception { + syncGetPatchDeployment(); + } + + public static void syncGetPatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.GetPatchDeploymentRequest request = + PatchDeployments.GetPatchDeploymentRequest.newBuilder().setName("name3373707").build(); + PatchDeployments.PatchDeployment response = osConfigServiceClient.getPatchDeployment(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_getpatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchjob/AsyncGetPatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchjob/AsyncGetPatchJob.java new file mode 100644 index 00000000..9347d9ad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchjob/AsyncGetPatchJob.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_getpatchjob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; + +public class AsyncGetPatchJob { + + public static void main(String[] args) throws Exception { + asyncGetPatchJob(); + } + + public static void asyncGetPatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.GetPatchJobRequest request = + PatchJobs.GetPatchJobRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + osConfigServiceClient.getPatchJobCallable().futureCall(request); + // Do something. + PatchJobs.PatchJob response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_getpatchjob_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchjob/SyncGetPatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchjob/SyncGetPatchJob.java new file mode 100644 index 00000000..fa515fa5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/getpatchjob/SyncGetPatchJob.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_getpatchjob_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; + +public class SyncGetPatchJob { + + public static void main(String[] args) throws Exception { + syncGetPatchJob(); + } + + public static void syncGetPatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.GetPatchJobRequest request = + PatchJobs.GetPatchJobRequest.newBuilder().setName("name3373707").build(); + PatchJobs.PatchJob response = osConfigServiceClient.getPatchJob(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_getpatchjob_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/AsyncListGuestPolicies.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/AsyncListGuestPolicies.java new file mode 100644 index 00000000..c5bb356e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/AsyncListGuestPolicies.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.ProjectName; + +public class AsyncListGuestPolicies { + + public static void main(String[] args) throws Exception { + asyncListGuestPolicies(); + } + + public static void asyncListGuestPolicies() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.ListGuestPoliciesRequest request = + GuestPolicies.ListGuestPoliciesRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + osConfigServiceClient.listGuestPoliciesPagedCallable().futureCall(request); + // Do something. + for (GuestPolicies.GuestPolicy element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/AsyncListGuestPoliciesPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/AsyncListGuestPoliciesPaged.java new file mode 100644 index 00000000..c04ac2ef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/AsyncListGuestPoliciesPaged.java @@ -0,0 +1,57 @@ +/* + * 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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_paged_async] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.ProjectName; +import com.google.common.base.Strings; + +public class AsyncListGuestPoliciesPaged { + + public static void main(String[] args) throws Exception { + asyncListGuestPoliciesPaged(); + } + + public static void asyncListGuestPoliciesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.ListGuestPoliciesRequest request = + GuestPolicies.ListGuestPoliciesRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + GuestPolicies.ListGuestPoliciesResponse response = + osConfigServiceClient.listGuestPoliciesCallable().call(request); + for (GuestPolicies.GuestPolicy element : response.getGuestPoliciesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPolicies.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPolicies.java new file mode 100644 index 00000000..cf093351 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPolicies.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.ProjectName; + +public class SyncListGuestPolicies { + + public static void main(String[] args) throws Exception { + syncListGuestPolicies(); + } + + public static void syncListGuestPolicies() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.ListGuestPoliciesRequest request = + GuestPolicies.ListGuestPoliciesRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (GuestPolicies.GuestPolicy element : + osConfigServiceClient.listGuestPolicies(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPoliciesProjectname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPoliciesProjectname.java new file mode 100644 index 00000000..8e7b830e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPoliciesProjectname.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_projectname_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.ProjectName; + +public class SyncListGuestPoliciesProjectname { + + public static void main(String[] args) throws Exception { + syncListGuestPoliciesProjectname(); + } + + public static void syncListGuestPoliciesProjectname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (GuestPolicies.GuestPolicy element : + osConfigServiceClient.listGuestPolicies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_projectname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPoliciesString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPoliciesString.java new file mode 100644 index 00000000..b80c460c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listguestpolicies/SyncListGuestPoliciesString.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_string_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.ProjectName; + +public class SyncListGuestPoliciesString { + + public static void main(String[] args) throws Exception { + syncListGuestPoliciesString(); + } + + public static void syncListGuestPoliciesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + for (GuestPolicies.GuestPolicy element : + osConfigServiceClient.listGuestPolicies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listguestpolicies_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeployments.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeployments.java new file mode 100644 index 00000000..d2aeeea8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeployments.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchdeployments_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class AsyncListPatchDeployments { + + public static void main(String[] args) throws Exception { + asyncListPatchDeployments(); + } + + public static void asyncListPatchDeployments() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ListPatchDeploymentsRequest request = + PatchDeployments.ListPatchDeploymentsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + osConfigServiceClient.listPatchDeploymentsPagedCallable().futureCall(request); + // Do something. + for (PatchDeployments.PatchDeployment element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchdeployments_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeploymentsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeploymentsPaged.java new file mode 100644 index 00000000..3d2dd00d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/AsyncListPatchDeploymentsPaged.java @@ -0,0 +1,56 @@ +/* + * 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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchdeployments_paged_async] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; +import com.google.common.base.Strings; + +public class AsyncListPatchDeploymentsPaged { + + public static void main(String[] args) throws Exception { + asyncListPatchDeploymentsPaged(); + } + + public static void asyncListPatchDeploymentsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ListPatchDeploymentsRequest request = + PatchDeployments.ListPatchDeploymentsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + PatchDeployments.ListPatchDeploymentsResponse response = + osConfigServiceClient.listPatchDeploymentsCallable().call(request); + for (PatchDeployments.PatchDeployment element : response.getPatchDeploymentsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchdeployments_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/SyncListPatchDeployments.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/SyncListPatchDeployments.java new file mode 100644 index 00000000..80c87720 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchdeployments/SyncListPatchDeployments.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchdeployments_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncListPatchDeployments { + + public static void main(String[] args) throws Exception { + syncListPatchDeployments(); + } + + public static void syncListPatchDeployments() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ListPatchDeploymentsRequest request = + PatchDeployments.ListPatchDeploymentsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (PatchDeployments.PatchDeployment element : + osConfigServiceClient.listPatchDeployments(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchdeployments_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetails.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetails.java new file mode 100644 index 00000000..097fda43 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetails.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchjobinstancedetails_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; + +public class AsyncListPatchJobInstanceDetails { + + public static void main(String[] args) throws Exception { + asyncListPatchJobInstanceDetails(); + } + + public static void asyncListPatchJobInstanceDetails() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobInstanceDetailsRequest request = + PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + osConfigServiceClient.listPatchJobInstanceDetailsPagedCallable().futureCall(request); + // Do something. + for (PatchJobs.PatchJobInstanceDetails element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchjobinstancedetails_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetailsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetailsPaged.java new file mode 100644 index 00000000..e91249ef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/AsyncListPatchJobInstanceDetailsPaged.java @@ -0,0 +1,58 @@ +/* + * 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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchjobinstancedetails_paged_async] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; +import com.google.common.base.Strings; + +public class AsyncListPatchJobInstanceDetailsPaged { + + public static void main(String[] args) throws Exception { + asyncListPatchJobInstanceDetailsPaged(); + } + + public static void asyncListPatchJobInstanceDetailsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobInstanceDetailsRequest request = + PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + PatchJobs.ListPatchJobInstanceDetailsResponse response = + osConfigServiceClient.listPatchJobInstanceDetailsCallable().call(request); + for (PatchJobs.PatchJobInstanceDetails element : + response.getPatchJobInstanceDetailsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchjobinstancedetails_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetails.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetails.java new file mode 100644 index 00000000..64c77045 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetails.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchjobinstancedetails_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; + +public class SyncListPatchJobInstanceDetails { + + public static void main(String[] args) throws Exception { + syncListPatchJobInstanceDetails(); + } + + public static void syncListPatchJobInstanceDetails() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobInstanceDetailsRequest request = + PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (PatchJobs.PatchJobInstanceDetails element : + osConfigServiceClient.listPatchJobInstanceDetails(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchjobinstancedetails_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsString.java new file mode 100644 index 00000000..4a743ed1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobinstancedetails/SyncListPatchJobInstanceDetailsString.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchjobinstancedetails_string_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; + +public class SyncListPatchJobInstanceDetailsString { + + public static void main(String[] args) throws Exception { + syncListPatchJobInstanceDetailsString(); + } + + public static void syncListPatchJobInstanceDetailsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String parent = "parent-995424086"; + for (PatchJobs.PatchJobInstanceDetails element : + osConfigServiceClient.listPatchJobInstanceDetails(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchjobinstancedetails_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/AsyncListPatchJobs.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/AsyncListPatchJobs.java new file mode 100644 index 00000000..36e72be9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/AsyncListPatchJobs.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchjobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; + +public class AsyncListPatchJobs { + + public static void main(String[] args) throws Exception { + asyncListPatchJobs(); + } + + public static void asyncListPatchJobs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobsRequest request = + PatchJobs.ListPatchJobsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + osConfigServiceClient.listPatchJobsPagedCallable().futureCall(request); + // Do something. + for (PatchJobs.PatchJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchjobs_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/AsyncListPatchJobsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/AsyncListPatchJobsPaged.java new file mode 100644 index 00000000..b2309df3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/AsyncListPatchJobsPaged.java @@ -0,0 +1,57 @@ +/* + * 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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchjobs_paged_async] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; +import com.google.common.base.Strings; + +public class AsyncListPatchJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListPatchJobsPaged(); + } + + public static void asyncListPatchJobsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobsRequest request = + PatchJobs.ListPatchJobsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + PatchJobs.ListPatchJobsResponse response = + osConfigServiceClient.listPatchJobsCallable().call(request); + for (PatchJobs.PatchJob element : response.getPatchJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchjobs_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/SyncListPatchJobs.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/SyncListPatchJobs.java new file mode 100644 index 00000000..79d6d0c6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/listpatchjobs/SyncListPatchJobs.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_listpatchjobs_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchJobs; + +public class SyncListPatchJobs { + + public static void main(String[] args) throws Exception { + syncListPatchJobs(); + } + + public static void syncListPatchJobs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchJobs.ListPatchJobsRequest request = + PatchJobs.ListPatchJobsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (PatchJobs.PatchJob element : osConfigServiceClient.listPatchJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_listpatchjobs_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/lookupeffectiveguestpolicy/AsyncLookupEffectiveGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/lookupeffectiveguestpolicy/AsyncLookupEffectiveGuestPolicy.java new file mode 100644 index 00000000..5b0a5247 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/lookupeffectiveguestpolicy/AsyncLookupEffectiveGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_lookupeffectiveguestpolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; + +public class AsyncLookupEffectiveGuestPolicy { + + public static void main(String[] args) throws Exception { + asyncLookupEffectiveGuestPolicy(); + } + + public static void asyncLookupEffectiveGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.LookupEffectiveGuestPolicyRequest request = + GuestPolicies.LookupEffectiveGuestPolicyRequest.newBuilder() + .setInstance("instance555127957") + .setOsShortName("osShortName1253394339") + .setOsVersion("osVersion1812004436") + .setOsArchitecture("osArchitecture1339954519") + .build(); + ApiFuture future = + osConfigServiceClient.lookupEffectiveGuestPolicyCallable().futureCall(request); + // Do something. + GuestPolicies.EffectiveGuestPolicy response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_lookupeffectiveguestpolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/lookupeffectiveguestpolicy/SyncLookupEffectiveGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/lookupeffectiveguestpolicy/SyncLookupEffectiveGuestPolicy.java new file mode 100644 index 00000000..927792e3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/lookupeffectiveguestpolicy/SyncLookupEffectiveGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_lookupeffectiveguestpolicy_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; + +public class SyncLookupEffectiveGuestPolicy { + + public static void main(String[] args) throws Exception { + syncLookupEffectiveGuestPolicy(); + } + + public static void syncLookupEffectiveGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.LookupEffectiveGuestPolicyRequest request = + GuestPolicies.LookupEffectiveGuestPolicyRequest.newBuilder() + .setInstance("instance555127957") + .setOsShortName("osShortName1253394339") + .setOsVersion("osVersion1812004436") + .setOsArchitecture("osArchitecture1339954519") + .build(); + GuestPolicies.EffectiveGuestPolicy response = + osConfigServiceClient.lookupEffectiveGuestPolicy(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_lookupeffectiveguestpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/AsyncPausePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/AsyncPausePatchDeployment.java new file mode 100644 index 00000000..7e91a761 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/AsyncPausePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeploymentName; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class AsyncPausePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncPausePatchDeployment(); + } + + public static void asyncPausePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.PausePatchDeploymentRequest request = + PatchDeployments.PausePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.pausePatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeployment.java new file mode 100644 index 00000000..16c7598e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeploymentName; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncPausePatchDeployment { + + public static void main(String[] args) throws Exception { + syncPausePatchDeployment(); + } + + public static void syncPausePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.PausePatchDeploymentRequest request = + PatchDeployments.PausePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.pausePatchDeployment(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java new file mode 100644 index 00000000..bf757165 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.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.osconfig.v1beta.samples; + +// [START +// osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_patchdeploymentname_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeploymentName; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncPausePatchDeploymentPatchdeploymentname { + + public static void main(String[] args) throws Exception { + syncPausePatchDeploymentPatchdeploymentname(); + } + + public static void syncPausePatchDeploymentPatchdeploymentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + PatchDeployments.PatchDeployment response = osConfigServiceClient.pausePatchDeployment(name); + } + } +} +// [END +// osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_patchdeploymentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentString.java new file mode 100644 index 00000000..71c65f5c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentString.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_string_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeploymentName; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncPausePatchDeploymentString { + + public static void main(String[] args) throws Exception { + syncPausePatchDeploymentString(); + } + + public static void syncPausePatchDeploymentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString(); + PatchDeployments.PatchDeployment response = osConfigServiceClient.pausePatchDeployment(name); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/AsyncResumePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/AsyncResumePatchDeployment.java new file mode 100644 index 00000000..fc64908d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/AsyncResumePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeploymentName; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class AsyncResumePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncResumePatchDeployment(); + } + + public static void asyncResumePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ResumePatchDeploymentRequest request = + PatchDeployments.ResumePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + ApiFuture future = + osConfigServiceClient.resumePatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeployment.java new file mode 100644 index 00000000..f9bdeb8a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeploymentName; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncResumePatchDeployment { + + public static void main(String[] args) throws Exception { + syncResumePatchDeployment(); + } + + public static void syncResumePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.ResumePatchDeploymentRequest request = + PatchDeployments.ResumePatchDeploymentRequest.newBuilder() + .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) + .build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.resumePatchDeployment(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java new file mode 100644 index 00000000..ffe95546 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.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.osconfig.v1beta.samples; + +// [START +// osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeploymentName; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncResumePatchDeploymentPatchdeploymentname { + + public static void main(String[] args) throws Exception { + syncResumePatchDeploymentPatchdeploymentname(); + } + + public static void syncResumePatchDeploymentPatchdeploymentname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); + PatchDeployments.PatchDeployment response = osConfigServiceClient.resumePatchDeployment(name); + } + } +} +// [END +// osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentString.java new file mode 100644 index 00000000..6200b7f7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentString.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_string_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeploymentName; +import com.google.cloud.osconfig.v1beta.PatchDeployments; + +public class SyncResumePatchDeploymentString { + + public static void main(String[] args) throws Exception { + syncResumePatchDeploymentString(); + } + + public static void syncResumePatchDeploymentString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString(); + PatchDeployments.PatchDeployment response = osConfigServiceClient.resumePatchDeployment(name); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/AsyncUpdateGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/AsyncUpdateGuestPolicy.java new file mode 100644 index 00000000..9fe7573a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/AsyncUpdateGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateGuestPolicy { + + public static void main(String[] args) throws Exception { + asyncUpdateGuestPolicy(); + } + + public static void asyncUpdateGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.UpdateGuestPolicyRequest request = + GuestPolicies.UpdateGuestPolicyRequest.newBuilder() + .setGuestPolicy(GuestPolicies.GuestPolicy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + osConfigServiceClient.updateGuestPolicyCallable().futureCall(request); + // Do something. + GuestPolicies.GuestPolicy response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicy.java new file mode 100644 index 00000000..14f5d73e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicy.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateGuestPolicy { + + public static void main(String[] args) throws Exception { + syncUpdateGuestPolicy(); + } + + public static void syncUpdateGuestPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.UpdateGuestPolicyRequest request = + GuestPolicies.UpdateGuestPolicyRequest.newBuilder() + .setGuestPolicy(GuestPolicies.GuestPolicy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + GuestPolicies.GuestPolicy response = osConfigServiceClient.updateGuestPolicy(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask.java new file mode 100644 index 00000000..3fb6a960 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask.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.osconfig.v1beta.samples; + +// [START +// osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_guestpoliciesguestpolicyfieldmask_sync] +import com.google.cloud.osconfig.v1beta.GuestPolicies; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask(); + } + + public static void syncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + GuestPolicies.GuestPolicy response = + osConfigServiceClient.updateGuestPolicy(guestPolicy, updateMask); + } + } +} +// [END +// osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_guestpoliciesguestpolicyfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/AsyncUpdatePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/AsyncUpdatePatchDeployment.java new file mode 100644 index 00000000..b81c1ea1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/AsyncUpdatePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; +import com.google.protobuf.FieldMask; + +public class AsyncUpdatePatchDeployment { + + public static void main(String[] args) throws Exception { + asyncUpdatePatchDeployment(); + } + + public static void asyncUpdatePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.UpdatePatchDeploymentRequest request = + PatchDeployments.UpdatePatchDeploymentRequest.newBuilder() + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + osConfigServiceClient.updatePatchDeploymentCallable().futureCall(request); + // Do something. + PatchDeployments.PatchDeployment response = future.get(); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeployment.java new file mode 100644 index 00000000..1661b7dc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeployment.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; +import com.google.protobuf.FieldMask; + +public class SyncUpdatePatchDeployment { + + public static void main(String[] args) throws Exception { + syncUpdatePatchDeployment(); + } + + public static void syncUpdatePatchDeployment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.UpdatePatchDeploymentRequest request = + PatchDeployments.UpdatePatchDeploymentRequest.newBuilder() + .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.updatePatchDeployment(request); + } + } +} +// [END osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java new file mode 100644 index 00000000..1645e5c8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.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.osconfig.v1beta.samples; + +// [START +// osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.cloud.osconfig.v1beta.PatchDeployments; +import com.google.protobuf.FieldMask; + +public class SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask(); + } + + public static void syncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { + PatchDeployments.PatchDeployment patchDeployment = + PatchDeployments.PatchDeployment.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + PatchDeployments.PatchDeployment response = + osConfigServiceClient.updatePatchDeployment(patchDeployment, updateMask); + } + } +} +// [END +// osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigservicesettings/executepatchjob/SyncExecutePatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigservicesettings/executepatchjob/SyncExecutePatchJob.java new file mode 100644 index 00000000..2916e08e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigservicesettings/executepatchjob/SyncExecutePatchJob.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.osconfig.v1beta.samples; + +// [START osconfig_v1beta_generated_osconfigservicesettings_executepatchjob_sync] +import com.google.cloud.osconfig.v1beta.OsConfigServiceSettings; +import java.time.Duration; + +public class SyncExecutePatchJob { + + public static void main(String[] args) throws Exception { + syncExecutePatchJob(); + } + + public static void syncExecutePatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + OsConfigServiceSettings.Builder osConfigServiceSettingsBuilder = + OsConfigServiceSettings.newBuilder(); + osConfigServiceSettingsBuilder + .executePatchJobSettings() + .setRetrySettings( + osConfigServiceSettingsBuilder + .executePatchJobSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + OsConfigServiceSettings osConfigServiceSettings = osConfigServiceSettingsBuilder.build(); + } +} +// [END osconfig_v1beta_generated_osconfigservicesettings_executepatchjob_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/stub/osconfigservicestubsettings/executepatchjob/SyncExecutePatchJob.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/stub/osconfigservicestubsettings/executepatchjob/SyncExecutePatchJob.java new file mode 100644 index 00000000..2cf0e889 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/stub/osconfigservicestubsettings/executepatchjob/SyncExecutePatchJob.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.osconfig.v1beta.stub.samples; + +// [START osconfig_v1beta_generated_osconfigservicestubsettings_executepatchjob_sync] +import com.google.cloud.osconfig.v1beta.stub.OsConfigServiceStubSettings; +import java.time.Duration; + +public class SyncExecutePatchJob { + + public static void main(String[] args) throws Exception { + syncExecutePatchJob(); + } + + public static void syncExecutePatchJob() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + OsConfigServiceStubSettings.Builder osConfigServiceSettingsBuilder = + OsConfigServiceStubSettings.newBuilder(); + osConfigServiceSettingsBuilder + .executePatchJobSettings() + .setRetrySettings( + osConfigServiceSettingsBuilder + .executePatchJobSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + OsConfigServiceStubSettings osConfigServiceSettings = osConfigServiceSettingsBuilder.build(); + } +} +// [END osconfig_v1beta_generated_osconfigservicestubsettings_executepatchjob_sync] From 6bad28c8acf20190cad909a73847979a5d761b04 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:20:52 +0000 Subject: [PATCH 10/14] chore: update dependencies for regapic (#1467) (#490) * 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 a79f0627..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:2567a120ce90fadb6201999b87d649d9f67459de28815ad239bce9ebfaa18a74 -# created: 2022-05-19T15:12:45.278246753Z + 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 8145795ab21617583384b1a2c159cadac337ad21 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 28 Jun 2022 04:16:29 +0000 Subject: [PATCH 11/14] fix: update gapic-generator-java with mock service generation fixes (#491) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 457524730 Source-Link: https://github.com/googleapis/googleapis/commit/917e7f21cb1dc062744c6694437cdd46219f28cb Source-Link: https://github.com/googleapis/googleapis-gen/commit/2497f9a069d3f6b2d6810d5a4e239cda1e7e5a39 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjQ5N2Y5YTA2OWQzZjZiMmQ2ODEwZDVhNGUyMzljZGExZTdlNWEzOSJ9 --- .../cloud/osconfig/v1/OsConfigZonalServiceClient.java | 2 ++ .../cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java | 1 + ...ntProjectnamePatchdeploymentspatchdeploymentString.java | 6 ++---- ...loymentStringPatchdeploymentspatchdeploymentString.java | 6 ++---- .../deletepatchdeployment/SyncDeletePatchDeployment.java | 1 + .../SyncDeletePatchDeploymentPatchdeploymentname.java | 4 ++-- .../SyncDeletePatchDeploymentString.java | 1 + .../SyncResumePatchDeploymentPatchdeploymentname.java | 3 +-- ...DeploymentPatchdeploymentspatchdeploymentFieldmask.java | 6 ++---- ...licyAssignmentLocationnameOspolicyassignmentString.java | 6 ++---- ...teOSPolicyAssignmentStringOspolicyassignmentString.java | 6 ++---- .../SyncDeleteOSPolicyAssignment.java | 1 + ...SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java | 7 +++---- .../SyncDeleteOSPolicyAssignmentString.java | 1 + .../SyncGetOSPolicyAssignmentOspolicyassignmentname.java | 6 ++---- ...PolicyAssignmentReportOspolicyassignmentreportname.java | 6 ++---- .../SyncGetVulnerabilityReportVulnerabilityreportname.java | 6 ++---- .../AsyncListOSPolicyAssignmentReportsPaged.java | 3 +-- ...icyAssignmentReportsInstanceospolicyassignmentname.java | 6 ++---- .../SyncListOSPolicyAssignmentReportsString.java | 3 +-- .../AsyncListOSPolicyAssignmentRevisionsPaged.java | 6 ++---- ...tOSPolicyAssignmentRevisionsOspolicyassignmentname.java | 6 ++---- .../SyncListOSPolicyAssignmentRevisionsString.java | 6 ++---- .../SyncListOSPolicyAssignmentsLocationname.java | 3 +-- .../SyncListVulnerabilityReportsInstancename.java | 3 +-- ...pdateOSPolicyAssignmentOspolicyassignmentFieldmask.java | 6 ++---- ...licyAssignmentLocationnameOspolicyassignmentString.java | 6 ++---- ...teOSPolicyAssignmentStringOspolicyassignmentString.java | 6 ++---- .../SyncDeleteOSPolicyAssignment.java | 1 + ...SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java | 7 +++---- .../SyncDeleteOSPolicyAssignmentString.java | 4 ++-- .../AsyncGetInstanceOSPoliciesCompliance.java | 3 +-- .../SyncGetInstanceOSPoliciesCompliance.java | 3 +-- ...PoliciesComplianceInstanceospoliciescompliancename.java | 6 ++---- .../SyncGetInstanceOSPoliciesComplianceString.java | 6 ++---- .../SyncGetOSPolicyAssignmentOspolicyassignmentname.java | 6 ++---- ...PolicyAssignmentReportOspolicyassignmentreportname.java | 6 ++---- .../SyncGetOSPolicyAssignmentReportString.java | 6 ++---- .../SyncGetVulnerabilityReportVulnerabilityreportname.java | 6 ++---- .../AsyncListInstanceOSPoliciesCompliances.java | 6 ++---- .../AsyncListInstanceOSPoliciesCompliancesPaged.java | 6 ++---- .../SyncListInstanceOSPoliciesCompliances.java | 6 ++---- .../SyncListInstanceOSPoliciesCompliancesLocationname.java | 6 ++---- .../SyncListInstanceOSPoliciesCompliancesString.java | 6 ++---- .../AsyncListOSPolicyAssignmentReportsPaged.java | 6 ++---- ...icyAssignmentReportsInstanceospolicyassignmentname.java | 6 ++---- .../SyncListOSPolicyAssignmentReportsString.java | 6 ++---- .../AsyncListOSPolicyAssignmentRevisions.java | 3 +-- .../AsyncListOSPolicyAssignmentRevisionsPaged.java | 6 ++---- .../SyncListOSPolicyAssignmentRevisions.java | 3 +-- ...tOSPolicyAssignmentRevisionsOspolicyassignmentname.java | 6 ++---- .../SyncListOSPolicyAssignmentRevisionsString.java | 6 ++---- .../SyncListOSPolicyAssignmentsLocationname.java | 6 ++---- .../AsyncListVulnerabilityReportsPaged.java | 3 +-- .../SyncListVulnerabilityReportsInstancename.java | 6 ++---- .../SyncListVulnerabilityReportsString.java | 3 +-- ...pdateOSPolicyAssignmentOspolicyassignmentFieldmask.java | 6 ++---- ...eateGuestPolicyProjectnameGuestpoliciesguestpolicy.java | 6 ++---- ...yncCreateGuestPolicyStringGuestpoliciesguestpolicy.java | 6 ++---- .../deleteguestpolicy/SyncDeleteGuestPolicy.java | 1 + .../SyncDeleteGuestPolicyGuestpolicyname.java | 1 + .../deleteguestpolicy/SyncDeleteGuestPolicyString.java | 1 + .../deletepatchdeployment/SyncDeletePatchDeployment.java | 1 + .../SyncPausePatchDeploymentPatchdeploymentname.java | 6 ++---- .../SyncResumePatchDeploymentPatchdeploymentname.java | 6 ++---- ...UpdateGuestPolicyGuestpoliciesguestpolicyFieldmask.java | 6 ++---- ...DeploymentPatchdeploymentspatchdeploymentFieldmask.java | 6 ++---- 67 files changed, 115 insertions(+), 198 deletions(-) diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java index 779813c4..d999c42f 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigZonalServiceClient.java @@ -18,6 +18,7 @@ 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.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; @@ -197,6 +198,7 @@ public final com.google.longrunning.OperationsClient getOperationsClient() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ + @BetaApi public final OperationsClient getHttpJsonOperationsClient() { return httpJsonOperationsClient; } diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java index 195a5deb..1ece1f25 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1alpha/OsConfigZonalServiceClient.java @@ -199,6 +199,7 @@ public final com.google.longrunning.OperationsClient getOperationsClient() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ + @BetaApi public final OperationsClient getHttpJsonOperationsClient() { return httpJsonOperationsClient; } diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString.java index 193fc069..f541f503 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentProjectnamePatchdeploymentspatchdeploymentString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_projectnamepatchdeploymentspatchdeploymentstring_sync] +// [START osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_projectnamepatchdeploymentspatchdeploymentstring_sync] import com.google.cloud.osconfig.v1.OsConfigServiceClient; import com.google.cloud.osconfig.v1.PatchDeployments; import com.google.cloud.osconfig.v1.ProjectName; @@ -42,5 +41,4 @@ public static void syncCreatePatchDeploymentProjectnamePatchdeploymentspatchdepl } } } -// [END -// osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_projectnamepatchdeploymentspatchdeploymentstring_sync] +// [END osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_projectnamepatchdeploymentspatchdeploymentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString.java index 815c08b9..00902648 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/createpatchdeployment/SyncCreatePatchDeploymentStringPatchdeploymentspatchdeploymentString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_stringpatchdeploymentspatchdeploymentstring_sync] +// [START osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_stringpatchdeploymentspatchdeploymentstring_sync] import com.google.cloud.osconfig.v1.OsConfigServiceClient; import com.google.cloud.osconfig.v1.PatchDeployments; import com.google.cloud.osconfig.v1.ProjectName; @@ -42,5 +41,4 @@ public static void syncCreatePatchDeploymentStringPatchdeploymentspatchdeploymen } } } -// [END -// osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_stringpatchdeploymentspatchdeploymentstring_sync] +// [END osconfig_v1_generated_osconfigserviceclient_createpatchdeployment_stringpatchdeploymentspatchdeploymentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java index 43f40e4b..48adb1fb 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java @@ -20,6 +20,7 @@ import com.google.cloud.osconfig.v1.OsConfigServiceClient; import com.google.cloud.osconfig.v1.PatchDeploymentName; import com.google.cloud.osconfig.v1.PatchDeployments; +import com.google.protobuf.Empty; public class SyncDeletePatchDeployment { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentPatchdeploymentname.java index 689acfb3..6d7abe79 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentPatchdeploymentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentPatchdeploymentname.java @@ -16,10 +16,10 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_patchdeploymentname_sync] +// [START osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_patchdeploymentname_sync] import com.google.cloud.osconfig.v1.OsConfigServiceClient; import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.protobuf.Empty; public class SyncDeletePatchDeploymentPatchdeploymentname { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentString.java index f0598470..0d111a59 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeploymentString.java @@ -19,6 +19,7 @@ // [START osconfig_v1_generated_osconfigserviceclient_deletepatchdeployment_string_sync] import com.google.cloud.osconfig.v1.OsConfigServiceClient; import com.google.cloud.osconfig.v1.PatchDeploymentName; +import com.google.protobuf.Empty; public class SyncDeletePatchDeploymentString { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java index 20aae25d..d76083ab 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] +// [START osconfig_v1_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] import com.google.cloud.osconfig.v1.OsConfigServiceClient; import com.google.cloud.osconfig.v1.PatchDeploymentName; import com.google.cloud.osconfig.v1.PatchDeployments; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java index d00293fd..e247e106 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] +// [START osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] import com.google.cloud.osconfig.v1.OsConfigServiceClient; import com.google.cloud.osconfig.v1.PatchDeployments; import com.google.protobuf.FieldMask; @@ -41,5 +40,4 @@ public static void syncUpdatePatchDeploymentPatchdeploymentspatchdeploymentField } } } -// [END -// osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] +// [END osconfig_v1_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java index b0f03617..eadbb051 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] import com.google.cloud.osconfig.v1.LocationName; import com.google.cloud.osconfig.v1.OSPolicyAssignment; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; @@ -44,5 +43,4 @@ public static void syncCreateOSPolicyAssignmentLocationnameOspolicyassignmentStr } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java index a6b01a70..fd223f0f 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] import com.google.cloud.osconfig.v1.LocationName; import com.google.cloud.osconfig.v1.OSPolicyAssignment; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; @@ -43,5 +42,4 @@ public static void syncCreateOSPolicyAssignmentStringOspolicyassignmentString() } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java index 0fa8ef79..ede37b68 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java @@ -20,6 +20,7 @@ import com.google.cloud.osconfig.v1.DeleteOSPolicyAssignmentRequest; import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.protobuf.Empty; public class SyncDeleteOSPolicyAssignment { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java index 1e9be5cd..f3c99ff9 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java @@ -16,10 +16,10 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.protobuf.Empty; public class SyncDeleteOSPolicyAssignmentOspolicyassignmentname { @@ -38,5 +38,4 @@ public static void syncDeleteOSPolicyAssignmentOspolicyassignmentname() throws E } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java index 0304f623..3ed8c00f 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java @@ -19,6 +19,7 @@ // [START osconfig_v1_generated_osconfigzonalserviceclient_deleteospolicyassignment_string_sync] import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; +import com.google.protobuf.Empty; public class SyncDeleteOSPolicyAssignmentString { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java index 90531eaf..a488cbcd 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] import com.google.cloud.osconfig.v1.OSPolicyAssignment; import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; @@ -39,5 +38,4 @@ public static void syncGetOSPolicyAssignmentOspolicyassignmentname() throws Exce } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java index 0b0b82d8..101dd291 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; import com.google.cloud.osconfig.v1.OSPolicyAssignmentReportName; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; @@ -41,5 +40,4 @@ public static void syncGetOSPolicyAssignmentReportOspolicyassignmentreportname() } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java index 7638d792..76700335 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; import com.google.cloud.osconfig.v1.VulnerabilityReport; import com.google.cloud.osconfig.v1.VulnerabilityReportName; @@ -39,5 +38,4 @@ public static void syncGetVulnerabilityReportVulnerabilityreportname() throws Ex } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java index 35b0b685..34908a66 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] import com.google.cloud.osconfig.v1.InstanceOSPolicyAssignmentName; import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsRequest; import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsResponse; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java index dda8e0a7..8040c44d 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] import com.google.cloud.osconfig.v1.InstanceOSPolicyAssignmentName; import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; @@ -44,5 +43,4 @@ public static void syncListOSPolicyAssignmentReportsInstanceospolicyassignmentna } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java index fad41b55..6e635390 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] import com.google.cloud.osconfig.v1.InstanceOSPolicyAssignmentName; import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java index b60bac66..2dd559d5 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsRequest; import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsResponse; import com.google.cloud.osconfig.v1.OSPolicyAssignment; @@ -60,5 +59,4 @@ public static void asyncListOSPolicyAssignmentRevisionsPaged() throws Exception } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java index 4fb3d1de..b52262e5 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] import com.google.cloud.osconfig.v1.OSPolicyAssignment; import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; @@ -42,5 +41,4 @@ public static void syncListOSPolicyAssignmentRevisionsOspolicyassignmentname() t } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java index a30c74b1..6ca87918 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] import com.google.cloud.osconfig.v1.OSPolicyAssignment; import com.google.cloud.osconfig.v1.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; @@ -42,5 +41,4 @@ public static void syncListOSPolicyAssignmentRevisionsString() throws Exception } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java index 9e47c418..9ab6801c 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] import com.google.cloud.osconfig.v1.LocationName; import com.google.cloud.osconfig.v1.OSPolicyAssignment; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java index d33ed443..9c332f7c 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] import com.google.cloud.osconfig.v1.InstanceName; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; import com.google.cloud.osconfig.v1.VulnerabilityReport; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java index f577b162..2d00bffc 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1.samples; -// [START -// osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] +// [START osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] import com.google.cloud.osconfig.v1.OSPolicyAssignment; import com.google.cloud.osconfig.v1.OsConfigZonalServiceClient; import com.google.protobuf.FieldMask; @@ -42,5 +41,4 @@ public static void syncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask() thr } } } -// [END -// osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] +// [END osconfig_v1_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java index 1480ca20..02a2ef2f 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentLocationnameOspolicyassignmentString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] import com.google.cloud.osconfig.v1alpha.LocationName; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -44,5 +43,4 @@ public static void syncCreateOSPolicyAssignmentLocationnameOspolicyassignmentStr } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_locationnameospolicyassignmentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java index 0aa6db02..fdd34a5d 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/createospolicyassignment/SyncCreateOSPolicyAssignmentStringOspolicyassignmentString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] import com.google.cloud.osconfig.v1alpha.LocationName; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -43,5 +42,4 @@ public static void syncCreateOSPolicyAssignmentStringOspolicyassignmentString() } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_createospolicyassignment_stringospolicyassignmentstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java index 195092c9..73f4c6e9 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignment.java @@ -20,6 +20,7 @@ import com.google.cloud.osconfig.v1alpha.DeleteOSPolicyAssignmentRequest; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.protobuf.Empty; public class SyncDeleteOSPolicyAssignment { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java index ba0612c9..830ed99a 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentOspolicyassignmentname.java @@ -16,10 +16,10 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.protobuf.Empty; public class SyncDeleteOSPolicyAssignmentOspolicyassignmentname { @@ -38,5 +38,4 @@ public static void syncDeleteOSPolicyAssignmentOspolicyassignmentname() throws E } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java index ac532038..9eb44868 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/deleteospolicyassignment/SyncDeleteOSPolicyAssignmentString.java @@ -16,10 +16,10 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_string_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_deleteospolicyassignment_string_sync] import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; +import com.google.protobuf.Empty; public class SyncDeleteOSPolicyAssignmentString { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/AsyncGetInstanceOSPoliciesCompliance.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/AsyncGetInstanceOSPoliciesCompliance.java index 720a6181..b7fc7c75 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/AsyncGetInstanceOSPoliciesCompliance.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/AsyncGetInstanceOSPoliciesCompliance.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_async] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_async] import com.google.api.core.ApiFuture; import com.google.cloud.osconfig.v1alpha.GetInstanceOSPoliciesComplianceRequest; import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesCompliance.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesCompliance.java index 2ff82be0..a04af61b 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesCompliance.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesCompliance.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_sync] import com.google.cloud.osconfig.v1alpha.GetInstanceOSPoliciesComplianceRequest; import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesComplianceName; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename.java index 5e6fc842..bff1cc35 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceInstanceospoliciescompliancename.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_instanceospoliciescompliancename_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_instanceospoliciescompliancename_sync] import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesComplianceName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -41,5 +40,4 @@ public static void syncGetInstanceOSPoliciesComplianceInstanceospoliciescomplian } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_instanceospoliciescompliancename_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_instanceospoliciescompliancename_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceString.java index 54a435e9..08148dde 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getinstanceospoliciescompliance/SyncGetInstanceOSPoliciesComplianceString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_string_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_string_sync] import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesComplianceName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -40,5 +39,4 @@ public static void syncGetInstanceOSPoliciesComplianceString() throws Exception } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_string_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getinstanceospoliciescompliance_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java index bdec1ece..0aa6dc4f 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignment/SyncGetOSPolicyAssignmentOspolicyassignmentname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -39,5 +38,4 @@ public static void syncGetOSPolicyAssignmentOspolicyassignmentname() throws Exce } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignment_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java index 4a99188d..3ca283a3 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportOspolicyassignmentreportname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReportName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -41,5 +40,4 @@ public static void syncGetOSPolicyAssignmentReportOspolicyassignmentreportname() } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_ospolicyassignmentreportname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java index e135a00d..0fea7390 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getospolicyassignmentreport/SyncGetOSPolicyAssignmentReportString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_string_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_string_sync] import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReportName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -41,5 +40,4 @@ public static void syncGetOSPolicyAssignmentReportString() throws Exception { } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_string_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getospolicyassignmentreport_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java index bdc61ef6..2cd0ce71 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/getvulnerabilityreport/SyncGetVulnerabilityReportVulnerabilityreportname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; import com.google.cloud.osconfig.v1alpha.VulnerabilityReportName; @@ -39,5 +38,4 @@ public static void syncGetVulnerabilityReportVulnerabilityreportname() throws Ex } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_getvulnerabilityreport_vulnerabilityreportname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliances.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliances.java index 97828069..f5d1822b 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliances.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliances.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_async] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_async] import com.google.api.core.ApiFuture; import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesRequest; @@ -53,5 +52,4 @@ public static void asyncListInstanceOSPoliciesCompliances() throws Exception { } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_async] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliancesPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliancesPaged.java index b609b11d..c13ba87f 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliancesPaged.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/AsyncListInstanceOSPoliciesCompliancesPaged.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_paged_async] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_paged_async] import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesRequest; import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesResponse; @@ -60,5 +59,4 @@ public static void asyncListInstanceOSPoliciesCompliancesPaged() throws Exceptio } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_paged_async] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliances.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliances.java index 04d0f199..181dd853 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliances.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliances.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_sync] import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; import com.google.cloud.osconfig.v1alpha.ListInstanceOSPoliciesCompliancesRequest; import com.google.cloud.osconfig.v1alpha.LocationName; @@ -48,5 +47,4 @@ public static void syncListInstanceOSPoliciesCompliances() throws Exception { } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesLocationname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesLocationname.java index a5df343d..3740662e 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesLocationname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesLocationname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_locationname_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_locationname_sync] import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; import com.google.cloud.osconfig.v1alpha.LocationName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -41,5 +40,4 @@ public static void syncListInstanceOSPoliciesCompliancesLocationname() throws Ex } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_locationname_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesString.java index f96eda9b..9eda62d8 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listinstanceospoliciescompliances/SyncListInstanceOSPoliciesCompliancesString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_string_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_string_sync] import com.google.cloud.osconfig.v1alpha.InstanceOSPoliciesCompliance; import com.google.cloud.osconfig.v1alpha.LocationName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -41,5 +40,4 @@ public static void syncListInstanceOSPoliciesCompliancesString() throws Exceptio } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_string_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listinstanceospoliciescompliances_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java index dfd34db6..09a818b6 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/AsyncListOSPolicyAssignmentReportsPaged.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] import com.google.cloud.osconfig.v1alpha.InstanceOSPolicyAssignmentName; import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentReportsRequest; import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentReportsResponse; @@ -62,5 +61,4 @@ public static void asyncListOSPolicyAssignmentReportsPaged() throws Exception { } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java index 3922f6b5..eee8135a 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsInstanceospolicyassignmentname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] import com.google.cloud.osconfig.v1alpha.InstanceOSPolicyAssignmentName; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -44,5 +43,4 @@ public static void syncListOSPolicyAssignmentReportsInstanceospolicyassignmentna } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_instanceospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java index 05278b79..5107710b 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentreports/SyncListOSPolicyAssignmentReportsString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] import com.google.cloud.osconfig.v1alpha.InstanceOSPolicyAssignmentName; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentReport; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -43,5 +42,4 @@ public static void syncListOSPolicyAssignmentReportsString() throws Exception { } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentreports_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java index 95579738..1a308cc9 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisions.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_async] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_async] import com.google.api.core.ApiFuture; import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsRequest; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java index f6ebaa72..1887db86 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/AsyncListOSPolicyAssignmentRevisionsPaged.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsRequest; import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsResponse; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; @@ -60,5 +59,4 @@ public static void asyncListOSPolicyAssignmentRevisionsPaged() throws Exception } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java index cca72e6d..e3866107 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisions.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_sync] import com.google.cloud.osconfig.v1alpha.ListOSPolicyAssignmentRevisionsRequest; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java index 87fa46ef..d6b7fca9 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsOspolicyassignmentname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -42,5 +41,4 @@ public static void syncListOSPolicyAssignmentRevisionsOspolicyassignmentname() t } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_ospolicyassignmentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java index f7cb4383..752a45cb 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignmentrevisions/SyncListOSPolicyAssignmentRevisionsString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignmentName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -42,5 +41,4 @@ public static void syncListOSPolicyAssignmentRevisionsString() throws Exception } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignmentrevisions_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java index 11618fd4..8b57d55c 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listospolicyassignments/SyncListOSPolicyAssignmentsLocationname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] import com.google.cloud.osconfig.v1alpha.LocationName; import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; @@ -41,5 +40,4 @@ public static void syncListOSPolicyAssignmentsLocationname() throws Exception { } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listospolicyassignments_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java index 0d53509d..776310bb 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/AsyncListVulnerabilityReportsPaged.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_paged_async] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_paged_async] import com.google.cloud.osconfig.v1alpha.InstanceName; import com.google.cloud.osconfig.v1alpha.ListVulnerabilityReportsRequest; import com.google.cloud.osconfig.v1alpha.ListVulnerabilityReportsResponse; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java index 80562c70..2342179f 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsInstancename.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] import com.google.cloud.osconfig.v1alpha.InstanceName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; @@ -41,5 +40,4 @@ public static void syncListVulnerabilityReportsInstancename() throws Exception { } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_instancename_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java index b5de96ba..bc924da0 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/listvulnerabilityreports/SyncListVulnerabilityReportsString.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_string_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_listvulnerabilityreports_string_sync] import com.google.cloud.osconfig.v1alpha.InstanceName; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; import com.google.cloud.osconfig.v1alpha.VulnerabilityReport; diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java index d92979e3..f0e2b61e 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1alpha/osconfigzonalserviceclient/updateospolicyassignment/SyncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1alpha.samples; -// [START -// osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] +// [START osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] import com.google.cloud.osconfig.v1alpha.OSPolicyAssignment; import com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient; import com.google.protobuf.FieldMask; @@ -42,5 +41,4 @@ public static void syncUpdateOSPolicyAssignmentOspolicyassignmentFieldmask() thr } } } -// [END -// osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] +// [END osconfig_v1alpha_generated_osconfigzonalserviceclient_updateospolicyassignment_ospolicyassignmentfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy.java index 62cfb5ac..2602868b 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1beta.samples; -// [START -// osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_projectnameguestpoliciesguestpolicy_sync] +// [START osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_projectnameguestpoliciesguestpolicy_sync] import com.google.cloud.osconfig.v1beta.GuestPolicies; import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; import com.google.cloud.osconfig.v1beta.ProjectName; @@ -39,5 +38,4 @@ public static void syncCreateGuestPolicyProjectnameGuestpoliciesguestpolicy() th } } } -// [END -// osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_projectnameguestpoliciesguestpolicy_sync] +// [END osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_projectnameguestpoliciesguestpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyStringGuestpoliciesguestpolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyStringGuestpoliciesguestpolicy.java index 9658580c..f9cce410 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyStringGuestpoliciesguestpolicy.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/createguestpolicy/SyncCreateGuestPolicyStringGuestpoliciesguestpolicy.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1beta.samples; -// [START -// osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_stringguestpoliciesguestpolicy_sync] +// [START osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_stringguestpoliciesguestpolicy_sync] import com.google.cloud.osconfig.v1beta.GuestPolicies; import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; import com.google.cloud.osconfig.v1beta.ProjectName; @@ -39,5 +38,4 @@ public static void syncCreateGuestPolicyStringGuestpoliciesguestpolicy() throws } } } -// [END -// osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_stringguestpoliciesguestpolicy_sync] +// [END osconfig_v1beta_generated_osconfigserviceclient_createguestpolicy_stringguestpoliciesguestpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicy.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicy.java index 345c4ccc..0573c4ee 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicy.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicy.java @@ -20,6 +20,7 @@ import com.google.cloud.osconfig.v1beta.GuestPolicies; import com.google.cloud.osconfig.v1beta.GuestPolicyName; import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.protobuf.Empty; public class SyncDeleteGuestPolicy { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyGuestpolicyname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyGuestpolicyname.java index 42a094d5..af7def0a 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyGuestpolicyname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyGuestpolicyname.java @@ -19,6 +19,7 @@ // [START osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_guestpolicyname_sync] import com.google.cloud.osconfig.v1beta.GuestPolicyName; import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.protobuf.Empty; public class SyncDeleteGuestPolicyGuestpolicyname { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyString.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyString.java index f86dd5a4..d46e5b90 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyString.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deleteguestpolicy/SyncDeleteGuestPolicyString.java @@ -19,6 +19,7 @@ // [START osconfig_v1beta_generated_osconfigserviceclient_deleteguestpolicy_string_sync] import com.google.cloud.osconfig.v1beta.GuestPolicyName; import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; +import com.google.protobuf.Empty; public class SyncDeleteGuestPolicyString { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java index f0182bad..e4b3dd1b 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/deletepatchdeployment/SyncDeletePatchDeployment.java @@ -19,6 +19,7 @@ // [START osconfig_v1beta_generated_osconfigserviceclient_deletepatchdeployment_sync] import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; import com.google.cloud.osconfig.v1beta.PatchDeployments; +import com.google.protobuf.Empty; public class SyncDeletePatchDeployment { diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java index bf757165..b51f9992 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/pausepatchdeployment/SyncPausePatchDeploymentPatchdeploymentname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1beta.samples; -// [START -// osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_patchdeploymentname_sync] +// [START osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_patchdeploymentname_sync] import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; import com.google.cloud.osconfig.v1beta.PatchDeploymentName; import com.google.cloud.osconfig.v1beta.PatchDeployments; @@ -37,5 +36,4 @@ public static void syncPausePatchDeploymentPatchdeploymentname() throws Exceptio } } } -// [END -// osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_patchdeploymentname_sync] +// [END osconfig_v1beta_generated_osconfigserviceclient_pausepatchdeployment_patchdeploymentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java index ffe95546..6d5d2487 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/resumepatchdeployment/SyncResumePatchDeploymentPatchdeploymentname.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1beta.samples; -// [START -// osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] +// [START osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; import com.google.cloud.osconfig.v1beta.PatchDeploymentName; import com.google.cloud.osconfig.v1beta.PatchDeployments; @@ -37,5 +36,4 @@ public static void syncResumePatchDeploymentPatchdeploymentname() throws Excepti } } } -// [END -// osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] +// [END osconfig_v1beta_generated_osconfigserviceclient_resumepatchdeployment_patchdeploymentname_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask.java index 3fb6a960..43d1946c 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updateguestpolicy/SyncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1beta.samples; -// [START -// osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_guestpoliciesguestpolicyfieldmask_sync] +// [START osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_guestpoliciesguestpolicyfieldmask_sync] import com.google.cloud.osconfig.v1beta.GuestPolicies; import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; import com.google.protobuf.FieldMask; @@ -39,5 +38,4 @@ public static void syncUpdateGuestPolicyGuestpoliciesguestpolicyFieldmask() thro } } } -// [END -// osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_guestpoliciesguestpolicyfieldmask_sync] +// [END osconfig_v1beta_generated_osconfigserviceclient_updateguestpolicy_guestpoliciesguestpolicyfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java index 1645e5c8..083d297d 100644 --- a/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java +++ b/samples/snippets/generated/com/google/cloud/osconfig/v1beta/osconfigserviceclient/updatepatchdeployment/SyncUpdatePatchDeploymentPatchdeploymentspatchdeploymentFieldmask.java @@ -16,8 +16,7 @@ package com.google.cloud.osconfig.v1beta.samples; -// [START -// osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] +// [START osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] import com.google.cloud.osconfig.v1beta.OsConfigServiceClient; import com.google.cloud.osconfig.v1beta.PatchDeployments; import com.google.protobuf.FieldMask; @@ -41,5 +40,4 @@ public static void syncUpdatePatchDeploymentPatchdeploymentspatchdeploymentField } } } -// [END -// osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] +// [END osconfig_v1beta_generated_osconfigserviceclient_updatepatchdeployment_patchdeploymentspatchdeploymentfieldmask_sync] From 057538f9172a7f8713ed0fb51d6ead5e1c0cfd64 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:22:30 +0000 Subject: [PATCH 12/14] chore: Disable CLIRR checks on releas (#1474) (#494) 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 028dcf87e512496ad1fdf6765f9483d6042560b4 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 1 Jul 2022 10:32:17 -0400 Subject: [PATCH 13/14] ci: removing clirr from required checks (#492) 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 0066c95411d47c486fc6cfcd4ae7ea79114a001b 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:34:11 +0000 Subject: [PATCH 14/14] chore(main): release 2.5.0 (#484) :robot: I have created a release *beep* *boop* --- ## [2.5.0](https://github.com/googleapis/java-os-config/compare/v2.4.3...v2.5.0) (2022-07-01) ### Features * add build scripts for native image testing in Java 17 ([#1440](https://github.com/googleapis/java-os-config/issues/1440)) ([#477](https://github.com/googleapis/java-os-config/issues/477)) ([0891ed6](https://github.com/googleapis/java-os-config/commit/0891ed6362b9592b7fcca6bfd9299e24653a9f3d)) * Enable REST transport for most of Java and Go clients ([#489](https://github.com/googleapis/java-os-config/issues/489)) ([2be3336](https://github.com/googleapis/java-os-config/commit/2be3336b765ddd818093d536fe5755a00ca08b30)) ### Bug Fixes * update gapic-generator-java with mock service generation fixes ([#491](https://github.com/googleapis/java-os-config/issues/491)) ([8145795](https://github.com/googleapis/java-os-config/commit/8145795ab21617583384b1a2c159cadac337ad21)) ### Dependencies * update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#488](https://github.com/googleapis/java-os-config/issues/488)) ([876c3b2](https://github.com/googleapis/java-os-config/commit/876c3b20dbb4d279d658dce2e27ce0459515175c)) --- 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 | 18 ++++++++++++++++++ google-cloud-os-config-bom/pom.xml | 16 ++++++++-------- google-cloud-os-config/pom.xml | 4 ++-- grpc-google-cloud-os-config-v1/pom.xml | 4 ++-- grpc-google-cloud-os-config-v1alpha/pom.xml | 4 ++-- grpc-google-cloud-os-config-v1beta/pom.xml | 4 ++-- pom.xml | 16 ++++++++-------- proto-google-cloud-os-config-v1/pom.xml | 4 ++-- proto-google-cloud-os-config-v1alpha/pom.xml | 4 ++-- proto-google-cloud-os-config-v1beta/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 14 +++++++------- 12 files changed, 56 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84cd7d96..60996345 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [2.5.0](https://github.com/googleapis/java-os-config/compare/v2.4.3...v2.5.0) (2022-07-01) + + +### Features + +* add build scripts for native image testing in Java 17 ([#1440](https://github.com/googleapis/java-os-config/issues/1440)) ([#477](https://github.com/googleapis/java-os-config/issues/477)) ([0891ed6](https://github.com/googleapis/java-os-config/commit/0891ed6362b9592b7fcca6bfd9299e24653a9f3d)) +* Enable REST transport for most of Java and Go clients ([#489](https://github.com/googleapis/java-os-config/issues/489)) ([2be3336](https://github.com/googleapis/java-os-config/commit/2be3336b765ddd818093d536fe5755a00ca08b30)) + + +### Bug Fixes + +* update gapic-generator-java with mock service generation fixes ([#491](https://github.com/googleapis/java-os-config/issues/491)) ([8145795](https://github.com/googleapis/java-os-config/commit/8145795ab21617583384b1a2c159cadac337ad21)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#488](https://github.com/googleapis/java-os-config/issues/488)) ([876c3b2](https://github.com/googleapis/java-os-config/commit/876c3b20dbb4d279d658dce2e27ce0459515175c)) + ### [2.4.3](https://github.com/googleapis/java-os-config/compare/v2.4.2...v2.4.3) (2022-05-19) diff --git a/google-cloud-os-config-bom/pom.xml b/google-cloud-os-config-bom/pom.xml index f12491ce..de591282 100644 --- a/google-cloud-os-config-bom/pom.xml +++ b/google-cloud-os-config-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-os-config-bom - 2.4.4-SNAPSHOT + 2.5.0 pom com.google.cloud @@ -52,37 +52,37 @@ com.google.cloud google-cloud-os-config - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc grpc-google-cloud-os-config-v1 - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc grpc-google-cloud-os-config-v1beta - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc grpc-google-cloud-os-config-v1alpha - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc proto-google-cloud-os-config-v1 - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc proto-google-cloud-os-config-v1alpha - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc proto-google-cloud-os-config-v1beta - 2.4.4-SNAPSHOT + 2.5.0 diff --git a/google-cloud-os-config/pom.xml b/google-cloud-os-config/pom.xml index 743227ab..1568fe76 100644 --- a/google-cloud-os-config/pom.xml +++ b/google-cloud-os-config/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-os-config - 2.4.4-SNAPSHOT + 2.5.0 jar Google OS Config API https://github.com/googleapis/java-os-config @@ -11,7 +11,7 @@ com.google.cloud google-cloud-os-config-parent - 2.4.4-SNAPSHOT + 2.5.0 google-cloud-os-config diff --git a/grpc-google-cloud-os-config-v1/pom.xml b/grpc-google-cloud-os-config-v1/pom.xml index 5e04b4a8..6b5445c6 100644 --- a/grpc-google-cloud-os-config-v1/pom.xml +++ b/grpc-google-cloud-os-config-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-os-config-v1 - 2.4.4-SNAPSHOT + 2.5.0 grpc-google-cloud-os-config-v1 GRPC library for grpc-google-cloud-os-config-v1 com.google.cloud google-cloud-os-config-parent - 2.4.4-SNAPSHOT + 2.5.0 diff --git a/grpc-google-cloud-os-config-v1alpha/pom.xml b/grpc-google-cloud-os-config-v1alpha/pom.xml index 38eaf3c4..11cf38a9 100644 --- a/grpc-google-cloud-os-config-v1alpha/pom.xml +++ b/grpc-google-cloud-os-config-v1alpha/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-os-config-v1alpha - 2.4.4-SNAPSHOT + 2.5.0 grpc-google-cloud-os-config-v1alpha GRPC library for google-cloud-os-config com.google.cloud google-cloud-os-config-parent - 2.4.4-SNAPSHOT + 2.5.0 diff --git a/grpc-google-cloud-os-config-v1beta/pom.xml b/grpc-google-cloud-os-config-v1beta/pom.xml index 00d71ee9..336fffe6 100644 --- a/grpc-google-cloud-os-config-v1beta/pom.xml +++ b/grpc-google-cloud-os-config-v1beta/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-os-config-v1beta - 2.4.4-SNAPSHOT + 2.5.0 grpc-google-cloud-os-config-v1beta GRPC library for google-cloud-os-config com.google.cloud google-cloud-os-config-parent - 2.4.4-SNAPSHOT + 2.5.0 diff --git a/pom.xml b/pom.xml index 58b80a41..d53747c4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-os-config-parent pom - 2.4.4-SNAPSHOT + 2.5.0 Google OS Config API Parent https://github.com/googleapis/java-os-config @@ -61,37 +61,37 @@ com.google.cloud google-cloud-os-config - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc proto-google-cloud-os-config-v1beta - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc proto-google-cloud-os-config-v1alpha - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc grpc-google-cloud-os-config-v1alpha - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc grpc-google-cloud-os-config-v1beta - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc proto-google-cloud-os-config-v1 - 2.4.4-SNAPSHOT + 2.5.0 com.google.api.grpc grpc-google-cloud-os-config-v1 - 2.4.4-SNAPSHOT + 2.5.0 diff --git a/proto-google-cloud-os-config-v1/pom.xml b/proto-google-cloud-os-config-v1/pom.xml index 487b1fd9..036676b2 100644 --- a/proto-google-cloud-os-config-v1/pom.xml +++ b/proto-google-cloud-os-config-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-os-config-v1 - 2.4.4-SNAPSHOT + 2.5.0 proto-google-cloud-os-config-v1 PROTO library for proto-google-cloud-os-config-v1 com.google.cloud google-cloud-os-config-parent - 2.4.4-SNAPSHOT + 2.5.0 diff --git a/proto-google-cloud-os-config-v1alpha/pom.xml b/proto-google-cloud-os-config-v1alpha/pom.xml index e29f99db..f6ea7fdc 100644 --- a/proto-google-cloud-os-config-v1alpha/pom.xml +++ b/proto-google-cloud-os-config-v1alpha/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-os-config-v1alpha - 2.4.4-SNAPSHOT + 2.5.0 proto-google-cloud-os-config-v1alpha Proto library for google-cloud-os-config com.google.cloud google-cloud-os-config-parent - 2.4.4-SNAPSHOT + 2.5.0 diff --git a/proto-google-cloud-os-config-v1beta/pom.xml b/proto-google-cloud-os-config-v1beta/pom.xml index 0ba89e08..f48e0d1a 100644 --- a/proto-google-cloud-os-config-v1beta/pom.xml +++ b/proto-google-cloud-os-config-v1beta/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-os-config-v1beta - 2.4.4-SNAPSHOT + 2.5.0 proto-google-cloud-os-config-v1beta Proto library for google-cloud-os-config com.google.cloud google-cloud-os-config-parent - 2.4.4-SNAPSHOT + 2.5.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index eef0bc7a..390f806e 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-os-config - 2.4.4-SNAPSHOT + 2.5.0 diff --git a/versions.txt b/versions.txt index 7a107d94..d35d6ee2 100644 --- a/versions.txt +++ b/versions.txt @@ -1,10 +1,10 @@ # Format: # module:released-version:current-version -google-cloud-os-config:2.4.3:2.4.4-SNAPSHOT -grpc-google-cloud-os-config-v1:2.4.3:2.4.4-SNAPSHOT -grpc-google-cloud-os-config-v1beta:2.4.3:2.4.4-SNAPSHOT -grpc-google-cloud-os-config-v1alpha:2.4.3:2.4.4-SNAPSHOT -proto-google-cloud-os-config-v1:2.4.3:2.4.4-SNAPSHOT -proto-google-cloud-os-config-v1alpha:2.4.3:2.4.4-SNAPSHOT -proto-google-cloud-os-config-v1beta:2.4.3:2.4.4-SNAPSHOT +google-cloud-os-config:2.5.0:2.5.0 +grpc-google-cloud-os-config-v1:2.5.0:2.5.0 +grpc-google-cloud-os-config-v1beta:2.5.0:2.5.0 +grpc-google-cloud-os-config-v1alpha:2.5.0:2.5.0 +proto-google-cloud-os-config-v1:2.5.0:2.5.0 +proto-google-cloud-os-config-v1alpha:2.5.0:2.5.0 +proto-google-cloud-os-config-v1beta:2.5.0:2.5.0