Skip to content
Permalink
Browse files
chore: pick up changes from googleapis - Secret Manager, TriggerWebho…
…ok (#432)

* chore: update gax-java dependency to 1.62

PiperOrigin-RevId: 361377784

Source-Author: Google APIs <noreply@google.com>
Source-Date: Sat Mar 6 21:09:41 2021 -0800
Source-Repo: googleapis/googleapis
Source-Sha: 0e915217fb5261c1e57bfaf0e16ee5c7feaaba89
Source-Link: googleapis/googleapis@0e91521

* chore: update java microgenerator to 1.0.2 Adds request initialization to sample code

Committer: @miraleung
PiperOrigin-RevId: 362856902

Source-Author: Google APIs <noreply@google.com>
Source-Date: Sun Mar 14 20:47:20 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 1305ca41d554eb0725237561e34129373bb8cbc1
Source-Link: googleapis/googleapis@1305ca4

* fix: Specify `build` as the body of a `CreateBuild` call. The Cloud Build API has always assumed this, but now we are actually specifying it.

feat: Add `ReceiveTriggerWebhook` for webhooks activating specific triggers.

docs: Update field docs on required-ness behavior and fix typos.

docs: Add `$PROJECT_NUMBER` as a substitution variable.

feat: Add `SecretManager`-related resources and messages for corresponding integration.

docs: Clarify lifetime/expiration behavior around `ListBuilds` page tokens.

feat: Add `COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY` for corresponding comment control behavior with triggered builds.

feat: Add `E2_HIGHCPU_8` and `E2_HIGHCPU_32` machine types.

Committer: @LOZORD
PiperOrigin-RevId: 363244566

Source-Author: Google APIs <noreply@google.com>
Source-Date: Tue Mar 16 12:32:12 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 913f5553d5ff5940cddd8245313136449b2a3571
Source-Link: googleapis/googleapis@913f555
  • Loading branch information
yoshi-automation committed Mar 24, 2021
1 parent fb5b40a commit be35172f0fea6a48a863278eb741722c03f7946e
Show file tree
Hide file tree
Showing 41 changed files with 7,777 additions and 606 deletions.
@@ -48,6 +48,8 @@
import com.google.cloudbuild.v1.ListBuildsResponse;
import com.google.cloudbuild.v1.ListWorkerPoolsRequest;
import com.google.cloudbuild.v1.ListWorkerPoolsResponse;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookRequest;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookResponse;
import com.google.cloudbuild.v1.RepoSource;
import com.google.cloudbuild.v1.RetryBuildRequest;
import com.google.cloudbuild.v1.RunBuildTriggerRequest;
@@ -490,6 +492,14 @@ public final UnaryCallable<ListBuildsRequest, ListBuildsPagedResponse> listBuild
*
* <pre>{@code
* try (CloudBuildClient cloudBuildClient = CloudBuildClient.create()) {
* ListBuildsRequest request =
* ListBuildsRequest.newBuilder()
* .setParent(BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]").toString())
* .setProjectId("projectId-894832108")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .build();
* while (true) {
* ListBuildsResponse response = cloudBuildClient.listBuildsCallable().call(request);
* for (Build element : response.getResponsesList()) {
@@ -1054,6 +1064,12 @@ public final ListBuildTriggersPagedResponse listBuildTriggers(ListBuildTriggersR
*
* <pre>{@code
* try (CloudBuildClient cloudBuildClient = CloudBuildClient.create()) {
* ListBuildTriggersRequest request =
* ListBuildTriggersRequest.newBuilder()
* .setProjectId("projectId-894832108")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListBuildTriggersResponse response =
* cloudBuildClient.listBuildTriggersCallable().call(request);
@@ -1259,7 +1275,7 @@ public final UnaryCallable<UpdateBuildTriggerRequest, BuildTrigger> updateBuildT
*
* @param projectId Required. ID of the project.
* @param triggerId Required. ID of the trigger.
* @param source Required. Source to build against this trigger.
* @param source Source to build against this trigger.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Build, BuildOperationMetadata> runBuildTriggerAsync(
@@ -1349,6 +1365,62 @@ public final UnaryCallable<RunBuildTriggerRequest, Operation> runBuildTriggerCal
return stub.runBuildTriggerCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted
* at a specific trigger.
*
* <p>Sample code:
*
* <pre>{@code
* try (CloudBuildClient cloudBuildClient = CloudBuildClient.create()) {
* ReceiveTriggerWebhookRequest request =
* ReceiveTriggerWebhookRequest.newBuilder()
* .setBody(HttpBody.newBuilder().build())
* .setProjectId("projectId-894832108")
* .setTrigger("trigger-1059891784")
* .setSecret("secret-906277200")
* .build();
* ReceiveTriggerWebhookResponse response = cloudBuildClient.receiveTriggerWebhook(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ReceiveTriggerWebhookResponse receiveTriggerWebhook(
ReceiveTriggerWebhookRequest request) {
return receiveTriggerWebhookCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted
* at a specific trigger.
*
* <p>Sample code:
*
* <pre>{@code
* try (CloudBuildClient cloudBuildClient = CloudBuildClient.create()) {
* ReceiveTriggerWebhookRequest request =
* ReceiveTriggerWebhookRequest.newBuilder()
* .setBody(HttpBody.newBuilder().build())
* .setProjectId("projectId-894832108")
* .setTrigger("trigger-1059891784")
* .setSecret("secret-906277200")
* .build();
* ApiFuture<ReceiveTriggerWebhookResponse> future =
* cloudBuildClient.receiveTriggerWebhookCallable().futureCall(request);
* // Do something.
* ReceiveTriggerWebhookResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<ReceiveTriggerWebhookRequest, ReceiveTriggerWebhookResponse>
receiveTriggerWebhookCallable() {
return stub.receiveTriggerWebhookCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a `WorkerPool` to run the builds, and returns the new worker pool.
@@ -50,6 +50,8 @@
import com.google.cloudbuild.v1.ListBuildsResponse;
import com.google.cloudbuild.v1.ListWorkerPoolsRequest;
import com.google.cloudbuild.v1.ListWorkerPoolsResponse;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookRequest;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookResponse;
import com.google.cloudbuild.v1.RetryBuildRequest;
import com.google.cloudbuild.v1.RunBuildTriggerRequest;
import com.google.cloudbuild.v1.UpdateBuildTriggerRequest;
@@ -171,6 +173,12 @@ public UnaryCallSettings<RunBuildTriggerRequest, Operation> runBuildTriggerSetti
return ((CloudBuildStubSettings) getStubSettings()).runBuildTriggerOperationSettings();
}

/** Returns the object with the settings used for calls to receiveTriggerWebhook. */
public UnaryCallSettings<ReceiveTriggerWebhookRequest, ReceiveTriggerWebhookResponse>
receiveTriggerWebhookSettings() {
return ((CloudBuildStubSettings) getStubSettings()).receiveTriggerWebhookSettings();
}

/** Returns the object with the settings used for calls to createWorkerPool. */
public UnaryCallSettings<CreateWorkerPoolRequest, WorkerPool> createWorkerPoolSettings() {
return ((CloudBuildStubSettings) getStubSettings()).createWorkerPoolSettings();
@@ -374,6 +382,12 @@ public UnaryCallSettings.Builder<RunBuildTriggerRequest, Operation> runBuildTrig
return getStubSettingsBuilder().runBuildTriggerOperationSettings();
}

/** Returns the builder for the settings used for calls to receiveTriggerWebhook. */
public UnaryCallSettings.Builder<ReceiveTriggerWebhookRequest, ReceiveTriggerWebhookResponse>
receiveTriggerWebhookSettings() {
return getStubSettingsBuilder().receiveTriggerWebhookSettings();
}

/** Returns the builder for the settings used for calls to createWorkerPool. */
public UnaryCallSettings.Builder<CreateWorkerPoolRequest, WorkerPool>
createWorkerPoolSettings() {
@@ -46,6 +46,9 @@
"ListWorkerPools": {
"methods": ["listWorkerPools", "listWorkerPoolsCallable"]
},
"ReceiveTriggerWebhook": {
"methods": ["receiveTriggerWebhook", "receiveTriggerWebhookCallable"]
},
"RetryBuild": {
"methods": ["retryBuildAsync", "retryBuildAsync", "retryBuildOperationCallable", "retryBuildCallable"]
},
@@ -40,6 +40,8 @@
import com.google.cloudbuild.v1.ListBuildsResponse;
import com.google.cloudbuild.v1.ListWorkerPoolsRequest;
import com.google.cloudbuild.v1.ListWorkerPoolsResponse;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookRequest;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookResponse;
import com.google.cloudbuild.v1.RetryBuildRequest;
import com.google.cloudbuild.v1.RunBuildTriggerRequest;
import com.google.cloudbuild.v1.UpdateBuildTriggerRequest;
@@ -132,6 +134,11 @@ public UnaryCallable<RunBuildTriggerRequest, Operation> runBuildTriggerCallable(
throw new UnsupportedOperationException("Not implemented: runBuildTriggerCallable()");
}

public UnaryCallable<ReceiveTriggerWebhookRequest, ReceiveTriggerWebhookResponse>
receiveTriggerWebhookCallable() {
throw new UnsupportedOperationException("Not implemented: receiveTriggerWebhookCallable()");
}

public UnaryCallable<CreateWorkerPoolRequest, WorkerPool> createWorkerPoolCallable() {
throw new UnsupportedOperationException("Not implemented: createWorkerPoolCallable()");
}
@@ -63,6 +63,8 @@
import com.google.cloudbuild.v1.ListBuildsResponse;
import com.google.cloudbuild.v1.ListWorkerPoolsRequest;
import com.google.cloudbuild.v1.ListWorkerPoolsResponse;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookRequest;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookResponse;
import com.google.cloudbuild.v1.RetryBuildRequest;
import com.google.cloudbuild.v1.RunBuildTriggerRequest;
import com.google.cloudbuild.v1.UpdateBuildTriggerRequest;
@@ -138,6 +140,8 @@ public class CloudBuildStubSettings extends StubSettings<CloudBuildStubSettings>
private final UnaryCallSettings<RunBuildTriggerRequest, Operation> runBuildTriggerSettings;
private final OperationCallSettings<RunBuildTriggerRequest, Build, BuildOperationMetadata>
runBuildTriggerOperationSettings;
private final UnaryCallSettings<ReceiveTriggerWebhookRequest, ReceiveTriggerWebhookResponse>
receiveTriggerWebhookSettings;
private final UnaryCallSettings<CreateWorkerPoolRequest, WorkerPool> createWorkerPoolSettings;
private final UnaryCallSettings<GetWorkerPoolRequest, WorkerPool> getWorkerPoolSettings;
private final UnaryCallSettings<DeleteWorkerPoolRequest, Empty> deleteWorkerPoolSettings;
@@ -335,6 +339,12 @@ public UnaryCallSettings<RunBuildTriggerRequest, Operation> runBuildTriggerSetti
return runBuildTriggerOperationSettings;
}

/** Returns the object with the settings used for calls to receiveTriggerWebhook. */
public UnaryCallSettings<ReceiveTriggerWebhookRequest, ReceiveTriggerWebhookResponse>
receiveTriggerWebhookSettings() {
return receiveTriggerWebhookSettings;
}

/** Returns the object with the settings used for calls to createWorkerPool. */
public UnaryCallSettings<CreateWorkerPoolRequest, WorkerPool> createWorkerPoolSettings() {
return createWorkerPoolSettings;
@@ -444,6 +454,7 @@ protected CloudBuildStubSettings(Builder settingsBuilder) throws IOException {
updateBuildTriggerSettings = settingsBuilder.updateBuildTriggerSettings().build();
runBuildTriggerSettings = settingsBuilder.runBuildTriggerSettings().build();
runBuildTriggerOperationSettings = settingsBuilder.runBuildTriggerOperationSettings().build();
receiveTriggerWebhookSettings = settingsBuilder.receiveTriggerWebhookSettings().build();
createWorkerPoolSettings = settingsBuilder.createWorkerPoolSettings().build();
getWorkerPoolSettings = settingsBuilder.getWorkerPoolSettings().build();
deleteWorkerPoolSettings = settingsBuilder.deleteWorkerPoolSettings().build();
@@ -481,6 +492,9 @@ public static class Builder extends StubSettings.Builder<CloudBuildStubSettings,
private final OperationCallSettings.Builder<
RunBuildTriggerRequest, Build, BuildOperationMetadata>
runBuildTriggerOperationSettings;
private final UnaryCallSettings.Builder<
ReceiveTriggerWebhookRequest, ReceiveTriggerWebhookResponse>
receiveTriggerWebhookSettings;
private final UnaryCallSettings.Builder<CreateWorkerPoolRequest, WorkerPool>
createWorkerPoolSettings;
private final UnaryCallSettings.Builder<GetWorkerPoolRequest, WorkerPool> getWorkerPoolSettings;
@@ -503,6 +517,7 @@ public static class Builder extends StubSettings.Builder<CloudBuildStubSettings,
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED)));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}

@@ -530,6 +545,8 @@ public static class Builder extends StubSettings.Builder<CloudBuildStubSettings,
.setTotalTimeout(Duration.ofMillis(600000L))
.build();
definitions.put("retry_policy_0_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}

@@ -554,6 +571,7 @@ protected Builder(ClientContext clientContext) {
updateBuildTriggerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
runBuildTriggerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
runBuildTriggerOperationSettings = OperationCallSettings.newBuilder();
receiveTriggerWebhookSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
createWorkerPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getWorkerPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
deleteWorkerPoolSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
@@ -573,6 +591,7 @@ protected Builder(ClientContext clientContext) {
deleteBuildTriggerSettings,
updateBuildTriggerSettings,
runBuildTriggerSettings,
receiveTriggerWebhookSettings,
createWorkerPoolSettings,
getWorkerPoolSettings,
deleteWorkerPoolSettings,
@@ -598,6 +617,7 @@ protected Builder(CloudBuildStubSettings settings) {
updateBuildTriggerSettings = settings.updateBuildTriggerSettings.toBuilder();
runBuildTriggerSettings = settings.runBuildTriggerSettings.toBuilder();
runBuildTriggerOperationSettings = settings.runBuildTriggerOperationSettings.toBuilder();
receiveTriggerWebhookSettings = settings.receiveTriggerWebhookSettings.toBuilder();
createWorkerPoolSettings = settings.createWorkerPoolSettings.toBuilder();
getWorkerPoolSettings = settings.getWorkerPoolSettings.toBuilder();
deleteWorkerPoolSettings = settings.deleteWorkerPoolSettings.toBuilder();
@@ -617,6 +637,7 @@ protected Builder(CloudBuildStubSettings settings) {
deleteBuildTriggerSettings,
updateBuildTriggerSettings,
runBuildTriggerSettings,
receiveTriggerWebhookSettings,
createWorkerPoolSettings,
getWorkerPoolSettings,
deleteWorkerPoolSettings,
@@ -691,6 +712,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));

builder
.receiveTriggerWebhookSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.createWorkerPoolSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
@@ -891,6 +917,12 @@ public UnaryCallSettings.Builder<RunBuildTriggerRequest, Operation> runBuildTrig
return runBuildTriggerOperationSettings;
}

/** Returns the builder for the settings used for calls to receiveTriggerWebhook. */
public UnaryCallSettings.Builder<ReceiveTriggerWebhookRequest, ReceiveTriggerWebhookResponse>
receiveTriggerWebhookSettings() {
return receiveTriggerWebhookSettings;
}

/** Returns the builder for the settings used for calls to createWorkerPool. */
public UnaryCallSettings.Builder<CreateWorkerPoolRequest, WorkerPool>
createWorkerPoolSettings() {

0 comments on commit be35172

Please sign in to comment.