Skip to content
Permalink
Browse files
feat: add dynamic_substitutions to BuildOptions, STACKDRIVER_ONLY/CLO…
…UD_LOGGING_ONLY to LoggingMode, name/service_account to Build (#246)

This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/b12affff-e85c-44ff-9cad-bd06f777bd37/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 331027363
Source-Link: googleapis/googleapis@bc18612
PiperOrigin-RevId: 330974505
Source-Link: googleapis/googleapis@3257ba5
PiperOrigin-RevId: 330504082
Source-Link: googleapis/googleapis@48ce887
  • Loading branch information
yoshi-automation committed Sep 22, 2020
1 parent f798aff commit 455c4101bc08461f1ab9944908e8ba642974dd15
Show file tree
Hide file tree
Showing 33 changed files with 3,564 additions and 478 deletions.
@@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>9.1.0</version>
<version>10.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -38,7 +38,7 @@ If you are using Maven without BOM, add this to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-build</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>

```
@@ -289,6 +289,7 @@ protected GrpcCloudBuildStub(
public Map<String, String> extract(ListBuildsRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("project_id", String.valueOf(request.getProjectId()));
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
})
@@ -306,21 +307,49 @@ public Map<String, String> extract(ListBuildsRequest request) {
public Map<String, String> extract(CreateBuildRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("project_id", String.valueOf(request.getProjectId()));
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
})
.build();
GrpcCallSettings<GetBuildRequest, Build> getBuildTransportSettings =
GrpcCallSettings.<GetBuildRequest, Build>newBuilder()
.setMethodDescriptor(getBuildMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<GetBuildRequest>() {
@Override
public Map<String, String> extract(GetBuildRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
}
})
.build();
GrpcCallSettings<CancelBuildRequest, Build> cancelBuildTransportSettings =
GrpcCallSettings.<CancelBuildRequest, Build>newBuilder()
.setMethodDescriptor(cancelBuildMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<CancelBuildRequest>() {
@Override
public Map<String, String> extract(CancelBuildRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
}
})
.build();
GrpcCallSettings<RetryBuildRequest, Operation> retryBuildTransportSettings =
GrpcCallSettings.<RetryBuildRequest, Operation>newBuilder()
.setMethodDescriptor(retryBuildMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<RetryBuildRequest>() {
@Override
public Map<String, String> extract(RetryBuildRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
}
})
.build();
GrpcCallSettings<CreateBuildTriggerRequest, BuildTrigger> createBuildTriggerTransportSettings =
GrpcCallSettings.<CreateBuildTriggerRequest, BuildTrigger>newBuilder()
@@ -27,7 +27,9 @@
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.api.gax.rpc.StatusCode;
import com.google.cloudbuild.v1.Build;
import com.google.cloudbuild.v1.BuildName;
import com.google.cloudbuild.v1.BuildTrigger;
import com.google.cloudbuild.v1.BuildTriggerName;
import com.google.cloudbuild.v1.CancelBuildRequest;
import com.google.cloudbuild.v1.CreateBuildRequest;
import com.google.cloudbuild.v1.CreateBuildTriggerRequest;
@@ -46,6 +48,7 @@
import com.google.cloudbuild.v1.RepoSource;
import com.google.cloudbuild.v1.RetryBuildRequest;
import com.google.cloudbuild.v1.RunBuildTriggerRequest;
import com.google.cloudbuild.v1.ServiceAccountName;
import com.google.cloudbuild.v1.UpdateBuildTriggerRequest;
import com.google.cloudbuild.v1.UpdateWorkerPoolRequest;
import com.google.cloudbuild.v1.WorkerPool;
@@ -200,20 +203,24 @@ public void deleteBuildTriggerExceptionTest() throws Exception {
@Test
@SuppressWarnings("all")
public void createBuildTest() throws Exception {
BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]");
String id = "id3355";
String projectId2 = "projectId2939242356";
String statusDetail = "statusDetail2089931070";
String logsBucket = "logsBucket1565363834";
String buildTriggerId = "buildTriggerId1105559411";
String logUrl = "logUrl342054388";
ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
Build expectedResponse =
Build.newBuilder()
.setName(name.toString())
.setId(id)
.setProjectId(projectId2)
.setStatusDetail(statusDetail)
.setLogsBucket(logsBucket)
.setBuildTriggerId(buildTriggerId)
.setLogUrl(logUrl)
.setServiceAccount(serviceAccount.toString())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -263,20 +270,24 @@ public void createBuildExceptionTest() throws Exception {
@Test
@SuppressWarnings("all")
public void getBuildTest() {
BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]");
String id2 = "id23227150";
String projectId2 = "projectId2939242356";
String statusDetail = "statusDetail2089931070";
String logsBucket = "logsBucket1565363834";
String buildTriggerId = "buildTriggerId1105559411";
String logUrl = "logUrl342054388";
ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
Build expectedResponse =
Build.newBuilder()
.setName(name.toString())
.setId(id2)
.setProjectId(projectId2)
.setStatusDetail(statusDetail)
.setLogsBucket(logsBucket)
.setBuildTriggerId(buildTriggerId)
.setLogUrl(logUrl)
.setServiceAccount(serviceAccount.toString())
.build();
mockCloudBuild.addResponse(expectedResponse);

@@ -318,20 +329,24 @@ public void getBuildExceptionTest() throws Exception {
@Test
@SuppressWarnings("all")
public void cancelBuildTest() {
BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]");
String id2 = "id23227150";
String projectId2 = "projectId2939242356";
String statusDetail = "statusDetail2089931070";
String logsBucket = "logsBucket1565363834";
String buildTriggerId = "buildTriggerId1105559411";
String logUrl = "logUrl342054388";
ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
Build expectedResponse =
Build.newBuilder()
.setName(name.toString())
.setId(id2)
.setProjectId(projectId2)
.setStatusDetail(statusDetail)
.setLogsBucket(logsBucket)
.setBuildTriggerId(buildTriggerId)
.setLogUrl(logUrl)
.setServiceAccount(serviceAccount.toString())
.build();
mockCloudBuild.addResponse(expectedResponse);

@@ -373,20 +388,24 @@ public void cancelBuildExceptionTest() throws Exception {
@Test
@SuppressWarnings("all")
public void retryBuildTest() throws Exception {
BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]");
String id2 = "id23227150";
String projectId2 = "projectId2939242356";
String statusDetail = "statusDetail2089931070";
String logsBucket = "logsBucket1565363834";
String buildTriggerId = "buildTriggerId1105559411";
String logUrl = "logUrl342054388";
ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
Build expectedResponse =
Build.newBuilder()
.setName(name.toString())
.setId(id2)
.setProjectId(projectId2)
.setStatusDetail(statusDetail)
.setLogsBucket(logsBucket)
.setBuildTriggerId(buildTriggerId)
.setLogUrl(logUrl)
.setServiceAccount(serviceAccount.toString())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -438,14 +457,14 @@ public void retryBuildExceptionTest() throws Exception {
public void createBuildTriggerTest() {
String id = "id3355";
String description = "description-1724546052";
String name = "name3373707";
BuildTriggerName name = BuildTriggerName.of("[PROJECT]", "[TRIGGER]");
String filename = "filename-734768633";
boolean disabled = true;
BuildTrigger expectedResponse =
BuildTrigger.newBuilder()
.setId(id)
.setDescription(description)
.setName(name)
.setName(name.toString())
.setFilename(filename)
.setDisabled(disabled)
.build();
@@ -491,14 +510,14 @@ public void createBuildTriggerExceptionTest() throws Exception {
public void getBuildTriggerTest() {
String id = "id3355";
String description = "description-1724546052";
String name = "name3373707";
BuildTriggerName name = BuildTriggerName.of("[PROJECT]", "[TRIGGER]");
String filename = "filename-734768633";
boolean disabled = true;
BuildTrigger expectedResponse =
BuildTrigger.newBuilder()
.setId(id)
.setDescription(description)
.setName(name)
.setName(name.toString())
.setFilename(filename)
.setDisabled(disabled)
.build();
@@ -592,14 +611,14 @@ public void listBuildTriggersExceptionTest() throws Exception {
public void updateBuildTriggerTest() {
String id = "id3355";
String description = "description-1724546052";
String name = "name3373707";
BuildTriggerName name = BuildTriggerName.of("[PROJECT]", "[TRIGGER]");
String filename = "filename-734768633";
boolean disabled = true;
BuildTrigger expectedResponse =
BuildTrigger.newBuilder()
.setId(id)
.setDescription(description)
.setName(name)
.setName(name.toString())
.setFilename(filename)
.setDisabled(disabled)
.build();
@@ -646,20 +665,24 @@ public void updateBuildTriggerExceptionTest() throws Exception {
@Test
@SuppressWarnings("all")
public void runBuildTriggerTest() throws Exception {
BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]");
String id = "id3355";
String projectId2 = "projectId2939242356";
String statusDetail = "statusDetail2089931070";
String logsBucket = "logsBucket1565363834";
String buildTriggerId = "buildTriggerId1105559411";
String logUrl = "logUrl342054388";
ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
Build expectedResponse =
Build.newBuilder()
.setName(name.toString())
.setId(id)
.setProjectId(projectId2)
.setStatusDetail(statusDetail)
.setLogsBucket(logsBucket)
.setBuildTriggerId(buildTriggerId)
.setLogUrl(logUrl)
.setServiceAccount(serviceAccount.toString())
.build();
Operation resultOperation =
Operation.newBuilder()
@@ -21,6 +21,14 @@
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
</dependency>
</dependencies>

<build>

0 comments on commit 455c410

Please sign in to comment.